From 5579d7500220bcdcbad1ebd5929ae87adda4ae74 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Sun, 6 Oct 2024 14:12:48 +0000 Subject: [PATCH] CodeGen from PR 30786 in Azure/azure-rest-api-specs Merge 15f2eae51c8d29890904d1a54f92530a7c2b219b into 4995036206058b8a75070667995b8feb038549be --- .../security/armsecurity/CHANGELOG.md | 1092 + .../armsecurity/accountconnectors_client.go | 274 - .../accountconnectors_client_example_test.go | 421 - .../adaptiveapplicationcontrols_client.go | 294 - ...applicationcontrols_client_example_test.go | 1321 -- .../adaptivenetworkhardenings_client.go | 294 - ...venetworkhardenings_client_example_test.go | 194 - .../advancedthreatprotection_client.go | 152 - ...cedthreatprotection_client_example_test.go | 82 - .../security/armsecurity/alerts_client.go | 955 - .../armsecurity/alerts_client_example_test.go | 1464 -- .../alertssuppressionrules_client.go | 276 - ...rtssuppressionrules_client_example_test.go | 296 - .../armsecurity/allowedconnections_client.go | 228 - .../allowedconnections_client_example_test.go | 235 - .../armsecurity/apicollections_client.go | 451 - .../apicollections_client_example_test.go | 248 - .../armsecurity/application_client.go | 215 - .../application_client_example_test.go | 132 - .../armsecurity/applications_client.go | 98 - .../applications_client_example_test.go | 86 - .../armsecurity/assessments_client.go | 265 - .../assessments_client_example_test.go | 234 - .../armsecurity/assessmentsmetadata_client.go | 380 - ...assessmentsmetadata_client_example_test.go | 418 - .../armsecurity/automations_client.go | 484 - .../automations_client_example_test.go | 602 - .../autoprovisioningsettings_client.go | 223 - ...rovisioningsettings_client_example_test.go | 118 - .../security/armsecurity/autorest.md | 7 +- .../armsecurity/azuredevopsorgs_client.go | 415 - .../azuredevopsorgs_client_example_test.go | 235 - .../armsecurity/azuredevopsprojects_client.go | 370 - ...azuredevopsprojects_client_example_test.go | 185 - .../armsecurity/azuredevopsrepos_client.go | 390 - .../azuredevopsrepos_client_example_test.go | 189 - .../security/armsecurity/client_factory.go | 545 +- .../armsecurity/complianceresults_client.go | 152 - .../complianceresults_client_example_test.go | 98 - .../armsecurity/compliances_client.go | 152 - .../compliances_client_example_test.go | 122 - .../connectorapplication_client.go | 247 - ...onnectorapplication_client_example_test.go | 132 - .../connectorapplications_client.go | 109 - ...nnectorapplications_client_example_test.go | 86 - .../security/armsecurity/connectors_client.go | 416 - .../connectors_client_example_test.go | 564 - .../security/armsecurity/constants.go | 2620 +-- .../security/armsecurity/contacts_client.go | 269 - .../contacts_client_example_test.go | 197 - .../customassessmentautomations_client.go | 349 - ...sessmentautomations_client_example_test.go | 273 - .../customentitystoreassignments_client.go | 348 - ...itystoreassignments_client_example_test.go | 230 - .../security/armsecurity/date_type.go | 58 - .../armsecurity/defenderforstorage_client.go | 192 +- .../defenderforstorage_client_example_test.go | 118 - .../devicesecuritygroups_client.go | 265 - ...evicesecuritygroups_client_example_test.go | 664 - .../devopsconfigurations_client.go | 412 - ...evopsconfigurations_client_example_test.go | 269 - .../devopsoperationresults_client.go | 114 - ...opsoperationresults_client_example_test.go | 78 - .../discoveredsecuritysolutions_client.go | 229 - ...edsecuritysolutions_client_example_test.go | 154 - .../externalsecuritysolutions_client.go | 229 - ...alsecuritysolutions_client_example_test.go | 345 - .../fake/accountconnectors_server.go | 214 - .../adaptiveapplicationcontrols_server.go | 238 - .../fake/adaptivenetworkhardenings_server.go | 240 - .../fake/advancedthreatprotection_server.go | 135 - .../armsecurity/fake/alerts_server.go | 706 - .../fake/alertssuppressionrules_server.go | 226 - .../fake/allowedconnections_server.go | 199 - .../armsecurity/fake/apicollections_server.go | 341 - .../armsecurity/fake/application_server.go | 170 - .../armsecurity/fake/applications_server.go | 103 - .../armsecurity/fake/assessments_server.go | 242 - .../fake/assessmentsmetadata_server.go | 284 - .../armsecurity/fake/automations_server.go | 357 - .../fake/autoprovisioningsettings_server.go | 179 - .../fake/azuredevopsorgs_server.go | 315 - .../fake/azuredevopsprojects_server.go | 292 - .../fake/azuredevopsrepos_server.go | 308 - .../fake/complianceresults_server.go | 148 - .../armsecurity/fake/compliances_server.go | 148 - .../fake/connectorapplication_server.go | 194 - .../fake/connectorapplications_server.go | 112 - .../armsecurity/fake/connectors_server.go | 314 - .../armsecurity/fake/contacts_server.go | 232 - .../customassessmentautomations_server.go | 271 - .../customentitystoreassignments_server.go | 271 - .../security/armsecurity/fake/date_type.go | 58 - .../fake/defenderforstorage_server.go | 143 + .../fake/devicesecuritygroups_server.go | 230 - .../fake/devopsconfigurations_server.go | 316 - .../fake/devopsoperationresults_server.go | 104 - .../discoveredsecuritysolutions_server.go | 193 - .../fake/externalsecuritysolutions_server.go | 193 - .../armsecurity/fake/githubowners_server.go | 195 - .../armsecurity/fake/githubrepos_server.go | 164 - .../armsecurity/fake/gitlabgroups_server.go | 195 - .../armsecurity/fake/gitlabprojects_server.go | 164 - .../fake/gitlabsubgroups_server.go | 104 - .../fake/governanceassignments_server.go | 246 - .../fake/governancerules_server.go | 352 - .../armsecurity/fake/healthreports_server.go | 148 - .../informationprotectionpolicies_server.go | 203 - .../security/armsecurity/fake/internal.go | 70 - .../fake/iotsecuritysolution_server.go | 338 - .../iotsecuritysolutionanalytics_server.go | 139 - ...olutionsanalyticsaggregatedalert_server.go | 221 - ...solutionsanalyticsrecommendation_server.go | 178 - .../fake/jitnetworkaccesspolicies_server.go | 424 - .../armsecurity/fake/locations_server.go | 140 - .../armsecurity/fake/mdeonboardings_server.go | 122 - .../armsecurity/fake/operations_server.go | 96 - .../armsecurity/fake/operators_server.go | 213 - .../armsecurity/fake/polymorphic_helpers.go | 58 - .../armsecurity/fake/pricings_server.go | 229 - .../regulatorycomplianceassessments_server.go | 168 - .../regulatorycompliancecontrols_server.go | 160 - .../regulatorycompliancestandards_server.go | 152 - .../securescorecontroldefinitions_server.go | 138 - .../fake/securescorecontrols_server.go | 173 - .../armsecurity/fake/securescores_server.go | 140 - .../fake/sensitivitysettings_server.go | 138 - .../armsecurity/fake/server_factory.go | 451 +- .../servervulnerabilityassessment_server.go | 264 - ...vulnerabilityassessmentssettings_server.go | 236 - .../armsecurity/fake/settings_server.go | 195 - .../fake/softwareinventories_server.go | 213 - .../armsecurity/fake/solutions_server.go | 148 - .../fake/solutionsreferencedata_server.go | 127 - ...erabilityassessmentbaselinerules_server.go | 294 - ...lnerabilityassessmentscanresults_server.go | 153 - .../sqlvulnerabilityassessmentscans_server.go | 145 - .../armsecurity/fake/subassessments_server.go | 201 - .../security/armsecurity/fake/tasks_server.go | 419 - .../security/armsecurity/fake/time_rfc3339.go | 110 - .../armsecurity/fake/topology_server.go | 193 - .../fake/workspacesettings_server.go | 253 - .../armsecurity/githubowners_client.go | 242 - .../githubowners_client_example_test.go | 138 - .../armsecurity/githubrepos_client.go | 187 - .../githubrepos_client_example_test.go | 92 - .../armsecurity/gitlabgroups_client.go | 242 - .../gitlabgroups_client_example_test.go | 143 - .../armsecurity/gitlabprojects_client.go | 187 - .../gitlabprojects_client_example_test.go | 90 - .../armsecurity/gitlabsubgroups_client.go | 113 - .../gitlabsubgroups_client_example_test.go | 52 - .../security/armsecurity/go.mod | 12 +- .../security/armsecurity/go.sum | 17 - .../governanceassignments_client.go | 301 - ...vernanceassignments_client_example_test.go | 209 - .../armsecurity/governancerules_client.go | 460 - .../governancerules_client_example_test.go | 1020 - .../armsecurity/healthreports_client.go | 152 - .../healthreports_client_example_test.go | 143 - .../informationprotectionpolicies_client.go | 217 - ...nprotectionpolicies_client_example_test.go | 512 - .../security/armsecurity/interfaces.go | 213 - .../armsecurity/iotsecuritysolution_client.go | 423 - ...iotsecuritysolution_client_example_test.go | 1192 - .../iotsecuritysolutionanalytics_client.go | 174 - ...tysolutionanalytics_client_example_test.go | 211 - ...olutionsanalyticsaggregatedalert_client.go | 244 - ...ticsaggregatedalert_client_example_test.go | 173 - ...solutionsanalyticsrecommendation_client.go | 184 - ...yticsrecommendation_client_example_test.go | 117 - .../jitnetworkaccesspolicies_client.go | 563 - ...tworkaccesspolicies_client_example_test.go | 530 - .../security/armsecurity/locations_client.go | 159 - .../locations_client_example_test.go | 82 - .../armsecurity/mdeonboardings_client.go | 152 - .../mdeonboardings_client_example_test.go | 79 - .../security/armsecurity/models.go | 7978 +------ .../security/armsecurity/models_serde.go | 17926 +--------------- .../security/armsecurity/operations_client.go | 88 - .../security/armsecurity/operators_client.go | 286 - .../operators_client_example_test.go | 128 - .../security/armsecurity/options.go | 1378 +- .../armsecurity/polymorphic_helpers.go | 688 - .../security/armsecurity/pricings_client.go | 279 - .../pricings_client_example_test.go | 926 - .../regulatorycomplianceassessments_client.go | 182 - ...mplianceassessments_client_example_test.go | 122 - .../regulatorycompliancecontrols_client.go | 172 - ...ycompliancecontrols_client_example_test.go | 114 - .../regulatorycompliancestandards_client.go | 162 - ...compliancestandards_client_example_test.go | 126 - .../security/armsecurity/responses.go | 1458 +- .../securescorecontroldefinitions_client.go | 151 - ...econtroldefinitions_client_example_test.go | 183 - .../armsecurity/securescorecontrols_client.go | 165 - ...securescorecontrols_client_example_test.go | 1594 -- .../armsecurity/securescores_client.go | 158 - .../securescores_client_example_test.go | 94 - .../armsecurity/sensitivitysettings_client.go | 194 - ...sensitivitysettings_client_example_test.go | 296 - .../servervulnerabilityassessment_client.go | 360 - ...erabilityassessment_client_example_test.go | 115 - ...vulnerabilityassessmentssettings_client.go | 274 - ...assessmentssettings_client_example_test.go | 164 - .../security/armsecurity/settings_client.go | 220 - .../settings_client_example_test.go | 150 - .../armsecurity/softwareinventories_client.go | 253 - ...softwareinventories_client_example_test.go | 169 - .../security/armsecurity/solutions_client.go | 167 - .../solutions_client_example_test.go | 102 - .../solutionsreferencedata_client.go | 159 - ...utionsreferencedata_client_example_test.go | 120 - ...erabilityassessmentbaselinerules_client.go | 333 - ...ssmentbaselinerules_client_example_test.go | 320 - ...lnerabilityassessmentscanresults_client.go | 166 - ...sessmentscanresults_client_example_test.go | 410 - .../sqlvulnerabilityassessmentscans_client.go | 156 - ...lityassessmentscans_client_example_test.go | 169 - .../armsecurity/subassessments_client.go | 216 - .../subassessments_client_example_test.go | 225 - .../security/armsecurity/tasks_client.go | 492 - .../armsecurity/tasks_client_example_test.go | 337 - .../security/armsecurity/time_rfc3339.go | 110 - .../security/armsecurity/topology_client.go | 227 - .../topology_client_example_test.go | 204 - .../armsecurity/workspacesettings_client.go | 338 - .../workspacesettings_client_example_test.go | 184 - 228 files changed, 1709 insertions(+), 87609 deletions(-) delete mode 100644 sdk/resourcemanager/security/armsecurity/accountconnectors_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/accountconnectors_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/adaptiveapplicationcontrols_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/adaptiveapplicationcontrols_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/adaptivenetworkhardenings_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/adaptivenetworkhardenings_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/advancedthreatprotection_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/advancedthreatprotection_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/alerts_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/alerts_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/alertssuppressionrules_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/alertssuppressionrules_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/allowedconnections_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/allowedconnections_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/apicollections_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/apicollections_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/application_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/application_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/applications_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/applications_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/assessments_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/assessments_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/assessmentsmetadata_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/assessmentsmetadata_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/automations_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/automations_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/autoprovisioningsettings_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/autoprovisioningsettings_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/azuredevopsorgs_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/azuredevopsorgs_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/azuredevopsprojects_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/azuredevopsprojects_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/azuredevopsrepos_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/azuredevopsrepos_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/complianceresults_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/complianceresults_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/compliances_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/compliances_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/connectorapplication_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/connectorapplication_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/connectorapplications_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/connectorapplications_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/connectors_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/connectors_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/contacts_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/contacts_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/customassessmentautomations_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/customassessmentautomations_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/customentitystoreassignments_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/customentitystoreassignments_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/date_type.go delete mode 100644 sdk/resourcemanager/security/armsecurity/defenderforstorage_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/devicesecuritygroups_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/devicesecuritygroups_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/devopsconfigurations_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/devopsconfigurations_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/devopsoperationresults_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/devopsoperationresults_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/discoveredsecuritysolutions_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/discoveredsecuritysolutions_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/externalsecuritysolutions_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/externalsecuritysolutions_client_example_test.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 delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/advancedthreatprotection_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/alerts_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/alertssuppressionrules_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/allowedconnections_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/apicollections_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/application_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/applications_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/assessments_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/assessmentsmetadata_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/automations_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/autoprovisioningsettings_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/azuredevopsorgs_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/azuredevopsprojects_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/azuredevopsrepos_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/complianceresults_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/compliances_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/connectorapplication_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/connectorapplications_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/connectors_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/contacts_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/customassessmentautomations_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/customentitystoreassignments_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/date_type.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/devicesecuritygroups_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/devopsconfigurations_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/devopsoperationresults_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/discoveredsecuritysolutions_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/externalsecuritysolutions_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/githubowners_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/githubrepos_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/gitlabgroups_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/gitlabprojects_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/gitlabsubgroups_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/governanceassignments_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/governancerules_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/healthreports_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/informationprotectionpolicies_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolution_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolutionanalytics_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolutionsanalyticsaggregatedalert_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolutionsanalyticsrecommendation_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/jitnetworkaccesspolicies_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/locations_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/mdeonboardings_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/operations_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/operators_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/polymorphic_helpers.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/pricings_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/regulatorycomplianceassessments_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/regulatorycompliancecontrols_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/regulatorycompliancestandards_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/securescorecontroldefinitions_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/securescorecontrols_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/securescores_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/sensitivitysettings_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/servervulnerabilityassessment_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/servervulnerabilityassessmentssettings_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/settings_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/softwareinventories_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/solutions_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/solutionsreferencedata_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/sqlvulnerabilityassessmentbaselinerules_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/sqlvulnerabilityassessmentscanresults_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/sqlvulnerabilityassessmentscans_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/subassessments_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/tasks_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/time_rfc3339.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/topology_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/workspacesettings_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/githubowners_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/githubowners_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/githubrepos_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/githubrepos_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/gitlabgroups_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/gitlabgroups_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/gitlabprojects_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/gitlabprojects_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/gitlabsubgroups_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/gitlabsubgroups_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/governanceassignments_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/governanceassignments_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/governancerules_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/governancerules_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/healthreports_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/healthreports_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/informationprotectionpolicies_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/informationprotectionpolicies_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/interfaces.go delete mode 100644 sdk/resourcemanager/security/armsecurity/iotsecuritysolution_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/iotsecuritysolution_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/iotsecuritysolutionanalytics_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/iotsecuritysolutionanalytics_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/iotsecuritysolutionsanalyticsaggregatedalert_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/iotsecuritysolutionsanalyticsaggregatedalert_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/iotsecuritysolutionsanalyticsrecommendation_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/iotsecuritysolutionsanalyticsrecommendation_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/jitnetworkaccesspolicies_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/jitnetworkaccesspolicies_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/locations_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/locations_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/mdeonboardings_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/mdeonboardings_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/operations_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/operators_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/operators_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/polymorphic_helpers.go delete mode 100644 sdk/resourcemanager/security/armsecurity/pricings_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/pricings_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/regulatorycomplianceassessments_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/regulatorycomplianceassessments_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/regulatorycompliancecontrols_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/regulatorycompliancecontrols_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/regulatorycompliancestandards_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/regulatorycompliancestandards_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/securescorecontroldefinitions_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/securescorecontroldefinitions_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/securescorecontrols_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/securescorecontrols_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/securescores_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/securescores_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/sensitivitysettings_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/sensitivitysettings_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/servervulnerabilityassessment_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/servervulnerabilityassessment_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/servervulnerabilityassessmentssettings_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/servervulnerabilityassessmentssettings_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/settings_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/settings_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/softwareinventories_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/softwareinventories_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/solutions_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/solutions_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/solutionsreferencedata_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/solutionsreferencedata_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentbaselinerules_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentbaselinerules_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentscanresults_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentscanresults_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentscans_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentscans_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/subassessments_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/subassessments_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/tasks_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/tasks_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/time_rfc3339.go delete mode 100644 sdk/resourcemanager/security/armsecurity/topology_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/topology_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/workspacesettings_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/workspacesettings_client_example_test.go diff --git a/sdk/resourcemanager/security/armsecurity/CHANGELOG.md b/sdk/resourcemanager/security/armsecurity/CHANGELOG.md index 14793702fc7a..95544bca11ff 100644 --- a/sdk/resourcemanager/security/armsecurity/CHANGELOG.md +++ b/sdk/resourcemanager/security/armsecurity/CHANGELOG.md @@ -1,5 +1,1097 @@ # Release History +## 0.15.0 (2024-10-06) +### Breaking Changes + +- Function `NewClientFactory` parameter(s) have been changed from `(string, azcore.TokenCredential, *arm.ClientOptions)` to `(azcore.TokenCredential, *arm.ClientOptions)` +- Enum `AADConnectivityState` has been removed +- Enum `ActionType` has been removed +- Enum `ActionableRemediationState` has been removed +- Enum `AdaptiveApplicationControlIssue` has been removed +- Enum `AdditionalWorkspaceDataType` has been removed +- Enum `AdditionalWorkspaceType` has been removed +- Enum `AlertSeverity` has been removed +- Enum `AlertStatus` has been removed +- Enum `AnnotateDefaultBranchState` has been removed +- Enum `ApplicationConditionOperator` has been removed +- Enum `ApplicationSourceResourceType` has been removed +- Enum `AssessedResourceType` has been removed +- Enum `AssessmentStatusCode` has been removed +- Enum `AssessmentType` has been removed +- Enum `AuthenticationProvisioningState` has been removed +- Enum `AuthenticationType` has been removed +- Enum `AutoDiscovery` has been removed +- Enum `AutoProvision` has been removed +- Enum `BundleType` has been removed +- Enum `Categories` has been removed +- Enum `CloudName` has been removed +- Enum `Code` has been removed +- Enum `ConfigurationStatus` has been removed +- Enum `ConnectionType` has been removed +- Enum `ControlType` has been removed +- Enum `CreatedByType` has been removed +- Enum `DataSource` has been removed +- Enum `DesiredOnboardingState` has been removed +- Enum `DevOpsProvisioningState` has been removed +- Enum `Direction` has been removed +- Enum `EndOfSupportStatus` has been removed +- Enum `Enforce` has been removed +- Enum `EnforcementMode` has been removed +- Enum `EnforcementSupport` has been removed +- Enum `EnvironmentType` has been removed +- Enum `EventSource` has been removed +- Enum `ExpandControlsEnum` has been removed +- Enum `ExpandEnum` has been removed +- Enum `ExportData` has been removed +- Enum `ExternalSecuritySolutionKind` has been removed +- Enum `FileType` has been removed +- Enum `GovernanceRuleConditionOperator` has been removed +- Enum `GovernanceRuleOwnerSourceType` has been removed +- Enum `GovernanceRuleSourceResourceType` has been removed +- Enum `GovernanceRuleType` has been removed +- Enum `HybridComputeProvisioningState` has been removed +- Enum `ImplementationEffort` has been removed +- Enum `InformationProtectionPolicyName` has been removed +- Enum `InheritFromParentState` has been removed +- Enum `Inherited` has been removed +- Enum `Intent` has been removed +- Enum `IsEnabled` has been removed +- Enum `Kind` has been removed +- Enum `MinimalRiskLevel` has been removed +- Enum `MinimalSeverity` has been removed +- Enum `MipIntegrationStatus` has been removed +- Enum `OfferingType` has been removed +- Enum `OnboardingState` has been removed +- Enum `OperationResult` has been removed +- Enum `Operator` has been removed +- Enum `OrganizationMembershipType` has been removed +- Enum `PermissionProperty` has been removed +- Enum `PricingTier` has been removed +- Enum `PropertyType` has been removed +- Enum `Protocol` has been removed +- Enum `ProvisioningState` has been removed +- Enum `Rank` has been removed +- Enum `RecommendationAction` has been removed +- Enum `RecommendationConfigStatus` has been removed +- Enum `RecommendationStatus` has been removed +- Enum `RecommendationType` has been removed +- Enum `ReportedSeverity` has been removed +- Enum `ResourceIdentifierType` has been removed +- Enum `ResourceStatus` has been removed +- Enum `ResourcesCoverageStatus` has been removed +- Enum `RuleCategory` has been removed +- Enum `RuleSeverity` has been removed +- Enum `RuleState` has been removed +- Enum `RuleStatus` has been removed +- Enum `RuleType` has been removed +- Enum `ScanState` has been removed +- Enum `ScanTriggerType` has been removed +- Enum `ScanningMode` has been removed +- Enum `SecurityContactName` has been removed +- Enum `SecurityContactRole` has been removed +- Enum `SecurityFamily` has been removed +- Enum `SecuritySolutionStatus` has been removed +- Enum `ServerVulnerabilityAssessmentPropertiesProvisioningState` has been removed +- Enum `ServerVulnerabilityAssessmentsAzureSettingSelectedProvider` has been removed +- Enum `ServerVulnerabilityAssessmentsSettingKind` has been removed +- Enum `ServerVulnerabilityAssessmentsSettingKindName` has been removed +- Enum `SettingKind` has been removed +- Enum `SettingNameAutoGenerated` has been removed +- Enum `Severity` has been removed +- Enum `SeverityEnum` has been removed +- Enum `Source` has been removed +- Enum `SourceSystem` has been removed +- Enum `SourceType` has been removed +- Enum `State` has been removed +- Enum `Status` has been removed +- Enum `StatusName` has been removed +- Enum `StatusReason` has been removed +- Enum `SubAssessmentStatusCode` has been removed +- Enum `SubPlan` has been removed +- Enum `SupportedCloudEnum` has been removed +- Enum `Tactics` has been removed +- Enum `TaskUpdateActionType` has been removed +- Enum `Techniques` has been removed +- Enum `Threats` has been removed +- Enum `TransportProtocol` has been removed +- Enum `Type` has been removed +- Enum `UnmaskedIPLoggingStatus` has been removed +- Enum `UserImpact` has been removed +- Enum `ValueType` has been removed +- Function `*AADExternalSecuritySolution.GetExternalSecuritySolution` has been removed +- Function `NewAPICollectionsClient` has been removed +- Function `*APICollectionsClient.GetByAzureAPIManagementService` has been removed +- Function `*APICollectionsClient.NewListByAzureAPIManagementServicePager` has been removed +- Function `*APICollectionsClient.NewListByResourceGroupPager` has been removed +- Function `*APICollectionsClient.NewListBySubscriptionPager` has been removed +- Function `*APICollectionsClient.OffboardAzureAPIManagementAPI` has been removed +- Function `*APICollectionsClient.BeginOnboardAzureAPIManagementAPI` 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 `*ActiveConnectionsNotInAllowedRange.GetCustomAlertRule` has been removed +- Function `*ActiveConnectionsNotInAllowedRange.GetThresholdCustomAlertRule` has been removed +- Function `*ActiveConnectionsNotInAllowedRange.GetTimeWindowCustomAlertRule` 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 `*AdditionalData.GetAdditionalData` has been removed +- Function `NewAdvancedThreatProtectionClient` has been removed +- Function `*AdvancedThreatProtectionClient.Create` has been removed +- Function `*AdvancedThreatProtectionClient.Get` has been removed +- Function `*AlertSimulatorBundlesRequestProperties.GetAlertSimulatorRequestProperties` has been removed +- Function `*AlertSimulatorRequestProperties.GetAlertSimulatorRequestProperties` has been removed +- Function `*AlertSyncSettings.GetSetting` has been removed +- Function `NewAlertsClient` has been removed +- Function `*AlertsClient.GetResourceGroupLevel` has been removed +- Function `*AlertsClient.GetSubscriptionLevel` has been removed +- Function `*AlertsClient.NewListByResourceGroupPager` has been removed +- Function `*AlertsClient.NewListPager` has been removed +- Function `*AlertsClient.NewListResourceGroupLevelByRegionPager` has been removed +- Function `*AlertsClient.NewListSubscriptionLevelByRegionPager` has been removed +- Function `*AlertsClient.BeginSimulate` has been removed +- Function `*AlertsClient.UpdateResourceGroupLevelStateToActivate` has been removed +- Function `*AlertsClient.UpdateResourceGroupLevelStateToDismiss` has been removed +- Function `*AlertsClient.UpdateResourceGroupLevelStateToInProgress` has been removed +- Function `*AlertsClient.UpdateResourceGroupLevelStateToResolve` has been removed +- Function `*AlertsClient.UpdateSubscriptionLevelStateToActivate` has been removed +- Function `*AlertsClient.UpdateSubscriptionLevelStateToDismiss` has been removed +- Function `*AlertsClient.UpdateSubscriptionLevelStateToInProgress` has been removed +- Function `*AlertsClient.UpdateSubscriptionLevelStateToResolve` has been removed +- Function `NewAlertsSuppressionRulesClient` has been removed +- Function `*AlertsSuppressionRulesClient.Delete` has been removed +- Function `*AlertsSuppressionRulesClient.Get` has been removed +- Function `*AlertsSuppressionRulesClient.NewListPager` has been removed +- Function `*AlertsSuppressionRulesClient.Update` has been removed +- Function `NewAllowedConnectionsClient` has been removed +- Function `*AllowedConnectionsClient.Get` has been removed +- Function `*AllowedConnectionsClient.NewListByHomeRegionPager` has been removed +- Function `*AllowedConnectionsClient.NewListPager` has been removed +- Function `*AllowlistCustomAlertRule.GetAllowlistCustomAlertRule` has been removed +- Function `*AllowlistCustomAlertRule.GetCustomAlertRule` has been removed +- Function `*AllowlistCustomAlertRule.GetListCustomAlertRule` has been removed +- Function `*AmqpC2DMessagesNotInAllowedRange.GetCustomAlertRule` has been removed +- Function `*AmqpC2DMessagesNotInAllowedRange.GetThresholdCustomAlertRule` has been removed +- Function `*AmqpC2DMessagesNotInAllowedRange.GetTimeWindowCustomAlertRule` has been removed +- Function `*AmqpC2DRejectedMessagesNotInAllowedRange.GetCustomAlertRule` has been removed +- Function `*AmqpC2DRejectedMessagesNotInAllowedRange.GetThresholdCustomAlertRule` has been removed +- Function `*AmqpC2DRejectedMessagesNotInAllowedRange.GetTimeWindowCustomAlertRule` has been removed +- Function `*AmqpD2CMessagesNotInAllowedRange.GetCustomAlertRule` has been removed +- Function `*AmqpD2CMessagesNotInAllowedRange.GetThresholdCustomAlertRule` has been removed +- Function `*AmqpD2CMessagesNotInAllowedRange.GetTimeWindowCustomAlertRule` has been removed +- Function `NewApplicationClient` has been removed +- Function `*ApplicationClient.CreateOrUpdate` has been removed +- Function `*ApplicationClient.Delete` has been removed +- Function `*ApplicationClient.Get` has been removed +- Function `NewApplicationsClient` has been removed +- Function `*ApplicationsClient.NewListPager` has been removed +- Function `NewAssessmentsClient` has been removed +- Function `*AssessmentsClient.CreateOrUpdate` has been removed +- Function `*AssessmentsClient.Delete` has been removed +- Function `*AssessmentsClient.Get` has been removed +- Function `*AssessmentsClient.NewListPager` has been removed +- Function `NewAssessmentsMetadataClient` has been removed +- Function `*AssessmentsMetadataClient.CreateInSubscription` has been removed +- Function `*AssessmentsMetadataClient.DeleteInSubscription` has been removed +- Function `*AssessmentsMetadataClient.Get` has been removed +- Function `*AssessmentsMetadataClient.GetInSubscription` has been removed +- Function `*AssessmentsMetadataClient.NewListBySubscriptionPager` has been removed +- Function `*AssessmentsMetadataClient.NewListPager` has been removed +- Function `*AtaExternalSecuritySolution.GetExternalSecuritySolution` has been removed +- Function `*AuthenticationDetailsProperties.GetAuthenticationDetailsProperties` has been removed +- Function `NewAutoProvisioningSettingsClient` has been removed +- Function `*AutoProvisioningSettingsClient.Create` has been removed +- Function `*AutoProvisioningSettingsClient.Get` has been removed +- Function `*AutoProvisioningSettingsClient.NewListPager` has been removed +- Function `*AutomationAction.GetAutomationAction` has been removed +- Function `*AutomationActionEventHub.GetAutomationAction` has been removed +- Function `*AutomationActionLogicApp.GetAutomationAction` has been removed +- Function `*AutomationActionWorkspace.GetAutomationAction` has been removed +- Function `NewAutomationsClient` has been removed +- Function `*AutomationsClient.CreateOrUpdate` has been removed +- Function `*AutomationsClient.Delete` has been removed +- Function `*AutomationsClient.Get` has been removed +- Function `*AutomationsClient.NewListByResourceGroupPager` has been removed +- Function `*AutomationsClient.NewListPager` has been removed +- Function `*AutomationsClient.Update` has been removed +- Function `*AutomationsClient.Validate` has been removed +- Function `*AwAssumeRoleAuthenticationDetailsProperties.GetAuthenticationDetailsProperties` has been removed +- Function `*AwsCredsAuthenticationDetailsProperties.GetAuthenticationDetailsProperties` has been removed +- Function `*AwsEnvironmentData.GetEnvironmentData` has been removed +- Function `*AwsOrganizationalData.GetAwsOrganizationalData` has been removed +- Function `*AwsOrganizationalDataMaster.GetAwsOrganizationalData` has been removed +- Function `*AwsOrganizationalDataMember.GetAwsOrganizationalData` has been removed +- Function `NewAzureDevOpsOrgsClient` has been removed +- Function `*AzureDevOpsOrgsClient.BeginCreateOrUpdate` has been removed +- Function `*AzureDevOpsOrgsClient.Get` has been removed +- Function `*AzureDevOpsOrgsClient.ListAvailable` has been removed +- Function `*AzureDevOpsOrgsClient.NewListPager` has been removed +- Function `*AzureDevOpsOrgsClient.BeginUpdate` has been removed +- Function `NewAzureDevOpsProjectsClient` has been removed +- Function `*AzureDevOpsProjectsClient.BeginCreateOrUpdate` has been removed +- Function `*AzureDevOpsProjectsClient.Get` has been removed +- Function `*AzureDevOpsProjectsClient.NewListPager` has been removed +- Function `*AzureDevOpsProjectsClient.BeginUpdate` has been removed +- Function `NewAzureDevOpsReposClient` has been removed +- Function `*AzureDevOpsReposClient.BeginCreateOrUpdate` has been removed +- Function `*AzureDevOpsReposClient.Get` has been removed +- Function `*AzureDevOpsReposClient.NewListPager` has been removed +- Function `*AzureDevOpsReposClient.BeginUpdate` has been removed +- Function `*AzureDevOpsScopeEnvironmentData.GetEnvironmentData` has been removed +- Function `*AzureResourceDetails.GetResourceDetails` has been removed +- Function `*AzureResourceIdentifier.GetResourceIdentifier` has been removed +- Function `*AzureServersSetting.GetServerVulnerabilityAssessmentsSetting` has been removed +- Function `*CefExternalSecuritySolution.GetExternalSecuritySolution` has been removed +- Function `*ClientFactory.NewAPICollectionsClient` has been removed +- Function `*ClientFactory.NewAccountConnectorsClient` has been removed +- Function `*ClientFactory.NewAdaptiveApplicationControlsClient` has been removed +- Function `*ClientFactory.NewAdaptiveNetworkHardeningsClient` has been removed +- Function `*ClientFactory.NewAdvancedThreatProtectionClient` has been removed +- Function `*ClientFactory.NewAlertsClient` has been removed +- Function `*ClientFactory.NewAlertsSuppressionRulesClient` has been removed +- Function `*ClientFactory.NewAllowedConnectionsClient` has been removed +- Function `*ClientFactory.NewApplicationClient` has been removed +- Function `*ClientFactory.NewApplicationsClient` has been removed +- Function `*ClientFactory.NewAssessmentsClient` has been removed +- Function `*ClientFactory.NewAssessmentsMetadataClient` has been removed +- Function `*ClientFactory.NewAutoProvisioningSettingsClient` has been removed +- Function `*ClientFactory.NewAutomationsClient` has been removed +- Function `*ClientFactory.NewAzureDevOpsOrgsClient` has been removed +- Function `*ClientFactory.NewAzureDevOpsProjectsClient` has been removed +- Function `*ClientFactory.NewAzureDevOpsReposClient` has been removed +- Function `*ClientFactory.NewComplianceResultsClient` has been removed +- Function `*ClientFactory.NewCompliancesClient` has been removed +- Function `*ClientFactory.NewConnectorApplicationClient` has been removed +- Function `*ClientFactory.NewConnectorApplicationsClient` has been removed +- Function `*ClientFactory.NewConnectorsClient` has been removed +- Function `*ClientFactory.NewContactsClient` has been removed +- Function `*ClientFactory.NewCustomAssessmentAutomationsClient` has been removed +- Function `*ClientFactory.NewCustomEntityStoreAssignmentsClient` has been removed +- Function `*ClientFactory.NewDevOpsConfigurationsClient` has been removed +- Function `*ClientFactory.NewDevOpsOperationResultsClient` has been removed +- Function `*ClientFactory.NewDeviceSecurityGroupsClient` has been removed +- Function `*ClientFactory.NewDiscoveredSecuritySolutionsClient` has been removed +- Function `*ClientFactory.NewExternalSecuritySolutionsClient` has been removed +- Function `*ClientFactory.NewGitHubOwnersClient` has been removed +- Function `*ClientFactory.NewGitHubReposClient` has been removed +- Function `*ClientFactory.NewGitLabGroupsClient` has been removed +- Function `*ClientFactory.NewGitLabProjectsClient` has been removed +- Function `*ClientFactory.NewGitLabSubgroupsClient` has been removed +- Function `*ClientFactory.NewGovernanceAssignmentsClient` has been removed +- Function `*ClientFactory.NewGovernanceRulesClient` has been removed +- Function `*ClientFactory.NewHealthReportsClient` has been removed +- Function `*ClientFactory.NewInformationProtectionPoliciesClient` has been removed +- Function `*ClientFactory.NewIotSecuritySolutionAnalyticsClient` has been removed +- Function `*ClientFactory.NewIotSecuritySolutionClient` has been removed +- Function `*ClientFactory.NewIotSecuritySolutionsAnalyticsAggregatedAlertClient` has been removed +- Function `*ClientFactory.NewIotSecuritySolutionsAnalyticsRecommendationClient` has been removed +- Function `*ClientFactory.NewJitNetworkAccessPoliciesClient` has been removed +- Function `*ClientFactory.NewLocationsClient` has been removed +- Function `*ClientFactory.NewMdeOnboardingsClient` has been removed +- Function `*ClientFactory.NewOperationsClient` has been removed +- Function `*ClientFactory.NewOperatorsClient` has been removed +- Function `*ClientFactory.NewPricingsClient` has been removed +- Function `*ClientFactory.NewRegulatoryComplianceAssessmentsClient` has been removed +- Function `*ClientFactory.NewRegulatoryComplianceControlsClient` has been removed +- Function `*ClientFactory.NewRegulatoryComplianceStandardsClient` has been removed +- Function `*ClientFactory.NewSQLVulnerabilityAssessmentBaselineRulesClient` has been removed +- Function `*ClientFactory.NewSQLVulnerabilityAssessmentScanResultsClient` has been removed +- Function `*ClientFactory.NewSQLVulnerabilityAssessmentScansClient` has been removed +- Function `*ClientFactory.NewSecureScoreControlDefinitionsClient` has been removed +- Function `*ClientFactory.NewSecureScoreControlsClient` has been removed +- Function `*ClientFactory.NewSecureScoresClient` has been removed +- Function `*ClientFactory.NewSensitivitySettingsClient` has been removed +- Function `*ClientFactory.NewServerVulnerabilityAssessmentClient` has been removed +- Function `*ClientFactory.NewServerVulnerabilityAssessmentsSettingsClient` has been removed +- Function `*ClientFactory.NewSettingsClient` has been removed +- Function `*ClientFactory.NewSoftwareInventoriesClient` has been removed +- Function `*ClientFactory.NewSolutionsClient` has been removed +- Function `*ClientFactory.NewSolutionsReferenceDataClient` has been removed +- Function `*ClientFactory.NewSubAssessmentsClient` has been removed +- Function `*ClientFactory.NewTasksClient` has been removed +- Function `*ClientFactory.NewTopologyClient` has been removed +- Function `*ClientFactory.NewWorkspaceSettingsClient` has been removed +- Function `*CloudOffering.GetCloudOffering` has been removed +- Function `NewComplianceResultsClient` has been removed +- Function `*ComplianceResultsClient.Get` has been removed +- Function `*ComplianceResultsClient.NewListPager` has been removed +- Function `NewCompliancesClient` has been removed +- Function `*CompliancesClient.Get` has been removed +- Function `*CompliancesClient.NewListPager` has been removed +- Function `*ConnectionFromIPNotAllowed.GetAllowlistCustomAlertRule` has been removed +- Function `*ConnectionFromIPNotAllowed.GetCustomAlertRule` has been removed +- Function `*ConnectionFromIPNotAllowed.GetListCustomAlertRule` has been removed +- Function `*ConnectionToIPNotAllowed.GetAllowlistCustomAlertRule` has been removed +- Function `*ConnectionToIPNotAllowed.GetCustomAlertRule` has been removed +- Function `*ConnectionToIPNotAllowed.GetListCustomAlertRule` has been removed +- Function `NewConnectorApplicationClient` has been removed +- Function `*ConnectorApplicationClient.CreateOrUpdate` has been removed +- Function `*ConnectorApplicationClient.Delete` has been removed +- Function `*ConnectorApplicationClient.Get` has been removed +- Function `NewConnectorApplicationsClient` has been removed +- Function `*ConnectorApplicationsClient.NewListPager` has been removed +- Function `NewConnectorsClient` has been removed +- Function `*ConnectorsClient.CreateOrUpdate` has been removed +- Function `*ConnectorsClient.Delete` has been removed +- Function `*ConnectorsClient.Get` has been removed +- Function `*ConnectorsClient.NewListByResourceGroupPager` has been removed +- Function `*ConnectorsClient.NewListPager` has been removed +- Function `*ConnectorsClient.Update` has been removed +- Function `NewContactsClient` has been removed +- Function `*ContactsClient.Create` has been removed +- Function `*ContactsClient.Delete` has been removed +- Function `*ContactsClient.Get` has been removed +- Function `*ContactsClient.NewListPager` has been removed +- Function `*ContainerRegistryVulnerabilityProperties.GetAdditionalData` has been removed +- Function `*CspmMonitorAwsOffering.GetCloudOffering` has been removed +- Function `*CspmMonitorAzureDevOpsOffering.GetCloudOffering` has been removed +- Function `*CspmMonitorGcpOffering.GetCloudOffering` has been removed +- Function `*CspmMonitorGitLabOffering.GetCloudOffering` has been removed +- Function `*CspmMonitorGithubOffering.GetCloudOffering` has been removed +- Function `*CustomAlertRule.GetCustomAlertRule` 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 `*DataExportSettings.GetSetting` has been removed +- Function `*DefenderCspmAwsOffering.GetCloudOffering` has been removed +- Function `*DefenderCspmGcpOffering.GetCloudOffering` has been removed +- Function `*DefenderFoDatabasesAwsOffering.GetCloudOffering` has been removed +- Function `*DefenderForContainersAwsOffering.GetCloudOffering` has been removed +- Function `*DefenderForContainersGcpOffering.GetCloudOffering` has been removed +- Function `*DefenderForDatabasesGcpOffering.GetCloudOffering` has been removed +- Function `*DefenderForServersAwsOffering.GetCloudOffering` has been removed +- Function `*DefenderForServersGcpOffering.GetCloudOffering` has been removed +- Function `*DenylistCustomAlertRule.GetCustomAlertRule` has been removed +- Function `*DenylistCustomAlertRule.GetListCustomAlertRule` has been removed +- Function `NewDevOpsConfigurationsClient` has been removed +- Function `*DevOpsConfigurationsClient.BeginCreateOrUpdate` has been removed +- Function `*DevOpsConfigurationsClient.BeginDelete` has been removed +- Function `*DevOpsConfigurationsClient.Get` has been removed +- Function `*DevOpsConfigurationsClient.NewListPager` has been removed +- Function `*DevOpsConfigurationsClient.BeginUpdate` has been removed +- Function `NewDevOpsOperationResultsClient` has been removed +- Function `*DevOpsOperationResultsClient.Get` has been removed +- Function `NewDeviceSecurityGroupsClient` has been removed +- Function `*DeviceSecurityGroupsClient.CreateOrUpdate` has been removed +- Function `*DeviceSecurityGroupsClient.Delete` has been removed +- Function `*DeviceSecurityGroupsClient.Get` has been removed +- Function `*DeviceSecurityGroupsClient.NewListPager` has been removed +- Function `*DirectMethodInvokesNotInAllowedRange.GetCustomAlertRule` has been removed +- Function `*DirectMethodInvokesNotInAllowedRange.GetThresholdCustomAlertRule` has been removed +- Function `*DirectMethodInvokesNotInAllowedRange.GetTimeWindowCustomAlertRule` has been removed +- Function `NewDiscoveredSecuritySolutionsClient` has been removed +- Function `*DiscoveredSecuritySolutionsClient.Get` has been removed +- Function `*DiscoveredSecuritySolutionsClient.NewListByHomeRegionPager` has been removed +- Function `*DiscoveredSecuritySolutionsClient.NewListPager` has been removed +- Function `*EnvironmentData.GetEnvironmentData` has been removed +- Function `*ExternalSecuritySolution.GetExternalSecuritySolution` has been removed +- Function `NewExternalSecuritySolutionsClient` has been removed +- Function `*ExternalSecuritySolutionsClient.Get` has been removed +- Function `*ExternalSecuritySolutionsClient.NewListByHomeRegionPager` has been removed +- Function `*ExternalSecuritySolutionsClient.NewListPager` has been removed +- Function `*FailedLocalLoginsNotInAllowedRange.GetCustomAlertRule` has been removed +- Function `*FailedLocalLoginsNotInAllowedRange.GetThresholdCustomAlertRule` has been removed +- Function `*FailedLocalLoginsNotInAllowedRange.GetTimeWindowCustomAlertRule` has been removed +- Function `*FileUploadsNotInAllowedRange.GetCustomAlertRule` has been removed +- Function `*FileUploadsNotInAllowedRange.GetThresholdCustomAlertRule` has been removed +- Function `*FileUploadsNotInAllowedRange.GetTimeWindowCustomAlertRule` has been removed +- Function `*GcpCredentialsDetailsProperties.GetAuthenticationDetailsProperties` has been removed +- Function `*GcpOrganizationalData.GetGcpOrganizationalData` has been removed +- Function `*GcpOrganizationalDataMember.GetGcpOrganizationalData` has been removed +- Function `*GcpOrganizationalDataOrganization.GetGcpOrganizationalData` has been removed +- Function `*GcpProjectEnvironmentData.GetEnvironmentData` has been removed +- Function `NewGitHubOwnersClient` has been removed +- Function `*GitHubOwnersClient.Get` has been removed +- Function `*GitHubOwnersClient.ListAvailable` has been removed +- Function `*GitHubOwnersClient.NewListPager` has been removed +- Function `NewGitHubReposClient` has been removed +- Function `*GitHubReposClient.Get` has been removed +- Function `*GitHubReposClient.NewListPager` has been removed +- Function `NewGitLabGroupsClient` has been removed +- Function `*GitLabGroupsClient.Get` has been removed +- Function `*GitLabGroupsClient.ListAvailable` has been removed +- Function `*GitLabGroupsClient.NewListPager` has been removed +- Function `NewGitLabProjectsClient` has been removed +- Function `*GitLabProjectsClient.Get` has been removed +- Function `*GitLabProjectsClient.NewListPager` has been removed +- Function `NewGitLabSubgroupsClient` has been removed +- Function `*GitLabSubgroupsClient.List` has been removed +- Function `*GithubScopeEnvironmentData.GetEnvironmentData` has been removed +- Function `*GitlabScopeEnvironmentData.GetEnvironmentData` has been removed +- Function `NewGovernanceAssignmentsClient` has been removed +- Function `*GovernanceAssignmentsClient.CreateOrUpdate` has been removed +- Function `*GovernanceAssignmentsClient.Delete` has been removed +- Function `*GovernanceAssignmentsClient.Get` has been removed +- Function `*GovernanceAssignmentsClient.NewListPager` has been removed +- Function `NewGovernanceRulesClient` has been removed +- Function `*GovernanceRulesClient.CreateOrUpdate` has been removed +- Function `*GovernanceRulesClient.BeginDelete` has been removed +- Function `*GovernanceRulesClient.BeginExecute` has been removed +- Function `*GovernanceRulesClient.Get` has been removed +- Function `*GovernanceRulesClient.NewListPager` has been removed +- Function `*GovernanceRulesClient.OperationResults` has been removed +- Function `*HTTPC2DMessagesNotInAllowedRange.GetCustomAlertRule` has been removed +- Function `*HTTPC2DMessagesNotInAllowedRange.GetThresholdCustomAlertRule` has been removed +- Function `*HTTPC2DMessagesNotInAllowedRange.GetTimeWindowCustomAlertRule` has been removed +- Function `*HTTPC2DRejectedMessagesNotInAllowedRange.GetCustomAlertRule` has been removed +- Function `*HTTPC2DRejectedMessagesNotInAllowedRange.GetThresholdCustomAlertRule` has been removed +- Function `*HTTPC2DRejectedMessagesNotInAllowedRange.GetTimeWindowCustomAlertRule` has been removed +- Function `*HTTPD2CMessagesNotInAllowedRange.GetCustomAlertRule` has been removed +- Function `*HTTPD2CMessagesNotInAllowedRange.GetThresholdCustomAlertRule` has been removed +- Function `*HTTPD2CMessagesNotInAllowedRange.GetTimeWindowCustomAlertRule` has been removed +- Function `NewHealthReportsClient` has been removed +- Function `*HealthReportsClient.Get` has been removed +- Function `*HealthReportsClient.NewListPager` has been removed +- Function `NewInformationProtectionPoliciesClient` has been removed +- Function `*InformationProtectionPoliciesClient.CreateOrUpdate` has been removed +- Function `*InformationProtectionPoliciesClient.Get` has been removed +- Function `*InformationProtectionPoliciesClient.NewListPager` has been removed +- Function `NewIotSecuritySolutionAnalyticsClient` has been removed +- Function `*IotSecuritySolutionAnalyticsClient.Get` has been removed +- Function `*IotSecuritySolutionAnalyticsClient.List` has been removed +- Function `NewIotSecuritySolutionClient` has been removed +- Function `*IotSecuritySolutionClient.CreateOrUpdate` has been removed +- Function `*IotSecuritySolutionClient.Delete` has been removed +- Function `*IotSecuritySolutionClient.Get` has been removed +- Function `*IotSecuritySolutionClient.NewListByResourceGroupPager` has been removed +- Function `*IotSecuritySolutionClient.NewListBySubscriptionPager` has been removed +- Function `*IotSecuritySolutionClient.Update` has been removed +- Function `NewIotSecuritySolutionsAnalyticsAggregatedAlertClient` has been removed +- Function `*IotSecuritySolutionsAnalyticsAggregatedAlertClient.Dismiss` has been removed +- Function `*IotSecuritySolutionsAnalyticsAggregatedAlertClient.Get` has been removed +- Function `*IotSecuritySolutionsAnalyticsAggregatedAlertClient.NewListPager` has been removed +- Function `NewIotSecuritySolutionsAnalyticsRecommendationClient` has been removed +- Function `*IotSecuritySolutionsAnalyticsRecommendationClient.Get` has been removed +- Function `*IotSecuritySolutionsAnalyticsRecommendationClient.NewListPager` has been removed +- Function `NewJitNetworkAccessPoliciesClient` has been removed +- Function `*JitNetworkAccessPoliciesClient.CreateOrUpdate` has been removed +- Function `*JitNetworkAccessPoliciesClient.Delete` has been removed +- Function `*JitNetworkAccessPoliciesClient.Get` has been removed +- Function `*JitNetworkAccessPoliciesClient.Initiate` has been removed +- Function `*JitNetworkAccessPoliciesClient.NewListByRegionPager` has been removed +- Function `*JitNetworkAccessPoliciesClient.NewListByResourceGroupAndRegionPager` has been removed +- Function `*JitNetworkAccessPoliciesClient.NewListByResourceGroupPager` has been removed +- Function `*JitNetworkAccessPoliciesClient.NewListPager` has been removed +- Function `*ListCustomAlertRule.GetCustomAlertRule` has been removed +- Function `*ListCustomAlertRule.GetListCustomAlertRule` has been removed +- Function `*LocalUserNotAllowed.GetAllowlistCustomAlertRule` has been removed +- Function `*LocalUserNotAllowed.GetCustomAlertRule` has been removed +- Function `*LocalUserNotAllowed.GetListCustomAlertRule` has been removed +- Function `NewLocationsClient` has been removed +- Function `*LocationsClient.Get` has been removed +- Function `*LocationsClient.NewListPager` has been removed +- Function `*LogAnalyticsIdentifier.GetResourceIdentifier` has been removed +- Function `NewMdeOnboardingsClient` has been removed +- Function `*MdeOnboardingsClient.Get` has been removed +- Function `*MdeOnboardingsClient.List` has been removed +- Function `*MqttC2DMessagesNotInAllowedRange.GetCustomAlertRule` has been removed +- Function `*MqttC2DMessagesNotInAllowedRange.GetThresholdCustomAlertRule` has been removed +- Function `*MqttC2DMessagesNotInAllowedRange.GetTimeWindowCustomAlertRule` has been removed +- Function `*MqttC2DRejectedMessagesNotInAllowedRange.GetCustomAlertRule` has been removed +- Function `*MqttC2DRejectedMessagesNotInAllowedRange.GetThresholdCustomAlertRule` has been removed +- Function `*MqttC2DRejectedMessagesNotInAllowedRange.GetTimeWindowCustomAlertRule` has been removed +- Function `*MqttD2CMessagesNotInAllowedRange.GetCustomAlertRule` has been removed +- Function `*MqttD2CMessagesNotInAllowedRange.GetThresholdCustomAlertRule` has been removed +- Function `*MqttD2CMessagesNotInAllowedRange.GetTimeWindowCustomAlertRule` has been removed +- Function `*OnPremiseResourceDetails.GetOnPremiseResourceDetails` has been removed +- Function `*OnPremiseResourceDetails.GetResourceDetails` has been removed +- Function `*OnPremiseSQLResourceDetails.GetOnPremiseResourceDetails` has been removed +- Function `*OnPremiseSQLResourceDetails.GetResourceDetails` has been removed +- Function `NewOperationsClient` has been removed +- Function `*OperationsClient.NewListPager` has been removed +- Function `NewOperatorsClient` has been removed +- Function `*OperatorsClient.CreateOrUpdate` has been removed +- Function `*OperatorsClient.Delete` has been removed +- Function `*OperatorsClient.Get` has been removed +- Function `*OperatorsClient.List` has been removed +- Function `PossibleEnforceValues` has been removed +- Function `PossibleServerVulnerabilityAssessmentsSettingKindValues` has been removed +- Function `PossibleSeverityValues` has been removed +- Function `PossibleSourceValues` has been removed +- Function `NewPricingsClient` has been removed +- Function `*PricingsClient.Delete` has been removed +- Function `*PricingsClient.Get` has been removed +- Function `*PricingsClient.List` has been removed +- Function `*PricingsClient.Update` has been removed +- Function `*ProcessNotAllowed.GetAllowlistCustomAlertRule` has been removed +- Function `*ProcessNotAllowed.GetCustomAlertRule` has been removed +- Function `*ProcessNotAllowed.GetListCustomAlertRule` has been removed +- Function `*QueuePurgesNotInAllowedRange.GetCustomAlertRule` has been removed +- Function `*QueuePurgesNotInAllowedRange.GetThresholdCustomAlertRule` has been removed +- Function `*QueuePurgesNotInAllowedRange.GetTimeWindowCustomAlertRule` has been removed +- Function `NewRegulatoryComplianceAssessmentsClient` has been removed +- Function `*RegulatoryComplianceAssessmentsClient.Get` has been removed +- Function `*RegulatoryComplianceAssessmentsClient.NewListPager` has been removed +- Function `NewRegulatoryComplianceControlsClient` has been removed +- Function `*RegulatoryComplianceControlsClient.Get` has been removed +- Function `*RegulatoryComplianceControlsClient.NewListPager` has been removed +- Function `NewRegulatoryComplianceStandardsClient` has been removed +- Function `*RegulatoryComplianceStandardsClient.Get` has been removed +- Function `*RegulatoryComplianceStandardsClient.NewListPager` has been removed +- Function `*ResourceDetails.GetResourceDetails` has been removed +- Function `*ResourceIdentifier.GetResourceIdentifier` has been removed +- Function `*SQLServerVulnerabilityProperties.GetAdditionalData` has been removed +- Function `NewSQLVulnerabilityAssessmentBaselineRulesClient` has been removed +- Function `*SQLVulnerabilityAssessmentBaselineRulesClient.Add` has been removed +- Function `*SQLVulnerabilityAssessmentBaselineRulesClient.CreateOrUpdate` has been removed +- Function `*SQLVulnerabilityAssessmentBaselineRulesClient.Delete` has been removed +- Function `*SQLVulnerabilityAssessmentBaselineRulesClient.Get` has been removed +- Function `*SQLVulnerabilityAssessmentBaselineRulesClient.List` has been removed +- Function `NewSQLVulnerabilityAssessmentScanResultsClient` has been removed +- Function `*SQLVulnerabilityAssessmentScanResultsClient.Get` has been removed +- Function `*SQLVulnerabilityAssessmentScanResultsClient.List` has been removed +- Function `NewSQLVulnerabilityAssessmentScansClient` has been removed +- Function `*SQLVulnerabilityAssessmentScansClient.Get` has been removed +- Function `*SQLVulnerabilityAssessmentScansClient.List` has been removed +- Function `NewSecureScoreControlDefinitionsClient` has been removed +- Function `*SecureScoreControlDefinitionsClient.NewListBySubscriptionPager` has been removed +- Function `*SecureScoreControlDefinitionsClient.NewListPager` has been removed +- Function `NewSecureScoreControlsClient` has been removed +- Function `*SecureScoreControlsClient.NewListBySecureScorePager` has been removed +- Function `*SecureScoreControlsClient.NewListPager` has been removed +- Function `NewSecureScoresClient` has been removed +- Function `*SecureScoresClient.Get` has been removed +- Function `*SecureScoresClient.NewListPager` has been removed +- Function `NewSensitivitySettingsClient` has been removed +- Function `*SensitivitySettingsClient.CreateOrUpdate` has been removed +- Function `*SensitivitySettingsClient.Get` has been removed +- Function `*SensitivitySettingsClient.List` has been removed +- Function `NewServerVulnerabilityAssessmentClient` has been removed +- Function `*ServerVulnerabilityAssessmentClient.CreateOrUpdate` has been removed +- Function `*ServerVulnerabilityAssessmentClient.BeginDelete` has been removed +- Function `*ServerVulnerabilityAssessmentClient.Get` has been removed +- Function `*ServerVulnerabilityAssessmentClient.ListByExtendedResource` has been removed +- Function `*ServerVulnerabilityAssessmentsSetting.GetServerVulnerabilityAssessmentsSetting` has been removed +- Function `NewServerVulnerabilityAssessmentsSettingsClient` has been removed +- Function `*ServerVulnerabilityAssessmentsSettingsClient.CreateOrUpdate` has been removed +- Function `*ServerVulnerabilityAssessmentsSettingsClient.Delete` has been removed +- Function `*ServerVulnerabilityAssessmentsSettingsClient.Get` has been removed +- Function `*ServerVulnerabilityAssessmentsSettingsClient.NewListBySubscriptionPager` has been removed +- Function `*ServerVulnerabilityProperties.GetAdditionalData` has been removed +- Function `*Setting.GetSetting` has been removed +- Function `NewSettingsClient` has been removed +- Function `*SettingsClient.Get` has been removed +- Function `*SettingsClient.NewListPager` has been removed +- Function `*SettingsClient.Update` 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 +- Function `NewSolutionsClient` has been removed +- Function `*SolutionsClient.Get` has been removed +- Function `*SolutionsClient.NewListPager` has been removed +- Function `NewSolutionsReferenceDataClient` has been removed +- Function `*SolutionsReferenceDataClient.List` has been removed +- Function `*SolutionsReferenceDataClient.ListByHomeRegion` has been removed +- Function `NewSubAssessmentsClient` has been removed +- Function `*SubAssessmentsClient.Get` has been removed +- Function `*SubAssessmentsClient.NewListAllPager` has been removed +- Function `*SubAssessmentsClient.NewListPager` has been removed +- Function `NewTasksClient` has been removed +- Function `*TasksClient.GetResourceGroupLevelTask` has been removed +- Function `*TasksClient.GetSubscriptionLevelTask` has been removed +- Function `*TasksClient.NewListByHomeRegionPager` has been removed +- Function `*TasksClient.NewListByResourceGroupPager` has been removed +- Function `*TasksClient.NewListPager` has been removed +- Function `*TasksClient.UpdateResourceGroupLevelTaskState` has been removed +- Function `*TasksClient.UpdateSubscriptionLevelTaskState` has been removed +- Function `*ThresholdCustomAlertRule.GetCustomAlertRule` has been removed +- Function `*ThresholdCustomAlertRule.GetThresholdCustomAlertRule` has been removed +- Function `*TimeWindowCustomAlertRule.GetCustomAlertRule` has been removed +- Function `*TimeWindowCustomAlertRule.GetThresholdCustomAlertRule` has been removed +- Function `*TimeWindowCustomAlertRule.GetTimeWindowCustomAlertRule` has been removed +- Function `NewTopologyClient` has been removed +- Function `*TopologyClient.Get` has been removed +- Function `*TopologyClient.NewListByHomeRegionPager` has been removed +- Function `*TopologyClient.NewListPager` has been removed +- Function `*TwinUpdatesNotInAllowedRange.GetCustomAlertRule` has been removed +- Function `*TwinUpdatesNotInAllowedRange.GetThresholdCustomAlertRule` has been removed +- Function `*TwinUpdatesNotInAllowedRange.GetTimeWindowCustomAlertRule` has been removed +- Function `*UnauthorizedOperationsNotInAllowedRange.GetCustomAlertRule` has been removed +- Function `*UnauthorizedOperationsNotInAllowedRange.GetThresholdCustomAlertRule` has been removed +- Function `*UnauthorizedOperationsNotInAllowedRange.GetTimeWindowCustomAlertRule` has been removed +- Function `NewWorkspaceSettingsClient` has been removed +- Function `*WorkspaceSettingsClient.Create` has been removed +- Function `*WorkspaceSettingsClient.Delete` has been removed +- Function `*WorkspaceSettingsClient.Get` has been removed +- Function `*WorkspaceSettingsClient.NewListPager` has been removed +- Function `*WorkspaceSettingsClient.Update` has been removed +- Function `*NotificationsSource.GetNotificationsSource` has been removed +- Function `*NotificationsSourceAlert.GetNotificationsSource` has been removed +- Function `*NotificationsSourceAttackPath.GetNotificationsSource` has been removed +- Struct `AADConnectivityStateAutoGenerated` has been removed +- Struct `AADExternalSecuritySolution` has been removed +- Struct `AADSolutionProperties` has been removed +- Struct `APICollection` has been removed +- Struct `APICollectionList` has been removed +- Struct `APICollectionProperties` has been removed +- Struct `ActionableRemediation` has been removed +- Struct `ActiveConnectionsNotInAllowedRange` 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 `AdditionalWorkspacesProperties` has been removed +- Struct `AdvancedThreatProtectionProperties` has been removed +- Struct `AdvancedThreatProtectionSetting` has been removed +- Struct `Alert` has been removed +- Struct `AlertEntity` has been removed +- Struct `AlertList` has been removed +- Struct `AlertProperties` has been removed +- Struct `AlertPropertiesSupportingEvidence` has been removed +- Struct `AlertSimulatorBundlesRequestProperties` has been removed +- Struct `AlertSimulatorRequestBody` has been removed +- Struct `AlertSyncSettingProperties` has been removed +- Struct `AlertSyncSettings` has been removed +- Struct `AlertsSuppressionRule` has been removed +- Struct `AlertsSuppressionRuleProperties` has been removed +- Struct `AlertsSuppressionRulesList` has been removed +- Struct `AllowedConnectionsList` has been removed +- Struct `AllowedConnectionsResource` has been removed +- Struct `AllowedConnectionsResourceProperties` has been removed +- Struct `AmqpC2DMessagesNotInAllowedRange` has been removed +- Struct `AmqpC2DRejectedMessagesNotInAllowedRange` has been removed +- Struct `AmqpD2CMessagesNotInAllowedRange` has been removed +- Struct `Application` has been removed +- Struct `ApplicationCondition` has been removed +- Struct `ApplicationProperties` has been removed +- Struct `ApplicationsList` has been removed +- Struct `ArcAutoProvisioning` has been removed +- Struct `ArcAutoProvisioningAws` has been removed +- Struct `ArcAutoProvisioningConfiguration` has been removed +- Struct `ArcAutoProvisioningGcp` has been removed +- Struct `AscLocation` has been removed +- Struct `AscLocationList` has been removed +- Struct `Assessment` has been removed +- Struct `AssessmentLinks` has been removed +- Struct `AssessmentList` has been removed +- Struct `AssessmentMetadata` has been removed +- Struct `AssessmentMetadataPartnerData` has been removed +- Struct `AssessmentMetadataProperties` has been removed +- Struct `AssessmentMetadataPropertiesResponse` has been removed +- Struct `AssessmentMetadataPropertiesResponsePublishDates` has been removed +- Struct `AssessmentMetadataResponse` has been removed +- Struct `AssessmentMetadataResponseList` has been removed +- Struct `AssessmentPartnerData` has been removed +- Struct `AssessmentProperties` has been removed +- Struct `AssessmentPropertiesBase` has been removed +- Struct `AssessmentPropertiesResponse` has been removed +- Struct `AssessmentResponse` has been removed +- Struct `AssessmentStatus` has been removed +- Struct `AssessmentStatusResponse` has been removed +- Struct `AtaExternalSecuritySolution` has been removed +- Struct `AtaSolutionProperties` has been removed +- Struct `Authorization` has been removed +- Struct `AutoProvisioningSetting` has been removed +- Struct `AutoProvisioningSettingList` has been removed +- Struct `AutoProvisioningSettingProperties` has been removed +- Struct `Automation` has been removed +- Struct `AutomationActionEventHub` has been removed +- Struct `AutomationActionLogicApp` has been removed +- Struct `AutomationActionWorkspace` has been removed +- Struct `AutomationList` has been removed +- Struct `AutomationProperties` has been removed +- Struct `AutomationRuleSet` has been removed +- Struct `AutomationScope` has been removed +- Struct `AutomationSource` has been removed +- Struct `AutomationTriggeringRule` has been removed +- Struct `AutomationUpdateModel` has been removed +- Struct `AutomationValidationStatus` has been removed +- Struct `AwAssumeRoleAuthenticationDetailsProperties` has been removed +- Struct `AwsCredsAuthenticationDetailsProperties` has been removed +- Struct `AwsEnvironmentData` has been removed +- Struct `AwsOrganizationalDataMaster` has been removed +- Struct `AwsOrganizationalDataMember` has been removed +- Struct `AzureDevOpsOrg` has been removed +- Struct `AzureDevOpsOrgListResponse` has been removed +- Struct `AzureDevOpsOrgProperties` has been removed +- Struct `AzureDevOpsOrganizationConfiguration` has been removed +- Struct `AzureDevOpsProject` has been removed +- Struct `AzureDevOpsProjectConfiguration` has been removed +- Struct `AzureDevOpsProjectListResponse` has been removed +- Struct `AzureDevOpsProjectProperties` has been removed +- Struct `AzureDevOpsRepository` has been removed +- Struct `AzureDevOpsRepositoryListResponse` has been removed +- Struct `AzureDevOpsRepositoryProperties` has been removed +- Struct `AzureDevOpsScopeEnvironmentData` has been removed +- Struct `AzureResourceDetails` has been removed +- Struct `AzureResourceIdentifier` has been removed +- Struct `AzureResourceLink` has been removed +- Struct `AzureServersSetting` has been removed +- Struct `AzureTrackedResourceLocation` has been removed +- Struct `BaseResourceConfiguration` has been removed +- Struct `Baseline` has been removed +- Struct `BaselineAdjustedResult` has been removed +- Struct `BenchmarkReference` has been removed +- Struct `BuiltInInfoType` has been removed +- Struct `CVE` has been removed +- Struct `CVSS` has been removed +- Struct `CategoryConfiguration` has been removed +- Struct `CefExternalSecuritySolution` has been removed +- Struct `CefSolutionProperties` has been removed +- Struct `Compliance` has been removed +- Struct `ComplianceList` has been removed +- Struct `ComplianceProperties` has been removed +- Struct `ComplianceResult` has been removed +- Struct `ComplianceResultList` has been removed +- Struct `ComplianceResultProperties` has been removed +- Struct `ComplianceSegment` has been removed +- Struct `Condition` has been removed +- Struct `ConnectableResource` has been removed +- Struct `ConnectedResource` has been removed +- Struct `ConnectedWorkspace` has been removed +- Struct `ConnectionFromIPNotAllowed` has been removed +- Struct `ConnectionToIPNotAllowed` has been removed +- Struct `Connector` has been removed +- Struct `ConnectorProperties` has been removed +- Struct `ConnectorSetting` has been removed +- Struct `ConnectorSettingList` has been removed +- Struct `ConnectorSettingProperties` has been removed +- Struct `ConnectorsList` has been removed +- Struct `Contact` has been removed +- Struct `ContactList` has been removed +- Struct `ContactProperties` has been removed +- Struct `ContactPropertiesNotificationsByRole` has been removed +- Struct `ContainerRegistryVulnerabilityProperties` has been removed +- Struct `CspmMonitorAwsOffering` has been removed +- Struct `CspmMonitorAwsOfferingNativeCloudConnection` has been removed +- Struct `CspmMonitorAzureDevOpsOffering` has been removed +- Struct `CspmMonitorGcpOffering` has been removed +- Struct `CspmMonitorGcpOfferingNativeCloudConnection` has been removed +- Struct `CspmMonitorGitLabOffering` has been removed +- Struct `CspmMonitorGithubOffering` 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 `DataExportSettingProperties` has been removed +- Struct `DataExportSettings` has been removed +- Struct `DefenderCspmAwsOffering` has been removed +- Struct `DefenderCspmAwsOfferingCiem` has been removed +- Struct `DefenderCspmAwsOfferingCiemDiscovery` has been removed +- Struct `DefenderCspmAwsOfferingCiemOidc` has been removed +- Struct `DefenderCspmAwsOfferingDataSensitivityDiscovery` has been removed +- Struct `DefenderCspmAwsOfferingDatabasesDspm` has been removed +- Struct `DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S` has been removed +- Struct `DefenderCspmAwsOfferingMdcContainersImageAssessment` has been removed +- Struct `DefenderCspmAwsOfferingVMScanners` has been removed +- Struct `DefenderCspmGcpOffering` has been removed +- Struct `DefenderCspmGcpOfferingCiemDiscovery` has been removed +- Struct `DefenderCspmGcpOfferingDataSensitivityDiscovery` has been removed +- Struct `DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S` has been removed +- Struct `DefenderCspmGcpOfferingMdcContainersImageAssessment` has been removed +- Struct `DefenderCspmGcpOfferingVMScanners` has been removed +- Struct `DefenderFoDatabasesAwsOffering` has been removed +- Struct `DefenderFoDatabasesAwsOfferingArcAutoProvisioning` has been removed +- Struct `DefenderFoDatabasesAwsOfferingDatabasesDspm` has been removed +- Struct `DefenderFoDatabasesAwsOfferingRds` has been removed +- Struct `DefenderForContainersAwsOffering` has been removed +- Struct `DefenderForContainersAwsOfferingCloudWatchToKinesis` has been removed +- Struct `DefenderForContainersAwsOfferingKinesisToS3` has been removed +- Struct `DefenderForContainersAwsOfferingKubernetesDataCollection` has been removed +- Struct `DefenderForContainersAwsOfferingKubernetesService` has been removed +- Struct `DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S` has been removed +- Struct `DefenderForContainersAwsOfferingMdcContainersImageAssessment` has been removed +- Struct `DefenderForContainersAwsOfferingVMScanners` has been removed +- Struct `DefenderForContainersGcpOffering` has been removed +- Struct `DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection` has been removed +- Struct `DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S` has been removed +- Struct `DefenderForContainersGcpOfferingMdcContainersImageAssessment` has been removed +- Struct `DefenderForContainersGcpOfferingNativeCloudConnection` has been removed +- Struct `DefenderForContainersGcpOfferingVMScanners` has been removed +- Struct `DefenderForDatabasesGcpOffering` has been removed +- Struct `DefenderForDatabasesGcpOfferingArcAutoProvisioning` has been removed +- Struct `DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning` has been removed +- Struct `DefenderForServersAwsOffering` has been removed +- Struct `DefenderForServersAwsOfferingArcAutoProvisioning` has been removed +- Struct `DefenderForServersAwsOfferingDefenderForServers` has been removed +- Struct `DefenderForServersAwsOfferingMdeAutoProvisioning` has been removed +- Struct `DefenderForServersAwsOfferingSubPlan` has been removed +- Struct `DefenderForServersAwsOfferingVMScanners` has been removed +- Struct `DefenderForServersAwsOfferingVaAutoProvisioning` has been removed +- Struct `DefenderForServersAwsOfferingVaAutoProvisioningConfiguration` has been removed +- Struct `DefenderForServersGcpOffering` has been removed +- Struct `DefenderForServersGcpOfferingArcAutoProvisioning` has been removed +- Struct `DefenderForServersGcpOfferingDefenderForServers` has been removed +- Struct `DefenderForServersGcpOfferingMdeAutoProvisioning` has been removed +- Struct `DefenderForServersGcpOfferingSubPlan` has been removed +- Struct `DefenderForServersGcpOfferingVMScanners` has been removed +- Struct `DefenderForServersGcpOfferingVaAutoProvisioning` has been removed +- Struct `DefenderForServersGcpOfferingVaAutoProvisioningConfiguration` has been removed +- Struct `DenylistCustomAlertRule` has been removed +- Struct `DevOpsConfiguration` has been removed +- Struct `DevOpsConfigurationListResponse` has been removed +- Struct `DevOpsConfigurationProperties` has been removed +- Struct `DeviceSecurityGroup` has been removed +- Struct `DeviceSecurityGroupList` has been removed +- Struct `DeviceSecurityGroupProperties` has been removed +- Struct `DirectMethodInvokesNotInAllowedRange` has been removed +- Struct `DiscoveredSecuritySolution` has been removed +- Struct `DiscoveredSecuritySolutionList` has been removed +- Struct `DiscoveredSecuritySolutionProperties` has been removed +- Struct `ETag` has been removed +- Struct `EffectiveNetworkSecurityGroups` has been removed +- Struct `EnvironmentDetails` has been removed +- Struct `ErrorDetail` has been removed +- Struct `ErrorDetailAutoGenerated` has been removed +- Struct `ErrorResponse` has been removed +- Struct `ErrorResponseAutoGenerated` has been removed +- Struct `ExecuteGovernanceRuleParams` has been removed +- Struct `Extension` has been removed +- Struct `ExternalSecuritySolutionList` has been removed +- Struct `ExternalSecuritySolutionProperties` has been removed +- Struct `FailedLocalLoginsNotInAllowedRange` has been removed +- Struct `FileUploadsNotInAllowedRange` has been removed +- Struct `GcpCredentialsDetailsProperties` has been removed +- Struct `GcpOrganizationalDataMember` has been removed +- Struct `GcpOrganizationalDataOrganization` has been removed +- Struct `GcpProjectDetails` has been removed +- Struct `GcpProjectEnvironmentData` has been removed +- Struct `GetSensitivitySettingsListResponse` has been removed +- Struct `GetSensitivitySettingsResponse` has been removed +- Struct `GetSensitivitySettingsResponseProperties` has been removed +- Struct `GetSensitivitySettingsResponsePropertiesMipInformation` has been removed +- Struct `GitHubOwner` has been removed +- Struct `GitHubOwnerConfiguration` has been removed +- Struct `GitHubOwnerListResponse` has been removed +- Struct `GitHubOwnerProperties` has been removed +- Struct `GitHubRepository` has been removed +- Struct `GitHubRepositoryListResponse` has been removed +- Struct `GitHubRepositoryProperties` has been removed +- Struct `GitLabGroup` has been removed +- Struct `GitLabGroupConfiguration` has been removed +- Struct `GitLabGroupListResponse` has been removed +- Struct `GitLabGroupProperties` has been removed +- Struct `GitLabProject` has been removed +- Struct `GitLabProjectListResponse` has been removed +- Struct `GitLabProjectProperties` has been removed +- Struct `GithubScopeEnvironmentData` has been removed +- Struct `GitlabScopeEnvironmentData` has been removed +- Struct `GovernanceAssignment` has been removed +- Struct `GovernanceAssignmentAdditionalData` has been removed +- Struct `GovernanceAssignmentProperties` has been removed +- Struct `GovernanceAssignmentsList` has been removed +- Struct `GovernanceEmailNotification` has been removed +- Struct `GovernanceRule` has been removed +- Struct `GovernanceRuleEmailNotification` has been removed +- Struct `GovernanceRuleList` has been removed +- Struct `GovernanceRuleMetadata` has been removed +- Struct `GovernanceRuleOwnerSource` has been removed +- Struct `GovernanceRuleProperties` has been removed +- Struct `HTTPC2DMessagesNotInAllowedRange` has been removed +- Struct `HTTPC2DRejectedMessagesNotInAllowedRange` has been removed +- Struct `HTTPD2CMessagesNotInAllowedRange` has been removed +- Struct `HealthDataClassification` has been removed +- Struct `HealthReport` has been removed +- Struct `HealthReportProperties` has been removed +- Struct `HealthReportsList` has been removed +- Struct `HybridComputeSettingsProperties` has been removed +- Struct `Identity` has been removed +- Struct `InfoType` has been removed +- Struct `InformationProtectionKeyword` has been removed +- Struct `InformationProtectionPolicy` has been removed +- Struct `InformationProtectionPolicyList` has been removed +- Struct `InformationProtectionPolicyProperties` has been removed +- Struct `InformationType` has been removed +- Struct `IoTSecurityAggregatedAlert` has been removed +- Struct `IoTSecurityAggregatedAlertList` has been removed +- Struct `IoTSecurityAggregatedAlertProperties` has been removed +- Struct `IoTSecurityAggregatedAlertPropertiesTopDevicesListItem` has been removed +- Struct `IoTSecurityAggregatedRecommendation` has been removed +- Struct `IoTSecurityAggregatedRecommendationList` has been removed +- Struct `IoTSecurityAggregatedRecommendationProperties` has been removed +- Struct `IoTSecurityAlertedDevice` has been removed +- Struct `IoTSecurityDeviceAlert` has been removed +- Struct `IoTSecurityDeviceRecommendation` has been removed +- Struct `IoTSecuritySolutionAnalyticsModel` has been removed +- Struct `IoTSecuritySolutionAnalyticsModelList` has been removed +- Struct `IoTSecuritySolutionAnalyticsModelProperties` has been removed +- Struct `IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem` has been removed +- Struct `IoTSecuritySolutionModel` has been removed +- Struct `IoTSecuritySolutionProperties` has been removed +- Struct `IoTSecuritySolutionsList` has been removed +- Struct `IoTSeverityMetrics` has been removed +- Struct `Issue` has been removed +- Struct `JitNetworkAccessPoliciesList` has been removed +- Struct `JitNetworkAccessPolicy` has been removed +- Struct `JitNetworkAccessPolicyInitiatePort` has been removed +- Struct `JitNetworkAccessPolicyInitiateRequest` has been removed +- Struct `JitNetworkAccessPolicyInitiateVirtualMachine` has been removed +- Struct `JitNetworkAccessPolicyProperties` has been removed +- Struct `JitNetworkAccessPolicyVirtualMachine` has been removed +- Struct `JitNetworkAccessPortRule` has been removed +- Struct `JitNetworkAccessRequest` has been removed +- Struct `JitNetworkAccessRequestPort` has been removed +- Struct `JitNetworkAccessRequestVirtualMachine` has been removed +- Struct `KindAutoGenerated` has been removed +- Struct `Label` has been removed +- Struct `LocalUserNotAllowed` has been removed +- Struct `Location` has been removed +- Struct `LogAnalyticsIdentifier` has been removed +- Struct `MdeOnboardingData` has been removed +- Struct `MdeOnboardingDataList` has been removed +- Struct `MdeOnboardingDataProperties` has been removed +- Struct `MqttC2DMessagesNotInAllowedRange` has been removed +- Struct `MqttC2DRejectedMessagesNotInAllowedRange` has been removed +- Struct `MqttD2CMessagesNotInAllowedRange` has been removed +- Struct `NotificationsSourceAlert` has been removed +- Struct `NotificationsSourceAttackPath` has been removed +- Struct `OnPremiseSQLResourceDetails` has been removed +- Struct `Operation` has been removed +- Struct `OperationDisplay` has been removed +- Struct `OperationList` has been removed +- Struct `OperationResultAutoGenerated` has been removed +- Struct `OperationStatusAutoGenerated` has been removed +- Struct `OperationStatusResult` has been removed +- Struct `OperatorList` has been removed +- Struct `OperatorResource` has been removed +- Struct `PathRecommendation` has been removed +- Struct `Pricing` has been removed +- Struct `PricingList` has been removed +- Struct `PricingProperties` has been removed +- Struct `ProcessNotAllowed` has been removed +- Struct `ProtectionMode` has been removed +- Struct `ProxyResource` has been removed +- Struct `ProxyServerProperties` has been removed +- Struct `PublisherInfo` has been removed +- Struct `QueryCheck` has been removed +- Struct `QueuePurgesNotInAllowedRange` has been removed +- Struct `RecommendationConfigurationProperties` has been removed +- Struct `RegulatoryComplianceAssessment` has been removed +- Struct `RegulatoryComplianceAssessmentList` has been removed +- Struct `RegulatoryComplianceAssessmentProperties` has been removed +- Struct `RegulatoryComplianceControl` has been removed +- Struct `RegulatoryComplianceControlList` has been removed +- Struct `RegulatoryComplianceControlProperties` has been removed +- Struct `RegulatoryComplianceStandard` has been removed +- Struct `RegulatoryComplianceStandardList` has been removed +- Struct `RegulatoryComplianceStandardProperties` has been removed +- Struct `Remediation` has been removed +- Struct `RemediationEta` has been removed +- Struct `ResourceAutoGenerated` has been removed +- Struct `ResourceAutoGenerated2` has been removed +- Struct `ResourceDetailsAutoGenerated` has been removed +- Struct `Rule` has been removed +- Struct `RuleResults` has been removed +- Struct `RuleResultsInput` has been removed +- Struct `RuleResultsProperties` has been removed +- Struct `RulesResults` has been removed +- Struct `RulesResultsInput` has been removed +- Struct `SQLServerVulnerabilityProperties` has been removed +- Struct `Scan` has been removed +- Struct `ScanProperties` has been removed +- Struct `ScanResult` has been removed +- Struct `ScanResultProperties` has been removed +- Struct `ScanResults` has been removed +- Struct `Scans` has been removed +- Struct `ScopeElement` has been removed +- Struct `ScoreDetails` has been removed +- Struct `SecureScoreControlDefinitionItem` has been removed +- Struct `SecureScoreControlDefinitionItemProperties` has been removed +- Struct `SecureScoreControlDefinitionList` has been removed +- Struct `SecureScoreControlDefinitionSource` has been removed +- Struct `SecureScoreControlDetails` has been removed +- Struct `SecureScoreControlList` has been removed +- Struct `SecureScoreControlScore` has been removed +- Struct `SecureScoreControlScoreDetails` has been removed +- Struct `SecureScoreItem` has been removed +- Struct `SecureScoreItemProperties` has been removed +- Struct `SecureScoresList` has been removed +- Struct `SensitivityLabel` has been removed +- Struct `ServerVulnerabilityAssessment` has been removed +- Struct `ServerVulnerabilityAssessmentProperties` has been removed +- Struct `ServerVulnerabilityAssessmentsAzureSettingProperties` has been removed +- Struct `ServerVulnerabilityAssessmentsList` has been removed +- Struct `ServerVulnerabilityAssessmentsSettingsList` has been removed +- Struct `ServerVulnerabilityProperties` has been removed +- Struct `ServicePrincipalProperties` has been removed +- Struct `SettingsList` has been removed +- Struct `Software` has been removed +- Struct `SoftwareProperties` has been removed +- Struct `SoftwaresList` has been removed +- Struct `Solution` has been removed +- Struct `SolutionList` has been removed +- Struct `SolutionProperties` has been removed +- Struct `SolutionsReferenceData` has been removed +- Struct `SolutionsReferenceDataList` has been removed +- Struct `SolutionsReferenceDataProperties` has been removed +- Struct `StatusAutoGenerated` has been removed +- Struct `SubAssessment` has been removed +- Struct `SubAssessmentList` has been removed +- Struct `SubAssessmentProperties` has been removed +- Struct `SubAssessmentStatus` has been removed +- Struct `SuppressionAlertsScope` has been removed +- Struct `SystemData` has been removed +- Struct `Tags` has been removed +- Struct `TagsResource` has been removed +- Struct `TargetBranchConfiguration` has been removed +- Struct `Task` has been removed +- Struct `TaskList` has been removed +- Struct `TaskParameters` has been removed +- Struct `TaskProperties` has been removed +- Struct `TopologyList` has been removed +- Struct `TopologyResource` has been removed +- Struct `TopologyResourceProperties` has been removed +- Struct `TopologySingleResource` has been removed +- Struct `TopologySingleResourceChild` has been removed +- Struct `TopologySingleResourceParent` has been removed +- Struct `TrackedResource` has been removed +- Struct `TwinUpdatesNotInAllowedRange` has been removed +- Struct `UnauthorizedOperationsNotInAllowedRange` has been removed +- Struct `UpdateIoTSecuritySolutionProperties` has been removed +- Struct `UpdateIotSecuritySolutionData` has been removed +- Struct `UpdateSensitivitySettingsRequest` has been removed +- Struct `UserDefinedResourcesProperties` has been removed +- Struct `UserRecommendation` has been removed +- Struct `VMRecommendation` has been removed +- Struct `VMScannersAws` has been removed +- Struct `VMScannersBase` has been removed +- Struct `VMScannersBaseConfiguration` has been removed +- Struct `VMScannersGcp` has been removed +- Struct `VaRule` has been removed +- Struct `VendorReference` has been removed +- Struct `WorkspaceSetting` has been removed +- Struct `WorkspaceSettingList` has been removed +- Struct `WorkspaceSettingProperties` has been removed + +### Features Added + +- New function `*DefenderForStorageClient.CancelMalwareScan(context.Context, string, SettingName, string, *DefenderForStorageClientCancelMalwareScanOptions) (DefenderForStorageClientCancelMalwareScanResponse, error)` +- New function `*DefenderForStorageClient.GetMalwareScan(context.Context, string, SettingName, string, *DefenderForStorageClientGetMalwareScanOptions) (DefenderForStorageClientGetMalwareScanResponse, error)` +- New function `*DefenderForStorageClient.StartMalwareScan(context.Context, string, SettingName, *DefenderForStorageClientStartMalwareScanOptions) (DefenderForStorageClientStartMalwareScanResponse, error)` +- New struct `BlobsScanSummary` +- New struct `MalwareScan` +- New struct `MalwareScanProperties` +- New struct `ScanSummary` + + ## 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 9b3053548fe5..000000000000 --- a/sdk/resourcemanager/security/armsecurity/accountconnectors_client.go +++ /dev/null @@ -1,274 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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/accountconnectors_client_example_test.go b/sdk/resourcemanager/security/armsecurity/accountconnectors_client_example_test.go deleted file mode 100644 index aeb9a45efc72..000000000000 --- a/sdk/resourcemanager/security/armsecurity/accountconnectors_client_example_test.go +++ /dev/null @@ -1,421 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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.go b/sdk/resourcemanager/security/armsecurity/adaptiveapplicationcontrols_client.go deleted file mode 100644 index 196d6d28c6d5..000000000000 --- a/sdk/resourcemanager/security/armsecurity/adaptiveapplicationcontrols_client.go +++ /dev/null @@ -1,294 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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/adaptiveapplicationcontrols_client_example_test.go b/sdk/resourcemanager/security/armsecurity/adaptiveapplicationcontrols_client_example_test.go deleted file mode 100644 index f43524fe2cb7..000000000000 --- a/sdk/resourcemanager/security/armsecurity/adaptiveapplicationcontrols_client_example_test.go +++ /dev/null @@ -1,1321 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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.go b/sdk/resourcemanager/security/armsecurity/adaptivenetworkhardenings_client.go deleted file mode 100644 index b87d48496e1f..000000000000 --- a/sdk/resourcemanager/security/armsecurity/adaptivenetworkhardenings_client.go +++ /dev/null @@ -1,294 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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/adaptivenetworkhardenings_client_example_test.go b/sdk/resourcemanager/security/armsecurity/adaptivenetworkhardenings_client_example_test.go deleted file mode 100644 index 8c4ac51cfa91..000000000000 --- a/sdk/resourcemanager/security/armsecurity/adaptivenetworkhardenings_client_example_test.go +++ /dev/null @@ -1,194 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/advancedthreatprotection_client.go b/sdk/resourcemanager/security/armsecurity/advancedthreatprotection_client.go deleted file mode 100644 index d261fee89336..000000000000 --- a/sdk/resourcemanager/security/armsecurity/advancedthreatprotection_client.go +++ /dev/null @@ -1,152 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armsecurity - -import ( - "context" - "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" -) - -// AdvancedThreatProtectionClient contains the methods for the AdvancedThreatProtection group. -// Don't use this type directly, use NewAdvancedThreatProtectionClient() instead. -type AdvancedThreatProtectionClient struct { - internal *arm.Client -} - -// 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. -func NewAdvancedThreatProtectionClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AdvancedThreatProtectionClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &AdvancedThreatProtectionClient{ - internal: cl, - } - return client, nil -} - -// Create - Creates or updates the Advanced Threat Protection settings on a specified resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-01-01 -// - resourceID - The identifier of the resource. -// - advancedThreatProtectionSetting - Advanced Threat Protection Settings -// - options - AdvancedThreatProtectionClientCreateOptions contains the optional parameters for the AdvancedThreatProtectionClient.Create -// method. -func (client *AdvancedThreatProtectionClient) Create(ctx context.Context, resourceID string, advancedThreatProtectionSetting AdvancedThreatProtectionSetting, options *AdvancedThreatProtectionClientCreateOptions) (AdvancedThreatProtectionClientCreateResponse, error) { - var err error - const operationName = "AdvancedThreatProtectionClient.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, advancedThreatProtectionSetting, options) - if err != nil { - return AdvancedThreatProtectionClientCreateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AdvancedThreatProtectionClientCreateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AdvancedThreatProtectionClientCreateResponse{}, err - } - resp, err := client.createHandleResponse(httpResp) - return resp, err -} - -// createCreateRequest creates the Create request. -func (client *AdvancedThreatProtectionClient) createCreateRequest(ctx context.Context, resourceID string, advancedThreatProtectionSetting AdvancedThreatProtectionSetting, options *AdvancedThreatProtectionClientCreateOptions) (*policy.Request, error) { - urlPath := "/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}" - 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)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, advancedThreatProtectionSetting); err != nil { - return nil, err - } - return req, nil -} - -// createHandleResponse handles the Create response. -func (client *AdvancedThreatProtectionClient) createHandleResponse(resp *http.Response) (AdvancedThreatProtectionClientCreateResponse, error) { - result := AdvancedThreatProtectionClientCreateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AdvancedThreatProtectionSetting); err != nil { - return AdvancedThreatProtectionClientCreateResponse{}, err - } - return result, nil -} - -// Get - Gets the Advanced Threat Protection settings for the specified resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-01-01 -// - resourceID - The 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) { - var err error - const operationName = "AdvancedThreatProtectionClient.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 AdvancedThreatProtectionClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AdvancedThreatProtectionClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AdvancedThreatProtectionClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *AdvancedThreatProtectionClient) getCreateRequest(ctx context.Context, resourceID string, options *AdvancedThreatProtectionClientGetOptions) (*policy.Request, error) { - urlPath := "/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}" - 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)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-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 *AdvancedThreatProtectionClient) getHandleResponse(resp *http.Response) (AdvancedThreatProtectionClientGetResponse, error) { - result := AdvancedThreatProtectionClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AdvancedThreatProtectionSetting); err != nil { - return AdvancedThreatProtectionClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/advancedthreatprotection_client_example_test.go b/sdk/resourcemanager/security/armsecurity/advancedthreatprotection_client_example_test.go deleted file mode 100644 index a02426283d28..000000000000 --- a/sdk/resourcemanager/security/armsecurity/advancedthreatprotection_client_example_test.go +++ /dev/null @@ -1,82 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/2019-01-01/examples/AdvancedThreatProtection/GetAdvancedThreatProtectionSettings_example.json -func ExampleAdvancedThreatProtectionClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAdvancedThreatProtectionClient().Get(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.AdvancedThreatProtectionSetting = armsecurity.AdvancedThreatProtectionSetting{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Security/advancedThreatProtectionSettings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount/providers/Microsoft.Security/advancedThreatProtectionSettings/current"), - // Properties: &armsecurity.AdvancedThreatProtectionProperties{ - // IsEnabled: to.Ptr(true), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2019-01-01/examples/AdvancedThreatProtection/PutAdvancedThreatProtectionSettings_example.json -func ExampleAdvancedThreatProtectionClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAdvancedThreatProtectionClient().Create(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount", armsecurity.AdvancedThreatProtectionSetting{ - Name: to.Ptr("current"), - Type: to.Ptr("Microsoft.Security/advancedThreatProtectionSettings"), - ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount/providers/Microsoft.Security/advancedThreatProtectionSettings/current"), - Properties: &armsecurity.AdvancedThreatProtectionProperties{ - IsEnabled: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.AdvancedThreatProtectionSetting = armsecurity.AdvancedThreatProtectionSetting{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Security/advancedThreatProtectionSettings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount/providers/Microsoft.Security/advancedThreatProtectionSettings/current"), - // Properties: &armsecurity.AdvancedThreatProtectionProperties{ - // IsEnabled: to.Ptr(true), - // }, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/alerts_client.go b/sdk/resourcemanager/security/armsecurity/alerts_client.go deleted file mode 100644 index 59fd173fbef7..000000000000 --- a/sdk/resourcemanager/security/armsecurity/alerts_client.go +++ /dev/null @@ -1,955 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// AlertsClient contains the methods for the Alerts group. -// Don't use this type directly, use NewAlertsClient() instead. -type AlertsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewAlertsClient creates a new instance of AlertsClient 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 NewAlertsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &AlertsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// GetResourceGroupLevel - Get an alert that is associated a resource group or a resource in a resource group -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-01 -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - alertName - Name of the alert object -// - options - AlertsClientGetResourceGroupLevelOptions contains the optional parameters for the AlertsClient.GetResourceGroupLevel -// method. -func (client *AlertsClient) GetResourceGroupLevel(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, options *AlertsClientGetResourceGroupLevelOptions) (AlertsClientGetResourceGroupLevelResponse, error) { - var err error - const operationName = "AlertsClient.GetResourceGroupLevel" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getResourceGroupLevelCreateRequest(ctx, resourceGroupName, ascLocation, alertName, options) - if err != nil { - return AlertsClientGetResourceGroupLevelResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AlertsClientGetResourceGroupLevelResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AlertsClientGetResourceGroupLevelResponse{}, err - } - resp, err := client.getResourceGroupLevelHandleResponse(httpResp) - return resp, err -} - -// getResourceGroupLevelCreateRequest creates the GetResourceGroupLevel request. -func (client *AlertsClient) getResourceGroupLevelCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, options *AlertsClientGetResourceGroupLevelOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ascLocation == "" { - return nil, errors.New("parameter ascLocation cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ascLocation}", url.PathEscape(ascLocation)) - if alertName == "" { - return nil, errors.New("parameter alertName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{alertName}", url.PathEscape(alertName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getResourceGroupLevelHandleResponse handles the GetResourceGroupLevel response. -func (client *AlertsClient) getResourceGroupLevelHandleResponse(resp *http.Response) (AlertsClientGetResourceGroupLevelResponse, error) { - result := AlertsClientGetResourceGroupLevelResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Alert); err != nil { - return AlertsClientGetResourceGroupLevelResponse{}, err - } - return result, nil -} - -// GetSubscriptionLevel - Get an alert that is associated with a subscription -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-01 -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - alertName - Name of the alert object -// - options - AlertsClientGetSubscriptionLevelOptions contains the optional parameters for the AlertsClient.GetSubscriptionLevel -// method. -func (client *AlertsClient) GetSubscriptionLevel(ctx context.Context, ascLocation string, alertName string, options *AlertsClientGetSubscriptionLevelOptions) (AlertsClientGetSubscriptionLevelResponse, error) { - var err error - const operationName = "AlertsClient.GetSubscriptionLevel" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getSubscriptionLevelCreateRequest(ctx, ascLocation, alertName, options) - if err != nil { - return AlertsClientGetSubscriptionLevelResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AlertsClientGetSubscriptionLevelResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AlertsClientGetSubscriptionLevelResponse{}, err - } - resp, err := client.getSubscriptionLevelHandleResponse(httpResp) - return resp, err -} - -// getSubscriptionLevelCreateRequest creates the GetSubscriptionLevel request. -func (client *AlertsClient) getSubscriptionLevelCreateRequest(ctx context.Context, ascLocation string, alertName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if ascLocation == "" { - return nil, errors.New("parameter ascLocation cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ascLocation}", url.PathEscape(ascLocation)) - if alertName == "" { - return nil, errors.New("parameter alertName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{alertName}", url.PathEscape(alertName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getSubscriptionLevelHandleResponse handles the GetSubscriptionLevel response. -func (client *AlertsClient) getSubscriptionLevelHandleResponse(resp *http.Response) (AlertsClientGetSubscriptionLevelResponse, error) { - result := AlertsClientGetSubscriptionLevelResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Alert); err != nil { - return AlertsClientGetSubscriptionLevelResponse{}, err - } - return result, nil -} - -// NewListPager - List all the alerts that are associated with the subscription -// -// Generated from API version 2022-01-01 -// - options - AlertsClientListOptions contains the optional parameters for the AlertsClient.NewListPager method. -func (client *AlertsClient) NewListPager(options *AlertsClientListOptions) *runtime.Pager[AlertsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[AlertsClientListResponse]{ - More: func(page AlertsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *AlertsClientListResponse) (AlertsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AlertsClient.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 AlertsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *AlertsClient) listCreateRequest(ctx context.Context, options *AlertsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alerts" - 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", "2022-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 *AlertsClient) listHandleResponse(resp *http.Response) (AlertsClientListResponse, error) { - result := AlertsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AlertList); err != nil { - return AlertsClientListResponse{}, err - } - return result, nil -} - -// 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. -// - options - AlertsClientListByResourceGroupOptions contains the optional parameters for the AlertsClient.NewListByResourceGroupPager -// method. -func (client *AlertsClient) NewListByResourceGroupPager(resourceGroupName string, options *AlertsClientListByResourceGroupOptions) *runtime.Pager[AlertsClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[AlertsClientListByResourceGroupResponse]{ - More: func(page AlertsClientListByResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *AlertsClientListByResourceGroupResponse) (AlertsClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AlertsClient.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 AlertsClientListByResourceGroupResponse{}, err - } - return client.listByResourceGroupHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *AlertsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *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") - } - 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", "2022-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *AlertsClient) listByResourceGroupHandleResponse(resp *http.Response) (AlertsClientListByResourceGroupResponse, error) { - result := AlertsClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AlertList); err != nil { - return AlertsClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// NewListResourceGroupLevelByRegionPager - List all the alerts that are associated with the resource group that are stored -// in a specific location -// -// Generated from API version 2022-01-01 -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - options - AlertsClientListResourceGroupLevelByRegionOptions contains the optional parameters for the AlertsClient.NewListResourceGroupLevelByRegionPager -// method. -func (client *AlertsClient) NewListResourceGroupLevelByRegionPager(ascLocation string, resourceGroupName string, options *AlertsClientListResourceGroupLevelByRegionOptions) *runtime.Pager[AlertsClientListResourceGroupLevelByRegionResponse] { - return runtime.NewPager(runtime.PagingHandler[AlertsClientListResourceGroupLevelByRegionResponse]{ - More: func(page AlertsClientListResourceGroupLevelByRegionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *AlertsClientListResourceGroupLevelByRegionResponse) (AlertsClientListResourceGroupLevelByRegionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AlertsClient.NewListResourceGroupLevelByRegionPager") - 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.listResourceGroupLevelByRegionCreateRequest(ctx, ascLocation, resourceGroupName, options) - }, nil) - if err != nil { - return AlertsClientListResourceGroupLevelByRegionResponse{}, err - } - return client.listResourceGroupLevelByRegionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listResourceGroupLevelByRegionCreateRequest creates the ListResourceGroupLevelByRegion request. -func (client *AlertsClient) listResourceGroupLevelByRegionCreateRequest(ctx context.Context, ascLocation string, resourceGroupName string, options *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") - } - 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 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", "2022-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listResourceGroupLevelByRegionHandleResponse handles the ListResourceGroupLevelByRegion response. -func (client *AlertsClient) listResourceGroupLevelByRegionHandleResponse(resp *http.Response) (AlertsClientListResourceGroupLevelByRegionResponse, error) { - result := AlertsClientListResourceGroupLevelByRegionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AlertList); err != nil { - return AlertsClientListResourceGroupLevelByRegionResponse{}, err - } - return result, nil -} - -// NewListSubscriptionLevelByRegionPager - List all the alerts that are associated with the subscription that are stored in -// a specific location -// -// Generated from API version 2022-01-01 -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - options - AlertsClientListSubscriptionLevelByRegionOptions contains the optional parameters for the AlertsClient.NewListSubscriptionLevelByRegionPager -// method. -func (client *AlertsClient) NewListSubscriptionLevelByRegionPager(ascLocation string, options *AlertsClientListSubscriptionLevelByRegionOptions) *runtime.Pager[AlertsClientListSubscriptionLevelByRegionResponse] { - return runtime.NewPager(runtime.PagingHandler[AlertsClientListSubscriptionLevelByRegionResponse]{ - More: func(page AlertsClientListSubscriptionLevelByRegionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *AlertsClientListSubscriptionLevelByRegionResponse) (AlertsClientListSubscriptionLevelByRegionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AlertsClient.NewListSubscriptionLevelByRegionPager") - 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.listSubscriptionLevelByRegionCreateRequest(ctx, ascLocation, options) - }, nil) - if err != nil { - return AlertsClientListSubscriptionLevelByRegionResponse{}, err - } - return client.listSubscriptionLevelByRegionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listSubscriptionLevelByRegionCreateRequest creates the ListSubscriptionLevelByRegion request. -func (client *AlertsClient) listSubscriptionLevelByRegionCreateRequest(ctx context.Context, ascLocation string, options *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") - } - 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)) - 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", "2022-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listSubscriptionLevelByRegionHandleResponse handles the ListSubscriptionLevelByRegion response. -func (client *AlertsClient) listSubscriptionLevelByRegionHandleResponse(resp *http.Response) (AlertsClientListSubscriptionLevelByRegionResponse, error) { - result := AlertsClientListSubscriptionLevelByRegionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AlertList); err != nil { - return AlertsClientListSubscriptionLevelByRegionResponse{}, err - } - return result, nil -} - -// BeginSimulate - Simulate security alerts -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-01 -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - alertSimulatorRequestBody - Alert Simulator Request Properties -// - options - AlertsClientBeginSimulateOptions contains the optional parameters for the AlertsClient.BeginSimulate method. -func (client *AlertsClient) BeginSimulate(ctx context.Context, ascLocation string, alertSimulatorRequestBody AlertSimulatorRequestBody, options *AlertsClientBeginSimulateOptions) (*runtime.Poller[AlertsClientSimulateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.simulate(ctx, ascLocation, alertSimulatorRequestBody, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AlertsClientSimulateResponse]{ - FinalStateVia: runtime.FinalStateViaOriginalURI, - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AlertsClientSimulateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Simulate - Simulate security alerts -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-01 -func (client *AlertsClient) simulate(ctx context.Context, ascLocation string, alertSimulatorRequestBody AlertSimulatorRequestBody, options *AlertsClientBeginSimulateOptions) (*http.Response, error) { - var err error - const operationName = "AlertsClient.BeginSimulate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.simulateCreateRequest(ctx, ascLocation, alertSimulatorRequestBody, 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 -} - -// simulateCreateRequest creates the Simulate request. -func (client *AlertsClient) simulateCreateRequest(ctx context.Context, ascLocation string, alertSimulatorRequestBody AlertSimulatorRequestBody, options *AlertsClientBeginSimulateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - 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)) - 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", "2022-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, alertSimulatorRequestBody); err != nil { - return nil, err - } - return req, nil -} - -// UpdateResourceGroupLevelStateToActivate - Update the alert's state -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-01 -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - alertName - Name of the alert object -// - options - AlertsClientUpdateResourceGroupLevelStateToActivateOptions contains the optional parameters for the AlertsClient.UpdateResourceGroupLevelStateToActivate -// method. -func (client *AlertsClient) UpdateResourceGroupLevelStateToActivate(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, options *AlertsClientUpdateResourceGroupLevelStateToActivateOptions) (AlertsClientUpdateResourceGroupLevelStateToActivateResponse, error) { - var err error - const operationName = "AlertsClient.UpdateResourceGroupLevelStateToActivate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateResourceGroupLevelStateToActivateCreateRequest(ctx, resourceGroupName, ascLocation, alertName, options) - if err != nil { - return AlertsClientUpdateResourceGroupLevelStateToActivateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AlertsClientUpdateResourceGroupLevelStateToActivateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return AlertsClientUpdateResourceGroupLevelStateToActivateResponse{}, err - } - return AlertsClientUpdateResourceGroupLevelStateToActivateResponse{}, nil -} - -// updateResourceGroupLevelStateToActivateCreateRequest creates the UpdateResourceGroupLevelStateToActivate request. -func (client *AlertsClient) updateResourceGroupLevelStateToActivateCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, options *AlertsClientUpdateResourceGroupLevelStateToActivateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ascLocation == "" { - return nil, errors.New("parameter ascLocation cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ascLocation}", url.PathEscape(ascLocation)) - if alertName == "" { - return nil, errors.New("parameter alertName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{alertName}", url.PathEscape(alertName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// UpdateResourceGroupLevelStateToDismiss - Update the alert's state -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-01 -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - alertName - Name of the alert object -// - options - AlertsClientUpdateResourceGroupLevelStateToDismissOptions contains the optional parameters for the AlertsClient.UpdateResourceGroupLevelStateToDismiss -// method. -func (client *AlertsClient) UpdateResourceGroupLevelStateToDismiss(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, options *AlertsClientUpdateResourceGroupLevelStateToDismissOptions) (AlertsClientUpdateResourceGroupLevelStateToDismissResponse, error) { - var err error - const operationName = "AlertsClient.UpdateResourceGroupLevelStateToDismiss" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateResourceGroupLevelStateToDismissCreateRequest(ctx, resourceGroupName, ascLocation, alertName, options) - if err != nil { - return AlertsClientUpdateResourceGroupLevelStateToDismissResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AlertsClientUpdateResourceGroupLevelStateToDismissResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return AlertsClientUpdateResourceGroupLevelStateToDismissResponse{}, err - } - return AlertsClientUpdateResourceGroupLevelStateToDismissResponse{}, nil -} - -// updateResourceGroupLevelStateToDismissCreateRequest creates the UpdateResourceGroupLevelStateToDismiss request. -func (client *AlertsClient) updateResourceGroupLevelStateToDismissCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, options *AlertsClientUpdateResourceGroupLevelStateToDismissOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ascLocation == "" { - return nil, errors.New("parameter ascLocation cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ascLocation}", url.PathEscape(ascLocation)) - if alertName == "" { - return nil, errors.New("parameter alertName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{alertName}", url.PathEscape(alertName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// UpdateResourceGroupLevelStateToInProgress - Update the alert's state -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-01 -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - alertName - Name of the alert object -// - options - AlertsClientUpdateResourceGroupLevelStateToInProgressOptions contains the optional parameters for the AlertsClient.UpdateResourceGroupLevelStateToInProgress -// method. -func (client *AlertsClient) UpdateResourceGroupLevelStateToInProgress(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, options *AlertsClientUpdateResourceGroupLevelStateToInProgressOptions) (AlertsClientUpdateResourceGroupLevelStateToInProgressResponse, error) { - var err error - const operationName = "AlertsClient.UpdateResourceGroupLevelStateToInProgress" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateResourceGroupLevelStateToInProgressCreateRequest(ctx, resourceGroupName, ascLocation, alertName, options) - if err != nil { - return AlertsClientUpdateResourceGroupLevelStateToInProgressResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AlertsClientUpdateResourceGroupLevelStateToInProgressResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return AlertsClientUpdateResourceGroupLevelStateToInProgressResponse{}, err - } - return AlertsClientUpdateResourceGroupLevelStateToInProgressResponse{}, nil -} - -// updateResourceGroupLevelStateToInProgressCreateRequest creates the UpdateResourceGroupLevelStateToInProgress request. -func (client *AlertsClient) updateResourceGroupLevelStateToInProgressCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, options *AlertsClientUpdateResourceGroupLevelStateToInProgressOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/inProgress" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ascLocation == "" { - return nil, errors.New("parameter ascLocation cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ascLocation}", url.PathEscape(ascLocation)) - if alertName == "" { - return nil, errors.New("parameter alertName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{alertName}", url.PathEscape(alertName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// UpdateResourceGroupLevelStateToResolve - Update the alert's state -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-01 -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - alertName - Name of the alert object -// - options - AlertsClientUpdateResourceGroupLevelStateToResolveOptions contains the optional parameters for the AlertsClient.UpdateResourceGroupLevelStateToResolve -// method. -func (client *AlertsClient) UpdateResourceGroupLevelStateToResolve(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, options *AlertsClientUpdateResourceGroupLevelStateToResolveOptions) (AlertsClientUpdateResourceGroupLevelStateToResolveResponse, error) { - var err error - const operationName = "AlertsClient.UpdateResourceGroupLevelStateToResolve" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateResourceGroupLevelStateToResolveCreateRequest(ctx, resourceGroupName, ascLocation, alertName, options) - if err != nil { - return AlertsClientUpdateResourceGroupLevelStateToResolveResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AlertsClientUpdateResourceGroupLevelStateToResolveResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return AlertsClientUpdateResourceGroupLevelStateToResolveResponse{}, err - } - return AlertsClientUpdateResourceGroupLevelStateToResolveResponse{}, nil -} - -// updateResourceGroupLevelStateToResolveCreateRequest creates the UpdateResourceGroupLevelStateToResolve request. -func (client *AlertsClient) updateResourceGroupLevelStateToResolveCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, options *AlertsClientUpdateResourceGroupLevelStateToResolveOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ascLocation == "" { - return nil, errors.New("parameter ascLocation cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ascLocation}", url.PathEscape(ascLocation)) - if alertName == "" { - return nil, errors.New("parameter alertName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{alertName}", url.PathEscape(alertName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// UpdateSubscriptionLevelStateToActivate - Update the alert's state -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-01 -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - alertName - Name of the alert object -// - options - AlertsClientUpdateSubscriptionLevelStateToActivateOptions contains the optional parameters for the AlertsClient.UpdateSubscriptionLevelStateToActivate -// method. -func (client *AlertsClient) UpdateSubscriptionLevelStateToActivate(ctx context.Context, ascLocation string, alertName string, options *AlertsClientUpdateSubscriptionLevelStateToActivateOptions) (AlertsClientUpdateSubscriptionLevelStateToActivateResponse, error) { - var err error - const operationName = "AlertsClient.UpdateSubscriptionLevelStateToActivate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateSubscriptionLevelStateToActivateCreateRequest(ctx, ascLocation, alertName, options) - if err != nil { - return AlertsClientUpdateSubscriptionLevelStateToActivateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AlertsClientUpdateSubscriptionLevelStateToActivateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return AlertsClientUpdateSubscriptionLevelStateToActivateResponse{}, err - } - return AlertsClientUpdateSubscriptionLevelStateToActivateResponse{}, nil -} - -// updateSubscriptionLevelStateToActivateCreateRequest creates the UpdateSubscriptionLevelStateToActivate request. -func (client *AlertsClient) updateSubscriptionLevelStateToActivateCreateRequest(ctx context.Context, ascLocation string, alertName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if ascLocation == "" { - return nil, errors.New("parameter ascLocation cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ascLocation}", url.PathEscape(ascLocation)) - if alertName == "" { - return nil, errors.New("parameter alertName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{alertName}", url.PathEscape(alertName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// UpdateSubscriptionLevelStateToDismiss - Update the alert's state -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-01 -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - alertName - Name of the alert object -// - options - AlertsClientUpdateSubscriptionLevelStateToDismissOptions contains the optional parameters for the AlertsClient.UpdateSubscriptionLevelStateToDismiss -// method. -func (client *AlertsClient) UpdateSubscriptionLevelStateToDismiss(ctx context.Context, ascLocation string, alertName string, options *AlertsClientUpdateSubscriptionLevelStateToDismissOptions) (AlertsClientUpdateSubscriptionLevelStateToDismissResponse, error) { - var err error - const operationName = "AlertsClient.UpdateSubscriptionLevelStateToDismiss" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateSubscriptionLevelStateToDismissCreateRequest(ctx, ascLocation, alertName, options) - if err != nil { - return AlertsClientUpdateSubscriptionLevelStateToDismissResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AlertsClientUpdateSubscriptionLevelStateToDismissResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return AlertsClientUpdateSubscriptionLevelStateToDismissResponse{}, err - } - return AlertsClientUpdateSubscriptionLevelStateToDismissResponse{}, nil -} - -// updateSubscriptionLevelStateToDismissCreateRequest creates the UpdateSubscriptionLevelStateToDismiss request. -func (client *AlertsClient) updateSubscriptionLevelStateToDismissCreateRequest(ctx context.Context, ascLocation string, alertName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if ascLocation == "" { - return nil, errors.New("parameter ascLocation cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ascLocation}", url.PathEscape(ascLocation)) - if alertName == "" { - return nil, errors.New("parameter alertName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{alertName}", url.PathEscape(alertName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// UpdateSubscriptionLevelStateToInProgress - Update the alert's state -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-01 -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - alertName - Name of the alert object -// - options - AlertsClientUpdateSubscriptionLevelStateToInProgressOptions contains the optional parameters for the AlertsClient.UpdateSubscriptionLevelStateToInProgress -// method. -func (client *AlertsClient) UpdateSubscriptionLevelStateToInProgress(ctx context.Context, ascLocation string, alertName string, options *AlertsClientUpdateSubscriptionLevelStateToInProgressOptions) (AlertsClientUpdateSubscriptionLevelStateToInProgressResponse, error) { - var err error - const operationName = "AlertsClient.UpdateSubscriptionLevelStateToInProgress" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateSubscriptionLevelStateToInProgressCreateRequest(ctx, ascLocation, alertName, options) - if err != nil { - return AlertsClientUpdateSubscriptionLevelStateToInProgressResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AlertsClientUpdateSubscriptionLevelStateToInProgressResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return AlertsClientUpdateSubscriptionLevelStateToInProgressResponse{}, err - } - return AlertsClientUpdateSubscriptionLevelStateToInProgressResponse{}, nil -} - -// updateSubscriptionLevelStateToInProgressCreateRequest creates the UpdateSubscriptionLevelStateToInProgress request. -func (client *AlertsClient) updateSubscriptionLevelStateToInProgressCreateRequest(ctx context.Context, ascLocation string, alertName string, options *AlertsClientUpdateSubscriptionLevelStateToInProgressOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/inProgress" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if ascLocation == "" { - return nil, errors.New("parameter ascLocation cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ascLocation}", url.PathEscape(ascLocation)) - if alertName == "" { - return nil, errors.New("parameter alertName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{alertName}", url.PathEscape(alertName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// UpdateSubscriptionLevelStateToResolve - Update the alert's state -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-01 -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - alertName - Name of the alert object -// - options - AlertsClientUpdateSubscriptionLevelStateToResolveOptions contains the optional parameters for the AlertsClient.UpdateSubscriptionLevelStateToResolve -// method. -func (client *AlertsClient) UpdateSubscriptionLevelStateToResolve(ctx context.Context, ascLocation string, alertName string, options *AlertsClientUpdateSubscriptionLevelStateToResolveOptions) (AlertsClientUpdateSubscriptionLevelStateToResolveResponse, error) { - var err error - const operationName = "AlertsClient.UpdateSubscriptionLevelStateToResolve" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateSubscriptionLevelStateToResolveCreateRequest(ctx, ascLocation, alertName, options) - if err != nil { - return AlertsClientUpdateSubscriptionLevelStateToResolveResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AlertsClientUpdateSubscriptionLevelStateToResolveResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return AlertsClientUpdateSubscriptionLevelStateToResolveResponse{}, err - } - return AlertsClientUpdateSubscriptionLevelStateToResolveResponse{}, nil -} - -// updateSubscriptionLevelStateToResolveCreateRequest creates the UpdateSubscriptionLevelStateToResolve request. -func (client *AlertsClient) updateSubscriptionLevelStateToResolveCreateRequest(ctx context.Context, ascLocation string, alertName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if ascLocation == "" { - return nil, errors.New("parameter ascLocation cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ascLocation}", url.PathEscape(ascLocation)) - if alertName == "" { - return nil, errors.New("parameter alertName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{alertName}", url.PathEscape(alertName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/alerts_client_example_test.go b/sdk/resourcemanager/security/armsecurity/alerts_client_example_test.go deleted file mode 100644 index 26568f8a556d..000000000000 --- a/sdk/resourcemanager/security/armsecurity/alerts_client_example_test.go +++ /dev/null @@ -1,1464 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/2022-01-01/examples/Alerts/GetAlertsSubscription_example.json -func ExampleAlertsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAlertsClient().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.AlertList = armsecurity.AlertList{ - // Value: []*armsecurity.Alert{ - // { - // Name: to.Ptr("2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a"), - // Type: to.Ptr("Microsoft.Security/Locations/alerts"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Security/locations/westeurope/alerts/2518770965529163669_F144EE95-A3E5-42DA-A279-967D115809AA"), - // Properties: &armsecurity.AlertProperties{ - // Description: to.Ptr("This is a test alert generated by Azure Security Center. No further action is needed."), - // AlertDisplayName: to.Ptr("Azure Security Center test alert (not a threat)"), - // AlertType: to.Ptr("VM_EICAR"), - // AlertURI: to.Ptr("https://portal.azure.com/#blade/Microsoft_Azure_Security/AlertBlade/alertId/2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a/subscriptionId/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroup/myRg1/referencedFrom/alertDeepLink/location/westeurope"), - // CompromisedEntity: to.Ptr("vm1"), - // CorrelationKey: to.Ptr("kso0LFWxzCll5tqrk5hmrBJ+MY1BX806W6q6+0s9Lk="), - // EndTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-22T00:00:00.000Z"); return t}()), - // Entities: []*armsecurity.AlertEntity{ - // { - // AdditionalProperties: map[string]any{ - // "address": "192.0.2.1", - // "location": map[string]any{ - // "asn": float64(6584), - // "city": "sonning", - // "countryCode": "gb", - // "latitude": float64(51.468), - // "longitude": float64(-0.909), - // "state": "wokingham", - // }, - // }, - // Type: to.Ptr("ip"), - // }}, - // ExtendedLinks: []map[string]*string{ - // map[string]*string{ - // "Category": to.Ptr("threat_reports"), - // "Href": to.Ptr("https://contoso.com/reports/DisplayReport"), - // "Label": to.Ptr("Report: RDP Brute Forcing"), - // "Type": to.Ptr("webLink"), - // }}, - // ExtendedProperties: map[string]*string{ - // "Property1": to.Ptr("Property1 information"), - // }, - // Intent: to.Ptr(armsecurity.IntentExecution), - // IsIncident: to.Ptr(true), - // ProcessingEndTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-23T13:47:58.920Z"); return t}()), - // ProductComponentName: to.Ptr("testName"), - // ProductName: to.Ptr("Azure Security Center"), - // RemediationSteps: []*string{ - // to.Ptr("No further action is needed.")}, - // ResourceIdentifiers: []armsecurity.ResourceIdentifierClassification{ - // &armsecurity.AzureResourceIdentifier{ - // Type: to.Ptr(armsecurity.ResourceIdentifierTypeAzureResource), - // AzureResourceID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1"), - // }, - // &armsecurity.LogAnalyticsIdentifier{ - // Type: to.Ptr(armsecurity.ResourceIdentifierTypeLogAnalytics), - // AgentID: to.Ptr("75724a01-f021-4aa8-9ec2-329792373e6e"), - // WorkspaceID: to.Ptr("f419f624-acad-4d89-b86d-f62fa387f019"), - // WorkspaceResourceGroup: to.Ptr("myRg1"), - // WorkspaceSubscriptionID: to.Ptr("20ff7fc3-e762-44dd-bd96-b71116dcdc23"), - // }}, - // Severity: to.Ptr(armsecurity.AlertSeverityHigh), - // StartTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-22T00:00:00.000Z"); return t}()), - // Status: to.Ptr(armsecurity.AlertStatusActive), - // SubTechniques: []*string{ - // to.Ptr("T1059.001"), - // to.Ptr("T1059.006"), - // to.Ptr("T1053.002")}, - // SupportingEvidence: &armsecurity.AlertPropertiesSupportingEvidence{ - // AdditionalProperties: map[string]any{ - // "columns": []any{ - // "Date", - // "Activity", - // "User", - // "TestedText", - // "TestedValue", - // }, - // "rows": []any{ - // []any{ - // "2022-01-17T07:03:52.034Z", - // "Log on", - // "testUser", - // "false", - // false, - // }, - // []any{ - // "2022-01-17T07:03:52.034Z", - // "Log on", - // "testUser2", - // "false", - // false, - // }, - // []any{ - // "2022-01-17T07:03:52.034Z", - // "Log on", - // "testUser3", - // "true", - // true, - // }, - // }, - // "title": "Investigate activity test", - // }, - // Type: to.Ptr("tabularEvidences"), - // }, - // SystemAlertID: to.Ptr("2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a"), - // Techniques: []*string{ - // to.Ptr("T1059"), - // to.Ptr("T1053"), - // to.Ptr("T1072")}, - // TimeGeneratedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-23T13:47:58.000Z"); return t}()), - // VendorName: to.Ptr("Microsoft"), - // Version: to.Ptr("2022-01-01"), - // }, - // }, - // { - // Name: to.Ptr("2518765996949954086_2325cf9e-42a2-4f72-ae7f-9b863cba2d22"), - // Type: to.Ptr("Microsoft.Security/Locations/alerts"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg2/providers/Microsoft.Security/locations/westeurope/alerts/2518765996949954086_2325cf9e-42a2-4f72-ae7f-9b863cba2d22"), - // Properties: &armsecurity.AlertProperties{ - // Description: to.Ptr("The process ‘c:\\users\\contosoUser\\scrsave.scr’ was observed executing from an uncommon location. Files with the .scr extensions are screen saver files and are normally reside and execute from the Windows system directory."), - // AlertDisplayName: to.Ptr("Suspicious Screensaver process executed"), - // AlertType: to.Ptr("VM_SuspiciousScreenSaver"), - // AlertURI: to.Ptr("https://portal.azure.com/#blade/Microsoft_Azure_Security/AlertBlade/alertId/2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a/subscriptionId/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroup/myRg1/referencedFrom/alertDeepLink/location/westeurope"), - // CompromisedEntity: to.Ptr("vm2"), - // CorrelationKey: to.Ptr("4hno6LF0xzCl5tqrk4nrBW+MY1BX816W6q6+0srk4"), - // EndTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-07T13:51:45.004Z"); return t}()), - // Entities: []*armsecurity.AlertEntity{ - // { - // AdditionalProperties: map[string]any{ - // "OsVersion": nil, - // "azureID": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/myRg2/providers/microsoft.compute/virtualmachines/vm2", - // "dnsDomain": "", - // "hostName": "vm2", - // "netBiosName": "vm2", - // "ntDomain": "", - // "omsAgentID": "45b44640-3b94-4892-a28c-4a5cae27065a", - // "operatingSystem": "Unknown", - // }, - // Type: to.Ptr("host"), - // }, - // { - // AdditionalProperties: map[string]any{ - // "name": "contosoUser", - // "logonId": "0x61450d87", - // "ntDomain": "vm2", - // "sid": "S-1-5-21-2144575486-8928446540-5163864319-500", - // }, - // Type: to.Ptr("account"), - // }, - // { - // AdditionalProperties: map[string]any{ - // "name": "cmd.exe", - // "directory": "c:\\windows\\system32", - // }, - // Type: to.Ptr("file"), - // }, - // { - // AdditionalProperties: map[string]any{ - // "processId": "0x3c44", - // }, - // Type: to.Ptr("process"), - // }, - // { - // AdditionalProperties: map[string]any{ - // "name": "scrsave.scr", - // "directory": "c:\\users\\contosoUser", - // }, - // Type: to.Ptr("file"), - // }, - // { - // AdditionalProperties: map[string]any{ - // "commandLine": "c:\\users\\contosoUser\\scrsave.scr", - // "creationTimeUtc": "2018-05-07T13:51:45.0045913Z", - // "processId": "0x4aec", - // }, - // Type: to.Ptr("process"), - // }}, - // ExtendedLinks: []map[string]*string{ - // map[string]*string{ - // "Category": to.Ptr("threat_reports"), - // "Href": to.Ptr("https://contoso.com/reports/DisplayReport"), - // "Label": to.Ptr("Report: RDP Brute Forcing"), - // "Type": to.Ptr("webLink"), - // }}, - // ExtendedProperties: map[string]*string{ - // "account logon id": to.Ptr("0x61450d87"), - // "command line": to.Ptr("c:\\users\\contosoUser\\scrsave.scr"), - // "domain name": to.Ptr("vm2"), - // "parent process": to.Ptr("cmd.exe"), - // "parent process id": to.Ptr("0x3c44"), - // "process id": to.Ptr("0x4aec"), - // "process name": to.Ptr("c:\\users\\contosoUser\\scrsave.scr"), - // "resourceType": to.Ptr("Virtual Machine"), - // "user SID": to.Ptr("S-1-5-21-2144575486-8928446540-5163864319-500"), - // "user name": to.Ptr("vm2\\contosoUser"), - // }, - // Intent: to.Ptr(armsecurity.IntentExecution), - // IsIncident: to.Ptr(true), - // ProcessingEndTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-07T13:51:48.981Z"); return t}()), - // ProductComponentName: to.Ptr("testName2"), - // ProductName: to.Ptr("Azure Security Center"), - // RemediationSteps: []*string{ - // to.Ptr("1. Run Process Explorer and try to identify unknown running processes (see https://technet.microsoft.com/en-us/sysinternals/bb896653.aspx)"), - // to.Ptr("2. Make sure the machine is completely updated and has an updated anti-malware application installed"), - // to.Ptr("3. Run a full anti-malware scan and verify that the threat was removed"), - // to.Ptr("4. Install and run Microsoft’s Malicious Software Removal Tool (see https://www.microsoft.com/en-us/download/malicious-software-removal-tool-details.aspx)"), - // to.Ptr("5. Run Microsoft’s Autoruns utility and try to identify unknown applications that are configured to run at login (see https://technet.microsoft.com/en-us/sysinternals/bb963902.aspx)"), - // to.Ptr("6. Escalate the alert to the information security team")}, - // ResourceIdentifiers: []armsecurity.ResourceIdentifierClassification{ - // &armsecurity.AzureResourceIdentifier{ - // Type: to.Ptr(armsecurity.ResourceIdentifierTypeAzureResource), - // AzureResourceID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1"), - // }, - // &armsecurity.LogAnalyticsIdentifier{ - // Type: to.Ptr(armsecurity.ResourceIdentifierTypeLogAnalytics), - // AgentID: to.Ptr("75724a01-f021-4aa8-9ec2-329792373e6e"), - // WorkspaceID: to.Ptr("f419f624-acad-4d89-b86d-f62fa387f019"), - // WorkspaceResourceGroup: to.Ptr("myRg1"), - // WorkspaceSubscriptionID: to.Ptr("20ff7fc3-e762-44dd-bd96-b71116dcdc23"), - // }}, - // Severity: to.Ptr(armsecurity.AlertSeverityMedium), - // StartTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-07T13:51:45.004Z"); return t}()), - // Status: to.Ptr(armsecurity.AlertStatusActive), - // SubTechniques: []*string{ - // to.Ptr("T1059.001"), - // to.Ptr("T1059.006"), - // to.Ptr("T1053.002")}, - // SupportingEvidence: &armsecurity.AlertPropertiesSupportingEvidence{ - // AdditionalProperties: map[string]any{ - // "supportingEvidenceList": []any{ - // map[string]any{ - // "type": "nestedList", - // "evidenceElements":[]any{ - // map[string]any{ - // "type": "evidenceElement", - // "innerElements": nil, - // "text":map[string]any{ - // "arguments":map[string]any{ - // "domainName":map[string]any{ - // "type": "string", - // "value": "domainName", - // }, - // "sensitiveEnumerationTypes":map[string]any{ - // "type": "string[]", - // "value":[]any{ - // "UseDesKey", - // }, - // }, - // }, - // "fallback": "Actor enumerated UseDesKey on domain1.test.local", - // "localizationKey": "AATP_ALERTS_LDAP_SENSITIVE_ATTRIBUTE_RECONNAISSANCE_SECURITY_ALERT_EVIDENCE_ENUMERATION_DETAIL_A7C00BD7", - // }, - // }, - // }, - // }, - // map[string]any{ - // "type": "tabularEvidences", - // "columns":[]any{ - // "Date", - // "Activity", - // "User", - // "TestedText", - // "TestedValue", - // }, - // "rows":[]any{ - // []any{ - // "2022-01-17T07:03:52.034Z", - // "Log on", - // "testUser", - // "false", - // false, - // }, - // []any{ - // "2022-01-17T07:03:52.034Z", - // "Log on", - // "testUser2", - // "false", - // false, - // }, - // []any{ - // "2022-01-17T07:03:52.034Z", - // "Log on", - // "testUser3", - // "true", - // true, - // }, - // }, - // "title": "Investigate activity test", - // }, - // }, - // }, - // Type: to.Ptr("supportingEvidenceList"), - // }, - // SystemAlertID: to.Ptr("2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a"), - // Techniques: []*string{ - // to.Ptr("T1059"), - // to.Ptr("T1053"), - // to.Ptr("T1072")}, - // TimeGeneratedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-07T13:51:48.381Z"); return t}()), - // VendorName: to.Ptr("Microsoft"), - // Version: to.Ptr("2022-01-01"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/GetAlertsResourceGroup_example.json -func ExampleAlertsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAlertsClient().NewListByResourceGroupPager("myRg1", 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.AlertList = armsecurity.AlertList{ - // Value: []*armsecurity.Alert{ - // { - // Name: to.Ptr("2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a"), - // Type: to.Ptr("Microsoft.Security/Locations/alerts"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Security/locations/westeurope/alerts/2518770965529163669_F144EE95-A3E5-42DA-A279-967D115809AA"), - // Properties: &armsecurity.AlertProperties{ - // Description: to.Ptr("This is a test alert generated by Azure Security Center. No further action is needed."), - // AlertDisplayName: to.Ptr("Azure Security Center test alert (not a threat)"), - // AlertType: to.Ptr("VM_EICAR"), - // AlertURI: to.Ptr("https://portal.azure.com/#blade/Microsoft_Azure_Security/AlertBlade/alertId/2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a/subscriptionId/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroup/myRg1/referencedFrom/alertDeepLink/location/westeurope"), - // CompromisedEntity: to.Ptr("vm1"), - // CorrelationKey: to.Ptr("kso0LFWxzCll5tqrk5hmrBJ+MY1BX806W6q6+0s9Lk="), - // EndTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-22T00:00:00.000Z"); return t}()), - // Entities: []*armsecurity.AlertEntity{ - // { - // AdditionalProperties: map[string]any{ - // "address": "192.0.2.1", - // "location": map[string]any{ - // "asn": float64(6584), - // "city": "sonning", - // "countryCode": "gb", - // "latitude": float64(51.468), - // "longitude": float64(-0.909), - // "state": "wokingham", - // }, - // }, - // Type: to.Ptr("ip"), - // }}, - // ExtendedLinks: []map[string]*string{ - // map[string]*string{ - // "Category": to.Ptr("threat_reports"), - // "Href": to.Ptr("https://contoso.com/reports/DisplayReport"), - // "Label": to.Ptr("Report: RDP Brute Forcing"), - // "Type": to.Ptr("webLink"), - // }}, - // ExtendedProperties: map[string]*string{ - // "Property1": to.Ptr("Property1 information"), - // }, - // Intent: to.Ptr(armsecurity.IntentExecution), - // IsIncident: to.Ptr(true), - // ProcessingEndTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-23T13:47:58.920Z"); return t}()), - // ProductComponentName: to.Ptr("testName"), - // ProductName: to.Ptr("Azure Security Center"), - // RemediationSteps: []*string{ - // to.Ptr("No further action is needed.")}, - // ResourceIdentifiers: []armsecurity.ResourceIdentifierClassification{ - // &armsecurity.AzureResourceIdentifier{ - // Type: to.Ptr(armsecurity.ResourceIdentifierTypeAzureResource), - // AzureResourceID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1"), - // }, - // &armsecurity.LogAnalyticsIdentifier{ - // Type: to.Ptr(armsecurity.ResourceIdentifierTypeLogAnalytics), - // AgentID: to.Ptr("75724a01-f021-4aa8-9ec2-329792373e6e"), - // WorkspaceID: to.Ptr("f419f624-acad-4d89-b86d-f62fa387f019"), - // WorkspaceResourceGroup: to.Ptr("myRg1"), - // WorkspaceSubscriptionID: to.Ptr("20ff7fc3-e762-44dd-bd96-b71116dcdc23"), - // }}, - // Severity: to.Ptr(armsecurity.AlertSeverityHigh), - // StartTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-22T00:00:00.000Z"); return t}()), - // Status: to.Ptr(armsecurity.AlertStatusActive), - // SubTechniques: []*string{ - // to.Ptr("T1059.001"), - // to.Ptr("T1059.006"), - // to.Ptr("T1053.002")}, - // SupportingEvidence: &armsecurity.AlertPropertiesSupportingEvidence{ - // AdditionalProperties: map[string]any{ - // "supportingEvidenceList": []any{ - // map[string]any{ - // "type": "nestedList", - // "evidenceElements":[]any{ - // map[string]any{ - // "type": "evidenceElement", - // "innerElements": nil, - // "text":map[string]any{ - // "arguments":map[string]any{ - // "domainName":map[string]any{ - // "type": "string", - // "value": "domainName", - // }, - // "sensitiveEnumerationTypes":map[string]any{ - // "type": "string[]", - // "value":[]any{ - // "UseDesKey", - // }, - // }, - // }, - // "fallback": "Actor enumerated UseDesKey on domain1.test.local", - // "localizationKey": "AATP_ALERTS_LDAP_SENSITIVE_ATTRIBUTE_RECONNAISSANCE_SECURITY_ALERT_EVIDENCE_ENUMERATION_DETAIL_A7C00BD7", - // }, - // }, - // }, - // }, - // map[string]any{ - // "type": "tabularEvidences", - // "columns":[]any{ - // "Date", - // "Activity", - // "User", - // "TestedText", - // "TestedValue", - // }, - // "rows":[]any{ - // []any{ - // "2022-01-17T07:03:52.034Z", - // "Log on", - // "testUser", - // "false", - // false, - // }, - // []any{ - // "2022-01-17T07:03:52.034Z", - // "Log on", - // "testUser2", - // "false", - // false, - // }, - // []any{ - // "2022-01-17T07:03:52.034Z", - // "Log on", - // "testUser3", - // "true", - // true, - // }, - // }, - // "title": "Investigate activity test", - // }, - // }, - // }, - // Type: to.Ptr("supportingEvidenceList"), - // }, - // SystemAlertID: to.Ptr("2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a"), - // Techniques: []*string{ - // to.Ptr("T1059"), - // to.Ptr("T1053"), - // to.Ptr("T1072")}, - // TimeGeneratedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-23T13:47:58.000Z"); return t}()), - // VendorName: to.Ptr("Microsoft"), - // Version: to.Ptr("2022-01-01"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/GetAlertsSubscriptionsLocation_example.json -func ExampleAlertsClient_NewListSubscriptionLevelByRegionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAlertsClient().NewListSubscriptionLevelByRegionPager("westeurope", 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.AlertList = armsecurity.AlertList{ - // Value: []*armsecurity.Alert{ - // { - // Name: to.Ptr("2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a"), - // Type: to.Ptr("Microsoft.Security/Locations/alerts"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Security/locations/westeurope/alerts/2518770965529163669_F144EE95-A3E5-42DA-A279-967D115809AA"), - // Properties: &armsecurity.AlertProperties{ - // Description: to.Ptr("This is a test alert generated by Azure Security Center. No further action is needed."), - // AlertDisplayName: to.Ptr("Azure Security Center test alert (not a threat)"), - // AlertType: to.Ptr("VM_EICAR"), - // AlertURI: to.Ptr("https://portal.azure.com/#blade/Microsoft_Azure_Security/AlertBlade/alertId/2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a/subscriptionId/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroup/myRg1/referencedFrom/alertDeepLink/location/westeurope"), - // CompromisedEntity: to.Ptr("vm1"), - // CorrelationKey: to.Ptr("kso0LFWxzCll5tqrk5hmrBJ+MY1BX806W6q6+0s9Lk="), - // EndTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-22T00:00:00.000Z"); return t}()), - // Entities: []*armsecurity.AlertEntity{ - // { - // AdditionalProperties: map[string]any{ - // "address": "192.0.2.1", - // "location": map[string]any{ - // "asn": float64(6584), - // "city": "sonning", - // "countryCode": "gb", - // "latitude": float64(51.468), - // "longitude": float64(-0.909), - // "state": "wokingham", - // }, - // }, - // Type: to.Ptr("ip"), - // }}, - // ExtendedLinks: []map[string]*string{ - // map[string]*string{ - // "Category": to.Ptr("threat_reports"), - // "Href": to.Ptr("https://contoso.com/reports/DisplayReport"), - // "Label": to.Ptr("Report: RDP Brute Forcing"), - // "Type": to.Ptr("webLink"), - // }}, - // ExtendedProperties: map[string]*string{ - // "Property1": to.Ptr("Property1 information"), - // }, - // Intent: to.Ptr(armsecurity.IntentExecution), - // IsIncident: to.Ptr(true), - // ProcessingEndTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-23T13:47:58.920Z"); return t}()), - // ProductComponentName: to.Ptr("testName"), - // ProductName: to.Ptr("Azure Security Center"), - // RemediationSteps: []*string{ - // to.Ptr("No further action is needed.")}, - // ResourceIdentifiers: []armsecurity.ResourceIdentifierClassification{ - // &armsecurity.AzureResourceIdentifier{ - // Type: to.Ptr(armsecurity.ResourceIdentifierTypeAzureResource), - // AzureResourceID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1"), - // }, - // &armsecurity.LogAnalyticsIdentifier{ - // Type: to.Ptr(armsecurity.ResourceIdentifierTypeLogAnalytics), - // AgentID: to.Ptr("75724a01-f021-4aa8-9ec2-329792373e6e"), - // WorkspaceID: to.Ptr("f419f624-acad-4d89-b86d-f62fa387f019"), - // WorkspaceResourceGroup: to.Ptr("myRg1"), - // WorkspaceSubscriptionID: to.Ptr("20ff7fc3-e762-44dd-bd96-b71116dcdc23"), - // }}, - // Severity: to.Ptr(armsecurity.AlertSeverityHigh), - // StartTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-22T00:00:00.000Z"); return t}()), - // Status: to.Ptr(armsecurity.AlertStatusActive), - // SubTechniques: []*string{ - // to.Ptr("T1059.001"), - // to.Ptr("T1059.006"), - // to.Ptr("T1053.002")}, - // SupportingEvidence: &armsecurity.AlertPropertiesSupportingEvidence{ - // AdditionalProperties: map[string]any{ - // "columns": []any{ - // "Date", - // "Activity", - // "User", - // "TestedText", - // "TestedValue", - // }, - // "rows": []any{ - // []any{ - // "2022-01-17T07:03:52.034Z", - // "Log on", - // "testUser", - // "false", - // false, - // }, - // []any{ - // "2022-01-17T07:03:52.034Z", - // "Log on", - // "testUser2", - // "false", - // false, - // }, - // []any{ - // "2022-01-17T07:03:52.034Z", - // "Log on", - // "testUser3", - // "true", - // true, - // }, - // }, - // "title": "Investigate activity test", - // }, - // Type: to.Ptr("tabularEvidences"), - // }, - // SystemAlertID: to.Ptr("2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a"), - // Techniques: []*string{ - // to.Ptr("T1059"), - // to.Ptr("T1053"), - // to.Ptr("T1072")}, - // TimeGeneratedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-23T13:47:58.000Z"); return t}()), - // VendorName: to.Ptr("Microsoft"), - // Version: to.Ptr("2022-01-01"), - // }, - // }, - // { - // Name: to.Ptr("2518765996949954086_2325cf9e-42a2-4f72-ae7f-9b863cba2d22"), - // Type: to.Ptr("Microsoft.Security/Locations/alerts"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg2/providers/Microsoft.Security/locations/westeurope/alerts/2518765996949954086_2325cf9e-42a2-4f72-ae7f-9b863cba2d22"), - // Properties: &armsecurity.AlertProperties{ - // Description: to.Ptr("The process ‘c:\\users\\contosoUser\\scrsave.scr’ was observed executing from an uncommon location. Files with the .scr extensions are screen saver files and are normally reside and execute from the Windows system directory."), - // AlertDisplayName: to.Ptr("Suspicious Screensaver process executed"), - // AlertType: to.Ptr("VM_SuspiciousScreenSaver"), - // AlertURI: to.Ptr("https://portal.azure.com/#blade/Microsoft_Azure_Security/AlertBlade/alertId/2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a/subscriptionId/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroup/myRg1/referencedFrom/alertDeepLink/location/westeurope"), - // CompromisedEntity: to.Ptr("vm2"), - // CorrelationKey: to.Ptr("4hno6LF0xzCl5tqrk4nrBW+MY1BX816W6q6+0srk4"), - // EndTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-07T13:51:45.004Z"); return t}()), - // Entities: []*armsecurity.AlertEntity{ - // { - // AdditionalProperties: map[string]any{ - // "OsVersion": nil, - // "azureID": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/myRg2/providers/microsoft.compute/virtualmachines/vm2", - // "dnsDomain": "", - // "hostName": "vm2", - // "netBiosName": "vm2", - // "ntDomain": "", - // "omsAgentID": "45b44640-3b94-4892-a28c-4a5cae27065a", - // "operatingSystem": "Unknown", - // }, - // Type: to.Ptr("host"), - // }, - // { - // AdditionalProperties: map[string]any{ - // "name": "contosoUser", - // "logonId": "0x61450d87", - // "ntDomain": "vm2", - // "sid": "S-1-5-21-2144575486-8928446540-5163864319-500", - // }, - // Type: to.Ptr("account"), - // }, - // { - // AdditionalProperties: map[string]any{ - // "name": "cmd.exe", - // "directory": "c:\\windows\\system32", - // }, - // Type: to.Ptr("file"), - // }, - // { - // AdditionalProperties: map[string]any{ - // "processId": "0x3c44", - // }, - // Type: to.Ptr("process"), - // }, - // { - // AdditionalProperties: map[string]any{ - // "name": "scrsave.scr", - // "directory": "c:\\users\\contosoUser", - // }, - // Type: to.Ptr("file"), - // }, - // { - // AdditionalProperties: map[string]any{ - // "commandLine": "c:\\users\\contosoUser\\scrsave.scr", - // "creationTimeUtc": "2018-05-07T13:51:45.0045913Z", - // "processId": "0x4aec", - // }, - // Type: to.Ptr("process"), - // }}, - // ExtendedLinks: []map[string]*string{ - // map[string]*string{ - // "Category": to.Ptr("threat_reports"), - // "Href": to.Ptr("https://contoso.com/reports/DisplayReport"), - // "Label": to.Ptr("Report: RDP Brute Forcing"), - // "Type": to.Ptr("webLink"), - // }}, - // ExtendedProperties: map[string]*string{ - // "account logon id": to.Ptr("0x61450d87"), - // "command line": to.Ptr("c:\\users\\contosoUser\\scrsave.scr"), - // "domainName": to.Ptr("vm2"), - // "parent process": to.Ptr("cmd.exe"), - // "parent process id": to.Ptr("0x3c44"), - // "process id": to.Ptr("0x4aec"), - // "processName": to.Ptr("c:\\users\\contosoUser\\scrsave.scr"), - // "resourceType": to.Ptr("Virtual Machine"), - // "user SID": to.Ptr("S-1-5-21-2144575486-8928446540-5163864319-500"), - // "userName": to.Ptr("vm2\\contosoUser"), - // }, - // Intent: to.Ptr(armsecurity.IntentExecution), - // IsIncident: to.Ptr(true), - // ProcessingEndTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-07T13:51:48.981Z"); return t}()), - // ProductComponentName: to.Ptr("testName2"), - // ProductName: to.Ptr("Azure Security Center"), - // RemediationSteps: []*string{ - // to.Ptr("1. Run Process Explorer and try to identify unknown running processes (see https://technet.microsoft.com/en-us/sysinternals/bb896653.aspx)"), - // to.Ptr("2. Make sure the machine is completely updated and has an updated anti-malware application installed"), - // to.Ptr("3. Run a full anti-malware scan and verify that the threat was removed"), - // to.Ptr("4. Install and run Microsoft’s Malicious Software Removal Tool (see https://www.microsoft.com/en-us/download/malicious-software-removal-tool-details.aspx)"), - // to.Ptr("5. Run Microsoft’s Autoruns utility and try to identify unknown applications that are configured to run at login (see https://technet.microsoft.com/en-us/sysinternals/bb963902.aspx)"), - // to.Ptr("6. Escalate the alert to the information security team")}, - // ResourceIdentifiers: []armsecurity.ResourceIdentifierClassification{ - // &armsecurity.AzureResourceIdentifier{ - // Type: to.Ptr(armsecurity.ResourceIdentifierTypeAzureResource), - // AzureResourceID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1"), - // }, - // &armsecurity.LogAnalyticsIdentifier{ - // Type: to.Ptr(armsecurity.ResourceIdentifierTypeLogAnalytics), - // AgentID: to.Ptr("75724a01-f021-4aa8-9ec2-329792373e6e"), - // WorkspaceID: to.Ptr("f419f624-acad-4d89-b86d-f62fa387f019"), - // WorkspaceResourceGroup: to.Ptr("myRg1"), - // WorkspaceSubscriptionID: to.Ptr("20ff7fc3-e762-44dd-bd96-b71116dcdc23"), - // }}, - // Severity: to.Ptr(armsecurity.AlertSeverityMedium), - // StartTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-07T13:51:45.004Z"); return t}()), - // Status: to.Ptr(armsecurity.AlertStatusActive), - // SubTechniques: []*string{ - // to.Ptr("T1059.001"), - // to.Ptr("T1059.006"), - // to.Ptr("T1053.002")}, - // SupportingEvidence: &armsecurity.AlertPropertiesSupportingEvidence{ - // AdditionalProperties: map[string]any{ - // "supportingEvidenceList": []any{ - // map[string]any{ - // "type": "nestedList", - // "evidenceElements":[]any{ - // map[string]any{ - // "type": "evidenceElement", - // "innerElements": nil, - // "text":map[string]any{ - // "arguments":map[string]any{ - // "domainName":map[string]any{ - // "type": "string", - // "value": "domainName", - // }, - // "sensitiveEnumerationTypes":map[string]any{ - // "type": "string[]", - // "value":[]any{ - // "UseDesKey", - // }, - // }, - // }, - // "fallback": "Actor enumerated UseDesKey on domain1.test.local", - // "localizationKey": "AATP_ALERTS_LDAP_SENSITIVE_ATTRIBUTE_RECONNAISSANCE_SECURITY_ALERT_EVIDENCE_ENUMERATION_DETAIL_A7C00BD7", - // }, - // }, - // }, - // }, - // map[string]any{ - // "type": "tabularEvidences", - // "columns":[]any{ - // "Date", - // "Activity", - // "User", - // "TestedText", - // "TestedValue", - // }, - // "rows":[]any{ - // []any{ - // "2022-01-17T07:03:52.034Z", - // "Log on", - // "testUser", - // "false", - // false, - // }, - // []any{ - // "2022-01-17T07:03:52.034Z", - // "Log on", - // "testUser2", - // "false", - // false, - // }, - // []any{ - // "2022-01-17T07:03:52.034Z", - // "Log on", - // "testUser3", - // "true", - // true, - // }, - // }, - // "title": "Investigate activity test", - // }, - // }, - // }, - // Type: to.Ptr("supportingEvidenceList"), - // }, - // SystemAlertID: to.Ptr("2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a"), - // Techniques: []*string{ - // to.Ptr("T1059"), - // to.Ptr("T1053"), - // to.Ptr("T1072")}, - // TimeGeneratedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-07T13:51:48.381Z"); return t}()), - // VendorName: to.Ptr("Microsoft"), - // Version: to.Ptr("2022-01-01"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/GetAlertsResourceGroupLocation_example.json -func ExampleAlertsClient_NewListResourceGroupLevelByRegionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAlertsClient().NewListResourceGroupLevelByRegionPager("westeurope", "myRg1", 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.AlertList = armsecurity.AlertList{ - // Value: []*armsecurity.Alert{ - // { - // Name: to.Ptr("2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a"), - // Type: to.Ptr("Microsoft.Security/Locations/alerts"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Security/locations/westeurope/alerts/2518770965529163669_F144EE95-A3E5-42DA-A279-967D115809AA"), - // Properties: &armsecurity.AlertProperties{ - // Description: to.Ptr("This is a test alert generated by Azure Security Center. No further action is needed."), - // AlertDisplayName: to.Ptr("Azure Security Center test alert (not a threat)"), - // AlertType: to.Ptr("VM_EICAR"), - // AlertURI: to.Ptr("https://portal.azure.com/#blade/Microsoft_Azure_Security/AlertBlade/alertId/2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a/subscriptionId/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroup/myRg1/referencedFrom/alertDeepLink/location/westeurope"), - // CompromisedEntity: to.Ptr("vm1"), - // CorrelationKey: to.Ptr("kso0LFWxzCll5tqrk5hmrBJ+MY1BX806W6q6+0s9Lk="), - // EndTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-22T00:00:00.000Z"); return t}()), - // Entities: []*armsecurity.AlertEntity{ - // { - // AdditionalProperties: map[string]any{ - // "address": "192.0.2.1", - // "location": map[string]any{ - // "asn": float64(6584), - // "city": "sonning", - // "countryCode": "gb", - // "latitude": float64(51.468), - // "longitude": float64(-0.909), - // "state": "wokingham", - // }, - // }, - // Type: to.Ptr("ip"), - // }}, - // ExtendedLinks: []map[string]*string{ - // map[string]*string{ - // "Category": to.Ptr("threat_reports"), - // "Href": to.Ptr("https://contoso.com/reports/DisplayReport"), - // "Label": to.Ptr("Report: RDP Brute Forcing"), - // "Type": to.Ptr("webLink"), - // }}, - // ExtendedProperties: map[string]*string{ - // "Property1": to.Ptr("Property1 information"), - // }, - // Intent: to.Ptr(armsecurity.IntentExecution), - // IsIncident: to.Ptr(true), - // ProcessingEndTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-23T13:47:58.920Z"); return t}()), - // ProductComponentName: to.Ptr("testName"), - // ProductName: to.Ptr("Azure Security Center"), - // RemediationSteps: []*string{ - // to.Ptr("No further action is needed.")}, - // ResourceIdentifiers: []armsecurity.ResourceIdentifierClassification{ - // &armsecurity.AzureResourceIdentifier{ - // Type: to.Ptr(armsecurity.ResourceIdentifierTypeAzureResource), - // AzureResourceID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1"), - // }, - // &armsecurity.LogAnalyticsIdentifier{ - // Type: to.Ptr(armsecurity.ResourceIdentifierTypeLogAnalytics), - // AgentID: to.Ptr("75724a01-f021-4aa8-9ec2-329792373e6e"), - // WorkspaceID: to.Ptr("f419f624-acad-4d89-b86d-f62fa387f019"), - // WorkspaceResourceGroup: to.Ptr("myRg1"), - // WorkspaceSubscriptionID: to.Ptr("20ff7fc3-e762-44dd-bd96-b71116dcdc23"), - // }}, - // Severity: to.Ptr(armsecurity.AlertSeverityHigh), - // StartTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-22T00:00:00.000Z"); return t}()), - // Status: to.Ptr(armsecurity.AlertStatusActive), - // SubTechniques: []*string{ - // to.Ptr("T1059.001"), - // to.Ptr("T1059.006"), - // to.Ptr("T1053.002")}, - // SupportingEvidence: &armsecurity.AlertPropertiesSupportingEvidence{ - // AdditionalProperties: map[string]any{ - // "supportingEvidenceList": []any{ - // map[string]any{ - // "type": "nestedList", - // "evidenceElements":[]any{ - // map[string]any{ - // "type": "evidenceElement", - // "innerElements": nil, - // "text":map[string]any{ - // "arguments":map[string]any{ - // "domainName":map[string]any{ - // "type": "string", - // "value": "domainName", - // }, - // "sensitiveEnumerationTypes":map[string]any{ - // "type": "string[]", - // "value":[]any{ - // "UseDesKey", - // }, - // }, - // }, - // "fallback": "Actor enumerated UseDesKey on domain1.test.local", - // "localizationKey": "AATP_ALERTS_LDAP_SENSITIVE_ATTRIBUTE_RECONNAISSANCE_SECURITY_ALERT_EVIDENCE_ENUMERATION_DETAIL_A7C00BD7", - // }, - // }, - // }, - // }, - // map[string]any{ - // "type": "tabularEvidences", - // "columns":[]any{ - // "Date", - // "Activity", - // "User", - // "TestedText", - // "TestedValue", - // }, - // "rows":[]any{ - // []any{ - // "2022-01-17T07:03:52.034Z", - // "Log on", - // "testUser", - // "false", - // false, - // }, - // []any{ - // "2022-01-17T07:03:52.034Z", - // "Log on", - // "testUser2", - // "false", - // false, - // }, - // []any{ - // "2022-01-17T07:03:52.034Z", - // "Log on", - // "testUser3", - // "true", - // true, - // }, - // }, - // "title": "Investigate activity test", - // }, - // }, - // }, - // Type: to.Ptr("supportingEvidenceList"), - // }, - // SystemAlertID: to.Ptr("2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a"), - // Techniques: []*string{ - // to.Ptr("T1059"), - // to.Ptr("T1053"), - // to.Ptr("T1072")}, - // TimeGeneratedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-23T13:47:58.000Z"); return t}()), - // VendorName: to.Ptr("Microsoft"), - // Version: to.Ptr("2022-01-01"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/GetAlertSubscriptionLocation_example.json -func ExampleAlertsClient_GetSubscriptionLevel() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertsClient().GetSubscriptionLevel(ctx, "westeurope", "2518770965529163669_F144EE95-A3E5-42DA-A279-967D115809AA", 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.Alert = armsecurity.Alert{ - // Name: to.Ptr("2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a"), - // Type: to.Ptr("Microsoft.Security/Locations/alerts"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Security/locations/westeurope/alerts/2518770965529163669_F144EE95-A3E5-42DA-A279-967D115809AA"), - // Properties: &armsecurity.AlertProperties{ - // Description: to.Ptr("This is a test alert generated by Azure Security Center. No further action is needed."), - // AlertDisplayName: to.Ptr("Azure Security Center test alert (not a threat)"), - // AlertType: to.Ptr("VM_EICAR"), - // AlertURI: to.Ptr("https://portal.azure.com/#blade/Microsoft_Azure_Security/AlertBlade/alertId/2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a/subscriptionId/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroup/myRg1/referencedFrom/alertDeepLink/location/westeurope"), - // CompromisedEntity: to.Ptr("vm1"), - // CorrelationKey: to.Ptr("kso0LFWxzCll5tqrk5hmrBJ+MY1BX806W6q6+0s9Lk="), - // EndTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-22T00:00:00.000Z"); return t}()), - // Entities: []*armsecurity.AlertEntity{ - // { - // AdditionalProperties: map[string]any{ - // "address": "192.0.2.1", - // "location": map[string]any{ - // "asn": float64(6584), - // "city": "sonning", - // "countryCode": "gb", - // "latitude": float64(51.468), - // "longitude": float64(-0.909), - // "state": "wokingham", - // }, - // }, - // Type: to.Ptr("ip"), - // }}, - // ExtendedLinks: []map[string]*string{ - // map[string]*string{ - // "Category": to.Ptr("threat_reports"), - // "Href": to.Ptr("https://contoso.com/reports/DisplayReport"), - // "Label": to.Ptr("Report: RDP Brute Forcing"), - // "Type": to.Ptr("webLink"), - // }}, - // ExtendedProperties: map[string]*string{ - // "Property1": to.Ptr("Property1 information"), - // }, - // Intent: to.Ptr(armsecurity.IntentExecution), - // IsIncident: to.Ptr(true), - // ProcessingEndTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-23T13:47:58.920Z"); return t}()), - // ProductComponentName: to.Ptr("testName"), - // ProductName: to.Ptr("Azure Security Center"), - // RemediationSteps: []*string{ - // to.Ptr("No further action is needed.")}, - // ResourceIdentifiers: []armsecurity.ResourceIdentifierClassification{ - // &armsecurity.AzureResourceIdentifier{ - // Type: to.Ptr(armsecurity.ResourceIdentifierTypeAzureResource), - // AzureResourceID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1"), - // }, - // &armsecurity.LogAnalyticsIdentifier{ - // Type: to.Ptr(armsecurity.ResourceIdentifierTypeLogAnalytics), - // AgentID: to.Ptr("75724a01-f021-4aa8-9ec2-329792373e6e"), - // WorkspaceID: to.Ptr("f419f624-acad-4d89-b86d-f62fa387f019"), - // WorkspaceResourceGroup: to.Ptr("myRg1"), - // WorkspaceSubscriptionID: to.Ptr("20ff7fc3-e762-44dd-bd96-b71116dcdc23"), - // }}, - // Severity: to.Ptr(armsecurity.AlertSeverityHigh), - // StartTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-22T00:00:00.000Z"); return t}()), - // Status: to.Ptr(armsecurity.AlertStatusActive), - // SubTechniques: []*string{ - // to.Ptr("T1059.001"), - // to.Ptr("T1059.006"), - // to.Ptr("T1053.002")}, - // SupportingEvidence: &armsecurity.AlertPropertiesSupportingEvidence{ - // AdditionalProperties: map[string]any{ - // "columns": []any{ - // "Date", - // "Activity", - // "User", - // "TestedText", - // "TestedValue", - // }, - // "rows": []any{ - // []any{ - // "2022-01-17T07:03:52.034Z", - // "Log on", - // "testUser", - // "false", - // false, - // }, - // []any{ - // "2022-01-17T07:03:52.034Z", - // "Log on", - // "testUser2", - // "false", - // false, - // }, - // []any{ - // "2022-01-17T07:03:52.034Z", - // "Log on", - // "testUser3", - // "true", - // true, - // }, - // }, - // "title": "Investigate activity test", - // }, - // Type: to.Ptr("tabularEvidences"), - // }, - // SystemAlertID: to.Ptr("2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a"), - // Techniques: []*string{ - // to.Ptr("T1059"), - // to.Ptr("T1053"), - // to.Ptr("T1072")}, - // TimeGeneratedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-23T13:47:58.000Z"); return t}()), - // VendorName: to.Ptr("Microsoft"), - // Version: to.Ptr("2022-01-01"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/GetAlertResourceGroupLocation_example.json -func ExampleAlertsClient_GetResourceGroupLevel() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertsClient().GetResourceGroupLevel(ctx, "myRg1", "westeurope", "2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a", 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.Alert = armsecurity.Alert{ - // Name: to.Ptr("2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a"), - // Type: to.Ptr("Microsoft.Security/Locations/alerts"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Security/locations/westeurope/alerts/2518770965529163669_F144EE95-A3E5-42DA-A279-967D115809AA"), - // Properties: &armsecurity.AlertProperties{ - // Description: to.Ptr("This is a test alert generated by Azure Security Center. No further action is needed."), - // AlertDisplayName: to.Ptr("Azure Security Center test alert (not a threat)"), - // AlertType: to.Ptr("VM_EICAR"), - // AlertURI: to.Ptr("https://portal.azure.com/#blade/Microsoft_Azure_Security/AlertBlade/alertId/2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a/subscriptionId/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroup/myRg1/referencedFrom/alertDeepLink/location/westeurope"), - // CompromisedEntity: to.Ptr("vm1"), - // CorrelationKey: to.Ptr("kso0LFWxzCll5tqrk5hmrBJ+MY1BX806W6q6+0s9Lk="), - // EndTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-22T00:00:00.000Z"); return t}()), - // Entities: []*armsecurity.AlertEntity{ - // { - // AdditionalProperties: map[string]any{ - // "address": "192.0.2.1", - // "location": map[string]any{ - // "asn": float64(6584), - // "city": "sonning", - // "countryCode": "gb", - // "latitude": float64(51.468), - // "longitude": float64(-0.909), - // "state": "wokingham", - // }, - // }, - // Type: to.Ptr("ip"), - // }}, - // ExtendedLinks: []map[string]*string{ - // map[string]*string{ - // "Category": to.Ptr("threat_reports"), - // "Href": to.Ptr("https://contoso.com/reports/DisplayReport"), - // "Label": to.Ptr("Report: RDP Brute Forcing"), - // "Type": to.Ptr("webLink"), - // }}, - // ExtendedProperties: map[string]*string{ - // "Property1": to.Ptr("Property1 information"), - // }, - // Intent: to.Ptr(armsecurity.IntentExecution), - // IsIncident: to.Ptr(true), - // ProcessingEndTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-23T13:47:58.920Z"); return t}()), - // ProductComponentName: to.Ptr("testName"), - // ProductName: to.Ptr("Azure Security Center"), - // RemediationSteps: []*string{ - // to.Ptr("No further action is needed.")}, - // ResourceIdentifiers: []armsecurity.ResourceIdentifierClassification{ - // &armsecurity.AzureResourceIdentifier{ - // Type: to.Ptr(armsecurity.ResourceIdentifierTypeAzureResource), - // AzureResourceID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1"), - // }, - // &armsecurity.LogAnalyticsIdentifier{ - // Type: to.Ptr(armsecurity.ResourceIdentifierTypeLogAnalytics), - // AgentID: to.Ptr("75724a01-f021-4aa8-9ec2-329792373e6e"), - // WorkspaceID: to.Ptr("f419f624-acad-4d89-b86d-f62fa387f019"), - // WorkspaceResourceGroup: to.Ptr("myRg1"), - // WorkspaceSubscriptionID: to.Ptr("20ff7fc3-e762-44dd-bd96-b71116dcdc23"), - // }}, - // Severity: to.Ptr(armsecurity.AlertSeverityHigh), - // StartTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-22T00:00:00.000Z"); return t}()), - // Status: to.Ptr(armsecurity.AlertStatusActive), - // SubTechniques: []*string{ - // to.Ptr("T1059.001"), - // to.Ptr("T1059.006"), - // to.Ptr("T1053.002")}, - // SupportingEvidence: &armsecurity.AlertPropertiesSupportingEvidence{ - // AdditionalProperties: map[string]any{ - // "supportingEvidenceList": []any{ - // map[string]any{ - // "type": "nestedList", - // "evidenceElements":[]any{ - // map[string]any{ - // "type": "evidenceElement", - // "innerElements": nil, - // "text":map[string]any{ - // "arguments":map[string]any{ - // "domainName":map[string]any{ - // "type": "string", - // "value": "domainName", - // }, - // "sensitiveEnumerationTypes":map[string]any{ - // "type": "string[]", - // "value":[]any{ - // "UseDesKey", - // }, - // }, - // }, - // "fallback": "Actor enumerated UseDesKey on domain1.test.local", - // "localizationKey": "AATP_ALERTS_LDAP_SENSITIVE_ATTRIBUTE_RECONNAISSANCE_SECURITY_ALERT_EVIDENCE_ENUMERATION_DETAIL_A7C00BD7", - // }, - // }, - // }, - // }, - // map[string]any{ - // "type": "tabularEvidences", - // "columns":[]any{ - // "Date", - // "Activity", - // "User", - // "TestedText", - // "TestedValue", - // }, - // "rows":[]any{ - // []any{ - // "2022-01-17T07:03:52.034Z", - // "Log on", - // "testUser", - // "false", - // false, - // }, - // []any{ - // "2022-01-17T07:03:52.034Z", - // "Log on", - // "testUser2", - // "false", - // false, - // }, - // []any{ - // "2022-01-17T07:03:52.034Z", - // "Log on", - // "testUser3", - // "true", - // true, - // }, - // }, - // "title": "Investigate activity test", - // }, - // }, - // }, - // Type: to.Ptr("supportingEvidenceList"), - // }, - // SystemAlertID: to.Ptr("2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a"), - // Techniques: []*string{ - // to.Ptr("T1059"), - // to.Ptr("T1053"), - // to.Ptr("T1072")}, - // TimeGeneratedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-23T13:47:58.000Z"); return t}()), - // VendorName: to.Ptr("Microsoft"), - // Version: to.Ptr("2022-01-01"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/UpdateAlertSubscriptionLocation_dismiss_example.json -func ExampleAlertsClient_UpdateSubscriptionLevelStateToDismiss() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAlertsClient().UpdateSubscriptionLevelStateToDismiss(ctx, "westeurope", "2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/UpdateAlertSubscriptionLocation_resolve_example.json -func ExampleAlertsClient_UpdateSubscriptionLevelStateToResolve() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAlertsClient().UpdateSubscriptionLevelStateToResolve(ctx, "westeurope", "2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/UpdateAlertSubscriptionLocation_activate_example.json -func ExampleAlertsClient_UpdateSubscriptionLevelStateToActivate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAlertsClient().UpdateSubscriptionLevelStateToActivate(ctx, "westeurope", "2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/UpdateAlertSubscriptionLocation_inProgress_example.json -func ExampleAlertsClient_UpdateSubscriptionLevelStateToInProgress() { - 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.NewAlertsClient().UpdateSubscriptionLevelStateToInProgress(ctx, "westeurope", "2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/UpdateAlertResourceGroupLocation_resolve_example.json -func ExampleAlertsClient_UpdateResourceGroupLevelStateToResolve() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAlertsClient().UpdateResourceGroupLevelStateToResolve(ctx, "myRg2", "westeurope", "2518765996949954086_2325cf9e-42a2-4f72-ae7f-9b863cba2d22", 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/stable/2022-01-01/examples/Alerts/UpdateAlertResourceGroupLocation_dismiss_example.json -func ExampleAlertsClient_UpdateResourceGroupLevelStateToDismiss() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAlertsClient().UpdateResourceGroupLevelStateToDismiss(ctx, "myRg2", "westeurope", "2518765996949954086_2325cf9e-42a2-4f72-ae7f-9b863cba2d22", 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/stable/2022-01-01/examples/Alerts/UpdateAlertResourceGroupLocation_activate_example.json -func ExampleAlertsClient_UpdateResourceGroupLevelStateToActivate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAlertsClient().UpdateResourceGroupLevelStateToActivate(ctx, "myRg2", "westeurope", "2518765996949954086_2325cf9e-42a2-4f72-ae7f-9b863cba2d22", 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/stable/2022-01-01/examples/Alerts/UpdateAlertResourceGroupLocation_inProgress_example.json -func ExampleAlertsClient_UpdateResourceGroupLevelStateToInProgress() { - 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.NewAlertsClient().UpdateResourceGroupLevelStateToInProgress(ctx, "myRg2", "westeurope", "2518765996949954086_2325cf9e-42a2-4f72-ae7f-9b863cba2d22", 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/stable/2022-01-01/examples/Alerts/SimulateAlerts_example.json -func ExampleAlertsClient_BeginSimulate() { - 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.NewAlertsClient().BeginSimulate(ctx, "centralus", armsecurity.AlertSimulatorRequestBody{ - Properties: &armsecurity.AlertSimulatorBundlesRequestProperties{ - Kind: to.Ptr(armsecurity.KindBundles), - Bundles: []*armsecurity.BundleType{ - to.Ptr(armsecurity.BundleTypeAppServices), - to.Ptr(armsecurity.BundleTypeDNS), - to.Ptr(armsecurity.BundleTypeKeyVaults), - to.Ptr(armsecurity.BundleTypeKubernetesService), - to.Ptr(armsecurity.BundleTypeResourceManager), - to.Ptr(armsecurity.BundleTypeSQLServers), - to.Ptr(armsecurity.BundleTypeStorageAccounts), - to.Ptr(armsecurity.BundleTypeVirtualMachines), - to.Ptr(armsecurity.BundleTypeCosmosDbs)}, - }, - }, 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/alertssuppressionrules_client.go b/sdk/resourcemanager/security/armsecurity/alertssuppressionrules_client.go deleted file mode 100644 index 478faa61daa1..000000000000 --- a/sdk/resourcemanager/security/armsecurity/alertssuppressionrules_client.go +++ /dev/null @@ -1,276 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// AlertsSuppressionRulesClient contains the methods for the AlertsSuppressionRules group. -// Don't use this type directly, use NewAlertsSuppressionRulesClient() instead. -type AlertsSuppressionRulesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewAlertsSuppressionRulesClient creates a new instance of AlertsSuppressionRulesClient 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 NewAlertsSuppressionRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertsSuppressionRulesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &AlertsSuppressionRulesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Delete - Delete dismiss alert rule for this subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-01-01-preview -// - alertsSuppressionRuleName - The unique name of the suppression alert rule -// - options - AlertsSuppressionRulesClientDeleteOptions contains the optional parameters for the AlertsSuppressionRulesClient.Delete -// method. -func (client *AlertsSuppressionRulesClient) Delete(ctx context.Context, alertsSuppressionRuleName string, options *AlertsSuppressionRulesClientDeleteOptions) (AlertsSuppressionRulesClientDeleteResponse, error) { - var err error - const operationName = "AlertsSuppressionRulesClient.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, alertsSuppressionRuleName, options) - if err != nil { - return AlertsSuppressionRulesClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AlertsSuppressionRulesClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return AlertsSuppressionRulesClientDeleteResponse{}, err - } - return AlertsSuppressionRulesClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *AlertsSuppressionRulesClient) deleteCreateRequest(ctx context.Context, alertsSuppressionRuleName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if alertsSuppressionRuleName == "" { - return nil, errors.New("parameter alertsSuppressionRuleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{alertsSuppressionRuleName}", url.PathEscape(alertsSuppressionRuleName)) - 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", "2019-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-01-01-preview -// - alertsSuppressionRuleName - The unique name of the suppression alert rule -// - options - AlertsSuppressionRulesClientGetOptions contains the optional parameters for the AlertsSuppressionRulesClient.Get -// method. -func (client *AlertsSuppressionRulesClient) Get(ctx context.Context, alertsSuppressionRuleName string, options *AlertsSuppressionRulesClientGetOptions) (AlertsSuppressionRulesClientGetResponse, error) { - var err error - const operationName = "AlertsSuppressionRulesClient.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, alertsSuppressionRuleName, options) - if err != nil { - return AlertsSuppressionRulesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AlertsSuppressionRulesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AlertsSuppressionRulesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *AlertsSuppressionRulesClient) getCreateRequest(ctx context.Context, alertsSuppressionRuleName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if alertsSuppressionRuleName == "" { - return nil, errors.New("parameter alertsSuppressionRuleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{alertsSuppressionRuleName}", url.PathEscape(alertsSuppressionRuleName)) - 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", "2019-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 *AlertsSuppressionRulesClient) getHandleResponse(resp *http.Response) (AlertsSuppressionRulesClientGetResponse, error) { - result := AlertsSuppressionRulesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AlertsSuppressionRule); err != nil { - return AlertsSuppressionRulesClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - List of all the dismiss rules for the given subscription -// -// Generated from API version 2019-01-01-preview -// - options - AlertsSuppressionRulesClientListOptions contains the optional parameters for the AlertsSuppressionRulesClient.NewListPager -// method. -func (client *AlertsSuppressionRulesClient) NewListPager(options *AlertsSuppressionRulesClientListOptions) *runtime.Pager[AlertsSuppressionRulesClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[AlertsSuppressionRulesClientListResponse]{ - More: func(page AlertsSuppressionRulesClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *AlertsSuppressionRulesClientListResponse) (AlertsSuppressionRulesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AlertsSuppressionRulesClient.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 AlertsSuppressionRulesClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *AlertsSuppressionRulesClient) listCreateRequest(ctx context.Context, options *AlertsSuppressionRulesClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules" - 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() - if options != nil && options.AlertType != nil { - reqQP.Set("AlertType", *options.AlertType) - } - reqQP.Set("api-version", "2019-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 *AlertsSuppressionRulesClient) listHandleResponse(resp *http.Response) (AlertsSuppressionRulesClientListResponse, error) { - result := AlertsSuppressionRulesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AlertsSuppressionRulesList); err != nil { - return AlertsSuppressionRulesClientListResponse{}, err - } - return result, nil -} - -// Update - Update existing rule or create new rule if it doesn't exist -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-01-01-preview -// - alertsSuppressionRuleName - The unique name of the suppression alert rule -// - alertsSuppressionRule - Suppression rule object -// - options - AlertsSuppressionRulesClientUpdateOptions contains the optional parameters for the AlertsSuppressionRulesClient.Update -// method. -func (client *AlertsSuppressionRulesClient) Update(ctx context.Context, alertsSuppressionRuleName string, alertsSuppressionRule AlertsSuppressionRule, options *AlertsSuppressionRulesClientUpdateOptions) (AlertsSuppressionRulesClientUpdateResponse, error) { - var err error - const operationName = "AlertsSuppressionRulesClient.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, alertsSuppressionRuleName, alertsSuppressionRule, options) - if err != nil { - return AlertsSuppressionRulesClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AlertsSuppressionRulesClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AlertsSuppressionRulesClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *AlertsSuppressionRulesClient) updateCreateRequest(ctx context.Context, alertsSuppressionRuleName string, alertsSuppressionRule AlertsSuppressionRule, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if alertsSuppressionRuleName == "" { - return nil, errors.New("parameter alertsSuppressionRuleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{alertsSuppressionRuleName}", url.PathEscape(alertsSuppressionRuleName)) - 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", "2019-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, alertsSuppressionRule); err != nil { - return nil, err - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *AlertsSuppressionRulesClient) updateHandleResponse(resp *http.Response) (AlertsSuppressionRulesClientUpdateResponse, error) { - result := AlertsSuppressionRulesClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AlertsSuppressionRule); err != nil { - return AlertsSuppressionRulesClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/alertssuppressionrules_client_example_test.go b/sdk/resourcemanager/security/armsecurity/alertssuppressionrules_client_example_test.go deleted file mode 100644 index c61df7bebd86..000000000000 --- a/sdk/resourcemanager/security/armsecurity/alertssuppressionrules_client_example_test.go +++ /dev/null @@ -1,296 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/AlertsSuppressionRules/GetAlertsSuppressionRulesWithAlertType_example.json -func ExampleAlertsSuppressionRulesClient_NewListPager_getSuppressionAlertRuleForSubscriptionFilteredByAlertType() { - 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.NewAlertsSuppressionRulesClient().NewListPager(&armsecurity.AlertsSuppressionRulesClientListOptions{AlertType: 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.AlertsSuppressionRulesList = armsecurity.AlertsSuppressionRulesList{ - // Value: []*armsecurity.AlertsSuppressionRule{ - // { - // Name: to.Ptr("dismissIpAnomalyAlerts"), - // Type: to.Ptr("Microsoft.Security/alertsSuppressionRules"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/alertsSuppressionRules/dismissIpAnomalyAlerts"), - // Properties: &armsecurity.AlertsSuppressionRuleProperties{ - // AlertType: to.Ptr("IpAnomaly"), - // Comment: to.Ptr("Test VM"), - // ExpirationDateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-01T19:50:47.083Z"); return t}()), - // LastModifiedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-31T19:50:47.083Z"); return t}()), - // Reason: to.Ptr("FalsePositive"), - // State: to.Ptr(armsecurity.RuleStateEnabled), - // SuppressionAlertsScope: &armsecurity.SuppressionAlertsScope{ - // AllOf: []*armsecurity.ScopeElement{ - // { - // AdditionalProperties: map[string]any{ - // "in": []any{ - // "104.215.95.187", - // "52.164.206.56", - // }, - // }, - // Field: to.Ptr("entities.ip.address"), - // }, - // { - // AdditionalProperties: map[string]any{ - // "contains": "POWERSHELL.EXE", - // }, - // Field: to.Ptr("entities.process.commandline"), - // }}, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/AlertsSuppressionRules/GetAlertsSuppressionRules_example.json -func ExampleAlertsSuppressionRulesClient_NewListPager_getSuppressionRulesForSubscription() { - 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.NewAlertsSuppressionRulesClient().NewListPager(&armsecurity.AlertsSuppressionRulesClientListOptions{AlertType: 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.AlertsSuppressionRulesList = armsecurity.AlertsSuppressionRulesList{ - // Value: []*armsecurity.AlertsSuppressionRule{ - // { - // Name: to.Ptr("dismissIpAnomalyAlerts"), - // Type: to.Ptr("Microsoft.Security/alertsSuppressionRules"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/alertsSuppressionRules/dismissIpAnomalyAlerts"), - // Properties: &armsecurity.AlertsSuppressionRuleProperties{ - // AlertType: to.Ptr("IpAnomaly"), - // Comment: to.Ptr("Test VM"), - // ExpirationDateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-01T19:50:47.083Z"); return t}()), - // LastModifiedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-31T19:50:47.083Z"); return t}()), - // Reason: to.Ptr("FalsePositive"), - // State: to.Ptr(armsecurity.RuleStateEnabled), - // SuppressionAlertsScope: &armsecurity.SuppressionAlertsScope{ - // AllOf: []*armsecurity.ScopeElement{ - // { - // AdditionalProperties: map[string]any{ - // "in": []any{ - // "104.215.95.187", - // "52.164.206.56", - // }, - // }, - // Field: to.Ptr("entities.ip.address"), - // }, - // { - // AdditionalProperties: map[string]any{ - // "contains": "POWERSHELL.EXE", - // }, - // Field: to.Ptr("entities.process.commandline"), - // }}, - // }, - // }, - // }, - // { - // Name: to.Ptr("dismissDataExfiltrationAnomalyAlertsOnTestVMs"), - // Type: to.Ptr("Microsoft.Security/alertsSuppressionRules"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/alertsSuppressionRules/dismissDataExfiltrationAnomalyAlertsOnTestVMs"), - // Properties: &armsecurity.AlertsSuppressionRuleProperties{ - // AlertType: to.Ptr("DataExfiltrationAnomaly"), - // ExpirationDateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-01T19:50:47.083Z"); return t}()), - // LastModifiedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-31T19:50:47.083Z"); return t}()), - // Reason: to.Ptr("FalsePositive"), - // State: to.Ptr(armsecurity.RuleStateEnabled), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/AlertsSuppressionRules/GetAlertsSuppressionRule_example.json -func ExampleAlertsSuppressionRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertsSuppressionRulesClient().Get(ctx, "dismissIpAnomalyAlerts", 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.AlertsSuppressionRule = armsecurity.AlertsSuppressionRule{ - // Name: to.Ptr("dismissIpAnomalyAlerts"), - // Type: to.Ptr("Microsoft.Security/alertsSuppressionRules"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/alertsSuppressionRules/dismissIpAnomalyAlerts"), - // Properties: &armsecurity.AlertsSuppressionRuleProperties{ - // AlertType: to.Ptr("IpAnomaly"), - // Comment: to.Ptr("Test VM"), - // ExpirationDateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-01T19:50:47.083Z"); return t}()), - // LastModifiedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-31T19:50:47.083Z"); return t}()), - // Reason: to.Ptr("FalsePositive"), - // State: to.Ptr(armsecurity.RuleStateEnabled), - // SuppressionAlertsScope: &armsecurity.SuppressionAlertsScope{ - // AllOf: []*armsecurity.ScopeElement{ - // { - // AdditionalProperties: map[string]any{ - // "in": []any{ - // "104.215.95.187", - // "52.164.206.56", - // }, - // }, - // Field: to.Ptr("entities.ip.address"), - // }, - // { - // AdditionalProperties: map[string]any{ - // "contains": "POWERSHELL.EXE", - // }, - // Field: to.Ptr("entities.process.commandline"), - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/AlertsSuppressionRules/PutAlertsSuppressionRule_example.json -func ExampleAlertsSuppressionRulesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertsSuppressionRulesClient().Update(ctx, "dismissIpAnomalyAlerts", armsecurity.AlertsSuppressionRule{ - Properties: &armsecurity.AlertsSuppressionRuleProperties{ - AlertType: to.Ptr("IpAnomaly"), - Comment: to.Ptr("Test VM"), - ExpirationDateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-01T19:50:47.083Z"); return t }()), - Reason: to.Ptr("FalsePositive"), - State: to.Ptr(armsecurity.RuleStateEnabled), - SuppressionAlertsScope: &armsecurity.SuppressionAlertsScope{ - AllOf: []*armsecurity.ScopeElement{ - { - AdditionalProperties: map[string]any{ - "in": []any{ - "104.215.95.187", - "52.164.206.56", - }, - }, - Field: to.Ptr("entities.ip.address"), - }, - { - AdditionalProperties: map[string]any{ - "contains": "POWERSHELL.EXE", - }, - Field: to.Ptr("entities.process.commandline"), - }}, - }, - }, - }, 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.AlertsSuppressionRule = armsecurity.AlertsSuppressionRule{ - // Name: to.Ptr("dismissIpAnomalyAlerts"), - // Type: to.Ptr("Microsoft.Security/alertsSuppressionRules"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/alertsSuppressionRules/dismissIpAnomalyAlerts"), - // Properties: &armsecurity.AlertsSuppressionRuleProperties{ - // AlertType: to.Ptr("IpAnomaly"), - // Comment: to.Ptr("Test VM"), - // ExpirationDateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-01T19:50:47.083Z"); return t}()), - // LastModifiedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-31T19:50:47.083Z"); return t}()), - // Reason: to.Ptr("FalsePositive"), - // State: to.Ptr(armsecurity.RuleStateEnabled), - // SuppressionAlertsScope: &armsecurity.SuppressionAlertsScope{ - // AllOf: []*armsecurity.ScopeElement{ - // { - // AdditionalProperties: map[string]any{ - // "in": []any{ - // "104.215.95.187", - // "52.164.206.56", - // }, - // }, - // Field: to.Ptr("entities.ip.address"), - // }, - // { - // AdditionalProperties: map[string]any{ - // "contains": "POWERSHELL.EXE", - // }, - // Field: to.Ptr("entities.process.commandline"), - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/AlertsSuppressionRules/DeleteAlertsSuppressionRule_example.json -func ExampleAlertsSuppressionRulesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAlertsSuppressionRulesClient().Delete(ctx, "dismissIpAnomalyAlerts", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/allowedconnections_client.go b/sdk/resourcemanager/security/armsecurity/allowedconnections_client.go deleted file mode 100644 index e8a5dfa34664..000000000000 --- a/sdk/resourcemanager/security/armsecurity/allowedconnections_client.go +++ /dev/null @@ -1,228 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// AllowedConnectionsClient contains the methods for the AllowedConnections group. -// Don't use this type directly, use NewAllowedConnectionsClient() instead. -type AllowedConnectionsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewAllowedConnectionsClient creates a new instance of AllowedConnectionsClient 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 NewAllowedConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AllowedConnectionsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &AllowedConnectionsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Gets the list of all possible traffic between resources for the subscription and location, based on connection type. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-01-01 -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - connectionType - The type of allowed connections (Internal, External) -// - options - AllowedConnectionsClientGetOptions contains the optional parameters for the AllowedConnectionsClient.Get method. -func (client *AllowedConnectionsClient) Get(ctx context.Context, resourceGroupName string, ascLocation string, connectionType ConnectionType, options *AllowedConnectionsClientGetOptions) (AllowedConnectionsClientGetResponse, error) { - var err error - const operationName = "AllowedConnectionsClient.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, ascLocation, connectionType, options) - if err != nil { - return AllowedConnectionsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AllowedConnectionsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AllowedConnectionsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *AllowedConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, connectionType ConnectionType, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ascLocation == "" { - return nil, errors.New("parameter ascLocation cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ascLocation}", url.PathEscape(ascLocation)) - if connectionType == "" { - return nil, errors.New("parameter connectionType cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{connectionType}", url.PathEscape(string(connectionType))) - 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 *AllowedConnectionsClient) getHandleResponse(resp *http.Response) (AllowedConnectionsClientGetResponse, error) { - result := AllowedConnectionsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AllowedConnectionsResource); err != nil { - return AllowedConnectionsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Gets the list of all possible traffic between resources for the subscription -// -// Generated from API version 2020-01-01 -// - options - AllowedConnectionsClientListOptions contains the optional parameters for the AllowedConnectionsClient.NewListPager -// method. -func (client *AllowedConnectionsClient) NewListPager(options *AllowedConnectionsClientListOptions) *runtime.Pager[AllowedConnectionsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[AllowedConnectionsClientListResponse]{ - More: func(page AllowedConnectionsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *AllowedConnectionsClientListResponse) (AllowedConnectionsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AllowedConnectionsClient.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 AllowedConnectionsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *AllowedConnectionsClient) listCreateRequest(ctx context.Context, options *AllowedConnectionsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/allowedConnections" - 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") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *AllowedConnectionsClient) listHandleResponse(resp *http.Response) (AllowedConnectionsClientListResponse, error) { - result := AllowedConnectionsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AllowedConnectionsList); err != nil { - return AllowedConnectionsClientListResponse{}, err - } - return result, nil -} - -// NewListByHomeRegionPager - Gets the list of all possible traffic between resources for the subscription and location. -// -// Generated from API version 2020-01-01 -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - options - AllowedConnectionsClientListByHomeRegionOptions contains the optional parameters for the AllowedConnectionsClient.NewListByHomeRegionPager -// method. -func (client *AllowedConnectionsClient) NewListByHomeRegionPager(ascLocation string, options *AllowedConnectionsClientListByHomeRegionOptions) *runtime.Pager[AllowedConnectionsClientListByHomeRegionResponse] { - return runtime.NewPager(runtime.PagingHandler[AllowedConnectionsClientListByHomeRegionResponse]{ - More: func(page AllowedConnectionsClientListByHomeRegionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *AllowedConnectionsClientListByHomeRegionResponse) (AllowedConnectionsClientListByHomeRegionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AllowedConnectionsClient.NewListByHomeRegionPager") - 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.listByHomeRegionCreateRequest(ctx, ascLocation, options) - }, nil) - if err != nil { - return AllowedConnectionsClientListByHomeRegionResponse{}, err - } - return client.listByHomeRegionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByHomeRegionCreateRequest creates the ListByHomeRegion request. -func (client *AllowedConnectionsClient) listByHomeRegionCreateRequest(ctx context.Context, ascLocation string, options *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") - } - 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)) - 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 -} - -// listByHomeRegionHandleResponse handles the ListByHomeRegion response. -func (client *AllowedConnectionsClient) listByHomeRegionHandleResponse(resp *http.Response) (AllowedConnectionsClientListByHomeRegionResponse, error) { - result := AllowedConnectionsClientListByHomeRegionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AllowedConnectionsList); err != nil { - return AllowedConnectionsClientListByHomeRegionResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/allowedconnections_client_example_test.go b/sdk/resourcemanager/security/armsecurity/allowedconnections_client_example_test.go deleted file mode 100644 index 6e42bc216fb7..000000000000 --- a/sdk/resourcemanager/security/armsecurity/allowedconnections_client_example_test.go +++ /dev/null @@ -1,235 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/AllowedConnections/GetAllowedConnectionsSubscription_example.json -func ExampleAllowedConnectionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAllowedConnectionsClient().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.AllowedConnectionsList = armsecurity.AllowedConnectionsList{ - // Value: []*armsecurity.AllowedConnectionsResource{ - // { - // Location: to.Ptr("centralus"), - // Name: to.Ptr("Internal"), - // Type: to.Ptr("Microsoft.Security/locations/allowedConnections"), - // ID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154baf/resourceGroups/myResourceGroup/providers/Microsoft.Security/locations/centralus/allowedConnections/Internal"), - // Properties: &armsecurity.AllowedConnectionsResourceProperties{ - // CalculatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-06T14:55:32.351Z"); return t}()), - // ConnectableResources: []*armsecurity.ConnectableResource{ - // { - // ID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154baf/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/virtaulMachine1"), - // InboundConnectedResources: []*armsecurity.ConnectedResource{ - // { - // ConnectedResourceID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154baf/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/virtaulMachine2"), - // TCPPorts: to.Ptr("[0-21,23-3388,3390-5984,5987-65535]"), - // UDPPorts: to.Ptr("[0-21,23-3388,3390-5984,5987-65535]"), - // }}, - // OutboundConnectedResources: []*armsecurity.ConnectedResource{ - // { - // ConnectedResourceID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154baf/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/virtaulMachine2"), - // TCPPorts: to.Ptr("[0-21,23-3388,3390-5984,5987-65535]"), - // UDPPorts: to.Ptr("[0-21,23-3388,3390-5984,5987-65535]"), - // }}, - // }, - // { - // ID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154baf/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/virtaulMachine2"), - // InboundConnectedResources: []*armsecurity.ConnectedResource{ - // { - // ConnectedResourceID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154baf/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/virtaulMachine1"), - // TCPPorts: to.Ptr("[0-21,23-3388,3390-5984,5987-65535]"), - // UDPPorts: to.Ptr("[0-21,23-3388,3390-5984,5987-65535]"), - // }}, - // OutboundConnectedResources: []*armsecurity.ConnectedResource{ - // { - // ConnectedResourceID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154baf/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/virtaulMachine1"), - // TCPPorts: to.Ptr("[0-21,23-3388,3390-5984,5987-65535]"), - // UDPPorts: to.Ptr("[0-21,23-3388,3390-5984,5987-65535]"), - // }}, - // }, - // { - // ID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154baf/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/virtaulMachine3"), - // InboundConnectedResources: []*armsecurity.ConnectedResource{ - // }, - // OutboundConnectedResources: []*armsecurity.ConnectedResource{ - // }, - // }}, - // }, - // }}, - // } - } -} - -// 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/AllowedConnections/GetAllowedConnectionsSubscriptionLocation_example.json -func ExampleAllowedConnectionsClient_NewListByHomeRegionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAllowedConnectionsClient().NewListByHomeRegionPager("centralus", 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.AllowedConnectionsList = armsecurity.AllowedConnectionsList{ - // Value: []*armsecurity.AllowedConnectionsResource{ - // { - // Location: to.Ptr("centralus"), - // Name: to.Ptr("Internal"), - // Type: to.Ptr("Microsoft.Security/locations/allowedConnections"), - // ID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154baf/resourceGroups/myResourceGroup/providers/Microsoft.Security/locations/centralus/allowedConnections/Internal"), - // Properties: &armsecurity.AllowedConnectionsResourceProperties{ - // CalculatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-06T14:55:32.351Z"); return t}()), - // ConnectableResources: []*armsecurity.ConnectableResource{ - // { - // ID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154baf/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/virtaulMachine1"), - // InboundConnectedResources: []*armsecurity.ConnectedResource{ - // { - // ConnectedResourceID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154baf/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/virtaulMachine2"), - // TCPPorts: to.Ptr("[0-21,23-3388,3390-5984,5987-65535]"), - // UDPPorts: to.Ptr("[0-21,23-3388,3390-5984,5987-65535]"), - // }}, - // OutboundConnectedResources: []*armsecurity.ConnectedResource{ - // { - // ConnectedResourceID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154baf/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/virtaulMachine2"), - // TCPPorts: to.Ptr("[0-21,23-3388,3390-5984,5987-65535]"), - // UDPPorts: to.Ptr("[0-21,23-3388,3390-5984,5987-65535]"), - // }}, - // }, - // { - // ID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154baf/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/virtaulMachine2"), - // InboundConnectedResources: []*armsecurity.ConnectedResource{ - // { - // ConnectedResourceID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154baf/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/virtaulMachine1"), - // TCPPorts: to.Ptr("[0-21,23-3388,3390-5984,5987-65535]"), - // UDPPorts: to.Ptr("[0-21,23-3388,3390-5984,5987-65535]"), - // }}, - // OutboundConnectedResources: []*armsecurity.ConnectedResource{ - // { - // ConnectedResourceID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154baf/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/virtaulMachine1"), - // TCPPorts: to.Ptr("[0-21,23-3388,3390-5984,5987-65535]"), - // UDPPorts: to.Ptr("[0-21,23-3388,3390-5984,5987-65535]"), - // }}, - // }, - // { - // ID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154baf/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/virtaulMachine3"), - // InboundConnectedResources: []*armsecurity.ConnectedResource{ - // }, - // OutboundConnectedResources: []*armsecurity.ConnectedResource{ - // }, - // }}, - // }, - // }}, - // } - } -} - -// 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/AllowedConnections/GetAllowedConnections_example.json -func ExampleAllowedConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAllowedConnectionsClient().Get(ctx, "myResourceGroup", "centralus", armsecurity.ConnectionTypeInternal, 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.AllowedConnectionsResource = armsecurity.AllowedConnectionsResource{ - // Location: to.Ptr("centralus"), - // Name: to.Ptr("Internal"), - // Type: to.Ptr("Microsoft.Security/locations/allowedConnections"), - // ID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154baf/resourceGroups/myResourceGroup/providers/Microsoft.Security/locations/centralus/allowedConnections/Internal"), - // Properties: &armsecurity.AllowedConnectionsResourceProperties{ - // CalculatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-06T14:55:32.351Z"); return t}()), - // ConnectableResources: []*armsecurity.ConnectableResource{ - // { - // ID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154baf/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/virtaulMachine1"), - // InboundConnectedResources: []*armsecurity.ConnectedResource{ - // { - // ConnectedResourceID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154baf/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/virtaulMachine2"), - // TCPPorts: to.Ptr("[0-21,23-3388,3390-5984,5987-65535]"), - // UDPPorts: to.Ptr("[0-21,23-3388,3390-5984,5987-65535]"), - // }}, - // OutboundConnectedResources: []*armsecurity.ConnectedResource{ - // { - // ConnectedResourceID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154baf/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/virtaulMachine2"), - // TCPPorts: to.Ptr("[0-21,23-3388,3390-5984,5987-65535]"), - // UDPPorts: to.Ptr("[0-21,23-3388,3390-5984,5987-65535]"), - // }}, - // }, - // { - // ID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154baf/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/virtaulMachine2"), - // InboundConnectedResources: []*armsecurity.ConnectedResource{ - // { - // ConnectedResourceID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154baf/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/virtaulMachine1"), - // TCPPorts: to.Ptr("[0-21,23-3388,3390-5984,5987-65535]"), - // UDPPorts: to.Ptr("[0-21,23-3388,3390-5984,5987-65535]"), - // }}, - // OutboundConnectedResources: []*armsecurity.ConnectedResource{ - // { - // ConnectedResourceID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154baf/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/virtaulMachine1"), - // TCPPorts: to.Ptr("[0-21,23-3388,3390-5984,5987-65535]"), - // UDPPorts: to.Ptr("[0-21,23-3388,3390-5984,5987-65535]"), - // }}, - // }, - // { - // ID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154baf/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/virtaulMachine3"), - // InboundConnectedResources: []*armsecurity.ConnectedResource{ - // }, - // OutboundConnectedResources: []*armsecurity.ConnectedResource{ - // }, - // }}, - // }, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/apicollections_client.go b/sdk/resourcemanager/security/armsecurity/apicollections_client.go deleted file mode 100644 index dc063450326f..000000000000 --- a/sdk/resourcemanager/security/armsecurity/apicollections_client.go +++ /dev/null @@ -1,451 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// APICollectionsClient contains the methods for the APICollections group. -// Don't use this type directly, use NewAPICollectionsClient() instead. -type APICollectionsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewAPICollectionsClient creates a new instance of APICollectionsClient 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 NewAPICollectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*APICollectionsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &APICollectionsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - 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. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-11-15 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - serviceName - The name of the API Management service. -// - apiID - API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n -// as a suffix where n is the revision number. -// - options - APICollectionsClientGetByAzureAPIManagementServiceOptions contains the optional parameters for the APICollectionsClient.GetByAzureAPIManagementService -// method. -func (client *APICollectionsClient) GetByAzureAPIManagementService(ctx context.Context, resourceGroupName string, serviceName string, apiID string, options *APICollectionsClientGetByAzureAPIManagementServiceOptions) (APICollectionsClientGetByAzureAPIManagementServiceResponse, error) { - var err error - const operationName = "APICollectionsClient.GetByAzureAPIManagementService" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getByAzureAPIManagementServiceCreateRequest(ctx, resourceGroupName, serviceName, apiID, options) - if err != nil { - return APICollectionsClientGetByAzureAPIManagementServiceResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return APICollectionsClientGetByAzureAPIManagementServiceResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return APICollectionsClientGetByAzureAPIManagementServiceResponse{}, err - } - resp, err := client.getByAzureAPIManagementServiceHandleResponse(httpResp) - return resp, err -} - -// getByAzureAPIManagementServiceCreateRequest creates the GetByAzureAPIManagementService request. -func (client *APICollectionsClient) getByAzureAPIManagementServiceCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, apiID string, options *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") - } - 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 serviceName == "" { - return nil, errors.New("parameter serviceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) - if apiID == "" { - return nil, errors.New("parameter apiID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-15") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getByAzureAPIManagementServiceHandleResponse handles the GetByAzureAPIManagementService response. -func (client *APICollectionsClient) getByAzureAPIManagementServiceHandleResponse(resp *http.Response) (APICollectionsClientGetByAzureAPIManagementServiceResponse, error) { - result := APICollectionsClientGetByAzureAPIManagementServiceResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.APICollection); err != nil { - return APICollectionsClientGetByAzureAPIManagementServiceResponse{}, err - } - 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. -// -// Generated from API version 2023-11-15 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - serviceName - The name of the API Management service. -// - options - APICollectionsClientListByAzureAPIManagementServiceOptions contains the optional parameters for the APICollectionsClient.NewListByAzureAPIManagementServicePager -// method. -func (client *APICollectionsClient) NewListByAzureAPIManagementServicePager(resourceGroupName string, serviceName string, options *APICollectionsClientListByAzureAPIManagementServiceOptions) *runtime.Pager[APICollectionsClientListByAzureAPIManagementServiceResponse] { - return runtime.NewPager(runtime.PagingHandler[APICollectionsClientListByAzureAPIManagementServiceResponse]{ - More: func(page APICollectionsClientListByAzureAPIManagementServiceResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *APICollectionsClientListByAzureAPIManagementServiceResponse) (APICollectionsClientListByAzureAPIManagementServiceResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "APICollectionsClient.NewListByAzureAPIManagementServicePager") - 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.listByAzureAPIManagementServiceCreateRequest(ctx, resourceGroupName, serviceName, options) - }, nil) - if err != nil { - return APICollectionsClientListByAzureAPIManagementServiceResponse{}, err - } - return client.listByAzureAPIManagementServiceHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByAzureAPIManagementServiceCreateRequest creates the ListByAzureAPIManagementService request. -func (client *APICollectionsClient) listByAzureAPIManagementServiceCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, options *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") - } - 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 serviceName == "" { - return nil, errors.New("parameter serviceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-15") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByAzureAPIManagementServiceHandleResponse handles the ListByAzureAPIManagementService response. -func (client *APICollectionsClient) listByAzureAPIManagementServiceHandleResponse(resp *http.Response) (APICollectionsClientListByAzureAPIManagementServiceResponse, error) { - result := APICollectionsClientListByAzureAPIManagementServiceResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.APICollectionList); err != nil { - return APICollectionsClientListByAzureAPIManagementServiceResponse{}, err - } - return result, nil -} - -// NewListByResourceGroupPager - 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. -// - options - APICollectionsClientListByResourceGroupOptions contains the optional parameters for the APICollectionsClient.NewListByResourceGroupPager -// method. -func (client *APICollectionsClient) NewListByResourceGroupPager(resourceGroupName string, options *APICollectionsClientListByResourceGroupOptions) *runtime.Pager[APICollectionsClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[APICollectionsClientListByResourceGroupResponse]{ - More: func(page APICollectionsClientListByResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *APICollectionsClientListByResourceGroupResponse) (APICollectionsClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "APICollectionsClient.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 APICollectionsClientListByResourceGroupResponse{}, err - } - return client.listByResourceGroupHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *APICollectionsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *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") - } - 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", "2023-11-15") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *APICollectionsClient) listByResourceGroupHandleResponse(resp *http.Response) (APICollectionsClientListByResourceGroupResponse, error) { - result := APICollectionsClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.APICollectionList); err != nil { - return APICollectionsClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionPager - 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 -// method. -func (client *APICollectionsClient) NewListBySubscriptionPager(options *APICollectionsClientListBySubscriptionOptions) *runtime.Pager[APICollectionsClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[APICollectionsClientListBySubscriptionResponse]{ - More: func(page APICollectionsClientListBySubscriptionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *APICollectionsClientListBySubscriptionResponse) (APICollectionsClientListBySubscriptionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "APICollectionsClient.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 APICollectionsClientListBySubscriptionResponse{}, err - } - return client.listBySubscriptionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *APICollectionsClient) listBySubscriptionCreateRequest(ctx context.Context, options *APICollectionsClientListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/apiCollections" - 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", "2023-11-15") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *APICollectionsClient) listBySubscriptionHandleResponse(resp *http.Response) (APICollectionsClientListBySubscriptionResponse, error) { - result := APICollectionsClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.APICollectionList); err != nil { - return APICollectionsClientListBySubscriptionResponse{}, err - } - 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. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-11-15 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - serviceName - The name of the API Management service. -// - apiID - API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n -// as a suffix where n is the revision number. -// - options - APICollectionsClientOffboardAzureAPIManagementAPIOptions contains the optional parameters for the APICollectionsClient.OffboardAzureAPIManagementAPI -// method. -func (client *APICollectionsClient) OffboardAzureAPIManagementAPI(ctx context.Context, resourceGroupName string, serviceName string, apiID string, options *APICollectionsClientOffboardAzureAPIManagementAPIOptions) (APICollectionsClientOffboardAzureAPIManagementAPIResponse, error) { - var err error - const operationName = "APICollectionsClient.OffboardAzureAPIManagementAPI" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.offboardAzureAPIManagementAPICreateRequest(ctx, resourceGroupName, serviceName, apiID, options) - if err != nil { - return APICollectionsClientOffboardAzureAPIManagementAPIResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return APICollectionsClientOffboardAzureAPIManagementAPIResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return APICollectionsClientOffboardAzureAPIManagementAPIResponse{}, err - } - return APICollectionsClientOffboardAzureAPIManagementAPIResponse{}, nil -} - -// offboardAzureAPIManagementAPICreateRequest creates the OffboardAzureAPIManagementAPI request. -func (client *APICollectionsClient) offboardAzureAPIManagementAPICreateRequest(ctx context.Context, resourceGroupName string, serviceName string, apiID string, options *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") - } - 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 serviceName == "" { - return nil, errors.New("parameter serviceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) - if apiID == "" { - return nil, errors.New("parameter apiID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-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. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-11-15 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - serviceName - The name of the API Management service. -// - apiID - API revision identifier. Must be unique in the API Management service instance. Non-current revision has ;rev=n -// as a suffix where n is the revision number. -// - options - APICollectionsClientBeginOnboardAzureAPIManagementAPIOptions contains the optional parameters for the APICollectionsClient.BeginOnboardAzureAPIManagementAPI -// method. -func (client *APICollectionsClient) BeginOnboardAzureAPIManagementAPI(ctx context.Context, resourceGroupName string, serviceName string, apiID string, options *APICollectionsClientBeginOnboardAzureAPIManagementAPIOptions) (*runtime.Poller[APICollectionsClientOnboardAzureAPIManagementAPIResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.onboardAzureAPIManagementAPI(ctx, resourceGroupName, serviceName, apiID, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[APICollectionsClientOnboardAzureAPIManagementAPIResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[APICollectionsClientOnboardAzureAPIManagementAPIResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// 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. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-11-15 -func (client *APICollectionsClient) onboardAzureAPIManagementAPI(ctx context.Context, resourceGroupName string, serviceName string, apiID string, options *APICollectionsClientBeginOnboardAzureAPIManagementAPIOptions) (*http.Response, error) { - var err error - const operationName = "APICollectionsClient.BeginOnboardAzureAPIManagementAPI" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.onboardAzureAPIManagementAPICreateRequest(ctx, resourceGroupName, serviceName, apiID, 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 -} - -// onboardAzureAPIManagementAPICreateRequest creates the OnboardAzureAPIManagementAPI request. -func (client *APICollectionsClient) onboardAzureAPIManagementAPICreateRequest(ctx context.Context, resourceGroupName string, serviceName string, apiID string, options *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") - } - 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 serviceName == "" { - return nil, errors.New("parameter serviceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) - if apiID == "" { - return nil, errors.New("parameter apiID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{apiId}", url.PathEscape(apiID)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-15") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/apicollections_client_example_test.go b/sdk/resourcemanager/security/armsecurity/apicollections_client_example_test.go deleted file mode 100644 index 62799527aeb9..000000000000 --- a/sdk/resourcemanager/security/armsecurity/apicollections_client_example_test.go +++ /dev/null @@ -1,248 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2023-11-15/examples/ApiCollections/APICollections_ListBySubscription_example.json -func ExampleAPICollectionsClient_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.NewAPICollectionsClient().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.APICollectionList = armsecurity.APICollectionList{ - // Value: []*armsecurity.APICollection{ - // { - // Name: to.Ptr("echo-api"), - // Type: to.Ptr("Microsoft.Security/apiCollections"), - // ID: to.Ptr("/subscriptions/3fa85f64-5717-4562-b3fc-2c963f66afa6/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/providers/Microsoft.Security/apiCollections/echo-api"), - // Properties: &armsecurity.APICollectionProperties{ - // BaseURL: to.Ptr("https://apimservice1.azure-api.net/echo"), - // DiscoveredVia: to.Ptr("/subscriptions/3fa85f64-5717-4562-b3fc-2c963f66afa6/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1"), - // DisplayName: to.Ptr("Echo API"), - // NumberOfAPIEndpoints: to.Ptr[int64](6), - // NumberOfAPIEndpointsWithSensitiveDataExposed: to.Ptr[int64](1), - // NumberOfExternalAPIEndpoints: to.Ptr[int64](3), - // NumberOfInactiveAPIEndpoints: to.Ptr[int64](3), - // NumberOfUnauthenticatedAPIEndpoints: to.Ptr[int64](1), - // ProvisioningState: to.Ptr(armsecurity.ProvisioningStateSucceeded), - // SensitivityLabel: to.Ptr("Highly Confidential"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2023-11-15/examples/ApiCollections/APICollections_ListByResourceGroup_example.json -func ExampleAPICollectionsClient_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.NewAPICollectionsClient().NewListByResourceGroupPager("rg1", 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.APICollectionList = armsecurity.APICollectionList{ - // Value: []*armsecurity.APICollection{ - // { - // Name: to.Ptr("echo-api"), - // Type: to.Ptr("Microsoft.Security/apiCollections"), - // ID: to.Ptr("/subscriptions/3fa85f64-5717-4562-b3fc-2c963f66afa6/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/providers/Microsoft.Security/apiCollections/echo-api"), - // Properties: &armsecurity.APICollectionProperties{ - // BaseURL: to.Ptr("https://apimservice1.azure-api.net/echo"), - // DiscoveredVia: to.Ptr("/subscriptions/3fa85f64-5717-4562-b3fc-2c963f66afa6/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1"), - // DisplayName: to.Ptr("Echo API"), - // NumberOfAPIEndpoints: to.Ptr[int64](6), - // NumberOfAPIEndpointsWithSensitiveDataExposed: to.Ptr[int64](1), - // NumberOfExternalAPIEndpoints: to.Ptr[int64](3), - // NumberOfInactiveAPIEndpoints: to.Ptr[int64](3), - // NumberOfUnauthenticatedAPIEndpoints: to.Ptr[int64](1), - // ProvisioningState: to.Ptr(armsecurity.ProvisioningStateSucceeded), - // SensitivityLabel: to.Ptr("Highly Confidential"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2023-11-15/examples/ApiCollections/APICollections_ListByAzureApiManagementService_example.json -func ExampleAPICollectionsClient_NewListByAzureAPIManagementServicePager() { - 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.NewAPICollectionsClient().NewListByAzureAPIManagementServicePager("rg1", "apimService1", 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.APICollectionList = armsecurity.APICollectionList{ - // Value: []*armsecurity.APICollection{ - // { - // Name: to.Ptr("echo-api"), - // Type: to.Ptr("Microsoft.Security/apiCollections"), - // ID: to.Ptr("/subscriptions/3fa85f64-5717-4562-b3fc-2c963f66afa6/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/providers/Microsoft.Security/apiCollections/echo-api"), - // Properties: &armsecurity.APICollectionProperties{ - // BaseURL: to.Ptr("https://apimservice1.azure-api.net/echo"), - // DiscoveredVia: to.Ptr("/subscriptions/3fa85f64-5717-4562-b3fc-2c963f66afa6/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1"), - // DisplayName: to.Ptr("Echo API"), - // NumberOfAPIEndpoints: to.Ptr[int64](6), - // NumberOfAPIEndpointsWithSensitiveDataExposed: to.Ptr[int64](1), - // NumberOfExternalAPIEndpoints: to.Ptr[int64](3), - // NumberOfInactiveAPIEndpoints: to.Ptr[int64](3), - // NumberOfUnauthenticatedAPIEndpoints: to.Ptr[int64](1), - // ProvisioningState: to.Ptr(armsecurity.ProvisioningStateSucceeded), - // SensitivityLabel: to.Ptr("Highly Confidential"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2023-11-15/examples/ApiCollections/APICollections_GetByAzureApiManagementService_example.json -func ExampleAPICollectionsClient_GetByAzureAPIManagementService() { - 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.NewAPICollectionsClient().GetByAzureAPIManagementService(ctx, "rg1", "apimService1", "echo-api", 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.APICollection = armsecurity.APICollection{ - // Name: to.Ptr("echo-api"), - // Type: to.Ptr("Microsoft.Security/apiCollections"), - // ID: to.Ptr("/subscriptions/3fa85f64-5717-4562-b3fc-2c963f66afa6/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/providers/Microsoft.Security/apiCollections/echo-api"), - // Properties: &armsecurity.APICollectionProperties{ - // BaseURL: to.Ptr("https://apimservice1.azure-api.net/echo"), - // DiscoveredVia: to.Ptr("/subscriptions/3fa85f64-5717-4562-b3fc-2c963f66afa6/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1"), - // DisplayName: to.Ptr("Echo API"), - // NumberOfAPIEndpoints: to.Ptr[int64](6), - // NumberOfAPIEndpointsWithSensitiveDataExposed: to.Ptr[int64](1), - // NumberOfExternalAPIEndpoints: to.Ptr[int64](3), - // NumberOfInactiveAPIEndpoints: to.Ptr[int64](3), - // NumberOfUnauthenticatedAPIEndpoints: to.Ptr[int64](1), - // ProvisioningState: to.Ptr(armsecurity.ProvisioningStateSucceeded), - // SensitivityLabel: to.Ptr("Highly Confidential"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2023-11-15/examples/ApiCollections/APICollections_OnboardAzureApiManagementApi_example.json -func ExampleAPICollectionsClient_BeginOnboardAzureAPIManagementAPI() { - 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.NewAPICollectionsClient().BeginOnboardAzureAPIManagementAPI(ctx, "rg1", "apimService1", "echo-api", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %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.APICollection = armsecurity.APICollection{ - // Name: to.Ptr("echo-api"), - // Type: to.Ptr("Microsoft.Security/apiCollections"), - // ID: to.Ptr("/subscriptions/3fa85f64-5717-4562-b3fc-2c963f66afa6/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/providers/Microsoft.Security/apiCollections/echo-api"), - // Properties: &armsecurity.APICollectionProperties{ - // BaseURL: to.Ptr("https://apimservice1.azure-api.net/echo"), - // DiscoveredVia: to.Ptr("/subscriptions/3fa85f64-5717-4562-b3fc-2c963f66afa6/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1"), - // DisplayName: to.Ptr("Echo API"), - // NumberOfAPIEndpoints: to.Ptr[int64](6), - // NumberOfAPIEndpointsWithSensitiveDataExposed: to.Ptr[int64](1), - // NumberOfExternalAPIEndpoints: to.Ptr[int64](3), - // NumberOfInactiveAPIEndpoints: to.Ptr[int64](3), - // NumberOfUnauthenticatedAPIEndpoints: to.Ptr[int64](1), - // ProvisioningState: to.Ptr(armsecurity.ProvisioningStateSucceeded), - // SensitivityLabel: to.Ptr("Highly Confidential"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2023-11-15/examples/ApiCollections/APICollections_OffboardAzureApiManagementApi_example.json -func ExampleAPICollectionsClient_OffboardAzureAPIManagementAPI() { - 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.NewAPICollectionsClient().OffboardAzureAPIManagementAPI(ctx, "rg1", "apimService1", "echo-api", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/application_client.go b/sdk/resourcemanager/security/armsecurity/application_client.go deleted file mode 100644 index 39255287bbe5..000000000000 --- a/sdk/resourcemanager/security/armsecurity/application_client.go +++ /dev/null @@ -1,215 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// ApplicationClient contains the methods for the Application group. -// Don't use this type directly, use NewApplicationClient() instead. -type ApplicationClient struct { - internal *arm.Client - subscriptionID string -} - -// NewApplicationClient creates a new instance of ApplicationClient with the specified values. -// - subscriptionID - Azure subscription ID -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewApplicationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ApplicationClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ApplicationClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Creates or update a security application on the given subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-07-01-preview -// - applicationID - The security Application key - unique key for the standard application -// - application - Application over a subscription scope -// - options - ApplicationClientCreateOrUpdateOptions contains the optional parameters for the ApplicationClient.CreateOrUpdate -// method. -func (client *ApplicationClient) CreateOrUpdate(ctx context.Context, applicationID string, application Application, options *ApplicationClientCreateOrUpdateOptions) (ApplicationClientCreateOrUpdateResponse, error) { - var err error - const operationName = "ApplicationClient.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, applicationID, application, options) - if err != nil { - return ApplicationClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ApplicationClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return ApplicationClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ApplicationClient) createOrUpdateCreateRequest(ctx context.Context, applicationID string, application Application, options *ApplicationClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if applicationID == "" { - return nil, errors.New("parameter applicationID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{applicationId}", url.PathEscape(applicationID)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, application); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *ApplicationClient) createOrUpdateHandleResponse(resp *http.Response) (ApplicationClientCreateOrUpdateResponse, error) { - result := ApplicationClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Application); err != nil { - return ApplicationClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Delete an Application over a given scope -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-07-01-preview -// - applicationID - The security Application key - unique key for the standard application -// - options - ApplicationClientDeleteOptions contains the optional parameters for the ApplicationClient.Delete method. -func (client *ApplicationClient) Delete(ctx context.Context, applicationID string, options *ApplicationClientDeleteOptions) (ApplicationClientDeleteResponse, error) { - var err error - const operationName = "ApplicationClient.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, applicationID, options) - if err != nil { - return ApplicationClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ApplicationClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return ApplicationClientDeleteResponse{}, err - } - return ApplicationClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *ApplicationClient) deleteCreateRequest(ctx context.Context, applicationID string, options *ApplicationClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if applicationID == "" { - return nil, errors.New("parameter applicationID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{applicationId}", url.PathEscape(applicationID)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - return req, nil -} - -// Get - Get a specific application for the requested scope by applicationId -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-07-01-preview -// - applicationID - The security Application key - unique key for the standard application -// - options - ApplicationClientGetOptions contains the optional parameters for the ApplicationClient.Get method. -func (client *ApplicationClient) Get(ctx context.Context, applicationID string, options *ApplicationClientGetOptions) (ApplicationClientGetResponse, error) { - var err error - const operationName = "ApplicationClient.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, applicationID, options) - if err != nil { - return ApplicationClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ApplicationClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ApplicationClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ApplicationClient) getCreateRequest(ctx context.Context, applicationID string, options *ApplicationClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if applicationID == "" { - return nil, errors.New("parameter applicationID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{applicationId}", url.PathEscape(applicationID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ApplicationClient) getHandleResponse(resp *http.Response) (ApplicationClientGetResponse, error) { - result := ApplicationClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Application); err != nil { - return ApplicationClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/application_client_example_test.go b/sdk/resourcemanager/security/armsecurity/application_client_example_test.go deleted file mode 100644 index 4bb74e526f85..000000000000 --- a/sdk/resourcemanager/security/armsecurity/application_client_example_test.go +++ /dev/null @@ -1,132 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// 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/2022-07-01-preview/examples/Applications/GetApplication_example.json -func ExampleApplicationClient_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.NewApplicationClient().Get(ctx, "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", 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.Application = armsecurity.Application{ - // Name: to.Ptr("ad9a8e26-29d9-4829-bb30-e597a58cdbb8"), - // Type: to.Ptr("Microsoft.Security/applications"), - // ID: to.Ptr("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/applications/ad9a8e26-29d9-4829-bb30-e597a58cdbb8"), - // Properties: &armsecurity.ApplicationProperties{ - // Description: to.Ptr("An application on critical recommendations"), - // ConditionSets: []any{ - // map[string]any{ - // "conditions":[]any{ - // map[string]any{ - // "operator": "contains", - // "property": "$.Id", - // "value": "-bil-", - // }, - // }, - // }}, - // DisplayName: to.Ptr("Admin's application"), - // SourceResourceType: to.Ptr(armsecurity.ApplicationSourceResourceTypeAssessments), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/PutApplication_example.json -func ExampleApplicationClient_CreateOrUpdate() { - 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.NewApplicationClient().CreateOrUpdate(ctx, "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", armsecurity.Application{ - Properties: &armsecurity.ApplicationProperties{ - Description: to.Ptr("An application on critical recommendations"), - ConditionSets: []any{ - map[string]any{ - "conditions": []any{ - map[string]any{ - "operator": "contains", - "property": "$.Id", - "value": "-bil-", - }, - }, - }}, - DisplayName: to.Ptr("Admin's application"), - SourceResourceType: to.Ptr(armsecurity.ApplicationSourceResourceTypeAssessments), - }, - }, 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.Application = armsecurity.Application{ - // Name: to.Ptr("1f3afdf9-d0c9-4c3d-847f-89da613e70a8"), - // Type: to.Ptr("Microsoft.Security/applications"), - // ID: to.Ptr("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/applications/ad9a8e26-29d9-4829-bb30-e597a58cdbb8"), - // Properties: &armsecurity.ApplicationProperties{ - // Description: to.Ptr("An application on critical recommendations"), - // ConditionSets: []any{ - // map[string]any{ - // "conditions":[]any{ - // map[string]any{ - // "operator": "contains", - // "property": "$.Id", - // "value": "-dev-", - // }, - // }, - // }}, - // DisplayName: to.Ptr("Admin's application"), - // SourceResourceType: to.Ptr(armsecurity.ApplicationSourceResourceTypeAssessments), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/DeleteApplication_example.json -func ExampleApplicationClient_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.NewApplicationClient().Delete(ctx, "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/applications_client.go b/sdk/resourcemanager/security/armsecurity/applications_client.go deleted file mode 100644 index 73f3c8418b4d..000000000000 --- a/sdk/resourcemanager/security/armsecurity/applications_client.go +++ /dev/null @@ -1,98 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// ApplicationsClient contains the methods for the Applications group. -// Don't use this type directly, use NewApplicationsClient() instead. -type ApplicationsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewApplicationsClient creates a new instance of ApplicationsClient with the specified values. -// - subscriptionID - Azure subscription ID -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewApplicationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ApplicationsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ApplicationsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// NewListPager - Get a list of all relevant applications over a subscription level scope -// -// Generated from API version 2022-07-01-preview -// - options - ApplicationsClientListOptions contains the optional parameters for the ApplicationsClient.NewListPager method. -func (client *ApplicationsClient) NewListPager(options *ApplicationsClientListOptions) *runtime.Pager[ApplicationsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[ApplicationsClientListResponse]{ - More: func(page ApplicationsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ApplicationsClientListResponse) (ApplicationsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ApplicationsClient.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 ApplicationsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *ApplicationsClient) listCreateRequest(ctx context.Context, options *ApplicationsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *ApplicationsClient) listHandleResponse(resp *http.Response) (ApplicationsClientListResponse, error) { - result := ApplicationsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationsList); err != nil { - return ApplicationsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/applications_client_example_test.go b/sdk/resourcemanager/security/armsecurity/applications_client_example_test.go deleted file mode 100644 index 1e76532c1ee2..000000000000 --- a/sdk/resourcemanager/security/armsecurity/applications_client_example_test.go +++ /dev/null @@ -1,86 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/ListBySubscriptionApplications_example.json -func ExampleApplicationsClient_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.NewApplicationsClient().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.ApplicationsList = armsecurity.ApplicationsList{ - // Value: []*armsecurity.Application{ - // { - // Name: to.Ptr("ad9a8e26-29d9-4829-bb30-e597a58cdbb8"), - // Type: to.Ptr("Microsoft.Security/applications"), - // ID: to.Ptr("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/applications/ad9a8e26-29d9-4829-bb30-e597a58cdbb8"), - // Properties: &armsecurity.ApplicationProperties{ - // Description: to.Ptr("An application on critical recommendations"), - // ConditionSets: []any{ - // map[string]any{ - // "conditions":[]any{ - // map[string]any{ - // "operator": "contains", - // "property": "$.Id", - // "value": "-bil-", - // }, - // }, - // }}, - // DisplayName: to.Ptr("Admin's application"), - // SourceResourceType: to.Ptr(armsecurity.ApplicationSourceResourceTypeAssessments), - // }, - // }, - // { - // Name: to.Ptr("4106f43c-6d82-4fc8-a92c-dcfe50799d1d"), - // Type: to.Ptr("Microsoft.Security/applications"), - // ID: to.Ptr("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/applications/4106f43c-6d82-4fc8-a92c-dcfe50799d1d"), - // Properties: &armsecurity.ApplicationProperties{ - // Description: to.Ptr("An application on critical recommendations"), - // ConditionSets: []any{ - // map[string]any{ - // "conditions":[]any{ - // map[string]any{ - // "operator": "contains", - // "property": "$.Id", - // "value": "-prod-", - // }, - // }, - // }}, - // DisplayName: to.Ptr("Admin's application"), - // SourceResourceType: to.Ptr(armsecurity.ApplicationSourceResourceTypeAssessments), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/security/armsecurity/assessments_client.go b/sdk/resourcemanager/security/armsecurity/assessments_client.go deleted file mode 100644 index 740ee2b00d1e..000000000000 --- a/sdk/resourcemanager/security/armsecurity/assessments_client.go +++ /dev/null @@ -1,265 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// AssessmentsClient contains the methods for the Assessments group. -// Don't use this type directly, use NewAssessmentsClient() instead. -type AssessmentsClient struct { - internal *arm.Client -} - -// 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. -func NewAssessmentsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AssessmentsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &AssessmentsClient{ - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Create a security assessment on your resource. An assessment metadata that describes this assessment must -// 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. -// - 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 -// method. -func (client *AssessmentsClient) CreateOrUpdate(ctx context.Context, resourceID string, assessmentName string, assessment Assessment, options *AssessmentsClientCreateOrUpdateOptions) (AssessmentsClientCreateOrUpdateResponse, error) { - var err error - const operationName = "AssessmentsClient.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, assessmentName, assessment, options) - if err != nil { - return AssessmentsClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AssessmentsClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return AssessmentsClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *AssessmentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceID string, assessmentName string, assessment Assessment, options *AssessmentsClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}" - urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) - if assessmentName == "" { - return nil, errors.New("parameter assessmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) - req, err := runtime.NewRequest(ctx, http.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") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, assessment); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *AssessmentsClient) createOrUpdateHandleResponse(resp *http.Response) (AssessmentsClientCreateOrUpdateResponse, error) { - result := AssessmentsClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AssessmentResponse); err != nil { - return AssessmentsClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Delete a security assessment on your resource. An assessment metadata that describes this assessment must 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. -// - 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) { - var err error - const operationName = "AssessmentsClient.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, assessmentName, options) - if err != nil { - return AssessmentsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AssessmentsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return AssessmentsClientDeleteResponse{}, err - } - return AssessmentsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *AssessmentsClient) deleteCreateRequest(ctx context.Context, resourceID string, assessmentName string, options *AssessmentsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}" - urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) - if assessmentName == "" { - return nil, errors.New("parameter assessmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) - req, err := runtime.NewRequest(ctx, http.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") - 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. -// - 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) { - var err error - const operationName = "AssessmentsClient.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, assessmentName, options) - if err != nil { - return AssessmentsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AssessmentsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AssessmentsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// 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}" - urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) - if assessmentName == "" { - return nil, errors.New("parameter assessmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Expand != nil { - reqQP.Set("$expand", string(*options.Expand)) - } - reqQP.Set("api-version", "2021-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *AssessmentsClient) getHandleResponse(resp *http.Response) (AssessmentsClientGetResponse, error) { - result := AssessmentsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AssessmentResponse); err != nil { - return AssessmentsClientGetResponse{}, err - } - return result, nil -} - -// 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). -// - 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]{ - More: func(page AssessmentsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *AssessmentsClientListResponse) (AssessmentsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AssessmentsClient.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 AssessmentsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *AssessmentsClient) listCreateRequest(ctx context.Context, scope string, options *AssessmentsClientListOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Security/assessments" - 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") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *AssessmentsClient) listHandleResponse(resp *http.Response) (AssessmentsClientListResponse, error) { - result := AssessmentsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AssessmentList); err != nil { - return AssessmentsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/assessments_client_example_test.go b/sdk/resourcemanager/security/armsecurity/assessments_client_example_test.go deleted file mode 100644 index 280f41610951..000000000000 --- a/sdk/resourcemanager/security/armsecurity/assessments_client_example_test.go +++ /dev/null @@ -1,234 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/2021-06-01/examples/Assessments/ListAssessments_example.json -func ExampleAssessmentsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAssessmentsClient().NewListPager("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", 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.AssessmentList = armsecurity.AssessmentList{ - // Value: []*armsecurity.AssessmentResponse{ - // { - // Name: to.Ptr("21300918-b2e3-0346-785f-c77ff57d243b"), - // Type: to.Ptr("Microsoft.Security/assessments"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/providers/Microsoft.Security/assessments/21300918-b2e3-0346-785f-c77ff57d243b"), - // Properties: &armsecurity.AssessmentPropertiesResponse{ - // DisplayName: to.Ptr("Install endpoint protection solution on virtual machine scale sets"), - // ResourceDetails: &armsecurity.AzureResourceDetails{ - // Source: to.Ptr(armsecurity.SourceAzure), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1"), - // }, - // Status: &armsecurity.AssessmentStatusResponse{ - // Code: to.Ptr(armsecurity.AssessmentStatusCodeHealthy), - // FirstEvaluationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-12T09:07:18.675Z"); return t}()), - // StatusChangeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-12T09:07:18.675Z"); return t}()), - // }, - // }, - // }, - // { - // Name: to.Ptr("21300918-b2e3-0346-785f-c77ff57d243b"), - // Type: to.Ptr("Microsoft.Security/assessments"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2/providers/Microsoft.Security/assessments/21300918-b2e3-0346-785f-c77ff57d243b"), - // Properties: &armsecurity.AssessmentPropertiesResponse{ - // AdditionalData: map[string]*string{ - // "linkedWorkspaceId": to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myLaWorkspace"), - // }, - // DisplayName: to.Ptr("Install endpoint protection solution on virtual machine scale sets"), - // ResourceDetails: &armsecurity.AzureResourceDetails{ - // Source: to.Ptr(armsecurity.SourceAzure), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2"), - // }, - // Status: &armsecurity.AssessmentStatusResponse{ - // Description: to.Ptr("The effective policy for the assessment was evaluated to off - use Microsoft.Authorization/policyAssignments to turn this assessment on"), - // Cause: to.Ptr("OffByPolicy"), - // Code: to.Ptr(armsecurity.AssessmentStatusCodeNotApplicable), - // FirstEvaluationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-12T09:07:18.675Z"); return t}()), - // StatusChangeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-12T09:07:18.675Z"); return t}()), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/Assessments/GetAssessment_example.json -func ExampleAssessmentsClient_Get_getSecurityRecommendationTaskFromSecurityDataLocation() { - 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.NewAssessmentsClient().Get(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2", "21300918-b2e3-0346-785f-c77ff57d243b", &armsecurity.AssessmentsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.AssessmentResponse = armsecurity.AssessmentResponse{ - // Name: to.Ptr("21300918-b2e3-0346-785f-c77ff57d243b"), - // Type: to.Ptr("Microsoft.Security/assessments"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2/providers/Microsoft.Security/assessments/21300918-b2e3-0346-785f-c77ff57d243b"), - // Properties: &armsecurity.AssessmentPropertiesResponse{ - // AdditionalData: map[string]*string{ - // "linkedWorkspaceId": to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myLaWorkspace"), - // }, - // DisplayName: to.Ptr("Install endpoint protection solution on virtual machine scale sets"), - // ResourceDetails: &armsecurity.AzureResourceDetails{ - // Source: to.Ptr(armsecurity.SourceAzure), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2"), - // }, - // Status: &armsecurity.AssessmentStatusResponse{ - // Description: to.Ptr("The effective policy for the assessment was evaluated to off - use Microsoft.Authorization/policyAssignments to turn this assessment on"), - // Cause: to.Ptr("OffByPolicy"), - // Code: to.Ptr(armsecurity.AssessmentStatusCodeNotApplicable), - // FirstEvaluationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-12T09:07:18.675Z"); return t}()), - // StatusChangeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-12T09:07:18.675Z"); return t}()), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/Assessments/GetAssessmentWithExpand_example.json -func ExampleAssessmentsClient_Get_getSecurityRecommendationTaskFromSecurityDataLocationWithExpandParameter() { - 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.NewAssessmentsClient().Get(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2", "21300918-b2e3-0346-785f-c77ff57d243b", &armsecurity.AssessmentsClientGetOptions{Expand: to.Ptr(armsecurity.ExpandEnumLinks)}) - 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.AssessmentResponse = armsecurity.AssessmentResponse{ - // Name: to.Ptr("21300918-b2e3-0346-785f-c77ff57d243b"), - // Type: to.Ptr("Microsoft.Security/assessments"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2/providers/Microsoft.Security/assessments/21300918-b2e3-0346-785f-c77ff57d243b"), - // Properties: &armsecurity.AssessmentPropertiesResponse{ - // AdditionalData: map[string]*string{ - // "linkedWorkspaceId": to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myLaWorkspace"), - // }, - // DisplayName: to.Ptr("Install endpoint protection solution on virtual machine scale sets"), - // Links: &armsecurity.AssessmentLinks{ - // AzurePortalURI: to.Ptr("https://www.portal.azure.com/?fea#blade/Microsoft_Azure_Security/RecommendationsBlade/assessmentKey/21300918-b2e3-0346-785f-c77ff57d243b"), - // }, - // ResourceDetails: &armsecurity.AzureResourceDetails{ - // Source: to.Ptr(armsecurity.SourceAzure), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2"), - // }, - // Status: &armsecurity.AssessmentStatusResponse{ - // Description: to.Ptr("The effective policy for the assessment was evaluated to off - use Microsoft.Authorization/policyAssignments to turn this assessment on"), - // Cause: to.Ptr("OffByPolicy"), - // Code: to.Ptr(armsecurity.AssessmentStatusCodeNotApplicable), - // FirstEvaluationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-12T09:07:18.675Z"); return t}()), - // StatusChangeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-12T09:07:18.675Z"); return t}()), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/Assessments/PutAssessment_example.json -func ExampleAssessmentsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAssessmentsClient().CreateOrUpdate(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2", "8bb8be0a-6010-4789-812f-e4d661c4ed0e", armsecurity.Assessment{ - Properties: &armsecurity.AssessmentProperties{ - ResourceDetails: &armsecurity.AzureResourceDetails{ - Source: to.Ptr(armsecurity.SourceAzure), - }, - Status: &armsecurity.AssessmentStatus{ - Code: to.Ptr(armsecurity.AssessmentStatusCodeHealthy), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.AssessmentResponse = armsecurity.AssessmentResponse{ - // Name: to.Ptr("8bb8be0a-6010-4789-812f-e4d661c4ed0e"), - // Type: to.Ptr("Microsoft.Security/assessments"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/providers/Microsoft.Security/assessments/8bb8be0a-6010-4789-812f-e4d661c4ed0e"), - // Properties: &armsecurity.AssessmentPropertiesResponse{ - // DisplayName: to.Ptr("Install internal agent on VM"), - // ResourceDetails: &armsecurity.AzureResourceDetails{ - // Source: to.Ptr(armsecurity.SourceAzure), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/providers/Microsoft.Security/assessments/8bb8be0a-6010-4789-812f-e4d661c4ed0e"), - // }, - // Status: &armsecurity.AssessmentStatusResponse{ - // Code: to.Ptr(armsecurity.AssessmentStatusCodeHealthy), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/Assessments/DeleteAssessment_example.json -func ExampleAssessmentsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAssessmentsClient().Delete(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2", "8bb8be0a-6010-4789-812f-e4d661c4ed0e", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/assessmentsmetadata_client.go b/sdk/resourcemanager/security/armsecurity/assessmentsmetadata_client.go deleted file mode 100644 index 3359687a5aac..000000000000 --- a/sdk/resourcemanager/security/armsecurity/assessmentsmetadata_client.go +++ /dev/null @@ -1,380 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// AssessmentsMetadataClient contains the methods for the AssessmentsMetadata group. -// Don't use this type directly, use NewAssessmentsMetadataClient() instead. -type AssessmentsMetadataClient struct { - internal *arm.Client - subscriptionID string -} - -// NewAssessmentsMetadataClient creates a new instance of AssessmentsMetadataClient 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 NewAssessmentsMetadataClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AssessmentsMetadataClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &AssessmentsMetadataClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// 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 -// - assessmentMetadataName - The Assessment Key - Unique key for the assessment type -// - assessmentMetadata - AssessmentMetadata object -// - options - AssessmentsMetadataClientCreateInSubscriptionOptions contains the optional parameters for the AssessmentsMetadataClient.CreateInSubscription -// method. -func (client *AssessmentsMetadataClient) CreateInSubscription(ctx context.Context, assessmentMetadataName string, assessmentMetadata AssessmentMetadataResponse, options *AssessmentsMetadataClientCreateInSubscriptionOptions) (AssessmentsMetadataClientCreateInSubscriptionResponse, error) { - var err error - const operationName = "AssessmentsMetadataClient.CreateInSubscription" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createInSubscriptionCreateRequest(ctx, assessmentMetadataName, assessmentMetadata, options) - if err != nil { - return AssessmentsMetadataClientCreateInSubscriptionResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AssessmentsMetadataClientCreateInSubscriptionResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AssessmentsMetadataClientCreateInSubscriptionResponse{}, err - } - resp, err := client.createInSubscriptionHandleResponse(httpResp) - return resp, err -} - -// createInSubscriptionCreateRequest creates the CreateInSubscription request. -func (client *AssessmentsMetadataClient) createInSubscriptionCreateRequest(ctx context.Context, assessmentMetadataName string, assessmentMetadata AssessmentMetadataResponse, options *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)) - 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") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, assessmentMetadata); err != nil { - return nil, err - } - return req, nil -} - -// createInSubscriptionHandleResponse handles the CreateInSubscription response. -func (client *AssessmentsMetadataClient) createInSubscriptionHandleResponse(resp *http.Response) (AssessmentsMetadataClientCreateInSubscriptionResponse, error) { - result := AssessmentsMetadataClientCreateInSubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AssessmentMetadataResponse); err != nil { - return AssessmentsMetadataClientCreateInSubscriptionResponse{}, err - } - return result, nil -} - -// DeleteInSubscription - Delete metadata information on an assessment type in a specific subscription, will cause the deletion -// 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 -// - assessmentMetadataName - The Assessment Key - Unique key for the assessment type -// - options - AssessmentsMetadataClientDeleteInSubscriptionOptions contains the optional parameters for the AssessmentsMetadataClient.DeleteInSubscription -// method. -func (client *AssessmentsMetadataClient) DeleteInSubscription(ctx context.Context, assessmentMetadataName string, options *AssessmentsMetadataClientDeleteInSubscriptionOptions) (AssessmentsMetadataClientDeleteInSubscriptionResponse, error) { - var err error - const operationName = "AssessmentsMetadataClient.DeleteInSubscription" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteInSubscriptionCreateRequest(ctx, assessmentMetadataName, options) - if err != nil { - return AssessmentsMetadataClientDeleteInSubscriptionResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AssessmentsMetadataClientDeleteInSubscriptionResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AssessmentsMetadataClientDeleteInSubscriptionResponse{}, err - } - return AssessmentsMetadataClientDeleteInSubscriptionResponse{}, nil -} - -// deleteInSubscriptionCreateRequest creates the DeleteInSubscription request. -func (client *AssessmentsMetadataClient) deleteInSubscriptionCreateRequest(ctx context.Context, assessmentMetadataName string, options *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)) - 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") - 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 -// - 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) { - var err error - const operationName = "AssessmentsMetadataClient.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, assessmentMetadataName, options) - if err != nil { - return AssessmentsMetadataClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AssessmentsMetadataClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AssessmentsMetadataClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *AssessmentsMetadataClient) getCreateRequest(ctx context.Context, assessmentMetadataName string, options *AssessmentsMetadataClientGetOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}" - 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") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *AssessmentsMetadataClient) getHandleResponse(resp *http.Response) (AssessmentsMetadataClientGetResponse, error) { - result := AssessmentsMetadataClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AssessmentMetadataResponse); err != nil { - return AssessmentsMetadataClientGetResponse{}, err - } - return result, nil -} - -// 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 -// - assessmentMetadataName - The Assessment Key - Unique key for the assessment type -// - options - AssessmentsMetadataClientGetInSubscriptionOptions contains the optional parameters for the AssessmentsMetadataClient.GetInSubscription -// method. -func (client *AssessmentsMetadataClient) GetInSubscription(ctx context.Context, assessmentMetadataName string, options *AssessmentsMetadataClientGetInSubscriptionOptions) (AssessmentsMetadataClientGetInSubscriptionResponse, error) { - var err error - const operationName = "AssessmentsMetadataClient.GetInSubscription" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getInSubscriptionCreateRequest(ctx, assessmentMetadataName, options) - if err != nil { - return AssessmentsMetadataClientGetInSubscriptionResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AssessmentsMetadataClientGetInSubscriptionResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AssessmentsMetadataClientGetInSubscriptionResponse{}, err - } - resp, err := client.getInSubscriptionHandleResponse(httpResp) - return resp, err -} - -// getInSubscriptionCreateRequest creates the GetInSubscription request. -func (client *AssessmentsMetadataClient) getInSubscriptionCreateRequest(ctx context.Context, assessmentMetadataName string, options *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)) - 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") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getInSubscriptionHandleResponse handles the GetInSubscription response. -func (client *AssessmentsMetadataClient) getInSubscriptionHandleResponse(resp *http.Response) (AssessmentsMetadataClientGetInSubscriptionResponse, error) { - result := AssessmentsMetadataClientGetInSubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AssessmentMetadataResponse); err != nil { - return AssessmentsMetadataClientGetInSubscriptionResponse{}, err - } - return result, nil -} - -// NewListPager - Get metadata information on all assessment types -// -// Generated from API version 2021-06-01 -// - options - AssessmentsMetadataClientListOptions contains the optional parameters for the AssessmentsMetadataClient.NewListPager -// method. -func (client *AssessmentsMetadataClient) NewListPager(options *AssessmentsMetadataClientListOptions) *runtime.Pager[AssessmentsMetadataClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[AssessmentsMetadataClientListResponse]{ - More: func(page AssessmentsMetadataClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *AssessmentsMetadataClientListResponse) (AssessmentsMetadataClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AssessmentsMetadataClient.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 AssessmentsMetadataClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *AssessmentsMetadataClient) listCreateRequest(ctx context.Context, options *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") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *AssessmentsMetadataClient) listHandleResponse(resp *http.Response) (AssessmentsMetadataClientListResponse, error) { - result := AssessmentsMetadataClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AssessmentMetadataResponseList); err != nil { - return AssessmentsMetadataClientListResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionPager - Get metadata information on all assessment types in a specific subscription -// -// Generated from API version 2021-06-01 -// - options - AssessmentsMetadataClientListBySubscriptionOptions contains the optional parameters for the AssessmentsMetadataClient.NewListBySubscriptionPager -// method. -func (client *AssessmentsMetadataClient) NewListBySubscriptionPager(options *AssessmentsMetadataClientListBySubscriptionOptions) *runtime.Pager[AssessmentsMetadataClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[AssessmentsMetadataClientListBySubscriptionResponse]{ - More: func(page AssessmentsMetadataClientListBySubscriptionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *AssessmentsMetadataClientListBySubscriptionResponse) (AssessmentsMetadataClientListBySubscriptionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AssessmentsMetadataClient.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 AssessmentsMetadataClientListBySubscriptionResponse{}, err - } - return client.listBySubscriptionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *AssessmentsMetadataClient) listBySubscriptionCreateRequest(ctx context.Context, options *AssessmentsMetadataClientListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata" - 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-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *AssessmentsMetadataClient) listBySubscriptionHandleResponse(resp *http.Response) (AssessmentsMetadataClientListBySubscriptionResponse, error) { - result := AssessmentsMetadataClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AssessmentMetadataResponseList); err != nil { - return AssessmentsMetadataClientListBySubscriptionResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/assessmentsmetadata_client_example_test.go b/sdk/resourcemanager/security/armsecurity/assessmentsmetadata_client_example_test.go deleted file mode 100644 index 652c74707a8a..000000000000 --- a/sdk/resourcemanager/security/armsecurity/assessmentsmetadata_client_example_test.go +++ /dev/null @@ -1,418 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/2021-06-01/examples/AssessmentsMetadata/ListAssessmentsMetadata_example.json -func ExampleAssessmentsMetadataClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAssessmentsMetadataClient().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.AssessmentMetadataResponseList = armsecurity.AssessmentMetadataResponseList{ - // Value: []*armsecurity.AssessmentMetadataResponse{ - // { - // Name: to.Ptr("21300918-b2e3-0346-785f-c77ff57d243b"), - // Type: to.Ptr("Microsoft.Security/assessmentMetadata"), - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/21300918-b2e3-0346-785f-c77ff57d243b"), - // Properties: &armsecurity.AssessmentMetadataPropertiesResponse{ - // Description: to.Ptr("Install an endpoint protection solution on your virtual machines scale sets, to protect them from threats and vulnerabilities."), - // AssessmentType: to.Ptr(armsecurity.AssessmentTypeBuiltIn), - // Categories: []*armsecurity.Categories{ - // to.Ptr(armsecurity.CategoriesCompute)}, - // DisplayName: to.Ptr("Install endpoint protection solution on virtual machine scale sets"), - // ImplementationEffort: to.Ptr(armsecurity.ImplementationEffortLow), - // PolicyDefinitionID: to.Ptr("/providers/Microsoft.Authorization/policyDefinitions/26a828e1-e88f-464e-bbb3-c134a282b9de"), - // RemediationDescription: to.Ptr("To install an endpoint protection solution: 1. Follow the instructions in How do I turn on antimalware in my virtual machine scale set"), - // Severity: to.Ptr(armsecurity.SeverityMedium), - // Threats: []*armsecurity.Threats{ - // to.Ptr(armsecurity.ThreatsDataExfiltration), - // to.Ptr(armsecurity.ThreatsDataSpillage), - // to.Ptr(armsecurity.ThreatsMaliciousInsider)}, - // UserImpact: to.Ptr(armsecurity.UserImpactLow), - // PlannedDeprecationDate: to.Ptr("03/2022"), - // PublishDates: &armsecurity.AssessmentMetadataPropertiesResponsePublishDates{ - // GA: to.Ptr("06/01/2021"), - // Public: to.Ptr("06/01/2021"), - // }, - // Tactics: []*armsecurity.Tactics{ - // to.Ptr(armsecurity.TacticsCredentialAccess), - // to.Ptr(armsecurity.TacticsPersistence), - // to.Ptr(armsecurity.TacticsExecution), - // to.Ptr(armsecurity.TacticsDefenseEvasion), - // to.Ptr(armsecurity.TacticsCollection), - // to.Ptr(armsecurity.TacticsDiscovery), - // to.Ptr(armsecurity.TacticsPrivilegeEscalation)}, - // Techniques: []*armsecurity.Techniques{ - // to.Ptr(armsecurity.TechniquesObfuscatedFilesOrInformation), - // to.Ptr(armsecurity.TechniquesIngressToolTransfer), - // to.Ptr(armsecurity.TechniquesPhishing), - // to.Ptr(armsecurity.TechniquesUserExecution)}, - // }, - // }, - // { - // Name: to.Ptr("bc303248-3d14-44c2-96a0-55f5c326b5fe"), - // Type: to.Ptr("Microsoft.Security/assessmentMetadata"), - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/bc303248-3d14-44c2-96a0-55f5c326b5fe"), - // Properties: &armsecurity.AssessmentMetadataPropertiesResponse{ - // Description: to.Ptr("Open remote management ports expose your VM to a high level of risk from internet-based attacks that attempt to brute force credentials to gain admin access to the machine."), - // AssessmentType: to.Ptr(armsecurity.AssessmentTypeCustomPolicy), - // Categories: []*armsecurity.Categories{ - // to.Ptr(armsecurity.CategoriesNetworking)}, - // DisplayName: to.Ptr("Close management ports on your virtual machines"), - // ImplementationEffort: to.Ptr(armsecurity.ImplementationEffortLow), - // PolicyDefinitionID: to.Ptr("/providers/Microsoft.Authorization/policyDefinitions/22730e10-96f6-4aac-ad84-9383d35b5917"), - // Preview: to.Ptr(true), - // RemediationDescription: to.Ptr("We recommend that you edit the inbound rules of the below virtual machines to restrict access to specific source ranges.
To restrict the access to your virtual machines: 1. Click on a VM from the list below 2. At the 'Networking' blade, click on each of the rules that allow management ports (e.g. RDP-3389, WINRM-5985, SSH-22) 3. Change the 'Action' property to 'Deny' 4. Click 'Save'"), - // Severity: to.Ptr(armsecurity.SeverityMedium), - // Threats: []*armsecurity.Threats{ - // to.Ptr(armsecurity.ThreatsDataExfiltration), - // to.Ptr(armsecurity.ThreatsDataSpillage), - // to.Ptr(armsecurity.ThreatsMaliciousInsider)}, - // UserImpact: to.Ptr(armsecurity.UserImpactHigh), - // PublishDates: &armsecurity.AssessmentMetadataPropertiesResponsePublishDates{ - // GA: to.Ptr("06/01/2021"), - // Public: to.Ptr("06/01/2021"), - // }, - // }, - // }, - // { - // Name: to.Ptr("ca039e75-a276-4175-aebc-bcd41e4b14b7"), - // Type: to.Ptr("Microsoft.Security/assessmentMetadata"), - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/ca039e75-a276-4175-aebc-bcd41e4b14b7"), - // Properties: &armsecurity.AssessmentMetadataPropertiesResponse{ - // Description: to.Ptr("Assessment that my organization created to view our security assessment in Azure Security Center"), - // AssessmentType: to.Ptr(armsecurity.AssessmentTypeCustomerManaged), - // Categories: []*armsecurity.Categories{ - // to.Ptr(armsecurity.CategoriesCompute)}, - // DisplayName: to.Ptr("My organization security assessment"), - // ImplementationEffort: to.Ptr(armsecurity.ImplementationEffortLow), - // RemediationDescription: to.Ptr("Fix it with these remediation instructions"), - // Severity: to.Ptr(armsecurity.SeverityMedium), - // Threats: []*armsecurity.Threats{ - // }, - // UserImpact: to.Ptr(armsecurity.UserImpactLow), - // PublishDates: &armsecurity.AssessmentMetadataPropertiesResponsePublishDates{ - // GA: to.Ptr("06/01/2021"), - // Public: to.Ptr("06/01/2021"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/GetAssessmentsMetadata_example.json -func ExampleAssessmentsMetadataClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAssessmentsMetadataClient().Get(ctx, "21300918-b2e3-0346-785f-c77ff57d243b", 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.AssessmentMetadataResponse = armsecurity.AssessmentMetadataResponse{ - // Name: to.Ptr("21300918-b2e3-0346-785f-c77ff57d243b"), - // Type: to.Ptr("Microsoft.Security/assessmentMetadata"), - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/21300918-b2e3-0346-785f-c77ff57d243b"), - // Properties: &armsecurity.AssessmentMetadataPropertiesResponse{ - // Description: to.Ptr("Install an endpoint protection solution on your virtual machines scale sets, to protect them from threats and vulnerabilities."), - // AssessmentType: to.Ptr(armsecurity.AssessmentTypeBuiltIn), - // Categories: []*armsecurity.Categories{ - // to.Ptr(armsecurity.CategoriesCompute)}, - // DisplayName: to.Ptr("Install endpoint protection solution on virtual machine scale sets"), - // ImplementationEffort: to.Ptr(armsecurity.ImplementationEffortLow), - // PolicyDefinitionID: to.Ptr("/providers/Microsoft.Authorization/policyDefinitions/26a828e1-e88f-464e-bbb3-c134a282b9de"), - // RemediationDescription: to.Ptr("To install an endpoint protection solution: 1. Follow the instructions in How do I turn on antimalware in my virtual machine scale set"), - // Severity: to.Ptr(armsecurity.SeverityMedium), - // Threats: []*armsecurity.Threats{ - // to.Ptr(armsecurity.ThreatsDataExfiltration), - // to.Ptr(armsecurity.ThreatsDataSpillage), - // to.Ptr(armsecurity.ThreatsMaliciousInsider)}, - // UserImpact: to.Ptr(armsecurity.UserImpactLow), - // PlannedDeprecationDate: to.Ptr("03/2022"), - // PublishDates: &armsecurity.AssessmentMetadataPropertiesResponsePublishDates{ - // GA: to.Ptr("06/01/2021"), - // Public: to.Ptr("06/01/2021"), - // }, - // Tactics: []*armsecurity.Tactics{ - // to.Ptr(armsecurity.TacticsCredentialAccess), - // to.Ptr(armsecurity.TacticsPersistence), - // to.Ptr(armsecurity.TacticsExecution), - // to.Ptr(armsecurity.TacticsDefenseEvasion), - // to.Ptr(armsecurity.TacticsCollection), - // to.Ptr(armsecurity.TacticsDiscovery), - // to.Ptr(armsecurity.TacticsPrivilegeEscalation)}, - // Techniques: []*armsecurity.Techniques{ - // to.Ptr(armsecurity.TechniquesObfuscatedFilesOrInformation), - // to.Ptr(armsecurity.TechniquesIngressToolTransfer), - // to.Ptr(armsecurity.TechniquesPhishing), - // to.Ptr(armsecurity.TechniquesUserExecution)}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/ListAssessmentsMetadata_subscription_example.json -func ExampleAssessmentsMetadataClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAssessmentsMetadataClient().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.AssessmentMetadataResponseList = armsecurity.AssessmentMetadataResponseList{ - // Value: []*armsecurity.AssessmentMetadataResponse{ - // { - // Name: to.Ptr("21300918-b2e3-0346-785f-c77ff57d243b"), - // Type: to.Ptr("Microsoft.Security/assessmentMetadata"), - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/21300918-b2e3-0346-785f-c77ff57d243b"), - // Properties: &armsecurity.AssessmentMetadataPropertiesResponse{ - // Description: to.Ptr("Install an endpoint protection solution on your virtual machines scale sets, to protect them from threats and vulnerabilities."), - // AssessmentType: to.Ptr(armsecurity.AssessmentTypeBuiltIn), - // Categories: []*armsecurity.Categories{ - // to.Ptr(armsecurity.CategoriesCompute)}, - // DisplayName: to.Ptr("Install endpoint protection solution on virtual machine scale sets"), - // ImplementationEffort: to.Ptr(armsecurity.ImplementationEffortLow), - // PolicyDefinitionID: to.Ptr("/providers/Microsoft.Authorization/policyDefinitions/26a828e1-e88f-464e-bbb3-c134a282b9de"), - // RemediationDescription: to.Ptr("To install an endpoint protection solution: 1. Follow the instructions in How do I turn on antimalware in my virtual machine scale set"), - // Severity: to.Ptr(armsecurity.SeverityMedium), - // Threats: []*armsecurity.Threats{ - // to.Ptr(armsecurity.ThreatsDataExfiltration), - // to.Ptr(armsecurity.ThreatsDataSpillage), - // to.Ptr(armsecurity.ThreatsMaliciousInsider)}, - // UserImpact: to.Ptr(armsecurity.UserImpactLow), - // PlannedDeprecationDate: to.Ptr("03/2022"), - // PublishDates: &armsecurity.AssessmentMetadataPropertiesResponsePublishDates{ - // GA: to.Ptr("06/01/2021"), - // Public: to.Ptr("06/01/2021"), - // }, - // Tactics: []*armsecurity.Tactics{ - // to.Ptr(armsecurity.TacticsCredentialAccess), - // to.Ptr(armsecurity.TacticsPersistence), - // to.Ptr(armsecurity.TacticsExecution), - // to.Ptr(armsecurity.TacticsDefenseEvasion), - // to.Ptr(armsecurity.TacticsCollection), - // to.Ptr(armsecurity.TacticsDiscovery), - // to.Ptr(armsecurity.TacticsPrivilegeEscalation)}, - // Techniques: []*armsecurity.Techniques{ - // to.Ptr(armsecurity.TechniquesObfuscatedFilesOrInformation), - // to.Ptr(armsecurity.TechniquesIngressToolTransfer), - // to.Ptr(armsecurity.TechniquesPhishing), - // to.Ptr(armsecurity.TechniquesUserExecution)}, - // }, - // }, - // { - // Name: to.Ptr("bc303248-3d14-44c2-96a0-55f5c326b5fe"), - // Type: to.Ptr("Microsoft.Security/assessmentMetadata"), - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/bc303248-3d14-44c2-96a0-55f5c326b5fe"), - // Properties: &armsecurity.AssessmentMetadataPropertiesResponse{ - // Description: to.Ptr("Open remote management ports expose your VM to a high level of risk from internet-based attacks that attempt to brute force credentials to gain admin access to the machine."), - // AssessmentType: to.Ptr(armsecurity.AssessmentTypeCustomPolicy), - // Categories: []*armsecurity.Categories{ - // to.Ptr(armsecurity.CategoriesNetworking)}, - // DisplayName: to.Ptr("Close management ports on your virtual machines"), - // ImplementationEffort: to.Ptr(armsecurity.ImplementationEffortLow), - // PolicyDefinitionID: to.Ptr("/providers/Microsoft.Authorization/policyDefinitions/22730e10-96f6-4aac-ad84-9383d35b5917"), - // Preview: to.Ptr(true), - // RemediationDescription: to.Ptr("We recommend that you edit the inbound rules of the below virtual machines to restrict access to specific source ranges.
To restrict the access to your virtual machines: 1. Click on a VM from the list below 2. At the 'Networking' blade, click on each of the rules that allow management ports (e.g. RDP-3389, WINRM-5985, SSH-22) 3. Change the 'Action' property to 'Deny' 4. Click 'Save'"), - // Severity: to.Ptr(armsecurity.SeverityMedium), - // Threats: []*armsecurity.Threats{ - // to.Ptr(armsecurity.ThreatsDataExfiltration), - // to.Ptr(armsecurity.ThreatsDataSpillage), - // to.Ptr(armsecurity.ThreatsMaliciousInsider)}, - // UserImpact: to.Ptr(armsecurity.UserImpactHigh), - // PublishDates: &armsecurity.AssessmentMetadataPropertiesResponsePublishDates{ - // GA: to.Ptr("06/01/2021"), - // Public: to.Ptr("06/01/2021"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/GetAssessmentsMetadata_subscription_example.json -func ExampleAssessmentsMetadataClient_GetInSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAssessmentsMetadataClient().GetInSubscription(ctx, "21300918-b2e3-0346-785f-c77ff57d243b", 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.AssessmentMetadataResponse = armsecurity.AssessmentMetadataResponse{ - // Name: to.Ptr("21300918-b2e3-0346-785f-c77ff57d243b"), - // Type: to.Ptr("Microsoft.Security/assessmentMetadata"), - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/21300918-b2e3-0346-785f-c77ff57d243b"), - // Properties: &armsecurity.AssessmentMetadataPropertiesResponse{ - // Description: to.Ptr("Install an endpoint protection solution on your virtual machines scale sets, to protect them from threats and vulnerabilities."), - // AssessmentType: to.Ptr(armsecurity.AssessmentTypeBuiltIn), - // Categories: []*armsecurity.Categories{ - // to.Ptr(armsecurity.CategoriesCompute)}, - // DisplayName: to.Ptr("Install endpoint protection solution on virtual machine scale sets"), - // ImplementationEffort: to.Ptr(armsecurity.ImplementationEffortLow), - // PolicyDefinitionID: to.Ptr("/providers/Microsoft.Authorization/policyDefinitions/26a828e1-e88f-464e-bbb3-c134a282b9de"), - // RemediationDescription: to.Ptr("To install an endpoint protection solution: 1. Follow the instructions in How do I turn on antimalware in my virtual machine scale set"), - // Severity: to.Ptr(armsecurity.SeverityMedium), - // Threats: []*armsecurity.Threats{ - // to.Ptr(armsecurity.ThreatsDataExfiltration), - // to.Ptr(armsecurity.ThreatsDataSpillage), - // to.Ptr(armsecurity.ThreatsMaliciousInsider)}, - // UserImpact: to.Ptr(armsecurity.UserImpactLow), - // PlannedDeprecationDate: to.Ptr("03/2022"), - // PublishDates: &armsecurity.AssessmentMetadataPropertiesResponsePublishDates{ - // GA: to.Ptr("06/01/2021"), - // Public: to.Ptr("06/01/2021"), - // }, - // Tactics: []*armsecurity.Tactics{ - // to.Ptr(armsecurity.TacticsCredentialAccess), - // to.Ptr(armsecurity.TacticsPersistence), - // to.Ptr(armsecurity.TacticsExecution), - // to.Ptr(armsecurity.TacticsDefenseEvasion), - // to.Ptr(armsecurity.TacticsCollection), - // to.Ptr(armsecurity.TacticsDiscovery), - // to.Ptr(armsecurity.TacticsPrivilegeEscalation)}, - // Techniques: []*armsecurity.Techniques{ - // to.Ptr(armsecurity.TechniquesObfuscatedFilesOrInformation), - // to.Ptr(armsecurity.TechniquesIngressToolTransfer), - // to.Ptr(armsecurity.TechniquesPhishing), - // to.Ptr(armsecurity.TechniquesUserExecution)}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/CreateAssessmentsMetadata_subscription_example.json -func ExampleAssessmentsMetadataClient_CreateInSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAssessmentsMetadataClient().CreateInSubscription(ctx, "ca039e75-a276-4175-aebc-bcd41e4b14b7", armsecurity.AssessmentMetadataResponse{ - Properties: &armsecurity.AssessmentMetadataPropertiesResponse{ - Description: to.Ptr("Install an endpoint protection solution on your virtual machines scale sets, to protect them from threats and vulnerabilities."), - AssessmentType: to.Ptr(armsecurity.AssessmentTypeCustomerManaged), - Categories: []*armsecurity.Categories{ - to.Ptr(armsecurity.CategoriesCompute)}, - DisplayName: to.Ptr("Install endpoint protection solution on virtual machine scale sets"), - ImplementationEffort: to.Ptr(armsecurity.ImplementationEffortLow), - RemediationDescription: to.Ptr("To install an endpoint protection solution: 1. Follow the instructions in How do I turn on antimalware in my virtual machine scale set"), - Severity: to.Ptr(armsecurity.SeverityMedium), - Threats: []*armsecurity.Threats{ - to.Ptr(armsecurity.ThreatsDataExfiltration), - to.Ptr(armsecurity.ThreatsDataSpillage), - to.Ptr(armsecurity.ThreatsMaliciousInsider)}, - UserImpact: to.Ptr(armsecurity.UserImpactLow), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.AssessmentMetadataResponse = armsecurity.AssessmentMetadataResponse{ - // Name: to.Ptr("ca039e75-a276-4175-aebc-bcd41e4b14b7"), - // Type: to.Ptr("Microsoft.Security/assessmentMetadata"), - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/ca039e75-a276-4175-aebc-bcd41e4b14b7"), - // Properties: &armsecurity.AssessmentMetadataPropertiesResponse{ - // Description: to.Ptr("Assessment that my organization created to view our security assessment in Azure Security Center"), - // AssessmentType: to.Ptr(armsecurity.AssessmentTypeCustomerManaged), - // Categories: []*armsecurity.Categories{ - // to.Ptr(armsecurity.CategoriesCompute)}, - // DisplayName: to.Ptr("My organization security assessment"), - // ImplementationEffort: to.Ptr(armsecurity.ImplementationEffortLow), - // RemediationDescription: to.Ptr("Fix it with these remediation instructions"), - // Severity: to.Ptr(armsecurity.SeverityMedium), - // Threats: []*armsecurity.Threats{ - // to.Ptr(armsecurity.ThreatsDataExfiltration), - // to.Ptr(armsecurity.ThreatsDataSpillage), - // to.Ptr(armsecurity.ThreatsMaliciousInsider)}, - // UserImpact: to.Ptr(armsecurity.UserImpactLow), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/DeleteAssessmentsMetadata_subscription_example.json -func ExampleAssessmentsMetadataClient_DeleteInSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAssessmentsMetadataClient().DeleteInSubscription(ctx, "ca039e75-a276-4175-aebc-bcd41e4b14b7", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/automations_client.go b/sdk/resourcemanager/security/armsecurity/automations_client.go deleted file mode 100644 index fe5afc6269c5..000000000000 --- a/sdk/resourcemanager/security/armsecurity/automations_client.go +++ /dev/null @@ -1,484 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// AutomationsClient contains the methods for the Automations group. -// Don't use this type directly, use NewAutomationsClient() instead. -type AutomationsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewAutomationsClient creates a new instance of AutomationsClient 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 NewAutomationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AutomationsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &AutomationsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Creates or updates a security automation. If a security automation is already created and a subsequent -// request is issued for the same automation id, then it will be updated. -// 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. -// - automationName - The security automation name. -// - automation - The security automation resource -// - options - AutomationsClientCreateOrUpdateOptions contains the optional parameters for the AutomationsClient.CreateOrUpdate -// method. -func (client *AutomationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationName string, automation Automation, options *AutomationsClientCreateOrUpdateOptions) (AutomationsClientCreateOrUpdateResponse, error) { - var err error - const operationName = "AutomationsClient.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, automationName, automation, options) - if err != nil { - return AutomationsClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AutomationsClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return AutomationsClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *AutomationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, automationName string, automation Automation, options *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") - } - 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 automationName == "" { - return nil, errors.New("parameter automationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{automationName}", url.PathEscape(automationName)) - 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-12-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, automation); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *AutomationsClient) createOrUpdateHandleResponse(resp *http.Response) (AutomationsClientCreateOrUpdateResponse, error) { - result := AutomationsClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Automation); err != nil { - return AutomationsClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Deletes a security automation. -// 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. -// - 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) { - var err error - const operationName = "AutomationsClient.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, automationName, options) - if err != nil { - return AutomationsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AutomationsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return AutomationsClientDeleteResponse{}, err - } - return AutomationsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *AutomationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, automationName string, options *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") - } - 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 automationName == "" { - return nil, errors.New("parameter automationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{automationName}", url.PathEscape(automationName)) - 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-12-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Retrieves information about the model of a security automation. -// 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. -// - 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) { - var err error - const operationName = "AutomationsClient.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, automationName, options) - if err != nil { - return AutomationsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AutomationsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AutomationsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *AutomationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, automationName string, options *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") - } - 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 automationName == "" { - return nil, errors.New("parameter automationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{automationName}", url.PathEscape(automationName)) - 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-12-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 *AutomationsClient) getHandleResponse(resp *http.Response) (AutomationsClientGetResponse, error) { - result := AutomationsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Automation); err != nil { - return AutomationsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Lists all the security automations in the specified subscription. Use the 'nextLink' property in the response -// to get the next page of security automations for the specified subscription. -// -// Generated from API version 2023-12-01-preview -// - options - AutomationsClientListOptions contains the optional parameters for the AutomationsClient.NewListPager method. -func (client *AutomationsClient) NewListPager(options *AutomationsClientListOptions) *runtime.Pager[AutomationsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[AutomationsClientListResponse]{ - More: func(page AutomationsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *AutomationsClientListResponse) (AutomationsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AutomationsClient.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 AutomationsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *AutomationsClient) listCreateRequest(ctx context.Context, options *AutomationsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/automations" - 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", "2023-12-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 *AutomationsClient) listHandleResponse(resp *http.Response) (AutomationsClientListResponse, error) { - result := AutomationsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AutomationList); err != nil { - return AutomationsClientListResponse{}, err - } - return result, nil -} - -// NewListByResourceGroupPager - Lists all the security automations in the specified resource group. Use the 'nextLink' property -// in the response to get the next page of security automations for the specified resource group. -// -// 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. -// - options - AutomationsClientListByResourceGroupOptions contains the optional parameters for the AutomationsClient.NewListByResourceGroupPager -// method. -func (client *AutomationsClient) NewListByResourceGroupPager(resourceGroupName string, options *AutomationsClientListByResourceGroupOptions) *runtime.Pager[AutomationsClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[AutomationsClientListByResourceGroupResponse]{ - More: func(page AutomationsClientListByResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *AutomationsClientListByResourceGroupResponse) (AutomationsClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AutomationsClient.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 AutomationsClientListByResourceGroupResponse{}, err - } - return client.listByResourceGroupHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *AutomationsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *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") - } - 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", "2023-12-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 *AutomationsClient) listByResourceGroupHandleResponse(resp *http.Response) (AutomationsClientListByResourceGroupResponse, error) { - result := AutomationsClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AutomationList); err != nil { - return AutomationsClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// Update - Updates a security automation -// 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. -// - automationName - The security automation name. -// - automation - The update model of security automation resource -// - options - AutomationsClientUpdateOptions contains the optional parameters for the AutomationsClient.Update method. -func (client *AutomationsClient) Update(ctx context.Context, resourceGroupName string, automationName string, automation AutomationUpdateModel, options *AutomationsClientUpdateOptions) (AutomationsClientUpdateResponse, error) { - var err error - const operationName = "AutomationsClient.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, automationName, automation, options) - if err != nil { - return AutomationsClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AutomationsClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AutomationsClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *AutomationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, automationName string, automation AutomationUpdateModel, options *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") - } - 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 automationName == "" { - return nil, errors.New("parameter automationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{automationName}", url.PathEscape(automationName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-12-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, automation); err != nil { - return nil, err - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *AutomationsClient) updateHandleResponse(resp *http.Response) (AutomationsClientUpdateResponse, error) { - result := AutomationsClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Automation); err != nil { - return AutomationsClientUpdateResponse{}, err - } - return result, nil -} - -// Validate - Validates the security automation model before create or update. Any validation errors are returned to the client. -// 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. -// - automationName - The security automation name. -// - automation - The security automation resource -// - options - AutomationsClientValidateOptions contains the optional parameters for the AutomationsClient.Validate method. -func (client *AutomationsClient) Validate(ctx context.Context, resourceGroupName string, automationName string, automation Automation, options *AutomationsClientValidateOptions) (AutomationsClientValidateResponse, error) { - var err error - const operationName = "AutomationsClient.Validate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.validateCreateRequest(ctx, resourceGroupName, automationName, automation, options) - if err != nil { - return AutomationsClientValidateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AutomationsClientValidateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AutomationsClientValidateResponse{}, err - } - resp, err := client.validateHandleResponse(httpResp) - return resp, err -} - -// validateCreateRequest creates the Validate request. -func (client *AutomationsClient) validateCreateRequest(ctx context.Context, resourceGroupName string, automationName string, automation Automation, options *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") - } - 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 automationName == "" { - return nil, errors.New("parameter automationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{automationName}", url.PathEscape(automationName)) - 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-12-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, automation); err != nil { - return nil, err - } - return req, nil -} - -// validateHandleResponse handles the Validate response. -func (client *AutomationsClient) validateHandleResponse(resp *http.Response) (AutomationsClientValidateResponse, error) { - result := AutomationsClientValidateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AutomationValidationStatus); err != nil { - return AutomationsClientValidateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/automations_client_example_test.go b/sdk/resourcemanager/security/armsecurity/automations_client_example_test.go deleted file mode 100644 index e1991d1c767b..000000000000 --- a/sdk/resourcemanager/security/armsecurity/automations_client_example_test.go +++ /dev/null @@ -1,602 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/2023-12-01-preview/examples/Automations/GetAutomationsSubscription_example.json -func ExampleAutomationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAutomationsClient().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.AutomationList = armsecurity.AutomationList{ - // Value: []*armsecurity.Automation{ - // { - // Location: to.Ptr("Central US"), - // Etag: to.Ptr("etag value"), - // Name: to.Ptr("exampleAutomation"), - // Type: to.Ptr("Microsoft.Security/automations"), - // ID: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/exampleResourceGroup/providers/Microsoft.Security/automations/exampleAutomation"), - // Tags: map[string]*string{ - // }, - // Properties: &armsecurity.AutomationProperties{ - // Description: to.Ptr("An example of a security automation that triggers one LogicApp resource (myTest1) on any security assessment of type customAssessment"), - // Actions: []armsecurity.AutomationActionClassification{ - // &armsecurity.AutomationActionLogicApp{ - // ActionType: to.Ptr(armsecurity.ActionTypeLogicApp), - // LogicAppResourceID: to.Ptr("/subscriptions/e54a4a18-5b94-4f90-9471-bd3decad8a2e/resourceGroups/sample/providers/Microsoft.Logic/workflows/MyTest1"), - // }}, - // IsEnabled: to.Ptr(true), - // Scopes: []*armsecurity.AutomationScope{ - // { - // Description: to.Ptr("A description that helps to identify this scope - for example: security assessments that relate to the resource group myResourceGroup within the subscription a5caac9c-5c04-49af-b3d0-e204f40345d5"), - // ScopePath: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/myResourceGroup"), - // }}, - // Sources: []*armsecurity.AutomationSource{ - // { - // EventSource: to.Ptr(armsecurity.EventSourceAssessments), - // RuleSets: []*armsecurity.AutomationRuleSet{ - // { - // Rules: []*armsecurity.AutomationTriggeringRule{ - // { - // ExpectedValue: to.Ptr("customAssessment"), - // Operator: to.Ptr(armsecurity.OperatorEquals), - // PropertyJPath: to.Ptr("$.Entity.AssessmentType"), - // PropertyType: to.Ptr(armsecurity.PropertyTypeString), - // }}, - // }}, - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/GetAutomationsResourceGroup_example.json -func ExampleAutomationsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAutomationsClient().NewListByResourceGroupPager("exampleResourceGroup", 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.AutomationList = armsecurity.AutomationList{ - // Value: []*armsecurity.Automation{ - // { - // Location: to.Ptr("Central US"), - // Etag: to.Ptr("etag value"), - // Name: to.Ptr("exampleAutomation"), - // Type: to.Ptr("Microsoft.Security/automations"), - // ID: to.Ptr("/subscriptions/e4272367-5645-4c4e-9c67-3b74b59a6982/resourceGroups/exampleResourceGroup/providers/Microsoft.Security/automations/exampleAutomation"), - // Tags: map[string]*string{ - // }, - // Properties: &armsecurity.AutomationProperties{ - // Description: to.Ptr("An example of a security automation that triggers one LogicApp resource (myTest1) on any security assessment of type customAssessment"), - // Actions: []armsecurity.AutomationActionClassification{ - // &armsecurity.AutomationActionLogicApp{ - // ActionType: to.Ptr(armsecurity.ActionTypeLogicApp), - // LogicAppResourceID: to.Ptr("/subscriptions/e54a4a18-5b94-4f90-9471-bd3decad8a2e/resourceGroups/sample/providers/Microsoft.Logic/workflows/MyTest1"), - // }}, - // IsEnabled: to.Ptr(true), - // Scopes: []*armsecurity.AutomationScope{ - // { - // Description: to.Ptr("A description that helps to identify this scope - for example: security assessments that relate to the resource group myResourceGroup within the subscription a5caac9c-5c04-49af-b3d0-e204f40345d5"), - // ScopePath: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/myResourceGroup"), - // }}, - // Sources: []*armsecurity.AutomationSource{ - // { - // EventSource: to.Ptr(armsecurity.EventSourceAssessments), - // RuleSets: []*armsecurity.AutomationRuleSet{ - // { - // Rules: []*armsecurity.AutomationTriggeringRule{ - // { - // ExpectedValue: to.Ptr("customAssessment"), - // Operator: to.Ptr(armsecurity.OperatorEquals), - // PropertyJPath: to.Ptr("$.Entity.AssessmentType"), - // PropertyType: to.Ptr(armsecurity.PropertyTypeString), - // }}, - // }}, - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/GetAutomationResourceGroup_example.json -func ExampleAutomationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAutomationsClient().Get(ctx, "exampleResourceGroup", "exampleAutomation", 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.Automation = armsecurity.Automation{ - // Location: to.Ptr("Central US"), - // Etag: to.Ptr("etag value"), - // Name: to.Ptr("exampleAutomation"), - // Type: to.Ptr("Microsoft.Security/automations"), - // ID: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/exampleResourceGroup/providers/Microsoft.Security/automations/exampleAutomation"), - // Tags: map[string]*string{ - // }, - // Properties: &armsecurity.AutomationProperties{ - // Description: to.Ptr("An example of a security automation that triggers one LogicApp resource (myTest1) on any security assessment of type customAssessment"), - // Actions: []armsecurity.AutomationActionClassification{ - // &armsecurity.AutomationActionLogicApp{ - // ActionType: to.Ptr(armsecurity.ActionTypeLogicApp), - // LogicAppResourceID: to.Ptr("/subscriptions/e54a4a18-5b94-4f90-9471-bd3decad8a2e/resourceGroups/sample/providers/Microsoft.Logic/workflows/MyTest1"), - // }}, - // IsEnabled: to.Ptr(true), - // Scopes: []*armsecurity.AutomationScope{ - // { - // Description: to.Ptr("A description that helps to identify this scope - for example: security assessments that relate to the resource group myResourceGroup within the subscription a5caac9c-5c04-49af-b3d0-e204f40345d5"), - // ScopePath: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/myResourceGroup"), - // }}, - // Sources: []*armsecurity.AutomationSource{ - // { - // EventSource: to.Ptr(armsecurity.EventSourceAssessments), - // RuleSets: []*armsecurity.AutomationRuleSet{ - // { - // Rules: []*armsecurity.AutomationTriggeringRule{ - // { - // ExpectedValue: to.Ptr("customAssessment"), - // Operator: to.Ptr(armsecurity.OperatorEquals), - // PropertyJPath: to.Ptr("$.Entity.AssessmentType"), - // PropertyType: to.Ptr(armsecurity.PropertyTypeString), - // }}, - // }}, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/PutAutomationAllAssessments_example.json -func ExampleAutomationsClient_CreateOrUpdate_createOrUpdateASecurityAutomationForAllAssessmentsIncludingAllSeverities() { - 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.NewAutomationsClient().CreateOrUpdate(ctx, "exampleResourceGroup", "exampleAutomation", armsecurity.Automation{ - Location: to.Ptr("Central US"), - Etag: to.Ptr("etag value (must be supplied for update)"), - Tags: map[string]*string{}, - Properties: &armsecurity.AutomationProperties{ - Description: to.Ptr("An example of a security automation that triggers one LogicApp resource (myTest1) on any security assessment"), - Actions: []armsecurity.AutomationActionClassification{ - &armsecurity.AutomationActionLogicApp{ - ActionType: to.Ptr(armsecurity.ActionTypeLogicApp), - LogicAppResourceID: to.Ptr("/subscriptions/e54a4a18-5b94-4f90-9471-bd3decad8a2e/resourceGroups/sample/providers/Microsoft.Logic/workflows/MyTest1"), - URI: to.Ptr("https://exampleTriggerUri1.com"), - }}, - IsEnabled: to.Ptr(true), - Scopes: []*armsecurity.AutomationScope{ - { - Description: to.Ptr("A description that helps to identify this scope - for example: security assessments that relate to the resource group myResourceGroup within the subscription a5caac9c-5c04-49af-b3d0-e204f40345d5"), - ScopePath: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/myResourceGroup"), - }}, - Sources: []*armsecurity.AutomationSource{ - { - EventSource: to.Ptr(armsecurity.EventSourceAssessments), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.Automation = armsecurity.Automation{ - // Location: to.Ptr("Central US"), - // Etag: to.Ptr("new etag value"), - // Name: to.Ptr("exampleAutomation"), - // Type: to.Ptr("Microsoft.Security/automations"), - // ID: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/exampleResourceGroup/providers/Microsoft.Security/automations/exampleAutomation"), - // Tags: map[string]*string{ - // }, - // Properties: &armsecurity.AutomationProperties{ - // Description: to.Ptr("An example of a security automation that triggers one LogicApp resource (myTest1) on any security assessment"), - // Actions: []armsecurity.AutomationActionClassification{ - // &armsecurity.AutomationActionLogicApp{ - // ActionType: to.Ptr(armsecurity.ActionTypeLogicApp), - // LogicAppResourceID: to.Ptr("/subscriptions/e54a4a18-5b94-4f90-9471-bd3decad8a2e/resourceGroups/sample/providers/Microsoft.Logic/workflows/MyTest1"), - // }}, - // IsEnabled: to.Ptr(true), - // Scopes: []*armsecurity.AutomationScope{ - // { - // Description: to.Ptr("A description that helps to identify this scope - for example: security assessments that relate to the resource group myResourceGroup within the subscription a5caac9c-5c04-49af-b3d0-e204f40345d5"), - // ScopePath: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/myResourceGroup"), - // }}, - // Sources: []*armsecurity.AutomationSource{ - // { - // EventSource: to.Ptr(armsecurity.EventSourceAssessments), - // RuleSets: []*armsecurity.AutomationRuleSet{ - // }, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/PutAutomationHighSeverityAssessments_example.json -func ExampleAutomationsClient_CreateOrUpdate_createOrUpdateASecurityAutomationForAllHighSeverityAssessments() { - 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.NewAutomationsClient().CreateOrUpdate(ctx, "exampleResourceGroup", "exampleAutomation", armsecurity.Automation{ - Location: to.Ptr("Central US"), - Etag: to.Ptr("etag value (must be supplied for update)"), - Tags: map[string]*string{}, - Properties: &armsecurity.AutomationProperties{ - Description: to.Ptr("An example of a security automation that triggers one LogicApp resource (myTest1) on any high severity security assessment"), - Actions: []armsecurity.AutomationActionClassification{ - &armsecurity.AutomationActionLogicApp{ - ActionType: to.Ptr(armsecurity.ActionTypeLogicApp), - LogicAppResourceID: to.Ptr("/subscriptions/e54a4a18-5b94-4f90-9471-bd3decad8a2e/resourceGroups/sample/providers/Microsoft.Logic/workflows/MyTest1"), - URI: to.Ptr("https://exampleTriggerUri1.com"), - }}, - IsEnabled: to.Ptr(true), - Scopes: []*armsecurity.AutomationScope{ - { - Description: to.Ptr("A description that helps to identify this scope - for example: security assessments that relate to the resource group myResourceGroup within the subscription a5caac9c-5c04-49af-b3d0-e204f40345d5"), - ScopePath: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/myResourceGroup"), - }}, - Sources: []*armsecurity.AutomationSource{ - { - EventSource: to.Ptr(armsecurity.EventSourceAssessments), - RuleSets: []*armsecurity.AutomationRuleSet{ - { - Rules: []*armsecurity.AutomationTriggeringRule{ - { - ExpectedValue: to.Ptr("High"), - Operator: to.Ptr(armsecurity.OperatorEquals), - PropertyJPath: to.Ptr("properties.metadata.severity"), - PropertyType: to.Ptr(armsecurity.PropertyTypeString), - }}, - }}, - }}, - }, - }, 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.Automation = armsecurity.Automation{ - // Location: to.Ptr("Central US"), - // Etag: to.Ptr("new etag value"), - // Name: to.Ptr("exampleAutomation"), - // Type: to.Ptr("Microsoft.Security/automations"), - // ID: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/exampleResourceGroup/providers/Microsoft.Security/automations/exampleAutomation"), - // Tags: map[string]*string{ - // }, - // Properties: &armsecurity.AutomationProperties{ - // Description: to.Ptr("An example of a security automation that triggers one LogicApp resource (myTest1) on any high severity security assessment"), - // Actions: []armsecurity.AutomationActionClassification{ - // &armsecurity.AutomationActionLogicApp{ - // ActionType: to.Ptr(armsecurity.ActionTypeLogicApp), - // LogicAppResourceID: to.Ptr("/subscriptions/e54a4a18-5b94-4f90-9471-bd3decad8a2e/resourceGroups/sample/providers/Microsoft.Logic/workflows/MyTest1"), - // }}, - // IsEnabled: to.Ptr(true), - // Scopes: []*armsecurity.AutomationScope{ - // { - // Description: to.Ptr("A description that helps to identify this scope - for example: security assessments that relate to the resource group myResourceGroup within the subscription a5caac9c-5c04-49af-b3d0-e204f40345d5"), - // ScopePath: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/myResourceGroup"), - // }}, - // Sources: []*armsecurity.AutomationSource{ - // { - // EventSource: to.Ptr(armsecurity.EventSourceAssessments), - // RuleSets: []*armsecurity.AutomationRuleSet{ - // { - // Rules: []*armsecurity.AutomationTriggeringRule{ - // { - // ExpectedValue: to.Ptr("High"), - // Operator: to.Ptr(armsecurity.OperatorEquals), - // PropertyJPath: to.Ptr("properties.metadata.severity"), - // PropertyType: to.Ptr(armsecurity.PropertyTypeString), - // }}, - // }}, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/PutDisableAutomation_example.json -func ExampleAutomationsClient_CreateOrUpdate_disableOrEnableASecurityAutomation() { - 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.NewAutomationsClient().CreateOrUpdate(ctx, "exampleResourceGroup", "exampleAutomation", armsecurity.Automation{ - Location: to.Ptr("Central US"), - Etag: to.Ptr("etag value (must be supplied for update)"), - Tags: map[string]*string{}, - Properties: &armsecurity.AutomationProperties{ - Description: to.Ptr("An example of a security automation that triggers one LogicApp resource (myTest1) on any security assessment of type customAssessment"), - Actions: []armsecurity.AutomationActionClassification{ - &armsecurity.AutomationActionLogicApp{ - ActionType: to.Ptr(armsecurity.ActionTypeLogicApp), - LogicAppResourceID: to.Ptr("/subscriptions/e54a4a18-5b94-4f90-9471-bd3decad8a2e/resourceGroups/sample/providers/Microsoft.Logic/workflows/MyTest1"), - URI: to.Ptr("https://exampleTriggerUri1.com"), - }}, - IsEnabled: to.Ptr(false), - Scopes: []*armsecurity.AutomationScope{ - { - Description: to.Ptr("A description that helps to identify this scope - for example: security assessments that relate to the resource group myResourceGroup within the subscription a5caac9c-5c04-49af-b3d0-e204f40345d5"), - ScopePath: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/myResourceGroup"), - }}, - Sources: []*armsecurity.AutomationSource{ - { - EventSource: to.Ptr(armsecurity.EventSourceAssessments), - RuleSets: []*armsecurity.AutomationRuleSet{ - { - Rules: []*armsecurity.AutomationTriggeringRule{ - { - ExpectedValue: to.Ptr("customAssessment"), - Operator: to.Ptr(armsecurity.OperatorEquals), - PropertyJPath: to.Ptr("$.Entity.AssessmentType"), - PropertyType: to.Ptr(armsecurity.PropertyTypeString), - }}, - }}, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.Automation = armsecurity.Automation{ - // Location: to.Ptr("Central US"), - // Etag: to.Ptr("new etag value"), - // Name: to.Ptr("exampleAutomation"), - // Type: to.Ptr("Microsoft.Security/automations"), - // ID: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/exampleResourceGroup/providers/Microsoft.Security/automations/exampleAutomation"), - // Tags: map[string]*string{ - // }, - // Properties: &armsecurity.AutomationProperties{ - // Description: to.Ptr("An example of a security automation that triggers one LogicApp resource (myTest1) on any security assessment of type customAssessment"), - // Actions: []armsecurity.AutomationActionClassification{ - // &armsecurity.AutomationActionLogicApp{ - // ActionType: to.Ptr(armsecurity.ActionTypeLogicApp), - // LogicAppResourceID: to.Ptr("/subscriptions/e54a4a18-5b94-4f90-9471-bd3decad8a2e/resourceGroups/sample/providers/Microsoft.Logic/workflows/MyTest1"), - // }}, - // IsEnabled: to.Ptr(false), - // Scopes: []*armsecurity.AutomationScope{ - // { - // Description: to.Ptr("A description that helps to identify this scope - for example: security assessments that relate to the resource group myResourceGroup within the subscription a5caac9c-5c04-49af-b3d0-e204f40345d5"), - // ScopePath: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/myResourceGroup"), - // }}, - // Sources: []*armsecurity.AutomationSource{ - // { - // EventSource: to.Ptr(armsecurity.EventSourceAssessments), - // RuleSets: []*armsecurity.AutomationRuleSet{ - // { - // Rules: []*armsecurity.AutomationTriggeringRule{ - // { - // ExpectedValue: to.Ptr("customAssessment"), - // Operator: to.Ptr(armsecurity.OperatorEquals), - // PropertyJPath: to.Ptr("$.Entity.AssessmentType"), - // PropertyType: to.Ptr(armsecurity.PropertyTypeString), - // }}, - // }}, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/PatchAutomation_example.json -func ExampleAutomationsClient_Update() { - 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.NewAutomationsClient().Update(ctx, "exampleResourceGroup", "exampleAutomation", armsecurity.AutomationUpdateModel{ - Tags: map[string]*string{ - "Example": to.Ptr("exampleTag"), - }, - Properties: &armsecurity.AutomationProperties{ - Description: to.Ptr("An example of a security automation that triggers one LogicApp resource (myTest1) on any security assessment"), - Actions: []armsecurity.AutomationActionClassification{ - &armsecurity.AutomationActionLogicApp{ - ActionType: to.Ptr(armsecurity.ActionTypeLogicApp), - LogicAppResourceID: to.Ptr("/subscriptions/e54a4a18-5b94-4f90-9471-bd3decad8a2e/resourceGroups/sample/providers/Microsoft.Logic/workflows/MyTest1"), - URI: to.Ptr("https://exampleTriggerUri1.com"), - }}, - Scopes: []*armsecurity.AutomationScope{ - { - Description: to.Ptr("A description that helps to identify this scope - for example: security assessments that relate to the resource group myResourceGroup within the subscription a5caac9c-5c04-49af-b3d0-e204f40345d5"), - ScopePath: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/myResourceGroup"), - }}, - Sources: []*armsecurity.AutomationSource{ - { - EventSource: to.Ptr(armsecurity.EventSourceAssessments), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.Automation = armsecurity.Automation{ - // Location: to.Ptr("Central US"), - // Etag: to.Ptr("new etag value"), - // Name: to.Ptr("exampleAutomation"), - // Type: to.Ptr("Microsoft.Security/automations"), - // ID: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/exampleResourceGroup/providers/Microsoft.Security/automations/exampleAutomation"), - // Tags: map[string]*string{ - // }, - // Properties: &armsecurity.AutomationProperties{ - // Description: to.Ptr("An example of a security automation that triggers one LogicApp resource (myTest1) on any security assessment"), - // Actions: []armsecurity.AutomationActionClassification{ - // &armsecurity.AutomationActionLogicApp{ - // ActionType: to.Ptr(armsecurity.ActionTypeLogicApp), - // LogicAppResourceID: to.Ptr("/subscriptions/e54a4a18-5b94-4f90-9471-bd3decad8a2e/resourceGroups/sample/providers/Microsoft.Logic/workflows/MyTest1"), - // }}, - // IsEnabled: to.Ptr(true), - // Scopes: []*armsecurity.AutomationScope{ - // { - // Description: to.Ptr("A description that helps to identify this scope - for example: security assessments that relate to the resource group myResourceGroup within the subscription a5caac9c-5c04-49af-b3d0-e204f40345d5"), - // ScopePath: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/myResourceGroup"), - // }}, - // Sources: []*armsecurity.AutomationSource{ - // { - // EventSource: to.Ptr(armsecurity.EventSourceAssessments), - // RuleSets: []*armsecurity.AutomationRuleSet{ - // }, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/DeleteAutomation_example.json -func ExampleAutomationsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAutomationsClient().Delete(ctx, "myRg", "myAutomationName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/ValidateAutomation_example.json -func ExampleAutomationsClient_Validate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAutomationsClient().Validate(ctx, "exampleResourceGroup", "exampleAutomation", armsecurity.Automation{ - Location: to.Ptr("Central US"), - Tags: map[string]*string{}, - Properties: &armsecurity.AutomationProperties{ - Description: to.Ptr("An example of a security automation that triggers one LogicApp resource (myTest1) on any security assessment of type customAssessment"), - Actions: []armsecurity.AutomationActionClassification{ - &armsecurity.AutomationActionLogicApp{ - ActionType: to.Ptr(armsecurity.ActionTypeLogicApp), - LogicAppResourceID: to.Ptr("/subscriptions/e54a4a18-5b94-4f90-9471-bd3decad8a2e/resourceGroups/sample/providers/Microsoft.Logic/workflows/MyTest1"), - URI: to.Ptr("https://exampleTriggerUri1.com"), - }}, - IsEnabled: to.Ptr(true), - Scopes: []*armsecurity.AutomationScope{ - { - Description: to.Ptr("A description that helps to identify this scope - for example: security assessments that relate to the resource group myResourceGroup within the subscription a5caac9c-5c04-49af-b3d0-e204f40345d5"), - ScopePath: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/myResourceGroup"), - }}, - Sources: []*armsecurity.AutomationSource{ - { - EventSource: to.Ptr(armsecurity.EventSourceAssessments), - RuleSets: []*armsecurity.AutomationRuleSet{ - { - Rules: []*armsecurity.AutomationTriggeringRule{ - { - ExpectedValue: to.Ptr("customAssessment"), - Operator: to.Ptr(armsecurity.OperatorEquals), - PropertyJPath: to.Ptr("$.Entity.AssessmentType"), - PropertyType: to.Ptr(armsecurity.PropertyTypeString), - }}, - }}, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.AutomationValidationStatus = armsecurity.AutomationValidationStatus{ - // IsValid: to.Ptr(true), - // Message: to.Ptr("Validation Successful"), - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/autoprovisioningsettings_client.go b/sdk/resourcemanager/security/armsecurity/autoprovisioningsettings_client.go deleted file mode 100644 index dab47f9d11ee..000000000000 --- a/sdk/resourcemanager/security/armsecurity/autoprovisioningsettings_client.go +++ /dev/null @@ -1,223 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// AutoProvisioningSettingsClient contains the methods for the AutoProvisioningSettings group. -// Don't use this type directly, use NewAutoProvisioningSettingsClient() instead. -type AutoProvisioningSettingsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewAutoProvisioningSettingsClient creates a new instance of AutoProvisioningSettingsClient 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 NewAutoProvisioningSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AutoProvisioningSettingsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &AutoProvisioningSettingsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Create - Details of a specific setting -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2017-08-01-preview -// - settingName - Auto provisioning setting key -// - setting - Auto provisioning setting key -// - options - AutoProvisioningSettingsClientCreateOptions contains the optional parameters for the AutoProvisioningSettingsClient.Create -// method. -func (client *AutoProvisioningSettingsClient) Create(ctx context.Context, settingName string, setting AutoProvisioningSetting, options *AutoProvisioningSettingsClientCreateOptions) (AutoProvisioningSettingsClientCreateResponse, error) { - var err error - const operationName = "AutoProvisioningSettingsClient.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, settingName, setting, options) - if err != nil { - return AutoProvisioningSettingsClientCreateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AutoProvisioningSettingsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AutoProvisioningSettingsClientCreateResponse{}, err - } - resp, err := client.createHandleResponse(httpResp) - return resp, err -} - -// createCreateRequest creates the Create request. -func (client *AutoProvisioningSettingsClient) createCreateRequest(ctx context.Context, settingName string, setting AutoProvisioningSetting, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if settingName == "" { - return nil, errors.New("parameter settingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{settingName}", url.PathEscape(settingName)) - 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", "2017-08-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, setting); err != nil { - return nil, err - } - return req, nil -} - -// createHandleResponse handles the Create response. -func (client *AutoProvisioningSettingsClient) createHandleResponse(resp *http.Response) (AutoProvisioningSettingsClientCreateResponse, error) { - result := AutoProvisioningSettingsClientCreateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AutoProvisioningSetting); err != nil { - return AutoProvisioningSettingsClientCreateResponse{}, err - } - return result, nil -} - -// Get - Details of a specific setting -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2017-08-01-preview -// - settingName - Auto provisioning setting key -// - options - AutoProvisioningSettingsClientGetOptions contains the optional parameters for the AutoProvisioningSettingsClient.Get -// method. -func (client *AutoProvisioningSettingsClient) Get(ctx context.Context, settingName string, options *AutoProvisioningSettingsClientGetOptions) (AutoProvisioningSettingsClientGetResponse, error) { - var err error - const operationName = "AutoProvisioningSettingsClient.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, settingName, options) - if err != nil { - return AutoProvisioningSettingsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AutoProvisioningSettingsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AutoProvisioningSettingsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *AutoProvisioningSettingsClient) getCreateRequest(ctx context.Context, settingName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if settingName == "" { - return nil, errors.New("parameter settingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{settingName}", url.PathEscape(settingName)) - 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", "2017-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 *AutoProvisioningSettingsClient) getHandleResponse(resp *http.Response) (AutoProvisioningSettingsClientGetResponse, error) { - result := AutoProvisioningSettingsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AutoProvisioningSetting); err != nil { - return AutoProvisioningSettingsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Exposes the auto provisioning settings of the subscriptions -// -// Generated from API version 2017-08-01-preview -// - options - AutoProvisioningSettingsClientListOptions contains the optional parameters for the AutoProvisioningSettingsClient.NewListPager -// method. -func (client *AutoProvisioningSettingsClient) NewListPager(options *AutoProvisioningSettingsClientListOptions) *runtime.Pager[AutoProvisioningSettingsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[AutoProvisioningSettingsClientListResponse]{ - More: func(page AutoProvisioningSettingsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *AutoProvisioningSettingsClientListResponse) (AutoProvisioningSettingsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AutoProvisioningSettingsClient.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 AutoProvisioningSettingsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *AutoProvisioningSettingsClient) listCreateRequest(ctx context.Context, options *AutoProvisioningSettingsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings" - 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", "2017-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 *AutoProvisioningSettingsClient) listHandleResponse(resp *http.Response) (AutoProvisioningSettingsClientListResponse, error) { - result := AutoProvisioningSettingsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AutoProvisioningSettingList); err != nil { - return AutoProvisioningSettingsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/autoprovisioningsettings_client_example_test.go b/sdk/resourcemanager/security/armsecurity/autoprovisioningsettings_client_example_test.go deleted file mode 100644 index 933c72c870d9..000000000000 --- a/sdk/resourcemanager/security/armsecurity/autoprovisioningsettings_client_example_test.go +++ /dev/null @@ -1,118 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/2017-08-01-preview/examples/AutoProvisioningSettings/GetAutoProvisioningSettingsSubscription_example.json -func ExampleAutoProvisioningSettingsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAutoProvisioningSettingsClient().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.AutoProvisioningSettingList = armsecurity.AutoProvisioningSettingList{ - // Value: []*armsecurity.AutoProvisioningSetting{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/autoProvisioningSettings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/autoProvisioningSettings/default"), - // Properties: &armsecurity.AutoProvisioningSettingProperties{ - // AutoProvision: to.Ptr(armsecurity.AutoProvisionOn), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/AutoProvisioningSettings/GetAutoProvisioningSettingSubscription_example.json -func ExampleAutoProvisioningSettingsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAutoProvisioningSettingsClient().Get(ctx, "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.AutoProvisioningSetting = armsecurity.AutoProvisioningSetting{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/autoProvisioningSettings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/autoProvisioningSettings/default"), - // Properties: &armsecurity.AutoProvisioningSettingProperties{ - // AutoProvision: to.Ptr(armsecurity.AutoProvisionOn), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/AutoProvisioningSettings/CreateAutoProvisioningSettingsSubscription_example.json -func ExampleAutoProvisioningSettingsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAutoProvisioningSettingsClient().Create(ctx, "default", armsecurity.AutoProvisioningSetting{ - Name: to.Ptr("default"), - Type: to.Ptr("Microsoft.Security/autoProvisioningSettings"), - ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/autoProvisioningSettings/default"), - Properties: &armsecurity.AutoProvisioningSettingProperties{ - AutoProvision: to.Ptr(armsecurity.AutoProvisionOn), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.AutoProvisioningSetting = armsecurity.AutoProvisioningSetting{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/autoProvisioningSettings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/autoProvisioningSettings/default"), - // Properties: &armsecurity.AutoProvisioningSettingProperties{ - // AutoProvision: to.Ptr(armsecurity.AutoProvisionOn), - // }, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/autorest.md b/sdk/resourcemanager/security/armsecurity/autorest.md index 110930e58447..fc7c22380037 100644 --- a/sdk/resourcemanager/security/armsecurity/autorest.md +++ b/sdk/resourcemanager/security/armsecurity/autorest.md @@ -4,12 +4,11 @@ ``` yaml azure-arm: true -tag: package-composite-v3 require: -- https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/security/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/security/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.14.0 +module-version: 0.15.0 directive: - from: externalSecuritySolutions.json where: $.definitions['ExternalSecuritySolutionKind'] diff --git a/sdk/resourcemanager/security/armsecurity/azuredevopsorgs_client.go b/sdk/resourcemanager/security/armsecurity/azuredevopsorgs_client.go deleted file mode 100644 index 49e3fb64c318..000000000000 --- a/sdk/resourcemanager/security/armsecurity/azuredevopsorgs_client.go +++ /dev/null @@ -1,415 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// AzureDevOpsOrgsClient contains the methods for the AzureDevOpsOrgs group. -// Don't use this type directly, use NewAzureDevOpsOrgsClient() instead. -type AzureDevOpsOrgsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewAzureDevOpsOrgsClient creates a new instance of AzureDevOpsOrgsClient 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 NewAzureDevOpsOrgsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AzureDevOpsOrgsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &AzureDevOpsOrgsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreateOrUpdate - 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 -// - 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. -func (client *AzureDevOpsOrgsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, azureDevOpsOrg AzureDevOpsOrg, options *AzureDevOpsOrgsClientBeginCreateOrUpdateOptions) (*runtime.Poller[AzureDevOpsOrgsClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, securityConnectorName, orgName, azureDevOpsOrg, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureDevOpsOrgsClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AzureDevOpsOrgsClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// CreateOrUpdate - 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 -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" - 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, securityConnectorName, orgName, azureDevOpsOrg, 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 *AzureDevOpsOrgsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, azureDevOpsOrg AzureDevOpsOrg, options *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") - } - 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 orgName == "" { - return nil, errors.New("parameter orgName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{orgName}", url.PathEscape(orgName)) - 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-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, azureDevOpsOrg); err != nil { - return nil, err - } - return req, nil -} - -// Get - 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 -// - 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 - const operationName = "AzureDevOpsOrgsClient.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, securityConnectorName, orgName, options) - if err != nil { - return AzureDevOpsOrgsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AzureDevOpsOrgsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AzureDevOpsOrgsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *AzureDevOpsOrgsClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, options *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") - } - 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 orgName == "" { - return nil, errors.New("parameter orgName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{orgName}", url.PathEscape(orgName)) - 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-09-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 *AzureDevOpsOrgsClient) getHandleResponse(resp *http.Response) (AzureDevOpsOrgsClientGetResponse, error) { - result := AzureDevOpsOrgsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureDevOpsOrg); err != nil { - return AzureDevOpsOrgsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Returns a list of Azure DevOps organizations onboarded to the connector. -// -// Generated from API version 2023-09-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 -// method. -func (client *AzureDevOpsOrgsClient) NewListPager(resourceGroupName string, securityConnectorName string, options *AzureDevOpsOrgsClientListOptions) *runtime.Pager[AzureDevOpsOrgsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[AzureDevOpsOrgsClientListResponse]{ - More: func(page AzureDevOpsOrgsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *AzureDevOpsOrgsClientListResponse) (AzureDevOpsOrgsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AzureDevOpsOrgsClient.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, securityConnectorName, options) - }, nil) - if err != nil { - return AzureDevOpsOrgsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *AzureDevOpsOrgsClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if securityConnectorName == "" { - return nil, errors.New("parameter securityConnectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-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 *AzureDevOpsOrgsClient) listHandleResponse(resp *http.Response) (AzureDevOpsOrgsClientListResponse, error) { - result := AzureDevOpsOrgsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureDevOpsOrgListResponse); err != nil { - return AzureDevOpsOrgsClientListResponse{}, err - } - return result, nil -} - -// ListAvailable - 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 -// - 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 -// method. -func (client *AzureDevOpsOrgsClient) ListAvailable(ctx context.Context, resourceGroupName string, securityConnectorName string, options *AzureDevOpsOrgsClientListAvailableOptions) (AzureDevOpsOrgsClientListAvailableResponse, error) { - var err error - const operationName = "AzureDevOpsOrgsClient.ListAvailable" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listAvailableCreateRequest(ctx, resourceGroupName, securityConnectorName, options) - if err != nil { - return AzureDevOpsOrgsClientListAvailableResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AzureDevOpsOrgsClientListAvailableResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AzureDevOpsOrgsClientListAvailableResponse{}, err - } - resp, err := client.listAvailableHandleResponse(httpResp) - return resp, err -} - -// listAvailableCreateRequest creates the ListAvailable request. -func (client *AzureDevOpsOrgsClient) listAvailableCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if securityConnectorName == "" { - return nil, errors.New("parameter securityConnectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listAvailableHandleResponse handles the ListAvailable response. -func (client *AzureDevOpsOrgsClient) listAvailableHandleResponse(resp *http.Response) (AzureDevOpsOrgsClientListAvailableResponse, error) { - result := AzureDevOpsOrgsClientListAvailableResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureDevOpsOrgListResponse); err != nil { - return AzureDevOpsOrgsClientListAvailableResponse{}, err - } - return result, nil -} - -// BeginUpdate - Updates monitored Azure DevOps organization details. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-09-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. -func (client *AzureDevOpsOrgsClient) BeginUpdate(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, azureDevOpsOrg AzureDevOpsOrg, options *AzureDevOpsOrgsClientBeginUpdateOptions) (*runtime.Poller[AzureDevOpsOrgsClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, securityConnectorName, orgName, azureDevOpsOrg, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureDevOpsOrgsClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AzureDevOpsOrgsClientUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Update - Updates monitored Azure DevOps organization details. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-09-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" - 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, securityConnectorName, orgName, azureDevOpsOrg, 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 -} - -// 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) { - 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") - } - 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 orgName == "" { - return nil, errors.New("parameter orgName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{orgName}", url.PathEscape(orgName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, azureDevOpsOrg); err != nil { - return nil, err - } - return req, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/azuredevopsorgs_client_example_test.go b/sdk/resourcemanager/security/armsecurity/azuredevopsorgs_client_example_test.go deleted file mode 100644 index c3d16d9fc989..000000000000 --- a/sdk/resourcemanager/security/armsecurity/azuredevopsorgs_client_example_test.go +++ /dev/null @@ -1,235 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/2023-09-01-preview/examples/SecurityConnectorsDevOps/ListAvailableAzureDevOpsOrgs_example.json -func ExampleAzureDevOpsOrgsClient_ListAvailable() { - 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.NewAzureDevOpsOrgsClient().ListAvailable(ctx, "myRg", "mySecurityConnectorName", 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.AzureDevOpsOrgListResponse = armsecurity.AzureDevOpsOrgListResponse{ - // Value: []*armsecurity.AzureDevOpsOrg{ - // { - // Name: to.Ptr("myAzDevOpsOrg"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/azureDevOpsOrgs/myAzDevOpsOrg"), - // Properties: &armsecurity.AzureDevOpsOrgProperties{ - // ActionableRemediation: &armsecurity.ActionableRemediation{ - // State: to.Ptr(armsecurity.ActionableRemediationStateEnabled), - // }, - // OnboardingState: to.Ptr(armsecurity.OnboardingStateOnboarded), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("anotherOrg"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/azureDevOpsOrgs/anotherOrg"), - // Properties: &armsecurity.AzureDevOpsOrgProperties{ - // ActionableRemediation: &armsecurity.ActionableRemediation{ - // State: to.Ptr(armsecurity.ActionableRemediationStateEnabled), - // }, - // OnboardingState: to.Ptr(armsecurity.OnboardingStateOnboardedByOtherConnector), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("notOnboardedOrg"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/azureDevOpsOrgs/notOnboardedOrg"), - // Properties: &armsecurity.AzureDevOpsOrgProperties{ - // ActionableRemediation: &armsecurity.ActionableRemediation{ - // State: to.Ptr(armsecurity.ActionableRemediationStateNone), - // }, - // OnboardingState: to.Ptr(armsecurity.OnboardingStateNotOnboarded), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-09-01-preview/examples/SecurityConnectorsDevOps/ListAzureDevOpsOrgs_example.json -func ExampleAzureDevOpsOrgsClient_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.NewAzureDevOpsOrgsClient().NewListPager("myRg", "mySecurityConnectorName", 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.AzureDevOpsOrgListResponse = armsecurity.AzureDevOpsOrgListResponse{ - // Value: []*armsecurity.AzureDevOpsOrg{ - // { - // Name: to.Ptr("myAzDevOpsOrg"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/azureDevOpsOrgs/myAzDevOpsOrg"), - // Properties: &armsecurity.AzureDevOpsOrgProperties{ - // ActionableRemediation: &armsecurity.ActionableRemediation{ - // State: to.Ptr(armsecurity.ActionableRemediationStateEnabled), - // }, - // OnboardingState: to.Ptr(armsecurity.OnboardingStateOnboarded), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-09-01-preview/examples/SecurityConnectorsDevOps/GetAzureDevOpsOrgs_example.json -func ExampleAzureDevOpsOrgsClient_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.NewAzureDevOpsOrgsClient().Get(ctx, "myRg", "mySecurityConnectorName", "myAzDevOpsOrg", 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.AzureDevOpsOrg = armsecurity.AzureDevOpsOrg{ - // Name: to.Ptr("myAzDevOpsOrg"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/azureDevOpsOrgs/myAzDevOpsOrg"), - // Properties: &armsecurity.AzureDevOpsOrgProperties{ - // ActionableRemediation: &armsecurity.ActionableRemediation{ - // State: to.Ptr(armsecurity.ActionableRemediationStateEnabled), - // }, - // OnboardingState: to.Ptr(armsecurity.OnboardingStateOnboarded), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-09-01-preview/examples/SecurityConnectorsDevOps/CreateOrUpdateAzureDevOpsOrgs_example.json -func ExampleAzureDevOpsOrgsClient_BeginCreateOrUpdate() { - 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.NewAzureDevOpsOrgsClient().BeginCreateOrUpdate(ctx, "myRg", "mySecurityConnectorName", "myAzDevOpsOrg", armsecurity.AzureDevOpsOrg{ - Properties: &armsecurity.AzureDevOpsOrgProperties{ - ActionableRemediation: &armsecurity.ActionableRemediation{ - State: to.Ptr(armsecurity.ActionableRemediationStateEnabled), - }, - OnboardingState: to.Ptr(armsecurity.OnboardingStateNotApplicable), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %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.AzureDevOpsOrg = armsecurity.AzureDevOpsOrg{ - // Name: to.Ptr("myAzDevOpsOrg"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/azureDevOpsOrgs/myAzDevOpsOrg"), - // Properties: &armsecurity.AzureDevOpsOrgProperties{ - // ActionableRemediation: &armsecurity.ActionableRemediation{ - // State: to.Ptr(armsecurity.ActionableRemediationStateEnabled), - // }, - // OnboardingState: to.Ptr(armsecurity.OnboardingStateOnboarded), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-09-01-preview/examples/SecurityConnectorsDevOps/UpdateAzureDevOpsOrgs_example.json -func ExampleAzureDevOpsOrgsClient_BeginUpdate() { - 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.NewAzureDevOpsOrgsClient().BeginUpdate(ctx, "myRg", "mySecurityConnectorName", "myAzDevOpsOrg", armsecurity.AzureDevOpsOrg{ - Properties: &armsecurity.AzureDevOpsOrgProperties{ - ActionableRemediation: &armsecurity.ActionableRemediation{ - State: to.Ptr(armsecurity.ActionableRemediationStateEnabled), - }, - OnboardingState: to.Ptr(armsecurity.OnboardingStateNotApplicable), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %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.AzureDevOpsOrg = armsecurity.AzureDevOpsOrg{ - // Name: to.Ptr("myAzDevOpsOrg"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/azureDevOpsOrgs/myAzDevOpsOrg"), - // Properties: &armsecurity.AzureDevOpsOrgProperties{ - // ActionableRemediation: &armsecurity.ActionableRemediation{ - // State: to.Ptr(armsecurity.ActionableRemediationStateEnabled), - // }, - // OnboardingState: to.Ptr(armsecurity.OnboardingStateOnboarded), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // }, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/azuredevopsprojects_client.go b/sdk/resourcemanager/security/armsecurity/azuredevopsprojects_client.go deleted file mode 100644 index 1f7451f44487..000000000000 --- a/sdk/resourcemanager/security/armsecurity/azuredevopsprojects_client.go +++ /dev/null @@ -1,370 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// AzureDevOpsProjectsClient contains the methods for the AzureDevOpsProjects group. -// Don't use this type directly, use NewAzureDevOpsProjectsClient() instead. -type AzureDevOpsProjectsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewAzureDevOpsProjectsClient creates a new instance of AzureDevOpsProjectsClient 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 NewAzureDevOpsProjectsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AzureDevOpsProjectsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &AzureDevOpsProjectsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreateOrUpdate - 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 -// - 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. -func (client *AzureDevOpsProjectsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, azureDevOpsProject AzureDevOpsProject, options *AzureDevOpsProjectsClientBeginCreateOrUpdateOptions) (*runtime.Poller[AzureDevOpsProjectsClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, securityConnectorName, orgName, projectName, azureDevOpsProject, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureDevOpsProjectsClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AzureDevOpsProjectsClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// CreateOrUpdate - 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 -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" - 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, securityConnectorName, orgName, projectName, azureDevOpsProject, 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 *AzureDevOpsProjectsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, azureDevOpsProject AzureDevOpsProject, options *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") - } - 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 orgName == "" { - return nil, errors.New("parameter orgName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{orgName}", url.PathEscape(orgName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - 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-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, azureDevOpsProject); err != nil { - return nil, err - } - return req, nil -} - -// Get - 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 -// - 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 - const operationName = "AzureDevOpsProjectsClient.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, securityConnectorName, orgName, projectName, options) - if err != nil { - return AzureDevOpsProjectsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AzureDevOpsProjectsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AzureDevOpsProjectsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// 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) { - 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") - } - 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 orgName == "" { - return nil, errors.New("parameter orgName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{orgName}", url.PathEscape(orgName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - 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-09-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 *AzureDevOpsProjectsClient) getHandleResponse(resp *http.Response) (AzureDevOpsProjectsClientGetResponse, error) { - result := AzureDevOpsProjectsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureDevOpsProject); err != nil { - return AzureDevOpsProjectsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Returns a list of Azure DevOps projects onboarded to the connector. -// -// Generated from API version 2023-09-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] { - return runtime.NewPager(runtime.PagingHandler[AzureDevOpsProjectsClientListResponse]{ - More: func(page AzureDevOpsProjectsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *AzureDevOpsProjectsClientListResponse) (AzureDevOpsProjectsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AzureDevOpsProjectsClient.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, securityConnectorName, orgName, options) - }, nil) - if err != nil { - return AzureDevOpsProjectsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *AzureDevOpsProjectsClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, options *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") - } - 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 orgName == "" { - return nil, errors.New("parameter orgName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{orgName}", url.PathEscape(orgName)) - 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-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 *AzureDevOpsProjectsClient) listHandleResponse(resp *http.Response) (AzureDevOpsProjectsClientListResponse, error) { - result := AzureDevOpsProjectsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureDevOpsProjectListResponse); err != nil { - return AzureDevOpsProjectsClientListResponse{}, err - } - return result, nil -} - -// BeginUpdate - 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 -// - 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. -func (client *AzureDevOpsProjectsClient) BeginUpdate(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, azureDevOpsProject AzureDevOpsProject, options *AzureDevOpsProjectsClientBeginUpdateOptions) (*runtime.Poller[AzureDevOpsProjectsClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, securityConnectorName, orgName, projectName, azureDevOpsProject, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureDevOpsProjectsClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AzureDevOpsProjectsClientUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Update - 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 -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" - 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, securityConnectorName, orgName, projectName, azureDevOpsProject, 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 -} - -// 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) { - 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") - } - 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 orgName == "" { - return nil, errors.New("parameter orgName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{orgName}", url.PathEscape(orgName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, azureDevOpsProject); err != nil { - return nil, err - } - return req, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/azuredevopsprojects_client_example_test.go b/sdk/resourcemanager/security/armsecurity/azuredevopsprojects_client_example_test.go deleted file mode 100644 index 67af938543b5..000000000000 --- a/sdk/resourcemanager/security/armsecurity/azuredevopsprojects_client_example_test.go +++ /dev/null @@ -1,185 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// 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/2023-09-01-preview/examples/SecurityConnectorsDevOps/ListAzureDevOpsProjects_example.json -func ExampleAzureDevOpsProjectsClient_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.NewAzureDevOpsProjectsClient().NewListPager("myRg", "mySecurityConnectorName", "myAzDevOpsOrg", 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.AzureDevOpsProjectListResponse = armsecurity.AzureDevOpsProjectListResponse{ - // Value: []*armsecurity.AzureDevOpsProject{ - // { - // Name: to.Ptr("myAzDevOpsProject"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/azureDevOpsOrgs/myAzDevOpsOrg/projects/myAzDevOpsProject"), - // Properties: &armsecurity.AzureDevOpsProjectProperties{ - // ActionableRemediation: &armsecurity.ActionableRemediation{ - // State: to.Ptr(armsecurity.ActionableRemediationStateEnabled), - // }, - // OnboardingState: to.Ptr(armsecurity.OnboardingStateOnboarded), - // ParentOrgName: to.Ptr("myAzDevOpsOrg"), - // ProjectID: to.Ptr("9ebbed8f-a9cc-405f-a647-b235e22179de"), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-09-01-preview/examples/SecurityConnectorsDevOps/GetAzureDevOpsProjects_example.json -func ExampleAzureDevOpsProjectsClient_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.NewAzureDevOpsProjectsClient().Get(ctx, "myRg", "mySecurityConnectorName", "myAzDevOpsOrg", "myAzDevOpsProject", 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.AzureDevOpsProject = armsecurity.AzureDevOpsProject{ - // Name: to.Ptr("myAzDevOpsProject"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/azureDevOpsOrgs/myAzDevOpsOrg/projects/myAzDevOpsProject"), - // Properties: &armsecurity.AzureDevOpsProjectProperties{ - // ActionableRemediation: &armsecurity.ActionableRemediation{ - // State: to.Ptr(armsecurity.ActionableRemediationStateEnabled), - // }, - // OnboardingState: to.Ptr(armsecurity.OnboardingStateOnboarded), - // ParentOrgName: to.Ptr("myAzDevOpsOrg"), - // ProjectID: to.Ptr("9ebbed8f-a9cc-405f-a647-b235e22179de"), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-09-01-preview/examples/SecurityConnectorsDevOps/CreateOrUpdateAzureDevOpsProjects_example.json -func ExampleAzureDevOpsProjectsClient_BeginCreateOrUpdate() { - 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.NewAzureDevOpsProjectsClient().BeginCreateOrUpdate(ctx, "myRg", "mySecurityConnectorName", "myAzDevOpsOrg", "myAzDevOpsProject", armsecurity.AzureDevOpsProject{ - Properties: &armsecurity.AzureDevOpsProjectProperties{ - ActionableRemediation: &armsecurity.ActionableRemediation{ - State: to.Ptr(armsecurity.ActionableRemediationStateEnabled), - }, - OnboardingState: to.Ptr(armsecurity.OnboardingStateNotApplicable), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %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.AzureDevOpsProject = armsecurity.AzureDevOpsProject{ - // Name: to.Ptr("myAzDevOpsProject"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/azureDevOpsOrgs/myAzDevOpsOrg/projects/myAzDevOpsProject"), - // Properties: &armsecurity.AzureDevOpsProjectProperties{ - // ActionableRemediation: &armsecurity.ActionableRemediation{ - // State: to.Ptr(armsecurity.ActionableRemediationStateEnabled), - // }, - // OnboardingState: to.Ptr(armsecurity.OnboardingStateOnboarded), - // ParentOrgName: to.Ptr("myAzDevOpsOrg"), - // ProjectID: to.Ptr("9ebbed8f-a9cc-405f-a647-b235e22179de"), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-09-01-preview/examples/SecurityConnectorsDevOps/UpdateAzureDevOpsProjects_example.json -func ExampleAzureDevOpsProjectsClient_BeginUpdate() { - 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.NewAzureDevOpsProjectsClient().BeginUpdate(ctx, "myRg", "mySecurityConnectorName", "myAzDevOpsOrg", "myAzDevOpsProject", armsecurity.AzureDevOpsProject{ - Properties: &armsecurity.AzureDevOpsProjectProperties{ - ActionableRemediation: &armsecurity.ActionableRemediation{ - State: to.Ptr(armsecurity.ActionableRemediationStateEnabled), - }, - OnboardingState: to.Ptr(armsecurity.OnboardingStateNotApplicable), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %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.AzureDevOpsProject = armsecurity.AzureDevOpsProject{ - // Name: to.Ptr("myAzDevOpsProject"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/azureDevOpsOrgs/myAzDevOpsOrg/projects/myAzDevOpsProject"), - // Properties: &armsecurity.AzureDevOpsProjectProperties{ - // ActionableRemediation: &armsecurity.ActionableRemediation{ - // State: to.Ptr(armsecurity.ActionableRemediationStateEnabled), - // }, - // OnboardingState: to.Ptr(armsecurity.OnboardingStateOnboarded), - // ParentOrgName: to.Ptr("myAzDevOpsOrg"), - // ProjectID: to.Ptr("9ebbed8f-a9cc-405f-a647-b235e22179de"), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // }, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/azuredevopsrepos_client.go b/sdk/resourcemanager/security/armsecurity/azuredevopsrepos_client.go deleted file mode 100644 index be73e1f4adde..000000000000 --- a/sdk/resourcemanager/security/armsecurity/azuredevopsrepos_client.go +++ /dev/null @@ -1,390 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// AzureDevOpsReposClient contains the methods for the AzureDevOpsRepos group. -// Don't use this type directly, use NewAzureDevOpsReposClient() instead. -type AzureDevOpsReposClient struct { - internal *arm.Client - subscriptionID string -} - -// NewAzureDevOpsReposClient creates a new instance of AzureDevOpsReposClient 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 NewAzureDevOpsReposClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AzureDevOpsReposClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &AzureDevOpsReposClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreateOrUpdate - 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 -// - 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. -func (client *AzureDevOpsReposClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, repoName string, azureDevOpsRepository AzureDevOpsRepository, options *AzureDevOpsReposClientBeginCreateOrUpdateOptions) (*runtime.Poller[AzureDevOpsReposClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, securityConnectorName, orgName, projectName, repoName, azureDevOpsRepository, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureDevOpsReposClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AzureDevOpsReposClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// CreateOrUpdate - 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 -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" - 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, securityConnectorName, orgName, projectName, repoName, azureDevOpsRepository, 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 *AzureDevOpsReposClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, repoName string, azureDevOpsRepository AzureDevOpsRepository, options *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") - } - 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 orgName == "" { - return nil, errors.New("parameter orgName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{orgName}", url.PathEscape(orgName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, azureDevOpsRepository); err != nil { - return nil, err - } - return req, nil -} - -// Get - 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 -// - 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 - const operationName = "AzureDevOpsReposClient.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, securityConnectorName, orgName, projectName, repoName, options) - if err != nil { - return AzureDevOpsReposClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AzureDevOpsReposClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AzureDevOpsReposClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// 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) { - 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") - } - 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 orgName == "" { - return nil, errors.New("parameter orgName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{orgName}", url.PathEscape(orgName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - 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.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-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 *AzureDevOpsReposClient) getHandleResponse(resp *http.Response) (AzureDevOpsReposClientGetResponse, error) { - result := AzureDevOpsReposClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureDevOpsRepository); err != nil { - return AzureDevOpsReposClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Returns a list of Azure DevOps repositories onboarded to the connector. -// -// Generated from API version 2023-09-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] { - return runtime.NewPager(runtime.PagingHandler[AzureDevOpsReposClientListResponse]{ - More: func(page AzureDevOpsReposClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *AzureDevOpsReposClientListResponse) (AzureDevOpsReposClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AzureDevOpsReposClient.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, securityConnectorName, orgName, projectName, options) - }, nil) - if err != nil { - return AzureDevOpsReposClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// 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) { - 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") - } - 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 orgName == "" { - return nil, errors.New("parameter orgName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{orgName}", url.PathEscape(orgName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - 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-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 *AzureDevOpsReposClient) listHandleResponse(resp *http.Response) (AzureDevOpsReposClientListResponse, error) { - result := AzureDevOpsReposClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureDevOpsRepositoryListResponse); err != nil { - return AzureDevOpsReposClientListResponse{}, err - } - return result, nil -} - -// BeginUpdate - 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 -// - 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. -func (client *AzureDevOpsReposClient) BeginUpdate(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, repoName string, azureDevOpsRepository AzureDevOpsRepository, options *AzureDevOpsReposClientBeginUpdateOptions) (*runtime.Poller[AzureDevOpsReposClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, securityConnectorName, orgName, projectName, repoName, azureDevOpsRepository, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureDevOpsReposClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AzureDevOpsReposClientUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Update - 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 -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" - 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, securityConnectorName, orgName, projectName, repoName, azureDevOpsRepository, 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 -} - -// 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) { - 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") - } - 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 orgName == "" { - return nil, errors.New("parameter orgName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{orgName}", url.PathEscape(orgName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - 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.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, azureDevOpsRepository); err != nil { - return nil, err - } - return req, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/azuredevopsrepos_client_example_test.go b/sdk/resourcemanager/security/armsecurity/azuredevopsrepos_client_example_test.go deleted file mode 100644 index 86fa647a942f..000000000000 --- a/sdk/resourcemanager/security/armsecurity/azuredevopsrepos_client_example_test.go +++ /dev/null @@ -1,189 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/2023-09-01-preview/examples/SecurityConnectorsDevOps/ListAzureDevOpsRepos_example.json -func ExampleAzureDevOpsReposClient_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.NewAzureDevOpsReposClient().NewListPager("myRg", "mySecurityConnectorName", "myAzDevOpsOrg", "myAzDevOpsProject", 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.AzureDevOpsRepositoryListResponse = armsecurity.AzureDevOpsRepositoryListResponse{ - // Value: []*armsecurity.AzureDevOpsRepository{ - // { - // Name: to.Ptr("myAzDevOpsRepo"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects/repos"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/azureDevOpsOrgs/myAzDevOpsOrg/projects/myAzDevOpsProject/repos/myAzDevOpsRepo"), - // Properties: &armsecurity.AzureDevOpsRepositoryProperties{ - // ActionableRemediation: &armsecurity.ActionableRemediation{ - // State: to.Ptr(armsecurity.ActionableRemediationStateEnabled), - // }, - // OnboardingState: to.Ptr(armsecurity.OnboardingStateOnboarded), - // ParentOrgName: to.Ptr("myAzDevOpsOrg"), - // ParentProjectName: to.Ptr("myAzDevOpsProject"), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // RepoID: to.Ptr("cb64ab91-c9ba-46df-b44c-c769358bccdf"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-09-01-preview/examples/SecurityConnectorsDevOps/GetAzureDevOpsRepos_example.json -func ExampleAzureDevOpsReposClient_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.NewAzureDevOpsReposClient().Get(ctx, "myRg", "mySecurityConnectorName", "myAzDevOpsOrg", "myAzDevOpsProject", "myAzDevOpsRepo", 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.AzureDevOpsRepository = armsecurity.AzureDevOpsRepository{ - // Name: to.Ptr("myAzDevOpsRepo"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects/repos"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/azureDevOpsOrgs/myAzDevOpsOrg/projects/myAzDevOpsProject/repos/myAzDevOpsRepo"), - // Properties: &armsecurity.AzureDevOpsRepositoryProperties{ - // ActionableRemediation: &armsecurity.ActionableRemediation{ - // State: to.Ptr(armsecurity.ActionableRemediationStateEnabled), - // }, - // OnboardingState: to.Ptr(armsecurity.OnboardingStateOnboarded), - // ParentOrgName: to.Ptr("myAzDevOpsOrg"), - // ParentProjectName: to.Ptr("myAzDevOpsProject"), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // RepoID: to.Ptr("cb64ab91-c9ba-46df-b44c-c769358bccdf"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-09-01-preview/examples/SecurityConnectorsDevOps/CreateOrUpdateAzureDevOpsRepos_example.json -func ExampleAzureDevOpsReposClient_BeginCreateOrUpdate() { - 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.NewAzureDevOpsReposClient().BeginCreateOrUpdate(ctx, "myRg", "mySecurityConnectorName", "myAzDevOpsOrg", "myAzDevOpsProject", "myAzDevOpsRepo", armsecurity.AzureDevOpsRepository{ - Properties: &armsecurity.AzureDevOpsRepositoryProperties{ - ActionableRemediation: &armsecurity.ActionableRemediation{ - State: to.Ptr(armsecurity.ActionableRemediationStateEnabled), - }, - OnboardingState: to.Ptr(armsecurity.OnboardingStateNotApplicable), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %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.AzureDevOpsRepository = armsecurity.AzureDevOpsRepository{ - // Name: to.Ptr("myAzDevOpsRepo"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects/repos"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/azureDevOpsOrgs/myAzDevOpsOrg/projects/myAzDevOpsProject/repos/myAzDevOpsRepo"), - // Properties: &armsecurity.AzureDevOpsRepositoryProperties{ - // ActionableRemediation: &armsecurity.ActionableRemediation{ - // State: to.Ptr(armsecurity.ActionableRemediationStateEnabled), - // }, - // OnboardingState: to.Ptr(armsecurity.OnboardingStateOnboarded), - // ParentOrgName: to.Ptr("myAzDevOpsOrg"), - // ParentProjectName: to.Ptr("myAzDevOpsProject"), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // RepoID: to.Ptr("cb64ab91-c9ba-46df-b44c-c769358bccdf"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-09-01-preview/examples/SecurityConnectorsDevOps/UpdateAzureDevOpsRepos_example.json -func ExampleAzureDevOpsReposClient_BeginUpdate() { - 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.NewAzureDevOpsReposClient().BeginUpdate(ctx, "myRg", "mySecurityConnectorName", "myAzDevOpsOrg", "myAzDevOpsProject", "myAzDevOpsRepo", armsecurity.AzureDevOpsRepository{ - Properties: &armsecurity.AzureDevOpsRepositoryProperties{ - ActionableRemediation: &armsecurity.ActionableRemediation{ - State: to.Ptr(armsecurity.ActionableRemediationStateEnabled), - }, - OnboardingState: to.Ptr(armsecurity.OnboardingStateNotApplicable), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %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.AzureDevOpsRepository = armsecurity.AzureDevOpsRepository{ - // Name: to.Ptr("myAzDevOpsRepo"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops/azureDevOpsOrgs/projects/repos"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/azureDevOpsOrgs/myAzDevOpsOrg/projects/myAzDevOpsProject/repos/myAzDevOpsRepo"), - // Properties: &armsecurity.AzureDevOpsRepositoryProperties{ - // ActionableRemediation: &armsecurity.ActionableRemediation{ - // State: to.Ptr(armsecurity.ActionableRemediationStateEnabled), - // }, - // OnboardingState: to.Ptr(armsecurity.OnboardingStateOnboarded), - // ParentOrgName: to.Ptr("myAzDevOpsOrg"), - // ParentProjectName: to.Ptr("myAzDevOpsProject"), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // RepoID: to.Ptr("cb64ab91-c9ba-46df-b44c-c769358bccdf"), - // }, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/client_factory.go b/sdk/resourcemanager/security/armsecurity/client_factory.go index 53440ccda54d..7254c4e7ab58 100644 --- a/sdk/resourcemanager/security/armsecurity/client_factory.go +++ b/sdk/resourcemanager/security/armsecurity/client_factory.go @@ -16,565 +16,26 @@ import ( // ClientFactory is a client factory used to create any client in this module. // Don't use this type directly, use NewClientFactory instead. type ClientFactory struct { - subscriptionID string - internal *arm.Client + internal *arm.Client } // 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 // - 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) { +func NewClientFactory(credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } return &ClientFactory{ - subscriptionID: subscriptionID, - internal: internal, + internal: internal, }, nil } -// NewAPICollectionsClient creates a new instance of APICollectionsClient. -func (c *ClientFactory) NewAPICollectionsClient() *APICollectionsClient { - return &APICollectionsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// 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{ - internal: c.internal, - } -} - -// NewAlertsClient creates a new instance of AlertsClient. -func (c *ClientFactory) NewAlertsClient() *AlertsClient { - return &AlertsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewAlertsSuppressionRulesClient creates a new instance of AlertsSuppressionRulesClient. -func (c *ClientFactory) NewAlertsSuppressionRulesClient() *AlertsSuppressionRulesClient { - return &AlertsSuppressionRulesClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewAllowedConnectionsClient creates a new instance of AllowedConnectionsClient. -func (c *ClientFactory) NewAllowedConnectionsClient() *AllowedConnectionsClient { - return &AllowedConnectionsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewApplicationClient creates a new instance of ApplicationClient. -func (c *ClientFactory) NewApplicationClient() *ApplicationClient { - return &ApplicationClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewApplicationsClient creates a new instance of ApplicationsClient. -func (c *ClientFactory) NewApplicationsClient() *ApplicationsClient { - return &ApplicationsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewAssessmentsClient creates a new instance of AssessmentsClient. -func (c *ClientFactory) NewAssessmentsClient() *AssessmentsClient { - return &AssessmentsClient{ - internal: c.internal, - } -} - -// NewAssessmentsMetadataClient creates a new instance of AssessmentsMetadataClient. -func (c *ClientFactory) NewAssessmentsMetadataClient() *AssessmentsMetadataClient { - return &AssessmentsMetadataClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewAutoProvisioningSettingsClient creates a new instance of AutoProvisioningSettingsClient. -func (c *ClientFactory) NewAutoProvisioningSettingsClient() *AutoProvisioningSettingsClient { - return &AutoProvisioningSettingsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewAutomationsClient creates a new instance of AutomationsClient. -func (c *ClientFactory) NewAutomationsClient() *AutomationsClient { - return &AutomationsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewAzureDevOpsOrgsClient creates a new instance of AzureDevOpsOrgsClient. -func (c *ClientFactory) NewAzureDevOpsOrgsClient() *AzureDevOpsOrgsClient { - return &AzureDevOpsOrgsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewAzureDevOpsProjectsClient creates a new instance of AzureDevOpsProjectsClient. -func (c *ClientFactory) NewAzureDevOpsProjectsClient() *AzureDevOpsProjectsClient { - return &AzureDevOpsProjectsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewAzureDevOpsReposClient creates a new instance of AzureDevOpsReposClient. -func (c *ClientFactory) NewAzureDevOpsReposClient() *AzureDevOpsReposClient { - return &AzureDevOpsReposClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewComplianceResultsClient creates a new instance of ComplianceResultsClient. -func (c *ClientFactory) NewComplianceResultsClient() *ComplianceResultsClient { - return &ComplianceResultsClient{ - internal: c.internal, - } -} - -// NewCompliancesClient creates a new instance of CompliancesClient. -func (c *ClientFactory) NewCompliancesClient() *CompliancesClient { - return &CompliancesClient{ - internal: c.internal, - } -} - -// NewConnectorApplicationClient creates a new instance of ConnectorApplicationClient. -func (c *ClientFactory) NewConnectorApplicationClient() *ConnectorApplicationClient { - return &ConnectorApplicationClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewConnectorApplicationsClient creates a new instance of ConnectorApplicationsClient. -func (c *ClientFactory) NewConnectorApplicationsClient() *ConnectorApplicationsClient { - return &ConnectorApplicationsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewConnectorsClient creates a new instance of ConnectorsClient. -func (c *ClientFactory) NewConnectorsClient() *ConnectorsClient { - return &ConnectorsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewContactsClient creates a new instance of ContactsClient. -func (c *ClientFactory) NewContactsClient() *ContactsClient { - return &ContactsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// 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, - } -} - // NewDefenderForStorageClient creates a new instance of DefenderForStorageClient. func (c *ClientFactory) NewDefenderForStorageClient() *DefenderForStorageClient { return &DefenderForStorageClient{ internal: c.internal, } } - -// NewDevOpsConfigurationsClient creates a new instance of DevOpsConfigurationsClient. -func (c *ClientFactory) NewDevOpsConfigurationsClient() *DevOpsConfigurationsClient { - return &DevOpsConfigurationsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewDevOpsOperationResultsClient creates a new instance of DevOpsOperationResultsClient. -func (c *ClientFactory) NewDevOpsOperationResultsClient() *DevOpsOperationResultsClient { - return &DevOpsOperationResultsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewDeviceSecurityGroupsClient creates a new instance of DeviceSecurityGroupsClient. -func (c *ClientFactory) NewDeviceSecurityGroupsClient() *DeviceSecurityGroupsClient { - return &DeviceSecurityGroupsClient{ - internal: c.internal, - } -} - -// NewDiscoveredSecuritySolutionsClient creates a new instance of DiscoveredSecuritySolutionsClient. -func (c *ClientFactory) NewDiscoveredSecuritySolutionsClient() *DiscoveredSecuritySolutionsClient { - return &DiscoveredSecuritySolutionsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewExternalSecuritySolutionsClient creates a new instance of ExternalSecuritySolutionsClient. -func (c *ClientFactory) NewExternalSecuritySolutionsClient() *ExternalSecuritySolutionsClient { - return &ExternalSecuritySolutionsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewGitHubOwnersClient creates a new instance of GitHubOwnersClient. -func (c *ClientFactory) NewGitHubOwnersClient() *GitHubOwnersClient { - return &GitHubOwnersClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewGitHubReposClient creates a new instance of GitHubReposClient. -func (c *ClientFactory) NewGitHubReposClient() *GitHubReposClient { - return &GitHubReposClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewGitLabGroupsClient creates a new instance of GitLabGroupsClient. -func (c *ClientFactory) NewGitLabGroupsClient() *GitLabGroupsClient { - return &GitLabGroupsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewGitLabProjectsClient creates a new instance of GitLabProjectsClient. -func (c *ClientFactory) NewGitLabProjectsClient() *GitLabProjectsClient { - return &GitLabProjectsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewGitLabSubgroupsClient creates a new instance of GitLabSubgroupsClient. -func (c *ClientFactory) NewGitLabSubgroupsClient() *GitLabSubgroupsClient { - return &GitLabSubgroupsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewGovernanceAssignmentsClient creates a new instance of GovernanceAssignmentsClient. -func (c *ClientFactory) NewGovernanceAssignmentsClient() *GovernanceAssignmentsClient { - return &GovernanceAssignmentsClient{ - internal: c.internal, - } -} - -// NewGovernanceRulesClient creates a new instance of GovernanceRulesClient. -func (c *ClientFactory) NewGovernanceRulesClient() *GovernanceRulesClient { - return &GovernanceRulesClient{ - internal: c.internal, - } -} - -// NewHealthReportsClient creates a new instance of HealthReportsClient. -func (c *ClientFactory) NewHealthReportsClient() *HealthReportsClient { - return &HealthReportsClient{ - internal: c.internal, - } -} - -// NewInformationProtectionPoliciesClient creates a new instance of InformationProtectionPoliciesClient. -func (c *ClientFactory) NewInformationProtectionPoliciesClient() *InformationProtectionPoliciesClient { - return &InformationProtectionPoliciesClient{ - internal: c.internal, - } -} - -// NewIotSecuritySolutionAnalyticsClient creates a new instance of IotSecuritySolutionAnalyticsClient. -func (c *ClientFactory) NewIotSecuritySolutionAnalyticsClient() *IotSecuritySolutionAnalyticsClient { - return &IotSecuritySolutionAnalyticsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewIotSecuritySolutionClient creates a new instance of IotSecuritySolutionClient. -func (c *ClientFactory) NewIotSecuritySolutionClient() *IotSecuritySolutionClient { - return &IotSecuritySolutionClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewIotSecuritySolutionsAnalyticsAggregatedAlertClient creates a new instance of IotSecuritySolutionsAnalyticsAggregatedAlertClient. -func (c *ClientFactory) NewIotSecuritySolutionsAnalyticsAggregatedAlertClient() *IotSecuritySolutionsAnalyticsAggregatedAlertClient { - return &IotSecuritySolutionsAnalyticsAggregatedAlertClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewIotSecuritySolutionsAnalyticsRecommendationClient creates a new instance of IotSecuritySolutionsAnalyticsRecommendationClient. -func (c *ClientFactory) NewIotSecuritySolutionsAnalyticsRecommendationClient() *IotSecuritySolutionsAnalyticsRecommendationClient { - return &IotSecuritySolutionsAnalyticsRecommendationClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewJitNetworkAccessPoliciesClient creates a new instance of JitNetworkAccessPoliciesClient. -func (c *ClientFactory) NewJitNetworkAccessPoliciesClient() *JitNetworkAccessPoliciesClient { - return &JitNetworkAccessPoliciesClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewLocationsClient creates a new instance of LocationsClient. -func (c *ClientFactory) NewLocationsClient() *LocationsClient { - return &LocationsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewMdeOnboardingsClient creates a new instance of MdeOnboardingsClient. -func (c *ClientFactory) NewMdeOnboardingsClient() *MdeOnboardingsClient { - return &MdeOnboardingsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewOperationsClient creates a new instance of OperationsClient. -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - return &OperationsClient{ - internal: c.internal, - } -} - -// NewOperatorsClient creates a new instance of OperatorsClient. -func (c *ClientFactory) NewOperatorsClient() *OperatorsClient { - return &OperatorsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewPricingsClient creates a new instance of PricingsClient. -func (c *ClientFactory) NewPricingsClient() *PricingsClient { - return &PricingsClient{ - internal: c.internal, - } -} - -// NewRegulatoryComplianceAssessmentsClient creates a new instance of RegulatoryComplianceAssessmentsClient. -func (c *ClientFactory) NewRegulatoryComplianceAssessmentsClient() *RegulatoryComplianceAssessmentsClient { - return &RegulatoryComplianceAssessmentsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewRegulatoryComplianceControlsClient creates a new instance of RegulatoryComplianceControlsClient. -func (c *ClientFactory) NewRegulatoryComplianceControlsClient() *RegulatoryComplianceControlsClient { - return &RegulatoryComplianceControlsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewRegulatoryComplianceStandardsClient creates a new instance of RegulatoryComplianceStandardsClient. -func (c *ClientFactory) NewRegulatoryComplianceStandardsClient() *RegulatoryComplianceStandardsClient { - return &RegulatoryComplianceStandardsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewSQLVulnerabilityAssessmentBaselineRulesClient creates a new instance of SQLVulnerabilityAssessmentBaselineRulesClient. -func (c *ClientFactory) NewSQLVulnerabilityAssessmentBaselineRulesClient() *SQLVulnerabilityAssessmentBaselineRulesClient { - return &SQLVulnerabilityAssessmentBaselineRulesClient{ - internal: c.internal, - } -} - -// NewSQLVulnerabilityAssessmentScanResultsClient creates a new instance of SQLVulnerabilityAssessmentScanResultsClient. -func (c *ClientFactory) NewSQLVulnerabilityAssessmentScanResultsClient() *SQLVulnerabilityAssessmentScanResultsClient { - return &SQLVulnerabilityAssessmentScanResultsClient{ - internal: c.internal, - } -} - -// NewSQLVulnerabilityAssessmentScansClient creates a new instance of SQLVulnerabilityAssessmentScansClient. -func (c *ClientFactory) NewSQLVulnerabilityAssessmentScansClient() *SQLVulnerabilityAssessmentScansClient { - return &SQLVulnerabilityAssessmentScansClient{ - internal: c.internal, - } -} - -// NewSecureScoreControlDefinitionsClient creates a new instance of SecureScoreControlDefinitionsClient. -func (c *ClientFactory) NewSecureScoreControlDefinitionsClient() *SecureScoreControlDefinitionsClient { - return &SecureScoreControlDefinitionsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewSecureScoreControlsClient creates a new instance of SecureScoreControlsClient. -func (c *ClientFactory) NewSecureScoreControlsClient() *SecureScoreControlsClient { - return &SecureScoreControlsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewSecureScoresClient creates a new instance of SecureScoresClient. -func (c *ClientFactory) NewSecureScoresClient() *SecureScoresClient { - return &SecureScoresClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewSensitivitySettingsClient creates a new instance of SensitivitySettingsClient. -func (c *ClientFactory) NewSensitivitySettingsClient() *SensitivitySettingsClient { - return &SensitivitySettingsClient{ - internal: c.internal, - } -} - -// NewServerVulnerabilityAssessmentClient creates a new instance of ServerVulnerabilityAssessmentClient. -func (c *ClientFactory) NewServerVulnerabilityAssessmentClient() *ServerVulnerabilityAssessmentClient { - return &ServerVulnerabilityAssessmentClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewServerVulnerabilityAssessmentsSettingsClient creates a new instance of ServerVulnerabilityAssessmentsSettingsClient. -func (c *ClientFactory) NewServerVulnerabilityAssessmentsSettingsClient() *ServerVulnerabilityAssessmentsSettingsClient { - return &ServerVulnerabilityAssessmentsSettingsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewSettingsClient creates a new instance of SettingsClient. -func (c *ClientFactory) NewSettingsClient() *SettingsClient { - return &SettingsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// 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{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewSolutionsReferenceDataClient creates a new instance of SolutionsReferenceDataClient. -func (c *ClientFactory) NewSolutionsReferenceDataClient() *SolutionsReferenceDataClient { - return &SolutionsReferenceDataClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewSubAssessmentsClient creates a new instance of SubAssessmentsClient. -func (c *ClientFactory) NewSubAssessmentsClient() *SubAssessmentsClient { - return &SubAssessmentsClient{ - internal: c.internal, - } -} - -// NewTasksClient creates a new instance of TasksClient. -func (c *ClientFactory) NewTasksClient() *TasksClient { - return &TasksClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewTopologyClient creates a new instance of TopologyClient. -func (c *ClientFactory) NewTopologyClient() *TopologyClient { - return &TopologyClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewWorkspaceSettingsClient creates a new instance of WorkspaceSettingsClient. -func (c *ClientFactory) NewWorkspaceSettingsClient() *WorkspaceSettingsClient { - return &WorkspaceSettingsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} diff --git a/sdk/resourcemanager/security/armsecurity/complianceresults_client.go b/sdk/resourcemanager/security/armsecurity/complianceresults_client.go deleted file mode 100644 index 8939dd56b750..000000000000 --- a/sdk/resourcemanager/security/armsecurity/complianceresults_client.go +++ /dev/null @@ -1,152 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// ComplianceResultsClient contains the methods for the ComplianceResults group. -// Don't use this type directly, use NewComplianceResultsClient() instead. -type ComplianceResultsClient struct { - internal *arm.Client -} - -// 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. -func NewComplianceResultsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ComplianceResultsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ComplianceResultsClient{ - internal: cl, - } - return client, nil -} - -// Get - Security Compliance Result -// 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 -// - 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 - const operationName = "ComplianceResultsClient.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, complianceResultName, options) - if err != nil { - return ComplianceResultsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ComplianceResultsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ComplianceResultsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ComplianceResultsClient) getCreateRequest(ctx context.Context, resourceID string, complianceResultName string, options *ComplianceResultsClientGetOptions) (*policy.Request, error) { - urlPath := "/{resourceId}/providers/Microsoft.Security/complianceResults/{complianceResultName}" - urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) - if complianceResultName == "" { - return nil, errors.New("parameter complianceResultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{complianceResultName}", url.PathEscape(complianceResultName)) - 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", "2017-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 *ComplianceResultsClient) getHandleResponse(resp *http.Response) (ComplianceResultsClientGetResponse, error) { - result := ComplianceResultsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ComplianceResult); err != nil { - return ComplianceResultsClientGetResponse{}, err - } - return result, nil -} - -// 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). -// - options - ComplianceResultsClientListOptions contains the optional parameters for the ComplianceResultsClient.NewListPager -// method. -func (client *ComplianceResultsClient) NewListPager(scope string, options *ComplianceResultsClientListOptions) *runtime.Pager[ComplianceResultsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[ComplianceResultsClientListResponse]{ - More: func(page ComplianceResultsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ComplianceResultsClientListResponse) (ComplianceResultsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ComplianceResultsClient.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 ComplianceResultsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *ComplianceResultsClient) listCreateRequest(ctx context.Context, scope string, options *ComplianceResultsClientListOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Security/complianceResults" - 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", "2017-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 *ComplianceResultsClient) listHandleResponse(resp *http.Response) (ComplianceResultsClientListResponse, error) { - result := ComplianceResultsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ComplianceResultList); err != nil { - return ComplianceResultsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/complianceresults_client_example_test.go b/sdk/resourcemanager/security/armsecurity/complianceresults_client_example_test.go deleted file mode 100644 index 57870a0841e1..000000000000 --- a/sdk/resourcemanager/security/armsecurity/complianceresults_client_example_test.go +++ /dev/null @@ -1,98 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2017-08-01/examples/ComplianceResults/ListComplianceResults_example.json -func ExampleComplianceResultsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewComplianceResultsClient().NewListPager("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", 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.ComplianceResultList = armsecurity.ComplianceResultList{ - // Value: []*armsecurity.ComplianceResult{ - // { - // Name: to.Ptr("DesignateMoreThanOneOwner"), - // Type: to.Ptr("Microsoft.Security/complianceResults"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/complianceResults/DesignateMoreThanOneOwner"), - // Properties: &armsecurity.ComplianceResultProperties{ - // ResourceStatus: to.Ptr(armsecurity.ResourceStatusHealthy), - // }, - // }, - // { - // Name: to.Ptr("RemoveExternalAccountsWithReadPermissions"), - // Type: to.Ptr("Microsoft.Security/complianceResults"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/complianceResults/RemoveExternalAccountsWithReadPermissions"), - // Properties: &armsecurity.ComplianceResultProperties{ - // ResourceStatus: to.Ptr(armsecurity.ResourceStatusNotHealthy), - // }, - // }, - // { - // Name: to.Ptr("RemoveDeprecatedAccounts"), - // Type: to.Ptr("Microsoft.Security/complianceResults"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/complianceResults/RemoveDeprecatedAccounts"), - // Properties: &armsecurity.ComplianceResultProperties{ - // ResourceStatus: to.Ptr(armsecurity.ResourceStatusHealthy), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2017-08-01/examples/ComplianceResults/GetComplianceResults_example.json -func ExampleComplianceResultsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewComplianceResultsClient().Get(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "DesignateMoreThanOneOwner", 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.ComplianceResult = armsecurity.ComplianceResult{ - // Name: to.Ptr("DesignateMoreThanOneOwner"), - // Type: to.Ptr("Microsoft.Security/complianceResults"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/complianceResults/DesignateMoreThanOneOwner"), - // Properties: &armsecurity.ComplianceResultProperties{ - // ResourceStatus: to.Ptr(armsecurity.ResourceStatusHealthy), - // }, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/compliances_client.go b/sdk/resourcemanager/security/armsecurity/compliances_client.go deleted file mode 100644 index 7700a00189c5..000000000000 --- a/sdk/resourcemanager/security/armsecurity/compliances_client.go +++ /dev/null @@ -1,152 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// CompliancesClient contains the methods for the Compliances group. -// Don't use this type directly, use NewCompliancesClient() instead. -type CompliancesClient struct { - internal *arm.Client -} - -// 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. -func NewCompliancesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*CompliancesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &CompliancesClient{ - internal: cl, - } - return client, nil -} - -// Get - Details of a specific Compliance. -// 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). -// - 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) { - var err error - const operationName = "CompliancesClient.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, complianceName, options) - if err != nil { - return CompliancesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return CompliancesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return CompliancesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *CompliancesClient) getCreateRequest(ctx context.Context, scope string, complianceName string, options *CompliancesClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Security/compliances/{complianceName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if complianceName == "" { - return nil, errors.New("parameter complianceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{complianceName}", url.PathEscape(complianceName)) - 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", "2017-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 *CompliancesClient) getHandleResponse(resp *http.Response) (CompliancesClientGetResponse, error) { - result := CompliancesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Compliance); err != nil { - return CompliancesClientGetResponse{}, err - } - return result, nil -} - -// 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). -// - 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]{ - More: func(page CompliancesClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *CompliancesClientListResponse) (CompliancesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CompliancesClient.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 CompliancesClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *CompliancesClient) listCreateRequest(ctx context.Context, scope string, options *CompliancesClientListOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Security/compliances" - 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", "2017-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 *CompliancesClient) listHandleResponse(resp *http.Response) (CompliancesClientListResponse, error) { - result := CompliancesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ComplianceList); err != nil { - return CompliancesClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/compliances_client_example_test.go b/sdk/resourcemanager/security/armsecurity/compliances_client_example_test.go deleted file mode 100644 index e244299c34fe..000000000000 --- a/sdk/resourcemanager/security/armsecurity/compliances_client_example_test.go +++ /dev/null @@ -1,122 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/Compliances/GetCompliances_example.json -func ExampleCompliancesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCompliancesClient().NewListPager("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", 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.ComplianceList = armsecurity.ComplianceList{ - // Value: []*armsecurity.Compliance{ - // { - // Name: to.Ptr("2018-01-01Z"), - // Type: to.Ptr("Microsoft.Security/compliances"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/compliances/2018-01-01Z"), - // Properties: &armsecurity.ComplianceProperties{ - // AssessmentResult: []*armsecurity.ComplianceSegment{ - // { - // Percentage: to.Ptr[float64](77.77777777777779), - // SegmentType: to.Ptr("Compliant"), - // }}, - // AssessmentTimestampUTCDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()), - // ResourceCount: to.Ptr[int32](18), - // }, - // }, - // { - // Name: to.Ptr("2018-01-02Z"), - // Type: to.Ptr("Microsoft.Security/compliances"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/compliances/2018-01-02Z"), - // Properties: &armsecurity.ComplianceProperties{ - // AssessmentResult: []*armsecurity.ComplianceSegment{ - // { - // Percentage: to.Ptr[float64](94.44444444444444), - // SegmentType: to.Ptr("Compliant"), - // }}, - // AssessmentTimestampUTCDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-02T00:00:00.000Z"); return t}()), - // ResourceCount: to.Ptr[int32](18), - // }, - // }, - // { - // Name: to.Ptr("2018-01-03Z"), - // Type: to.Ptr("Microsoft.Security/compliances"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/compliances/2018-01-03Z"), - // Properties: &armsecurity.ComplianceProperties{ - // AssessmentResult: []*armsecurity.ComplianceSegment{ - // { - // Percentage: to.Ptr[float64](100), - // SegmentType: to.Ptr("Compliant"), - // }}, - // AssessmentTimestampUTCDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-03T00:00:00.000Z"); return t}()), - // ResourceCount: to.Ptr[int32](18), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/Compliances/GetCompliance_example.json -func ExampleCompliancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCompliancesClient().Get(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "2018-01-01Z", 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.Compliance = armsecurity.Compliance{ - // Name: to.Ptr("2018-01-01Z"), - // Type: to.Ptr("Microsoft.Security/compliances"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/compliances/2018-01-01Z"), - // Properties: &armsecurity.ComplianceProperties{ - // AssessmentResult: []*armsecurity.ComplianceSegment{ - // { - // Percentage: to.Ptr[float64](77.77777777777779), - // SegmentType: to.Ptr("Compliant"), - // }}, - // AssessmentTimestampUTCDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()), - // ResourceCount: to.Ptr[int32](18), - // }, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/connectorapplication_client.go b/sdk/resourcemanager/security/armsecurity/connectorapplication_client.go deleted file mode 100644 index 4a1cb5501d5f..000000000000 --- a/sdk/resourcemanager/security/armsecurity/connectorapplication_client.go +++ /dev/null @@ -1,247 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// ConnectorApplicationClient contains the methods for the SecurityConnectorApplication group. -// Don't use this type directly, use NewConnectorApplicationClient() instead. -type ConnectorApplicationClient struct { - internal *arm.Client - subscriptionID string -} - -// NewConnectorApplicationClient creates a new instance of ConnectorApplicationClient with the specified values. -// - subscriptionID - Azure subscription ID -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewConnectorApplicationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConnectorApplicationClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ConnectorApplicationClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Creates or update a security Application on the given security connector. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-07-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - securityConnectorName - The security connector name. -// - applicationID - The security Application key - unique key for the standard application -// - application - Application over a subscription scope -// - options - ConnectorApplicationClientCreateOrUpdateOptions contains the optional parameters for the ConnectorApplicationClient.CreateOrUpdate -// method. -func (client *ConnectorApplicationClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, securityConnectorName string, applicationID string, application Application, options *ConnectorApplicationClientCreateOrUpdateOptions) (ConnectorApplicationClientCreateOrUpdateResponse, error) { - var err error - const operationName = "ConnectorApplicationClient.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, securityConnectorName, applicationID, application, options) - if err != nil { - return ConnectorApplicationClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ConnectorApplicationClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return ConnectorApplicationClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ConnectorApplicationClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, applicationID string, application Application, options *ConnectorApplicationClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if securityConnectorName == "" { - return nil, errors.New("parameter securityConnectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) - if applicationID == "" { - return nil, errors.New("parameter applicationID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{applicationId}", url.PathEscape(applicationID)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, application); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *ConnectorApplicationClient) createOrUpdateHandleResponse(resp *http.Response) (ConnectorApplicationClientCreateOrUpdateResponse, error) { - result := ConnectorApplicationClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Application); err != nil { - return ConnectorApplicationClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Delete an Application over a given scope -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-07-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - securityConnectorName - The security connector name. -// - applicationID - The security Application key - unique key for the standard application -// - options - ConnectorApplicationClientDeleteOptions contains the optional parameters for the ConnectorApplicationClient.Delete -// method. -func (client *ConnectorApplicationClient) Delete(ctx context.Context, resourceGroupName string, securityConnectorName string, applicationID string, options *ConnectorApplicationClientDeleteOptions) (ConnectorApplicationClientDeleteResponse, error) { - var err error - const operationName = "ConnectorApplicationClient.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, securityConnectorName, applicationID, options) - if err != nil { - return ConnectorApplicationClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ConnectorApplicationClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return ConnectorApplicationClientDeleteResponse{}, err - } - return ConnectorApplicationClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *ConnectorApplicationClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, applicationID string, options *ConnectorApplicationClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if securityConnectorName == "" { - return nil, errors.New("parameter securityConnectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) - if applicationID == "" { - return nil, errors.New("parameter applicationID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{applicationId}", url.PathEscape(applicationID)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - return req, nil -} - -// Get - Get a specific application for the requested scope by applicationId -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-07-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - securityConnectorName - The security connector name. -// - applicationID - The security Application key - unique key for the standard application -// - options - ConnectorApplicationClientGetOptions contains the optional parameters for the ConnectorApplicationClient.Get -// method. -func (client *ConnectorApplicationClient) Get(ctx context.Context, resourceGroupName string, securityConnectorName string, applicationID string, options *ConnectorApplicationClientGetOptions) (ConnectorApplicationClientGetResponse, error) { - var err error - const operationName = "ConnectorApplicationClient.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, securityConnectorName, applicationID, options) - if err != nil { - return ConnectorApplicationClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ConnectorApplicationClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ConnectorApplicationClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ConnectorApplicationClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, applicationID string, options *ConnectorApplicationClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if securityConnectorName == "" { - return nil, errors.New("parameter securityConnectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) - if applicationID == "" { - return nil, errors.New("parameter applicationID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{applicationId}", url.PathEscape(applicationID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ConnectorApplicationClient) getHandleResponse(resp *http.Response) (ConnectorApplicationClientGetResponse, error) { - result := ConnectorApplicationClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Application); err != nil { - return ConnectorApplicationClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/connectorapplication_client_example_test.go b/sdk/resourcemanager/security/armsecurity/connectorapplication_client_example_test.go deleted file mode 100644 index fdc1c97b55cf..000000000000 --- a/sdk/resourcemanager/security/armsecurity/connectorapplication_client_example_test.go +++ /dev/null @@ -1,132 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// 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/2022-07-01-preview/examples/Applications/GetSecurityConnectorApplication_example.json -func ExampleConnectorApplicationClient_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.NewConnectorApplicationClient().Get(ctx, "gcpResourceGroup", "gcpconnector", "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", 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.Application = armsecurity.Application{ - // Name: to.Ptr("ad9a8e26-29d9-4829-bb30-e597a58cdbb8"), - // Type: to.Ptr("Microsoft.Security/applications"), - // ID: to.Ptr("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector/providers/Microsoft.Security/applications/ad9a8e26-29d9-4829-bb30-e597a58cdbb8"), - // Properties: &armsecurity.ApplicationProperties{ - // Description: to.Ptr("An application on critical GCP recommendations"), - // ConditionSets: []any{ - // map[string]any{ - // "conditions":[]any{ - // map[string]any{ - // "operator": "contains", - // "property": "$.Id", - // "value": "-bil-", - // }, - // }, - // }}, - // DisplayName: to.Ptr("GCP Admin's application"), - // SourceResourceType: to.Ptr(armsecurity.ApplicationSourceResourceTypeAssessments), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/PutSecurityConnectorApplication_example.json -func ExampleConnectorApplicationClient_CreateOrUpdate() { - 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.NewConnectorApplicationClient().CreateOrUpdate(ctx, "gcpResourceGroup", "gcpconnector", "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", armsecurity.Application{ - Properties: &armsecurity.ApplicationProperties{ - Description: to.Ptr("An application on critical GCP recommendations"), - ConditionSets: []any{ - map[string]any{ - "conditions": []any{ - map[string]any{ - "operator": "contains", - "property": "$.Id", - "value": "-prod-", - }, - }, - }}, - DisplayName: to.Ptr("GCP Admin's application"), - SourceResourceType: to.Ptr(armsecurity.ApplicationSourceResourceTypeAssessments), - }, - }, 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.Application = armsecurity.Application{ - // Name: to.Ptr("1f3afdf9-d0c9-4c3d-847f-89da613e70a8"), - // Type: to.Ptr("Microsoft.Security/applications"), - // ID: to.Ptr("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector/providers/Microsoft.Security/applications/ad9a8e26-29d9-4829-bb30-e597a58cdbb8"), - // Properties: &armsecurity.ApplicationProperties{ - // Description: to.Ptr("An application on critical GCP recommendations"), - // ConditionSets: []any{ - // map[string]any{ - // "conditions":[]any{ - // map[string]any{ - // "operator": "contains", - // "property": "$.Id", - // "value": "-bil-", - // }, - // }, - // }}, - // DisplayName: to.Ptr("GCP Admin's application"), - // SourceResourceType: to.Ptr(armsecurity.ApplicationSourceResourceTypeAssessments), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/DeleteSecurityConnectorApplication_example.json -func ExampleConnectorApplicationClient_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.NewConnectorApplicationClient().Delete(ctx, "gcpResourceGroup", "gcpconnector", "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/connectorapplications_client.go b/sdk/resourcemanager/security/armsecurity/connectorapplications_client.go deleted file mode 100644 index afd889de2344..000000000000 --- a/sdk/resourcemanager/security/armsecurity/connectorapplications_client.go +++ /dev/null @@ -1,109 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// ConnectorApplicationsClient contains the methods for the SecurityConnectorApplications group. -// Don't use this type directly, use NewConnectorApplicationsClient() instead. -type ConnectorApplicationsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewConnectorApplicationsClient creates a new instance of ConnectorApplicationsClient with the specified values. -// - subscriptionID - Azure subscription ID -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewConnectorApplicationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConnectorApplicationsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ConnectorApplicationsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// NewListPager - Get a list of all relevant applications over a security connector level scope -// -// Generated from API version 2022-07-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - securityConnectorName - The security connector name. -// - options - ConnectorApplicationsClientListOptions contains the optional parameters for the ConnectorApplicationsClient.NewListPager -// method. -func (client *ConnectorApplicationsClient) NewListPager(resourceGroupName string, securityConnectorName string, options *ConnectorApplicationsClientListOptions) *runtime.Pager[ConnectorApplicationsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[ConnectorApplicationsClientListResponse]{ - More: func(page ConnectorApplicationsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ConnectorApplicationsClientListResponse) (ConnectorApplicationsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ConnectorApplicationsClient.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, securityConnectorName, options) - }, nil) - if err != nil { - return ConnectorApplicationsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *ConnectorApplicationsClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, options *ConnectorApplicationsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if securityConnectorName == "" { - return nil, errors.New("parameter securityConnectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *ConnectorApplicationsClient) listHandleResponse(resp *http.Response) (ConnectorApplicationsClientListResponse, error) { - result := ConnectorApplicationsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationsList); err != nil { - return ConnectorApplicationsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/connectorapplications_client_example_test.go b/sdk/resourcemanager/security/armsecurity/connectorapplications_client_example_test.go deleted file mode 100644 index 830bd48f5681..000000000000 --- a/sdk/resourcemanager/security/armsecurity/connectorapplications_client_example_test.go +++ /dev/null @@ -1,86 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/ListBySecurityConnectorApplications_example.json -func ExampleConnectorApplicationsClient_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.NewConnectorApplicationsClient().NewListPager("gcpResourceGroup", "gcpconnector", 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.ApplicationsList = armsecurity.ApplicationsList{ - // Value: []*armsecurity.Application{ - // { - // Name: to.Ptr("ad9a8e26-29d9-4829-bb30-e597a58cdbb8"), - // Type: to.Ptr("Microsoft.Security/applications"), - // ID: to.Ptr("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector/providers/Microsoft.Security/applications/ad9a8e26-29d9-4829-bb30-e597a58cdbb8"), - // Properties: &armsecurity.ApplicationProperties{ - // Description: to.Ptr("An application on critical GCP recommendations"), - // ConditionSets: []any{ - // map[string]any{ - // "conditions":[]any{ - // map[string]any{ - // "operator": "contains", - // "property": "$.Id", - // "value": "-bil-", - // }, - // }, - // }}, - // DisplayName: to.Ptr("Admin's GCP application"), - // SourceResourceType: to.Ptr(armsecurity.ApplicationSourceResourceTypeAssessments), - // }, - // }, - // { - // Name: to.Ptr("4106f43c-6d82-4fc8-a92c-dcfe50799d1d"), - // Type: to.Ptr("Microsoft.Security/applications"), - // ID: to.Ptr("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector/providers/Microsoft.Security/applications/4106f43c-6d82-4fc8-a92c-dcfe50799d1d"), - // Properties: &armsecurity.ApplicationProperties{ - // Description: to.Ptr("An application on critical GCP recommendations"), - // ConditionSets: []any{ - // map[string]any{ - // "conditions":[]any{ - // map[string]any{ - // "operator": "contains", - // "property": "$.Id", - // "value": "-prod-", - // }, - // }, - // }}, - // DisplayName: to.Ptr("GCP Admin's application"), - // SourceResourceType: to.Ptr(armsecurity.ApplicationSourceResourceTypeAssessments), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/security/armsecurity/connectors_client.go b/sdk/resourcemanager/security/armsecurity/connectors_client.go deleted file mode 100644 index faf0ddbf424c..000000000000 --- a/sdk/resourcemanager/security/armsecurity/connectors_client.go +++ /dev/null @@ -1,416 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// ConnectorsClient contains the methods for the SecurityConnectors group. -// Don't use this type directly, use NewConnectorsClient() instead. -type ConnectorsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewConnectorsClient creates a new instance of ConnectorsClient 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 NewConnectorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConnectorsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ConnectorsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Creates or updates a security connector. If a security connector is already created and a subsequent request -// is issued for the same security connector id, then it will be updated. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-03-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - securityConnectorName - The security connector name. -// - securityConnector - The security connector resource -// - options - ConnectorsClientCreateOrUpdateOptions contains the optional parameters for the ConnectorsClient.CreateOrUpdate -// method. -func (client *ConnectorsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, securityConnectorName string, securityConnector Connector, options *ConnectorsClientCreateOrUpdateOptions) (ConnectorsClientCreateOrUpdateResponse, error) { - var err error - const operationName = "ConnectorsClient.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, securityConnectorName, securityConnector, options) - if err != nil { - return ConnectorsClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ConnectorsClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return ConnectorsClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ConnectorsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, securityConnector Connector, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if securityConnectorName == "" { - return nil, errors.New("parameter securityConnectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, securityConnector); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *ConnectorsClient) createOrUpdateHandleResponse(resp *http.Response) (ConnectorsClientCreateOrUpdateResponse, error) { - result := ConnectorsClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Connector); err != nil { - return ConnectorsClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// 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. -// - 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) { - var err error - const operationName = "ConnectorsClient.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, securityConnectorName, options) - if err != nil { - return ConnectorsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ConnectorsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return ConnectorsClientDeleteResponse{}, err - } - return ConnectorsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *ConnectorsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if securityConnectorName == "" { - return nil, errors.New("parameter securityConnectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-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. -// - 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) { - var err error - const operationName = "ConnectorsClient.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, securityConnectorName, options) - if err != nil { - return ConnectorsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ConnectorsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ConnectorsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ConnectorsClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if securityConnectorName == "" { - return nil, errors.New("parameter securityConnectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-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 *ConnectorsClient) getHandleResponse(resp *http.Response) (ConnectorsClientGetResponse, error) { - result := ConnectorsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Connector); err != nil { - return ConnectorsClientGetResponse{}, err - } - return result, nil -} - -// 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 -// - 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]{ - More: func(page ConnectorsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ConnectorsClientListResponse) (ConnectorsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ConnectorsClient.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 ConnectorsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *ConnectorsClient) listCreateRequest(ctx context.Context, options *ConnectorsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors" - 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", "2024-03-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 *ConnectorsClient) listHandleResponse(resp *http.Response) (ConnectorsClientListResponse, error) { - result := ConnectorsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ConnectorsList); err != nil { - return ConnectorsClientListResponse{}, err - } - return result, nil -} - -// 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. -// - options - ConnectorsClientListByResourceGroupOptions contains the optional parameters for the ConnectorsClient.NewListByResourceGroupPager -// method. -func (client *ConnectorsClient) NewListByResourceGroupPager(resourceGroupName string, options *ConnectorsClientListByResourceGroupOptions) *runtime.Pager[ConnectorsClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[ConnectorsClientListByResourceGroupResponse]{ - More: func(page ConnectorsClientListByResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ConnectorsClientListByResourceGroupResponse) (ConnectorsClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ConnectorsClient.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 ConnectorsClientListByResourceGroupResponse{}, err - } - return client.listByResourceGroupHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *ConnectorsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *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") - } - 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", "2024-03-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 *ConnectorsClient) listByResourceGroupHandleResponse(resp *http.Response) (ConnectorsClientListByResourceGroupResponse, error) { - result := ConnectorsClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ConnectorsList); err != nil { - return ConnectorsClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// 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. -// - securityConnectorName - The security connector name. -// - securityConnector - The security connector resource -// - options - ConnectorsClientUpdateOptions contains the optional parameters for the ConnectorsClient.Update method. -func (client *ConnectorsClient) Update(ctx context.Context, resourceGroupName string, securityConnectorName string, securityConnector Connector, options *ConnectorsClientUpdateOptions) (ConnectorsClientUpdateResponse, error) { - var err error - const operationName = "ConnectorsClient.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, securityConnectorName, securityConnector, options) - if err != nil { - return ConnectorsClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ConnectorsClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ConnectorsClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *ConnectorsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, securityConnector Connector, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if securityConnectorName == "" { - return nil, errors.New("parameter securityConnectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, securityConnector); err != nil { - return nil, err - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *ConnectorsClient) updateHandleResponse(resp *http.Response) (ConnectorsClientUpdateResponse, error) { - result := ConnectorsClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Connector); err != nil { - return ConnectorsClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/connectors_client_example_test.go b/sdk/resourcemanager/security/armsecurity/connectors_client_example_test.go deleted file mode 100644 index 561926048bf1..000000000000 --- a/sdk/resourcemanager/security/armsecurity/connectors_client_example_test.go +++ /dev/null @@ -1,564 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/2024-03-01-preview/examples/SecurityConnectors/GetSecurityConnectorsSubscription_example.json -func ExampleConnectorsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewConnectorsClient().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.ConnectorsList = armsecurity.ConnectorsList{ - // Value: []*armsecurity.Connector{ - // { - // Location: to.Ptr("Central US"), - // Etag: to.Ptr("etag value"), - // Kind: to.Ptr(""), - // Name: to.Ptr("exampleSecurityConnectorAws"), - // Type: to.Ptr("Microsoft.Security/securityConnectors"), - // ID: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/exampleResourceGroup1/providers/Microsoft.Security/securityConnectors/exampleSecurityConnectorAws"), - // Tags: map[string]*string{ - // }, - // Properties: &armsecurity.ConnectorProperties{ - // EnvironmentData: &armsecurity.AwsEnvironmentData{ - // EnvironmentType: to.Ptr(armsecurity.EnvironmentTypeAwsAccount), - // ScanInterval: to.Ptr[int64](4), - // }, - // EnvironmentName: to.Ptr(armsecurity.CloudNameAWS), - // HierarchyIdentifier: to.Ptr("exampleHierarchyId"), - // Offerings: []armsecurity.CloudOfferingClassification{ - // &armsecurity.CspmMonitorAwsOffering{ - // OfferingType: to.Ptr(armsecurity.OfferingTypeCspmMonitorAws), - // NativeCloudConnection: &armsecurity.CspmMonitorAwsOfferingNativeCloudConnection{ - // CloudRoleArn: to.Ptr("arn:aws:iam::00000000:role/ASCMonitor"), - // }, - // }}, - // }, - // 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), - // }, - // }, - // { - // Location: to.Ptr("Central US"), - // Etag: to.Ptr("etag value"), - // Kind: to.Ptr(""), - // Name: to.Ptr("exampleSecurityConnectorAwsOrganization"), - // Type: to.Ptr("Microsoft.Security/securityConnectors"), - // ID: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/exampleResourceGroup2/providers/Microsoft.Security/securityConnectors/exampleSecurityConnectorAwsOrganization"), - // Tags: map[string]*string{ - // }, - // Properties: &armsecurity.ConnectorProperties{ - // EnvironmentData: &armsecurity.AwsEnvironmentData{ - // EnvironmentType: to.Ptr(armsecurity.EnvironmentTypeAwsAccount), - // OrganizationalData: &armsecurity.AwsOrganizationalDataMaster{ - // OrganizationMembershipType: to.Ptr(armsecurity.OrganizationMembershipTypeOrganization), - // ExcludedAccountIDs: []*string{ - // to.Ptr("excludedAccountIdExample")}, - // StacksetName: to.Ptr("myStackSetName"), - // }, - // ScanInterval: to.Ptr[int64](4), - // }, - // EnvironmentName: to.Ptr(armsecurity.CloudNameAWS), - // HierarchyIdentifier: to.Ptr("exampleHierarchyId"), - // Offerings: []armsecurity.CloudOfferingClassification{ - // &armsecurity.CspmMonitorAwsOffering{ - // OfferingType: to.Ptr(armsecurity.OfferingTypeCspmMonitorAws), - // NativeCloudConnection: &armsecurity.CspmMonitorAwsOfferingNativeCloudConnection{ - // CloudRoleArn: to.Ptr("arn:aws:iam::00000000:role/ASCMonitor"), - // }, - // }}, - // }, - // SystemData: &armsecurity.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-15T13: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-12-15T13:47:50.328Z"); return t}()), - // LastModifiedBy: to.Ptr("user@contoso.com"), - // LastModifiedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // }, - // }, - // { - // Location: to.Ptr("centralus"), - // Etag: to.Ptr("etag value"), - // Kind: to.Ptr(""), - // Name: to.Ptr("githubTest"), - // Type: to.Ptr("Microsoft.Security/securityconnectors"), - // ID: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/exampleResourceGroup3/providers/Microsoft.Security/securityConnectors/exampleSecurityConnectorGithub"), - // Tags: map[string]*string{ - // }, - // Properties: &armsecurity.ConnectorProperties{ - // EnvironmentData: &armsecurity.GithubScopeEnvironmentData{ - // EnvironmentType: to.Ptr(armsecurity.EnvironmentTypeGithubScope), - // }, - // EnvironmentName: to.Ptr(armsecurity.CloudNameGithub), - // HierarchyIdentifier: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/exampleResourceGroup3/providers/Microsoft.SecurityDevops/githubConnectors/exampleGithubConnector"), - // Offerings: []armsecurity.CloudOfferingClassification{ - // &armsecurity.CspmMonitorGithubOffering{ - // OfferingType: to.Ptr(armsecurity.OfferingTypeCspmMonitorGithub), - // }}, - // }, - // SystemData: &armsecurity.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-15T13: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-12-15T13:47:50.328Z"); return t}()), - // LastModifiedBy: to.Ptr("user@contoso.com"), - // LastModifiedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // }, - // }, - // { - // Location: to.Ptr("centralus"), - // Etag: to.Ptr("etag value"), - // Kind: to.Ptr(""), - // Name: to.Ptr("AzureDevOpsTest"), - // Type: to.Ptr("Microsoft.Security/securityconnectors"), - // ID: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/exampleResourceGroup3/providers/Microsoft.Security/securityConnectors/exampleSecurityConnectorAzureDevOpsConnectors"), - // Tags: map[string]*string{ - // }, - // Properties: &armsecurity.ConnectorProperties{ - // EnvironmentData: &armsecurity.GithubScopeEnvironmentData{ - // EnvironmentType: to.Ptr(armsecurity.EnvironmentTypeGithubScope), - // }, - // EnvironmentName: to.Ptr(armsecurity.CloudNameGithub), - // HierarchyIdentifier: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/exampleResourceGroup3/providers/Microsoft.SecurityDevops/azureDevOpsConnectors/exampleAzureDevOpsConnector"), - // Offerings: []armsecurity.CloudOfferingClassification{ - // &armsecurity.CspmMonitorGithubOffering{ - // OfferingType: to.Ptr(armsecurity.OfferingTypeCspmMonitorGithub), - // }}, - // }, - // SystemData: &armsecurity.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-15T13: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-12-15T13:47:50.328Z"); return t}()), - // LastModifiedBy: to.Ptr("user@contoso.com"), - // LastModifiedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // }, - // }, - // { - // Location: to.Ptr("Central US"), - // Etag: to.Ptr("etag value"), - // Kind: to.Ptr(""), - // Name: to.Ptr("exampleSecurityConnectorGcp"), - // Type: to.Ptr("Microsoft.Security/securityConnectors"), - // ID: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/exampleResourceGroup3/providers/Microsoft.Security/securityConnectors/exampleSecurityConnectorGcp"), - // Tags: map[string]*string{ - // }, - // Properties: &armsecurity.ConnectorProperties{ - // EnvironmentData: &armsecurity.GcpProjectEnvironmentData{ - // EnvironmentType: to.Ptr(armsecurity.EnvironmentTypeGcpProject), - // ProjectDetails: &armsecurity.GcpProjectDetails{ - // ProjectID: to.Ptr("My-0GCP-Project"), - // ProjectNumber: to.Ptr("exampleHierarchyId"), - // WorkloadIdentityPoolID: to.Ptr("6c78da41157548d3b1d8b3c72effdf8c"), - // }, - // }, - // EnvironmentName: to.Ptr(armsecurity.CloudNameGCP), - // HierarchyIdentifier: to.Ptr("exampleHierarchyId"), - // Offerings: []armsecurity.CloudOfferingClassification{ - // &armsecurity.CspmMonitorGcpOffering{ - // OfferingType: to.Ptr(armsecurity.OfferingTypeCspmMonitorGcp), - // NativeCloudConnection: &armsecurity.CspmMonitorGcpOfferingNativeCloudConnection{ - // ServiceAccountEmailAddress: to.Ptr("capm@projectName.com"), - // WorkloadIdentityProviderID: to.Ptr("My workload identity provider Id"), - // }, - // }}, - // }, - // SystemData: &armsecurity.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-15T13: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-12-15T13: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/2024-03-01-preview/examples/SecurityConnectors/GetSecurityConnectorsResourceGroup_example.json -func ExampleConnectorsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewConnectorsClient().NewListByResourceGroupPager("exampleResourceGroup", 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.ConnectorsList = armsecurity.ConnectorsList{ - // Value: []*armsecurity.Connector{ - // { - // Location: to.Ptr("Central US"), - // Etag: to.Ptr("etag value"), - // Kind: to.Ptr(""), - // Name: to.Ptr("exampleSecurityConnectorAws"), - // Type: to.Ptr("Microsoft.Security/securityConnectors"), - // ID: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/exampleResourceGroup/providers/Microsoft.Security/securityConnectors/exampleSecurityConnectorAws"), - // Tags: map[string]*string{ - // }, - // Properties: &armsecurity.ConnectorProperties{ - // EnvironmentData: &armsecurity.AwsEnvironmentData{ - // EnvironmentType: to.Ptr(armsecurity.EnvironmentTypeAwsAccount), - // ScanInterval: to.Ptr[int64](4), - // }, - // EnvironmentName: to.Ptr(armsecurity.CloudNameAWS), - // HierarchyIdentifier: to.Ptr("exampleHierarchyId"), - // Offerings: []armsecurity.CloudOfferingClassification{ - // &armsecurity.CspmMonitorAwsOffering{ - // OfferingType: to.Ptr(armsecurity.OfferingTypeCspmMonitorAws), - // NativeCloudConnection: &armsecurity.CspmMonitorAwsOfferingNativeCloudConnection{ - // CloudRoleArn: to.Ptr("arn:aws:iam::00000000:role/ASCMonitor"), - // }, - // }}, - // }, - // 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), - // }, - // }, - // { - // Location: to.Ptr("Central US"), - // Etag: to.Ptr("etag value"), - // Kind: to.Ptr(""), - // Name: to.Ptr("exampleSecurityConnectorAwsOrganization"), - // Type: to.Ptr("Microsoft.Security/securityConnectors"), - // ID: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/exampleResourceGroup/providers/Microsoft.Security/securityConnectors/exampleSecurityConnectorAwsOrganization"), - // Tags: map[string]*string{ - // }, - // Properties: &armsecurity.ConnectorProperties{ - // EnvironmentData: &armsecurity.AwsEnvironmentData{ - // EnvironmentType: to.Ptr(armsecurity.EnvironmentTypeAwsAccount), - // OrganizationalData: &armsecurity.AwsOrganizationalDataMaster{ - // OrganizationMembershipType: to.Ptr(armsecurity.OrganizationMembershipTypeOrganization), - // ExcludedAccountIDs: []*string{ - // to.Ptr("excludedAccountIdExample")}, - // StacksetName: to.Ptr("myStackSetName"), - // }, - // ScanInterval: to.Ptr[int64](4), - // }, - // EnvironmentName: to.Ptr(armsecurity.CloudNameAWS), - // HierarchyIdentifier: to.Ptr("exampleHierarchyId"), - // Offerings: []armsecurity.CloudOfferingClassification{ - // &armsecurity.CspmMonitorAwsOffering{ - // OfferingType: to.Ptr(armsecurity.OfferingTypeCspmMonitorAws), - // NativeCloudConnection: &armsecurity.CspmMonitorAwsOfferingNativeCloudConnection{ - // CloudRoleArn: to.Ptr("arn:aws:iam::00000000:role/ASCMonitor"), - // }, - // }}, - // }, - // SystemData: &armsecurity.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-15T13: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-12-15T13:47:50.328Z"); return t}()), - // LastModifiedBy: to.Ptr("user@contoso.com"), - // LastModifiedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // }, - // }, - // { - // Location: to.Ptr("Central US"), - // Etag: to.Ptr("etag value"), - // Kind: to.Ptr(""), - // Name: to.Ptr("exampleSecurityConnectorGcp"), - // Type: to.Ptr("Microsoft.Security/securityConnectors"), - // ID: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/exampleResourceGroup/providers/Microsoft.Security/securityConnectors/exampleSecurityConnectorGcp"), - // Tags: map[string]*string{ - // }, - // Properties: &armsecurity.ConnectorProperties{ - // EnvironmentData: &armsecurity.GcpProjectEnvironmentData{ - // EnvironmentType: to.Ptr(armsecurity.EnvironmentTypeGcpProject), - // ProjectDetails: &armsecurity.GcpProjectDetails{ - // ProjectID: to.Ptr("My-0GCP-Project"), - // ProjectNumber: to.Ptr("exampleHierarchyId"), - // WorkloadIdentityPoolID: to.Ptr("My-workload-identity-federation-pool-id"), - // }, - // }, - // EnvironmentName: to.Ptr(armsecurity.CloudNameGCP), - // HierarchyIdentifier: to.Ptr("exampleHierarchyId"), - // Offerings: []armsecurity.CloudOfferingClassification{ - // &armsecurity.CspmMonitorGcpOffering{ - // OfferingType: to.Ptr(armsecurity.OfferingTypeCspmMonitorGcp), - // NativeCloudConnection: &armsecurity.CspmMonitorGcpOfferingNativeCloudConnection{ - // ServiceAccountEmailAddress: to.Ptr("capm@projectName.com"), - // WorkloadIdentityProviderID: to.Ptr("My workload identity provider Id"), - // }, - // }}, - // }, - // SystemData: &armsecurity.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-15T13: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-12-15T13: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/2024-03-01-preview/examples/SecurityConnectors/GetSecurityConnectorSingleResource_example.json -func ExampleConnectorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewConnectorsClient().Get(ctx, "exampleResourceGroup", "exampleSecurityConnectorName", 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.Connector = armsecurity.Connector{ - // Location: to.Ptr("Central US"), - // Etag: to.Ptr("etag value"), - // Kind: to.Ptr(""), - // Name: to.Ptr("exampleSecurityConnectorName"), - // Type: to.Ptr("Microsoft.Security/securityConnectors"), - // ID: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/exampleResourceGroup/providers/Microsoft.Security/securityConnectors/exampleSecurityConnectorName"), - // Tags: map[string]*string{ - // }, - // Properties: &armsecurity.ConnectorProperties{ - // EnvironmentData: &armsecurity.AwsEnvironmentData{ - // EnvironmentType: to.Ptr(armsecurity.EnvironmentTypeAwsAccount), - // ScanInterval: to.Ptr[int64](4), - // }, - // EnvironmentName: to.Ptr(armsecurity.CloudNameAWS), - // HierarchyIdentifier: to.Ptr("exampleHierarchyId"), - // Offerings: []armsecurity.CloudOfferingClassification{ - // &armsecurity.CspmMonitorAwsOffering{ - // OfferingType: to.Ptr(armsecurity.OfferingTypeCspmMonitorAws), - // NativeCloudConnection: &armsecurity.CspmMonitorAwsOfferingNativeCloudConnection{ - // CloudRoleArn: to.Ptr("arn:aws:iam::00000000:role/ASCMonitor"), - // }, - // }}, - // }, - // 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/2024-03-01-preview/examples/SecurityConnectors/PutSecurityConnector_example.json -func ExampleConnectorsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewConnectorsClient().CreateOrUpdate(ctx, "exampleResourceGroup", "exampleSecurityConnectorName", armsecurity.Connector{ - Location: to.Ptr("Central US"), - Etag: to.Ptr("etag value (must be supplied for update)"), - Tags: map[string]*string{}, - Properties: &armsecurity.ConnectorProperties{ - EnvironmentData: &armsecurity.AwsEnvironmentData{ - EnvironmentType: to.Ptr(armsecurity.EnvironmentTypeAwsAccount), - ScanInterval: to.Ptr[int64](4), - }, - EnvironmentName: to.Ptr(armsecurity.CloudNameAWS), - HierarchyIdentifier: to.Ptr("exampleHierarchyId"), - Offerings: []armsecurity.CloudOfferingClassification{ - &armsecurity.CspmMonitorAwsOffering{ - OfferingType: to.Ptr(armsecurity.OfferingTypeCspmMonitorAws), - NativeCloudConnection: &armsecurity.CspmMonitorAwsOfferingNativeCloudConnection{ - CloudRoleArn: to.Ptr("arn:aws:iam::00000000:role/ASCMonitor"), - }, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.Connector = armsecurity.Connector{ - // Location: to.Ptr("Central US"), - // Etag: to.Ptr(""), - // Kind: to.Ptr(""), - // Name: to.Ptr("exampleSecurityConnectorName"), - // Type: to.Ptr("Microsoft.Security/securityConnectors"), - // ID: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/exampleResourceGroup/providers/Microsoft.Security/securityConnectors/exampleSecurityConnectorName"), - // Tags: map[string]*string{ - // }, - // Properties: &armsecurity.ConnectorProperties{ - // EnvironmentData: &armsecurity.AwsEnvironmentData{ - // EnvironmentType: to.Ptr(armsecurity.EnvironmentTypeAwsAccount), - // }, - // EnvironmentName: to.Ptr(armsecurity.CloudNameAWS), - // HierarchyIdentifier: to.Ptr("exampleHierarchyId"), - // Offerings: []armsecurity.CloudOfferingClassification{ - // &armsecurity.CspmMonitorAwsOffering{ - // OfferingType: to.Ptr(armsecurity.OfferingTypeCspmMonitorAws), - // NativeCloudConnection: &armsecurity.CspmMonitorAwsOfferingNativeCloudConnection{ - // CloudRoleArn: to.Ptr("arn:aws:iam::00000000:role/ASCMonitor"), - // }, - // }}, - // }, - // 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/2024-03-01-preview/examples/SecurityConnectors/PatchSecurityConnector_example.json -func ExampleConnectorsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewConnectorsClient().Update(ctx, "exampleResourceGroup", "exampleSecurityConnectorName", armsecurity.Connector{ - Location: to.Ptr("Central US"), - Etag: to.Ptr("etag value (must be supplied for update)"), - Tags: map[string]*string{}, - Properties: &armsecurity.ConnectorProperties{ - EnvironmentData: &armsecurity.AwsEnvironmentData{ - EnvironmentType: to.Ptr(armsecurity.EnvironmentTypeAwsAccount), - }, - EnvironmentName: to.Ptr(armsecurity.CloudNameAWS), - HierarchyIdentifier: to.Ptr("exampleHierarchyId"), - Offerings: []armsecurity.CloudOfferingClassification{ - &armsecurity.CspmMonitorAwsOffering{ - OfferingType: to.Ptr(armsecurity.OfferingTypeCspmMonitorAws), - NativeCloudConnection: &armsecurity.CspmMonitorAwsOfferingNativeCloudConnection{ - CloudRoleArn: to.Ptr("arn:aws:iam::00000000:role/ASCMonitor"), - }, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.Connector = armsecurity.Connector{ - // Location: to.Ptr("Central US"), - // Etag: to.Ptr("etag value"), - // Kind: to.Ptr(""), - // Name: to.Ptr("exampleSecurityConnectorName"), - // Type: to.Ptr("Microsoft.Security/securityConnectors"), - // ID: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/exampleResourceGroup/providers/Microsoft.Security/securityConnectors/exampleSecurityConnectorName"), - // Tags: map[string]*string{ - // }, - // Properties: &armsecurity.ConnectorProperties{ - // EnvironmentData: &armsecurity.AwsEnvironmentData{ - // EnvironmentType: to.Ptr(armsecurity.EnvironmentTypeAwsAccount), - // }, - // EnvironmentName: to.Ptr(armsecurity.CloudNameAWS), - // HierarchyIdentifier: to.Ptr("exampleHierarchyId"), - // Offerings: []armsecurity.CloudOfferingClassification{ - // &armsecurity.CspmMonitorAwsOffering{ - // OfferingType: to.Ptr(armsecurity.OfferingTypeCspmMonitorAws), - // NativeCloudConnection: &armsecurity.CspmMonitorAwsOfferingNativeCloudConnection{ - // CloudRoleArn: to.Ptr("arn:aws:iam::00000000:role/ASCMonitor"), - // }, - // }}, - // }, - // 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/2024-03-01-preview/examples/SecurityConnectors/DeleteSecurityConnector_example.json -func ExampleConnectorsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewConnectorsClient().Delete(ctx, "myRg", "mySecurityConnectorName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/constants.go b/sdk/resourcemanager/security/armsecurity/constants.go index cdae18a27aae..75dbbc76c92c 100644 --- a/sdk/resourcemanager/security/armsecurity/constants.go +++ b/sdk/resourcemanager/security/armsecurity/constants.go @@ -10,1988 +10,9 @@ package armsecurity const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" - moduleVersion = "v0.14.0" + moduleVersion = "v0.15.0" ) -// AADConnectivityState - The connectivity state of the external AAD solution -type AADConnectivityState string - -const ( - AADConnectivityStateConnected AADConnectivityState = "Connected" - AADConnectivityStateDiscovered AADConnectivityState = "Discovered" - AADConnectivityStateNotLicensed AADConnectivityState = "NotLicensed" -) - -// PossibleAADConnectivityStateValues returns the possible values for the AADConnectivityState const type. -func PossibleAADConnectivityStateValues() []AADConnectivityState { - return []AADConnectivityState{ - AADConnectivityStateConnected, - AADConnectivityStateDiscovered, - AADConnectivityStateNotLicensed, - } -} - -// ActionType - The type of the action that will be triggered by the Automation -type ActionType string - -const ( - ActionTypeEventHub ActionType = "EventHub" - ActionTypeLogicApp ActionType = "LogicApp" - ActionTypeWorkspace ActionType = "Workspace" -) - -// PossibleActionTypeValues returns the possible values for the ActionType const type. -func PossibleActionTypeValues() []ActionType { - return []ActionType{ - ActionTypeEventHub, - ActionTypeLogicApp, - ActionTypeWorkspace, - } -} - -// ActionableRemediationState - ActionableRemediation Setting. None - the setting was never set. Enabled - ActionableRemediation -// is enabled. Disabled - ActionableRemediation is disabled. -type ActionableRemediationState string - -const ( - ActionableRemediationStateDisabled ActionableRemediationState = "Disabled" - ActionableRemediationStateEnabled ActionableRemediationState = "Enabled" - ActionableRemediationStateNone ActionableRemediationState = "None" -) - -// PossibleActionableRemediationStateValues returns the possible values for the ActionableRemediationState const type. -func PossibleActionableRemediationStateValues() []ActionableRemediationState { - return []ActionableRemediationState{ - ActionableRemediationStateDisabled, - ActionableRemediationStateEnabled, - ActionableRemediationStateNone, - } -} - -// 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" - AdditionalWorkspaceDataTypeRawEvents AdditionalWorkspaceDataType = "RawEvents" -) - -// PossibleAdditionalWorkspaceDataTypeValues returns the possible values for the AdditionalWorkspaceDataType const type. -func PossibleAdditionalWorkspaceDataTypeValues() []AdditionalWorkspaceDataType { - return []AdditionalWorkspaceDataType{ - AdditionalWorkspaceDataTypeAlerts, - AdditionalWorkspaceDataTypeRawEvents, - } -} - -// AdditionalWorkspaceType - Workspace type. -type AdditionalWorkspaceType string - -const ( - AdditionalWorkspaceTypeSentinel AdditionalWorkspaceType = "Sentinel" -) - -// PossibleAdditionalWorkspaceTypeValues returns the possible values for the AdditionalWorkspaceType const type. -func PossibleAdditionalWorkspaceTypeValues() []AdditionalWorkspaceType { - return []AdditionalWorkspaceType{ - AdditionalWorkspaceTypeSentinel, - } -} - -// 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 - -const ( - // AlertSeverityHigh - High - AlertSeverityHigh AlertSeverity = "High" - // AlertSeverityInformational - Informational - AlertSeverityInformational AlertSeverity = "Informational" - // AlertSeverityLow - Low - AlertSeverityLow AlertSeverity = "Low" - // AlertSeverityMedium - Medium - AlertSeverityMedium AlertSeverity = "Medium" -) - -// PossibleAlertSeverityValues returns the possible values for the AlertSeverity const type. -func PossibleAlertSeverityValues() []AlertSeverity { - return []AlertSeverity{ - AlertSeverityHigh, - AlertSeverityInformational, - AlertSeverityLow, - AlertSeverityMedium, - } -} - -// AlertStatus - The life cycle status of the alert. -type AlertStatus string - -const ( - // AlertStatusActive - An alert which doesn't specify a value is assigned the status 'Active' - AlertStatusActive AlertStatus = "Active" - // AlertStatusDismissed - Alert dismissed as false positive - AlertStatusDismissed AlertStatus = "Dismissed" - // AlertStatusInProgress - An alert which is in handling state - AlertStatusInProgress AlertStatus = "InProgress" - // AlertStatusResolved - Alert closed after handling - AlertStatusResolved AlertStatus = "Resolved" -) - -// PossibleAlertStatusValues returns the possible values for the AlertStatus const type. -func PossibleAlertStatusValues() []AlertStatus { - return []AlertStatus{ - AlertStatusActive, - AlertStatusDismissed, - AlertStatusInProgress, - AlertStatusResolved, - } -} - -// 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. -type AnnotateDefaultBranchState string - -const ( - AnnotateDefaultBranchStateDisabled AnnotateDefaultBranchState = "Disabled" - AnnotateDefaultBranchStateEnabled AnnotateDefaultBranchState = "Enabled" -) - -// PossibleAnnotateDefaultBranchStateValues returns the possible values for the AnnotateDefaultBranchState const type. -func PossibleAnnotateDefaultBranchStateValues() []AnnotateDefaultBranchState { - return []AnnotateDefaultBranchState{ - AnnotateDefaultBranchStateDisabled, - AnnotateDefaultBranchStateEnabled, - } -} - -// 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 - -const ( - // ApplicationSourceResourceTypeAssessments - The source of the application is assessments - ApplicationSourceResourceTypeAssessments ApplicationSourceResourceType = "Assessments" -) - -// PossibleApplicationSourceResourceTypeValues returns the possible values for the ApplicationSourceResourceType const type. -func PossibleApplicationSourceResourceTypeValues() []ApplicationSourceResourceType { - return []ApplicationSourceResourceType{ - ApplicationSourceResourceTypeAssessments, - } -} - -// AssessedResourceType - Sub-assessment resource type -type AssessedResourceType string - -const ( - AssessedResourceTypeContainerRegistryVulnerability AssessedResourceType = "ContainerRegistryVulnerability" - AssessedResourceTypeSQLServerVulnerability AssessedResourceType = "SqlServerVulnerability" - AssessedResourceTypeServerVulnerability AssessedResourceType = "ServerVulnerability" -) - -// PossibleAssessedResourceTypeValues returns the possible values for the AssessedResourceType const type. -func PossibleAssessedResourceTypeValues() []AssessedResourceType { - return []AssessedResourceType{ - AssessedResourceTypeContainerRegistryVulnerability, - AssessedResourceTypeSQLServerVulnerability, - AssessedResourceTypeServerVulnerability, - } -} - -// AssessmentStatusCode - Programmatic code for the status of the assessment -type AssessmentStatusCode string - -const ( - // AssessmentStatusCodeHealthy - The resource is healthy - AssessmentStatusCodeHealthy AssessmentStatusCode = "Healthy" - // AssessmentStatusCodeNotApplicable - Assessment for this resource did not happen - AssessmentStatusCodeNotApplicable AssessmentStatusCode = "NotApplicable" - // AssessmentStatusCodeUnhealthy - The resource has a security issue that needs to be addressed - AssessmentStatusCodeUnhealthy AssessmentStatusCode = "Unhealthy" -) - -// PossibleAssessmentStatusCodeValues returns the possible values for the AssessmentStatusCode const type. -func PossibleAssessmentStatusCodeValues() []AssessmentStatusCode { - return []AssessmentStatusCode{ - AssessmentStatusCodeHealthy, - AssessmentStatusCodeNotApplicable, - AssessmentStatusCodeUnhealthy, - } -} - -// AssessmentType - BuiltIn if the assessment based on built-in Azure Policy definition, Custom if the assessment based on -// custom Azure Policy definition -type AssessmentType string - -const ( - // AssessmentTypeBuiltIn - Microsoft Defender for Cloud managed assessments - AssessmentTypeBuiltIn AssessmentType = "BuiltIn" - // 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 - AssessmentTypeVerifiedPartner AssessmentType = "VerifiedPartner" -) - -// PossibleAssessmentTypeValues returns the possible values for the AssessmentType const type. -func PossibleAssessmentTypeValues() []AssessmentType { - return []AssessmentType{ - AssessmentTypeBuiltIn, - AssessmentTypeCustomPolicy, - AssessmentTypeCustomerManaged, - AssessmentTypeVerifiedPartner, - } -} - -// AuthenticationProvisioningState - State of the multi-cloud connector -type AuthenticationProvisioningState 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" -) - -// PossibleAuthenticationProvisioningStateValues returns the possible values for the AuthenticationProvisioningState const type. -func PossibleAuthenticationProvisioningStateValues() []AuthenticationProvisioningState { - return []AuthenticationProvisioningState{ - AuthenticationProvisioningStateExpired, - AuthenticationProvisioningStateIncorrectPolicy, - AuthenticationProvisioningStateInvalid, - AuthenticationProvisioningStateValid, - } -} - -// AuthenticationType - Connect to your cloud account, for AWS use either account credentials or role-based authentication. -// For GCP use account organization credentials. -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" -) - -// PossibleAuthenticationTypeValues returns the possible values for the AuthenticationType const type. -func PossibleAuthenticationTypeValues() []AuthenticationType { - return []AuthenticationType{ - AuthenticationTypeAwsAssumeRole, - AuthenticationTypeAwsCreds, - AuthenticationTypeGcpCredentials, - } -} - -// AutoDiscovery - AutoDiscovery states. -type AutoDiscovery string - -const ( - AutoDiscoveryDisabled AutoDiscovery = "Disabled" - AutoDiscoveryEnabled AutoDiscovery = "Enabled" - AutoDiscoveryNotApplicable AutoDiscovery = "NotApplicable" -) - -// PossibleAutoDiscoveryValues returns the possible values for the AutoDiscovery const type. -func PossibleAutoDiscoveryValues() []AutoDiscovery { - return []AutoDiscovery{ - AutoDiscoveryDisabled, - AutoDiscoveryEnabled, - AutoDiscoveryNotApplicable, - } -} - -// AutoProvision - Describes what kind of security agent provisioning action to take -type AutoProvision string - -const ( - // AutoProvisionOff - Do not install security agent on the VMs automatically - AutoProvisionOff AutoProvision = "Off" - // AutoProvisionOn - Install missing security agent on VMs automatically - AutoProvisionOn AutoProvision = "On" -) - -// PossibleAutoProvisionValues returns the possible values for the AutoProvision const type. -func PossibleAutoProvisionValues() []AutoProvision { - return []AutoProvision{ - AutoProvisionOff, - AutoProvisionOn, - } -} - -// BundleType - Alert Simulator supported bundles. -type BundleType string - -const ( - BundleTypeAppServices BundleType = "AppServices" - BundleTypeCosmosDbs BundleType = "CosmosDbs" - BundleTypeDNS BundleType = "DNS" - BundleTypeKeyVaults BundleType = "KeyVaults" - BundleTypeKubernetesService BundleType = "KubernetesService" - BundleTypeResourceManager BundleType = "ResourceManager" - BundleTypeSQLServers BundleType = "SqlServers" - BundleTypeStorageAccounts BundleType = "StorageAccounts" - BundleTypeVirtualMachines BundleType = "VirtualMachines" -) - -// PossibleBundleTypeValues returns the possible values for the BundleType const type. -func PossibleBundleTypeValues() []BundleType { - return []BundleType{ - BundleTypeAppServices, - BundleTypeCosmosDbs, - BundleTypeDNS, - BundleTypeKeyVaults, - BundleTypeKubernetesService, - BundleTypeResourceManager, - BundleTypeSQLServers, - BundleTypeStorageAccounts, - BundleTypeVirtualMachines, - } -} - -// Categories - The categories of resource that is at risk when the assessment is unhealthy -type Categories string - -const ( - CategoriesCompute Categories = "Compute" - CategoriesData Categories = "Data" - CategoriesIdentityAndAccess Categories = "IdentityAndAccess" - CategoriesIoT Categories = "IoT" - CategoriesNetworking Categories = "Networking" -) - -// PossibleCategoriesValues returns the possible values for the Categories const type. -func PossibleCategoriesValues() []Categories { - return []Categories{ - CategoriesCompute, - CategoriesData, - CategoriesIdentityAndAccess, - CategoriesIoT, - CategoriesNetworking, - } -} - -// CloudName - The multi cloud resource's cloud name. -type CloudName string - -const ( - CloudNameAWS CloudName = "AWS" - CloudNameAzure CloudName = "Azure" - CloudNameAzureDevOps CloudName = "AzureDevOps" - CloudNameGCP CloudName = "GCP" - CloudNameGitLab CloudName = "GitLab" - CloudNameGithub CloudName = "Github" -) - -// PossibleCloudNameValues returns the possible values for the CloudName const type. -func PossibleCloudNameValues() []CloudName { - return []CloudName{ - CloudNameAWS, - CloudNameAzure, - CloudNameAzureDevOps, - 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, - } -} - -type ConnectionType string - -const ( - ConnectionTypeExternal ConnectionType = "External" - ConnectionTypeInternal ConnectionType = "Internal" -) - -// PossibleConnectionTypeValues returns the possible values for the ConnectionType const type. -func PossibleConnectionTypeValues() []ConnectionType { - return []ConnectionType{ - ConnectionTypeExternal, - ConnectionTypeInternal, - } -} - -// ControlType - The type of security control (for example, BuiltIn) -type ControlType string - -const ( - // ControlTypeBuiltIn - Microsoft Defender for Cloud managed assessments - ControlTypeBuiltIn ControlType = "BuiltIn" - // ControlTypeCustom - Non Microsoft Defender for Cloud managed assessments - ControlTypeCustom ControlType = "Custom" -) - -// PossibleControlTypeValues returns the possible values for the ControlType const type. -func PossibleControlTypeValues() []ControlType { - return []ControlType{ - ControlTypeBuiltIn, - ControlTypeCustom, - } -} - -// CreatedByType - The type of identity that created the resource. -type CreatedByType string - -const ( - CreatedByTypeApplication CreatedByType = "Application" - CreatedByTypeKey CreatedByType = "Key" - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - CreatedByTypeUser CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{ - CreatedByTypeApplication, - CreatedByTypeKey, - CreatedByTypeManagedIdentity, - CreatedByTypeUser, - } -} - -type DataSource string - -const ( - // DataSourceTwinData - Devices twin data - DataSourceTwinData DataSource = "TwinData" -) - -// PossibleDataSourceValues returns the possible values for the DataSource const type. -func PossibleDataSourceValues() []DataSource { - return []DataSource{ - DataSourceTwinData, - } -} - -// 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. -type DevOpsProvisioningState string - -const ( - DevOpsProvisioningStateCanceled DevOpsProvisioningState = "Canceled" - DevOpsProvisioningStateDeletionFailure DevOpsProvisioningState = "DeletionFailure" - DevOpsProvisioningStateDeletionSuccess DevOpsProvisioningState = "DeletionSuccess" - DevOpsProvisioningStateFailed DevOpsProvisioningState = "Failed" - DevOpsProvisioningStatePending DevOpsProvisioningState = "Pending" - DevOpsProvisioningStatePendingDeletion DevOpsProvisioningState = "PendingDeletion" - DevOpsProvisioningStateSucceeded DevOpsProvisioningState = "Succeeded" -) - -// PossibleDevOpsProvisioningStateValues returns the possible values for the DevOpsProvisioningState const type. -func PossibleDevOpsProvisioningStateValues() []DevOpsProvisioningState { - return []DevOpsProvisioningState{ - DevOpsProvisioningStateCanceled, - DevOpsProvisioningStateDeletionFailure, - DevOpsProvisioningStateDeletionSuccess, - DevOpsProvisioningStateFailed, - DevOpsProvisioningStatePending, - DevOpsProvisioningStatePendingDeletion, - DevOpsProvisioningStateSucceeded, - } -} - -// 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 - -const ( - EndOfSupportStatusNoLongerSupported EndOfSupportStatus = "noLongerSupported" - EndOfSupportStatusNone EndOfSupportStatus = "None" - EndOfSupportStatusUpcomingNoLongerSupported EndOfSupportStatus = "upcomingNoLongerSupported" - EndOfSupportStatusUpcomingVersionNoLongerSupported EndOfSupportStatus = "upcomingVersionNoLongerSupported" - EndOfSupportStatusVersionNoLongerSupported EndOfSupportStatus = "versionNoLongerSupported" -) - -// PossibleEndOfSupportStatusValues returns the possible values for the EndOfSupportStatus const type. -func PossibleEndOfSupportStatusValues() []EndOfSupportStatus { - return []EndOfSupportStatus{ - EndOfSupportStatusNoLongerSupported, - EndOfSupportStatusNone, - EndOfSupportStatusUpcomingNoLongerSupported, - EndOfSupportStatusUpcomingVersionNoLongerSupported, - EndOfSupportStatusVersionNoLongerSupported, - } -} - -// 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. -type Enforce string - -const ( - // EnforceFalse - Allows the descendants of this scope to override the pricing configuration set on this scope (allows setting - // inherited="False") - EnforceFalse Enforce = "False" - // EnforceTrue - Prevents overrides and forces the current scope's pricing configuration to all descendants - EnforceTrue Enforce = "True" -) - -// PossibleEnforceValues returns the possible values for the Enforce const type. -func PossibleEnforceValues() []Enforce { - return []Enforce{ - EnforceFalse, - EnforceTrue, - } -} - -// 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" - EnvironmentTypeAzureDevOpsScope EnvironmentType = "AzureDevOpsScope" - EnvironmentTypeGcpProject EnvironmentType = "GcpProject" - EnvironmentTypeGithubScope EnvironmentType = "GithubScope" - EnvironmentTypeGitlabScope EnvironmentType = "GitlabScope" -) - -// PossibleEnvironmentTypeValues returns the possible values for the EnvironmentType const type. -func PossibleEnvironmentTypeValues() []EnvironmentType { - return []EnvironmentType{ - EnvironmentTypeAwsAccount, - EnvironmentTypeAzureDevOpsScope, - EnvironmentTypeGcpProject, - EnvironmentTypeGithubScope, - EnvironmentTypeGitlabScope, - } -} - -// EventSource - A valid event source type. -type EventSource string - -const ( - EventSourceAlerts EventSource = "Alerts" - EventSourceAssessments EventSource = "Assessments" - EventSourceAssessmentsSnapshot EventSource = "AssessmentsSnapshot" - EventSourceAttackPaths EventSource = "AttackPaths" - EventSourceAttackPathsSnapshot EventSource = "AttackPathsSnapshot" - EventSourceRegulatoryComplianceAssessment EventSource = "RegulatoryComplianceAssessment" - EventSourceRegulatoryComplianceAssessmentSnapshot EventSource = "RegulatoryComplianceAssessmentSnapshot" - EventSourceSecureScoreControls EventSource = "SecureScoreControls" - EventSourceSecureScoreControlsSnapshot EventSource = "SecureScoreControlsSnapshot" - EventSourceSecureScores EventSource = "SecureScores" - EventSourceSecureScoresSnapshot EventSource = "SecureScoresSnapshot" - EventSourceSubAssessments EventSource = "SubAssessments" - EventSourceSubAssessmentsSnapshot EventSource = "SubAssessmentsSnapshot" -) - -// PossibleEventSourceValues returns the possible values for the EventSource const type. -func PossibleEventSourceValues() []EventSource { - return []EventSource{ - EventSourceAlerts, - EventSourceAssessments, - EventSourceAssessmentsSnapshot, - EventSourceAttackPaths, - EventSourceAttackPathsSnapshot, - EventSourceRegulatoryComplianceAssessment, - EventSourceRegulatoryComplianceAssessmentSnapshot, - EventSourceSecureScoreControls, - EventSourceSecureScoreControlsSnapshot, - EventSourceSecureScores, - EventSourceSecureScoresSnapshot, - EventSourceSubAssessments, - EventSourceSubAssessmentsSnapshot, - } -} - -type ExpandControlsEnum string - -const ( - // ExpandControlsEnumDefinition - Add definition object for each control - ExpandControlsEnumDefinition ExpandControlsEnum = "definition" -) - -// PossibleExpandControlsEnumValues returns the possible values for the ExpandControlsEnum const type. -func PossibleExpandControlsEnumValues() []ExpandControlsEnum { - return []ExpandControlsEnum{ - ExpandControlsEnumDefinition, - } -} - -type ExpandEnum string - -const ( - // ExpandEnumLinks - All links associated with an assessment - ExpandEnumLinks ExpandEnum = "links" - // ExpandEnumMetadata - Assessment metadata - ExpandEnumMetadata ExpandEnum = "metadata" -) - -// PossibleExpandEnumValues returns the possible values for the ExpandEnum const type. -func PossibleExpandEnumValues() []ExpandEnum { - return []ExpandEnum{ - ExpandEnumLinks, - ExpandEnumMetadata, - } -} - -type ExportData string - -const ( - // ExportDataRawEvents - Agent raw events - ExportDataRawEvents ExportData = "RawEvents" -) - -// PossibleExportDataValues returns the possible values for the ExportData const type. -func PossibleExportDataValues() []ExportData { - return []ExportData{ - ExportDataRawEvents, - } -} - -// ExternalSecuritySolutionKind - The kind of the external solution -type ExternalSecuritySolutionKind string - -const ( - ExternalSecuritySolutionKindAAD ExternalSecuritySolutionKind = "AAD" - ExternalSecuritySolutionKindATA ExternalSecuritySolutionKind = "ATA" - ExternalSecuritySolutionKindCEF ExternalSecuritySolutionKind = "CEF" -) - -// PossibleExternalSecuritySolutionKindValues returns the possible values for the ExternalSecuritySolutionKind const type. -func PossibleExternalSecuritySolutionKindValues() []ExternalSecuritySolutionKind { - return []ExternalSecuritySolutionKind{ - ExternalSecuritySolutionKindAAD, - ExternalSecuritySolutionKindATA, - ExternalSecuritySolutionKindCEF, - } -} - -// 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 - -const ( - // GovernanceRuleOwnerSourceTypeByTag - The rule source type defined using resource tag - GovernanceRuleOwnerSourceTypeByTag GovernanceRuleOwnerSourceType = "ByTag" - // GovernanceRuleOwnerSourceTypeManually - The rule source type defined manually - GovernanceRuleOwnerSourceTypeManually GovernanceRuleOwnerSourceType = "Manually" -) - -// PossibleGovernanceRuleOwnerSourceTypeValues returns the possible values for the GovernanceRuleOwnerSourceType const type. -func PossibleGovernanceRuleOwnerSourceTypeValues() []GovernanceRuleOwnerSourceType { - return []GovernanceRuleOwnerSourceType{ - GovernanceRuleOwnerSourceTypeByTag, - GovernanceRuleOwnerSourceTypeManually, - } -} - -// GovernanceRuleSourceResourceType - The governance rule source, what the rule affects, e.g. Assessments -type GovernanceRuleSourceResourceType string - -const ( - // GovernanceRuleSourceResourceTypeAssessments - The source of the governance rule is assessments - GovernanceRuleSourceResourceTypeAssessments GovernanceRuleSourceResourceType = "Assessments" -) - -// PossibleGovernanceRuleSourceResourceTypeValues returns the possible values for the GovernanceRuleSourceResourceType const type. -func PossibleGovernanceRuleSourceResourceTypeValues() []GovernanceRuleSourceResourceType { - return []GovernanceRuleSourceResourceType{ - GovernanceRuleSourceResourceTypeAssessments, - } -} - -// GovernanceRuleType - The rule type of the governance rule, defines the source of the rule e.g. Integrated -type GovernanceRuleType string - -const ( - // GovernanceRuleTypeIntegrated - The source of the rule type definition is integrated - GovernanceRuleTypeIntegrated GovernanceRuleType = "Integrated" - // GovernanceRuleTypeServiceNow - The source of the rule type definition is ServiceNow - GovernanceRuleTypeServiceNow GovernanceRuleType = "ServiceNow" -) - -// PossibleGovernanceRuleTypeValues returns the possible values for the GovernanceRuleType const type. -func PossibleGovernanceRuleTypeValues() []GovernanceRuleType { - return []GovernanceRuleType{ - GovernanceRuleTypeIntegrated, - GovernanceRuleTypeServiceNow, - } -} - -// HybridComputeProvisioningState - State of the service principal and its secret -type HybridComputeProvisioningState string - -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" - ImplementationEffortModerate ImplementationEffort = "Moderate" -) - -// PossibleImplementationEffortValues returns the possible values for the ImplementationEffort const type. -func PossibleImplementationEffortValues() []ImplementationEffort { - return []ImplementationEffort{ - ImplementationEffortHigh, - ImplementationEffortLow, - ImplementationEffortModerate, - } -} - -type InformationProtectionPolicyName string - -const ( - InformationProtectionPolicyNameCustom InformationProtectionPolicyName = "custom" - InformationProtectionPolicyNameEffective InformationProtectionPolicyName = "effective" -) - -// PossibleInformationProtectionPolicyNameValues returns the possible values for the InformationProtectionPolicyName const type. -func PossibleInformationProtectionPolicyNameValues() []InformationProtectionPolicyName { - return []InformationProtectionPolicyName{ - InformationProtectionPolicyNameCustom, - InformationProtectionPolicyNameEffective, - } -} - -// InheritFromParentState - Update Settings. -// Enabled - Resource should inherit configurations from parent. Disabled - Resource should not inherit configurations from -// parent. -type InheritFromParentState string - -const ( - InheritFromParentStateDisabled InheritFromParentState = "Disabled" - InheritFromParentStateEnabled InheritFromParentState = "Enabled" -) - -// PossibleInheritFromParentStateValues returns the possible values for the InheritFromParentState const type. -func PossibleInheritFromParentStateValues() []InheritFromParentState { - return []InheritFromParentState{ - InheritFromParentStateDisabled, - InheritFromParentStateEnabled, - } -} - -// 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. -type Inherited string - -const ( - // InheritedFalse - Indicates that the current scope sets its own pricing configuration and does not inherit it from its parent - InheritedFalse Inherited = "False" - // InheritedTrue - Indicates that the current scope is inheriting its pricing configuration from its parent - InheritedTrue Inherited = "True" -) - -// PossibleInheritedValues returns the possible values for the Inherited const type. -func PossibleInheritedValues() []Inherited { - return []Inherited{ - InheritedFalse, - InheritedTrue, - } -} - -// Intent - The kill chain related intent behind the alert. For list of supported values, and explanations of Azure Security -// Center's supported kill chain intents. -type Intent string - -const ( - // IntentCollection - Collection consists of techniques used to identify and gather information, such as sensitive files, - // from a target network prior to exfiltration. - IntentCollection Intent = "Collection" - // IntentCommandAndControl - The command and control tactic represents how adversaries communicate with systems under their - // control within a target network. - IntentCommandAndControl Intent = "CommandAndControl" - // IntentCredentialAccess - Credential access represents techniques resulting in access to or control over system, domain, - // or service credentials that are used within an enterprise environment. - IntentCredentialAccess Intent = "CredentialAccess" - // IntentDefenseEvasion - Defense evasion consists of techniques an adversary may use to evade detection or avoid other defenses. - IntentDefenseEvasion Intent = "DefenseEvasion" - // IntentDiscovery - Discovery consists of techniques that allow the adversary to gain knowledge about the system and internal - // network. - IntentDiscovery Intent = "Discovery" - // IntentExecution - The execution tactic represents techniques that result in execution of adversary-controlled code on a - // local or remote system. - IntentExecution Intent = "Execution" - // IntentExfiltration - Exfiltration refers to techniques and attributes that result or aid in the adversary removing files - // and information from a target network. - IntentExfiltration Intent = "Exfiltration" - // IntentExploitation - Exploitation is the stage where an attacker manages to get a foothold on the attacked resource. This - // stage is relevant for compute hosts and resources such as user accounts, certificates etc. - IntentExploitation Intent = "Exploitation" - // IntentImpact - Impact events primarily try to directly reduce the availability or integrity of a system, service, or network; - // including manipulation of data to impact a business or operational process. - IntentImpact Intent = "Impact" - // IntentInitialAccess - InitialAccess is the stage where an attacker manages to get foothold on the attacked resource. - IntentInitialAccess Intent = "InitialAccess" - // IntentLateralMovement - Lateral movement consists of techniques that enable an adversary to access and control remote systems - // on a network and could, but does not necessarily, include execution of tools on remote systems. - IntentLateralMovement Intent = "LateralMovement" - // IntentPersistence - Persistence is any access, action, or configuration change to a system that gives a threat actor a - // persistent presence on that system. - IntentPersistence Intent = "Persistence" - // IntentPreAttack - PreAttack could be either an attempt to access a certain resource regardless of a malicious intent, or - // a failed attempt to gain access to a target system to gather information prior to exploitation. This step is usually detected - // as an attempt, originating from outside the network, to scan the target system and find a way in. Further details on the - // PreAttack stage can be read in [MITRE Pre-Att&ck matrix](https://attack.mitre.org/matrices/pre/). - IntentPreAttack Intent = "PreAttack" - // IntentPrivilegeEscalation - Privilege escalation is the result of actions that allow an adversary to obtain a higher level - // of permissions on a system or network. - IntentPrivilegeEscalation Intent = "PrivilegeEscalation" - // IntentProbing - Probing could be either an attempt to access a certain resource regardless of a malicious intent, or a - // failed attempt to gain access to a target system to gather information prior to exploitation. - IntentProbing Intent = "Probing" - // IntentUnknown - Unknown - IntentUnknown Intent = "Unknown" -) - -// PossibleIntentValues returns the possible values for the Intent const type. -func PossibleIntentValues() []Intent { - return []Intent{ - IntentCollection, - IntentCommandAndControl, - IntentCredentialAccess, - IntentDefenseEvasion, - IntentDiscovery, - IntentExecution, - IntentExfiltration, - IntentExploitation, - IntentImpact, - IntentInitialAccess, - IntentLateralMovement, - IntentPersistence, - IntentPreAttack, - IntentPrivilegeEscalation, - IntentProbing, - IntentUnknown, - } -} - -// IsEnabled - Indicates whether the extension is enabled. -type IsEnabled string - -const ( - // IsEnabledFalse - Indicates the extension is disabled - IsEnabledFalse IsEnabled = "False" - // IsEnabledTrue - Indicates the extension is enabled - IsEnabledTrue IsEnabled = "True" -) - -// PossibleIsEnabledValues returns the possible values for the IsEnabled const type. -func PossibleIsEnabledValues() []IsEnabled { - return []IsEnabled{ - IsEnabledFalse, - IsEnabledTrue, - } -} - -// Kind - The kind of alert simulation. -type Kind string - -const ( - // KindBundles - Simulate alerts according to bundles - KindBundles Kind = "Bundles" -) - -// PossibleKindValues returns the possible values for the Kind const type. -func PossibleKindValues() []Kind { - return []Kind{ - KindBundles, - } -} - -// MinimalRiskLevel - Defines the minimal attack path risk level which will be sent as email notifications -type MinimalRiskLevel string - -const ( - // MinimalRiskLevelCritical - Get notifications on new attack paths with Critical risk level - MinimalRiskLevelCritical MinimalRiskLevel = "Critical" - // MinimalRiskLevelHigh - Get notifications on new attack paths with High or Critical risk level - MinimalRiskLevelHigh MinimalRiskLevel = "High" - // MinimalRiskLevelLow - Get notifications on new attach paths with Low, Medium, High or Critical risk level - MinimalRiskLevelLow MinimalRiskLevel = "Low" - // MinimalRiskLevelMedium - Get notifications on new attach paths with Medium, High or Critical risk level - MinimalRiskLevelMedium MinimalRiskLevel = "Medium" -) - -// PossibleMinimalRiskLevelValues returns the possible values for the MinimalRiskLevel const type. -func PossibleMinimalRiskLevelValues() []MinimalRiskLevel { - return []MinimalRiskLevel{ - MinimalRiskLevelCritical, - MinimalRiskLevelHigh, - MinimalRiskLevelLow, - MinimalRiskLevelMedium, - } -} - -// MinimalSeverity - Defines the minimal alert severity which will be sent as email notifications -type MinimalSeverity string - -const ( - // MinimalSeverityHigh - Get notifications on new alerts with High severity - MinimalSeverityHigh MinimalSeverity = "High" - // MinimalSeverityLow - Get notifications on new alerts with Low, Medium or High severity - MinimalSeverityLow MinimalSeverity = "Low" - // MinimalSeverityMedium - Get notifications on new alerts with Medium or High severity - MinimalSeverityMedium MinimalSeverity = "Medium" -) - -// PossibleMinimalSeverityValues returns the possible values for the MinimalSeverity const type. -func PossibleMinimalSeverityValues() []MinimalSeverity { - return []MinimalSeverity{ - MinimalSeverityHigh, - MinimalSeverityLow, - MinimalSeverityMedium, - } -} - -// MipIntegrationStatus - Microsoft information protection integration status -type MipIntegrationStatus string - -const ( - MipIntegrationStatusNoAutoLabelingRules MipIntegrationStatus = "noAutoLabelingRules" - MipIntegrationStatusNoConsent MipIntegrationStatus = "noConsent" - MipIntegrationStatusNoMipLabels MipIntegrationStatus = "noMipLabels" - MipIntegrationStatusOk MipIntegrationStatus = "Ok" -) - -// PossibleMipIntegrationStatusValues returns the possible values for the MipIntegrationStatus const type. -func PossibleMipIntegrationStatusValues() []MipIntegrationStatus { - return []MipIntegrationStatus{ - MipIntegrationStatusNoAutoLabelingRules, - MipIntegrationStatusNoConsent, - MipIntegrationStatusNoMipLabels, - MipIntegrationStatusOk, - } -} - -// OfferingType - The type of the security offering. -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" - OfferingTypeDefenderForContainersAws OfferingType = "DefenderForContainersAws" - OfferingTypeDefenderForContainersGcp OfferingType = "DefenderForContainersGcp" - OfferingTypeDefenderForDatabasesAws OfferingType = "DefenderForDatabasesAws" - OfferingTypeDefenderForDatabasesGcp OfferingType = "DefenderForDatabasesGcp" - OfferingTypeDefenderForServersAws OfferingType = "DefenderForServersAws" - OfferingTypeDefenderForServersGcp OfferingType = "DefenderForServersGcp" -) - -// PossibleOfferingTypeValues returns the possible values for the OfferingType const type. -func PossibleOfferingTypeValues() []OfferingType { - return []OfferingType{ - OfferingTypeCspmMonitorAws, - OfferingTypeCspmMonitorAzureDevOps, - OfferingTypeCspmMonitorGcp, - OfferingTypeCspmMonitorGitLab, - OfferingTypeCspmMonitorGithub, - OfferingTypeDefenderCspmAws, - OfferingTypeDefenderCspmGcp, - OfferingTypeDefenderForContainersAws, - OfferingTypeDefenderForContainersGcp, - OfferingTypeDefenderForDatabasesAws, - OfferingTypeDefenderForDatabasesGcp, - OfferingTypeDefenderForServersAws, - OfferingTypeDefenderForServersGcp, - } -} - -// 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. -type OnboardingState string - -const ( - OnboardingStateNotApplicable OnboardingState = "NotApplicable" - OnboardingStateNotOnboarded OnboardingState = "NotOnboarded" - OnboardingStateOnboarded OnboardingState = "Onboarded" - OnboardingStateOnboardedByOtherConnector OnboardingState = "OnboardedByOtherConnector" -) - -// PossibleOnboardingStateValues returns the possible values for the OnboardingState const type. -func PossibleOnboardingStateValues() []OnboardingState { - return []OnboardingState{ - OnboardingStateNotApplicable, - OnboardingStateNotOnboarded, - OnboardingStateOnboarded, - OnboardingStateOnboardedByOtherConnector, - } -} - -// OperationResult - The status of the long run operation result of governance rule -type OperationResult string - -const ( - // OperationResultCanceled - The operation canceled - OperationResultCanceled OperationResult = "Canceled" - // OperationResultFailed - The operation failed - OperationResultFailed OperationResult = "Failed" - // OperationResultSucceeded - The operation succeeded - OperationResultSucceeded OperationResult = "Succeeded" -) - -// PossibleOperationResultValues returns the possible values for the OperationResult const type. -func PossibleOperationResultValues() []OperationResult { - return []OperationResult{ - OperationResultCanceled, - OperationResultFailed, - OperationResultSucceeded, - } -} - -// Operator - A valid comparer operator to use. A case-insensitive comparison will be applied for String PropertyType. -type Operator string - -const ( - // OperatorContains - Applies only for non-decimal operands - OperatorContains Operator = "Contains" - // OperatorEndsWith - Applies only for non-decimal operands - OperatorEndsWith Operator = "EndsWith" - // OperatorEquals - Applies for decimal and non-decimal operands - OperatorEquals Operator = "Equals" - // OperatorGreaterThan - Applies only for decimal operands - OperatorGreaterThan Operator = "GreaterThan" - // OperatorGreaterThanOrEqualTo - Applies only for decimal operands - OperatorGreaterThanOrEqualTo Operator = "GreaterThanOrEqualTo" - // OperatorLesserThan - Applies only for decimal operands - OperatorLesserThan Operator = "LesserThan" - // OperatorLesserThanOrEqualTo - Applies only for decimal operands - OperatorLesserThanOrEqualTo Operator = "LesserThanOrEqualTo" - // OperatorNotEquals - Applies for decimal and non-decimal operands - OperatorNotEquals Operator = "NotEquals" - // OperatorStartsWith - Applies only for non-decimal operands - OperatorStartsWith Operator = "StartsWith" -) - -// PossibleOperatorValues returns the possible values for the Operator const type. -func PossibleOperatorValues() []Operator { - return []Operator{ - OperatorContains, - OperatorEndsWith, - OperatorEquals, - OperatorGreaterThan, - OperatorGreaterThanOrEqualTo, - OperatorLesserThan, - OperatorLesserThanOrEqualTo, - OperatorNotEquals, - OperatorStartsWith, - } -} - -// OrganizationMembershipType - The multi cloud account's membership type in the organization -type OrganizationMembershipType string - -const ( - OrganizationMembershipTypeMember OrganizationMembershipType = "Member" - OrganizationMembershipTypeOrganization OrganizationMembershipType = "Organization" -) - -// PossibleOrganizationMembershipTypeValues returns the possible values for the OrganizationMembershipType const type. -func PossibleOrganizationMembershipTypeValues() []OrganizationMembershipType { - return []OrganizationMembershipType{ - OrganizationMembershipTypeMember, - OrganizationMembershipTypeOrganization, - } -} - -// PermissionProperty - A permission detected in the cloud account. -type PermissionProperty 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" -) - -// PossiblePermissionPropertyValues returns the possible values for the PermissionProperty const type. -func PossiblePermissionPropertyValues() []PermissionProperty { - return []PermissionProperty{ - PermissionPropertyAWSAWSSecurityHubReadOnlyAccess, - PermissionPropertyAWSAmazonSSMAutomationRole, - PermissionPropertyAWSSecurityAudit, - PermissionPropertyGCPSecurityCenterAdminViewer, - } -} - -// 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. -type PricingTier string - -const ( - // PricingTierFree - Get free Microsoft Defender for Cloud experience with basic security features - PricingTierFree PricingTier = "Free" - // PricingTierStandard - Get the standard Microsoft Defender for Cloud experience with advanced security features - PricingTierStandard PricingTier = "Standard" -) - -// PossiblePricingTierValues returns the possible values for the PricingTier const type. -func PossiblePricingTierValues() []PricingTier { - return []PricingTier{ - PricingTierFree, - PricingTierStandard, - } -} - -// PropertyType - The data type of the compared operands (string, integer, floating point number or a boolean [true/false]] -type PropertyType string - -const ( - PropertyTypeBoolean PropertyType = "Boolean" - PropertyTypeInteger PropertyType = "Integer" - PropertyTypeNumber PropertyType = "Number" - PropertyTypeString PropertyType = "String" -) - -// PossiblePropertyTypeValues returns the possible values for the PropertyType const type. -func PossiblePropertyTypeValues() []PropertyType { - return []PropertyType{ - PropertyTypeBoolean, - PropertyTypeInteger, - PropertyTypeNumber, - PropertyTypeString, - } -} - -type Protocol string - -const ( - ProtocolAll Protocol = "*" - ProtocolTCP Protocol = "TCP" - ProtocolUDP Protocol = "UDP" -) - -// PossibleProtocolValues returns the possible values for the Protocol const type. -func PossibleProtocolValues() []Protocol { - return []Protocol{ - ProtocolAll, - ProtocolTCP, - ProtocolUDP, - } -} - -// ProvisioningState - The security family provisioning State -type ProvisioningState string - -const ( - ProvisioningStateFailed ProvisioningState = "Failed" - ProvisioningStateSucceeded ProvisioningState = "Succeeded" - ProvisioningStateUpdating ProvisioningState = "Updating" -) - -// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ - ProvisioningStateFailed, - ProvisioningStateSucceeded, - ProvisioningStateUpdating, - } -} - -// Rank - The rank of the sensitivity label. -type Rank string - -const ( - RankCritical Rank = "Critical" - RankHigh Rank = "High" - RankLow Rank = "Low" - RankMedium Rank = "Medium" - RankNone Rank = "None" -) - -// PossibleRankValues returns the possible values for the Rank const type. -func PossibleRankValues() []Rank { - return []Rank{ - RankCritical, - RankHigh, - RankLow, - RankMedium, - RankNone, - } -} - -// 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 RecommendationConfigStatus = "Disabled" - RecommendationConfigStatusEnabled RecommendationConfigStatus = "Enabled" -) - -// PossibleRecommendationConfigStatusValues returns the possible values for the RecommendationConfigStatus const type. -func PossibleRecommendationConfigStatusValues() []RecommendationConfigStatus { - return []RecommendationConfigStatus{ - RecommendationConfigStatusDisabled, - RecommendationConfigStatusEnabled, - } -} - -// RecommendationStatus - The initial recommendation status of the machine group or machine -type RecommendationStatus string - -const ( - RecommendationStatusNoStatus RecommendationStatus = "NoStatus" - RecommendationStatusNotAvailable RecommendationStatus = "NotAvailable" - RecommendationStatusNotRecommended RecommendationStatus = "NotRecommended" - RecommendationStatusRecommended RecommendationStatus = "Recommended" -) - -// PossibleRecommendationStatusValues returns the possible values for the RecommendationStatus const type. -func PossibleRecommendationStatusValues() []RecommendationStatus { - return []RecommendationStatus{ - RecommendationStatusNoStatus, - RecommendationStatusNotAvailable, - RecommendationStatusNotRecommended, - RecommendationStatusRecommended, - } -} - -// RecommendationType - The type of IoT Security recommendation. -type RecommendationType string - -const ( - // RecommendationTypeIoTAcrauthentication - Authentication schema used for pull an edge module from an ACR repository does - // not use Service Principal Authentication. - RecommendationTypeIoTAcrauthentication RecommendationType = "IoT_ACRAuthentication" - // RecommendationTypeIoTAgentSendsUnutilizedMessages - IoT agent message size capacity is currently underutilized, causing - // an increase in the number of sent messages. Adjust message intervals for better utilization. - RecommendationTypeIoTAgentSendsUnutilizedMessages RecommendationType = "IoT_AgentSendsUnutilizedMessages" - // RecommendationTypeIoTBaseline - Identified security related system configuration issues. - RecommendationTypeIoTBaseline RecommendationType = "IoT_Baseline" - // RecommendationTypeIoTEdgeHubMemOptimize - You can optimize Edge Hub memory usage by turning off protocol heads for any - // protocols not used by Edge modules in your solution. - RecommendationTypeIoTEdgeHubMemOptimize RecommendationType = "IoT_EdgeHubMemOptimize" - // RecommendationTypeIoTEdgeLoggingOptions - Logging is disabled for this edge module. - RecommendationTypeIoTEdgeLoggingOptions RecommendationType = "IoT_EdgeLoggingOptions" - // RecommendationTypeIoTInconsistentModuleSettings - A minority within a device security group has inconsistent Edge Module - // settings with the rest of their group. - RecommendationTypeIoTInconsistentModuleSettings RecommendationType = "IoT_InconsistentModuleSettings" - // RecommendationTypeIoTInstallAgent - Install the Azure Security of Things Agent. - RecommendationTypeIoTInstallAgent RecommendationType = "IoT_InstallAgent" - // RecommendationTypeIoTIpfilterDenyAll - IP Filter Configuration should have rules defined for allowed traffic and should - // deny all other traffic by default. - RecommendationTypeIoTIpfilterDenyAll RecommendationType = "IoT_IPFilter_DenyAll" - // RecommendationTypeIoTIpfilterPermissiveRule - An Allow IP Filter rules source IP range is too large. Overly permissive - // rules might expose your IoT hub to malicious intenders. - RecommendationTypeIoTIpfilterPermissiveRule RecommendationType = "IoT_IPFilter_PermissiveRule" - // RecommendationTypeIoTOpenPorts - A listening endpoint was found on the device. - RecommendationTypeIoTOpenPorts RecommendationType = "IoT_OpenPorts" - // RecommendationTypeIoTPermissiveFirewallPolicy - An Allowed firewall policy was found (INPUT/OUTPUT). The policy should - // Deny all traffic by default and define rules to allow necessary communication to/from the device. - RecommendationTypeIoTPermissiveFirewallPolicy RecommendationType = "IoT_PermissiveFirewallPolicy" - // RecommendationTypeIoTPermissiveInputFirewallRules - A rule in the firewall has been found that contains a permissive pattern - // for a wide range of IP addresses or Ports. - RecommendationTypeIoTPermissiveInputFirewallRules RecommendationType = "IoT_PermissiveInputFirewallRules" - // RecommendationTypeIoTPermissiveOutputFirewallRules - A rule in the firewall has been found that contains a permissive pattern - // for a wide range of IP addresses or Ports. - RecommendationTypeIoTPermissiveOutputFirewallRules RecommendationType = "IoT_PermissiveOutputFirewallRules" - // RecommendationTypeIoTPrivilegedDockerOptions - Edge module is configured to run in privileged mode, with extensive Linux - // capabilities or with host-level network access (send/receive data to host machine). - RecommendationTypeIoTPrivilegedDockerOptions RecommendationType = "IoT_PrivilegedDockerOptions" - // RecommendationTypeIoTSharedCredentials - Same authentication credentials to the IoT Hub used by multiple devices. This - // could indicate an illegitimate device impersonating a legitimate device. It also exposes the risk of device impersonation - // by an attacker. - RecommendationTypeIoTSharedCredentials RecommendationType = "IoT_SharedCredentials" - // RecommendationTypeIoTVulnerableTLSCipherSuite - Insecure TLS configurations detected. Immediate upgrade recommended. - RecommendationTypeIoTVulnerableTLSCipherSuite RecommendationType = "IoT_VulnerableTLSCipherSuite" -) - -// PossibleRecommendationTypeValues returns the possible values for the RecommendationType const type. -func PossibleRecommendationTypeValues() []RecommendationType { - return []RecommendationType{ - RecommendationTypeIoTAcrauthentication, - RecommendationTypeIoTAgentSendsUnutilizedMessages, - RecommendationTypeIoTBaseline, - RecommendationTypeIoTEdgeHubMemOptimize, - RecommendationTypeIoTEdgeLoggingOptions, - RecommendationTypeIoTInconsistentModuleSettings, - RecommendationTypeIoTInstallAgent, - RecommendationTypeIoTIpfilterDenyAll, - RecommendationTypeIoTIpfilterPermissiveRule, - RecommendationTypeIoTOpenPorts, - RecommendationTypeIoTPermissiveFirewallPolicy, - RecommendationTypeIoTPermissiveInputFirewallRules, - RecommendationTypeIoTPermissiveOutputFirewallRules, - RecommendationTypeIoTPrivilegedDockerOptions, - RecommendationTypeIoTSharedCredentials, - RecommendationTypeIoTVulnerableTLSCipherSuite, - } -} - -// ReportedSeverity - Assessed alert severity. -type ReportedSeverity string - -const ( - ReportedSeverityHigh ReportedSeverity = "High" - ReportedSeverityInformational ReportedSeverity = "Informational" - ReportedSeverityLow ReportedSeverity = "Low" - ReportedSeverityMedium ReportedSeverity = "Medium" -) - -// PossibleReportedSeverityValues returns the possible values for the ReportedSeverity const type. -func PossibleReportedSeverityValues() []ReportedSeverity { - return []ReportedSeverity{ - ReportedSeverityHigh, - ReportedSeverityInformational, - ReportedSeverityLow, - ReportedSeverityMedium, - } -} - -// ResourceIdentifierType - There can be multiple identifiers of different type per alert, this field specify the identifier -// type. -type ResourceIdentifierType string - -const ( - ResourceIdentifierTypeAzureResource ResourceIdentifierType = "AzureResource" - ResourceIdentifierTypeLogAnalytics ResourceIdentifierType = "LogAnalytics" -) - -// PossibleResourceIdentifierTypeValues returns the possible values for the ResourceIdentifierType const type. -func PossibleResourceIdentifierTypeValues() []ResourceIdentifierType { - return []ResourceIdentifierType{ - ResourceIdentifierTypeAzureResource, - ResourceIdentifierTypeLogAnalytics, - } -} - -// ResourceStatus - The status of the resource regarding a single assessment -type ResourceStatus string - -const ( - // ResourceStatusHealthy - This assessment on the resource is healthy - ResourceStatusHealthy ResourceStatus = "Healthy" - // ResourceStatusNotApplicable - This assessment is not applicable to this resource - ResourceStatusNotApplicable ResourceStatus = "NotApplicable" - // ResourceStatusNotHealthy - This assessment on the resource is not healthy - ResourceStatusNotHealthy ResourceStatus = "NotHealthy" - // ResourceStatusOffByPolicy - This assessment is turned off by policy on this subscription - ResourceStatusOffByPolicy ResourceStatus = "OffByPolicy" -) - -// PossibleResourceStatusValues returns the possible values for the ResourceStatus const type. -func PossibleResourceStatusValues() []ResourceStatus { - return []ResourceStatus{ - ResourceStatusHealthy, - ResourceStatusNotApplicable, - ResourceStatusNotHealthy, - ResourceStatusOffByPolicy, - } -} - -// 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. -type ResourcesCoverageStatus string - -const ( - // ResourcesCoverageStatusFullyCovered - This value indicates that all resources associated with the subscription have the - // Defender plan enabled. - ResourcesCoverageStatusFullyCovered ResourcesCoverageStatus = "FullyCovered" - // ResourcesCoverageStatusNotCovered - This value indicates that the Defender plan is disabled for all resources under the - // subscription. None of the resources are protected by the Defender plan. - ResourcesCoverageStatusNotCovered ResourcesCoverageStatus = "NotCovered" - // ResourcesCoverageStatusPartiallyCovered - This value indicates that some resources under the subscription have the Defender - // plan enabled, while others have it disabled. There is a mixed coverage status among resources. - ResourcesCoverageStatusPartiallyCovered ResourcesCoverageStatus = "PartiallyCovered" -) - -// PossibleResourcesCoverageStatusValues returns the possible values for the ResourcesCoverageStatus const type. -func PossibleResourcesCoverageStatusValues() []ResourcesCoverageStatus { - return []ResourcesCoverageStatus{ - ResourcesCoverageStatusFullyCovered, - ResourcesCoverageStatusNotCovered, - ResourcesCoverageStatusPartiallyCovered, - } -} - -// 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" - RuleCategoryDependencies RuleCategory = "Dependencies" - RuleCategoryIaC RuleCategory = "IaC" - RuleCategorySecrets RuleCategory = "Secrets" -) - -// PossibleRuleCategoryValues returns the possible values for the RuleCategory const type. -func PossibleRuleCategoryValues() []RuleCategory { - return []RuleCategory{ - RuleCategoryArtifacts, - RuleCategoryCode, - RuleCategoryContainers, - RuleCategoryDependencies, - RuleCategoryIaC, - RuleCategorySecrets, - } -} - -// RuleSeverity - The rule severity. -type RuleSeverity string - -const ( - // RuleSeverityHigh - High - RuleSeverityHigh RuleSeverity = "High" - // RuleSeverityInformational - Informational - RuleSeverityInformational RuleSeverity = "Informational" - // RuleSeverityLow - Low - RuleSeverityLow RuleSeverity = "Low" - // RuleSeverityMedium - Medium - RuleSeverityMedium RuleSeverity = "Medium" - // RuleSeverityObsolete - Obsolete - RuleSeverityObsolete RuleSeverity = "Obsolete" -) - -// PossibleRuleSeverityValues returns the possible values for the RuleSeverity const type. -func PossibleRuleSeverityValues() []RuleSeverity { - return []RuleSeverity{ - RuleSeverityHigh, - RuleSeverityInformational, - RuleSeverityLow, - RuleSeverityMedium, - RuleSeverityObsolete, - } -} - -// RuleState - Possible states of the rule -type RuleState string - -const ( - RuleStateDisabled RuleState = "Disabled" - RuleStateEnabled RuleState = "Enabled" - RuleStateExpired RuleState = "Expired" -) - -// PossibleRuleStateValues returns the possible values for the RuleState const type. -func PossibleRuleStateValues() []RuleState { - return []RuleState{ - RuleStateDisabled, - RuleStateEnabled, - RuleStateExpired, - } -} - -// RuleStatus - The rule result status. -type RuleStatus string - -const ( - // RuleStatusFinding - Finding - RuleStatusFinding RuleStatus = "Finding" - // RuleStatusInternalError - InternalError - RuleStatusInternalError RuleStatus = "InternalError" - // RuleStatusNonFinding - NonFinding - RuleStatusNonFinding RuleStatus = "NonFinding" -) - -// PossibleRuleStatusValues returns the possible values for the RuleStatus const type. -func PossibleRuleStatusValues() []RuleStatus { - return []RuleStatus{ - RuleStatusFinding, - RuleStatusInternalError, - RuleStatusNonFinding, - } -} - -// RuleType - The rule type. -type RuleType string - -const ( - // RuleTypeBaselineExpected - BaselineExpected - RuleTypeBaselineExpected RuleType = "BaselineExpected" - // RuleTypeBinary - Binary - RuleTypeBinary RuleType = "Binary" - // RuleTypeNegativeList - NegativeList - RuleTypeNegativeList RuleType = "NegativeList" - // RuleTypePositiveList - PositiveList - RuleTypePositiveList RuleType = "PositiveList" -) - -// PossibleRuleTypeValues returns the possible values for the RuleType const type. -func PossibleRuleTypeValues() []RuleType { - return []RuleType{ - RuleTypeBaselineExpected, - RuleTypeBinary, - RuleTypeNegativeList, - RuleTypePositiveList, - } -} - -// ScanState - The scan status. -type ScanState string - -const ( - // ScanStateFailed - Failed - ScanStateFailed ScanState = "Failed" - // ScanStateFailedToRun - FailedToRun - ScanStateFailedToRun ScanState = "FailedToRun" - // ScanStateInProgress - InProgress - ScanStateInProgress ScanState = "InProgress" - // ScanStatePassed - Passed - ScanStatePassed ScanState = "Passed" -) - -// PossibleScanStateValues returns the possible values for the ScanState const type. -func PossibleScanStateValues() []ScanState { - return []ScanState{ - ScanStateFailed, - ScanStateFailedToRun, - ScanStateInProgress, - ScanStatePassed, - } -} - -// ScanTriggerType - The scan trigger type. -type ScanTriggerType string - -const ( - // ScanTriggerTypeOnDemand - OnDemand - ScanTriggerTypeOnDemand ScanTriggerType = "OnDemand" - // ScanTriggerTypeRecurring - Recurring - ScanTriggerTypeRecurring ScanTriggerType = "Recurring" -) - -// PossibleScanTriggerTypeValues returns the possible values for the ScanTriggerType const type. -func PossibleScanTriggerTypeValues() []ScanTriggerType { - return []ScanTriggerType{ - ScanTriggerTypeOnDemand, - ScanTriggerTypeRecurring, - } -} - -// ScanningMode - The scanning mode for the VM scan. -type ScanningMode string - -const ( - ScanningModeDefault ScanningMode = "Default" -) - -// PossibleScanningModeValues returns the possible values for the ScanningMode const type. -func PossibleScanningModeValues() []ScanningMode { - return []ScanningMode{ - ScanningModeDefault, - } -} - -type SecurityContactName string - -const ( - // SecurityContactNameDefault - The single applicable name of the security contact object - SecurityContactNameDefault SecurityContactName = "default" -) - -// PossibleSecurityContactNameValues returns the possible values for the SecurityContactName const type. -func PossibleSecurityContactNameValues() []SecurityContactName { - return []SecurityContactName{ - SecurityContactNameDefault, - } -} - -// SecurityContactRole - A possible role to configure sending security notification alerts to -type SecurityContactRole string - -const ( - // SecurityContactRoleAccountAdmin - If enabled, send notification on new alerts to the account admins - SecurityContactRoleAccountAdmin SecurityContactRole = "AccountAdmin" - // SecurityContactRoleContributor - If enabled, send notification on new alerts to the subscription contributors - SecurityContactRoleContributor SecurityContactRole = "Contributor" - // SecurityContactRoleOwner - If enabled, send notification on new alerts to the subscription owners - SecurityContactRoleOwner SecurityContactRole = "Owner" - // SecurityContactRoleServiceAdmin - If enabled, send notification on new alerts to the service admins - SecurityContactRoleServiceAdmin SecurityContactRole = "ServiceAdmin" -) - -// PossibleSecurityContactRoleValues returns the possible values for the SecurityContactRole const type. -func PossibleSecurityContactRoleValues() []SecurityContactRole { - return []SecurityContactRole{ - SecurityContactRoleAccountAdmin, - SecurityContactRoleContributor, - SecurityContactRoleOwner, - SecurityContactRoleServiceAdmin, - } -} - -// SecurityFamily - The security family of the discovered solution -type SecurityFamily string - -const ( - SecurityFamilyNgfw SecurityFamily = "Ngfw" - SecurityFamilySaasWaf SecurityFamily = "SaasWaf" - SecurityFamilyVa SecurityFamily = "Va" - SecurityFamilyWaf SecurityFamily = "Waf" -) - -// PossibleSecurityFamilyValues returns the possible values for the SecurityFamily const type. -func PossibleSecurityFamilyValues() []SecurityFamily { - return []SecurityFamily{ - SecurityFamilyNgfw, - SecurityFamilySaasWaf, - SecurityFamilyVa, - SecurityFamilyWaf, - } -} - -// SecuritySolutionStatus - Status of the IoT Security solution. -type SecuritySolutionStatus string - -const ( - SecuritySolutionStatusDisabled SecuritySolutionStatus = "Disabled" - SecuritySolutionStatusEnabled SecuritySolutionStatus = "Enabled" -) - -// PossibleSecuritySolutionStatusValues returns the possible values for the SecuritySolutionStatus const type. -func PossibleSecuritySolutionStatusValues() []SecuritySolutionStatus { - return []SecuritySolutionStatus{ - SecuritySolutionStatusDisabled, - SecuritySolutionStatusEnabled, - } -} - -// ServerVulnerabilityAssessmentPropertiesProvisioningState - The provisioningState of the vulnerability assessment capability -// on the VM -type ServerVulnerabilityAssessmentPropertiesProvisioningState string - -const ( - ServerVulnerabilityAssessmentPropertiesProvisioningStateCanceled ServerVulnerabilityAssessmentPropertiesProvisioningState = "Canceled" - ServerVulnerabilityAssessmentPropertiesProvisioningStateDeprovisioning ServerVulnerabilityAssessmentPropertiesProvisioningState = "Deprovisioning" - ServerVulnerabilityAssessmentPropertiesProvisioningStateFailed ServerVulnerabilityAssessmentPropertiesProvisioningState = "Failed" - ServerVulnerabilityAssessmentPropertiesProvisioningStateProvisioning ServerVulnerabilityAssessmentPropertiesProvisioningState = "Provisioning" - ServerVulnerabilityAssessmentPropertiesProvisioningStateSucceeded ServerVulnerabilityAssessmentPropertiesProvisioningState = "Succeeded" -) - -// PossibleServerVulnerabilityAssessmentPropertiesProvisioningStateValues returns the possible values for the ServerVulnerabilityAssessmentPropertiesProvisioningState const type. -func PossibleServerVulnerabilityAssessmentPropertiesProvisioningStateValues() []ServerVulnerabilityAssessmentPropertiesProvisioningState { - return []ServerVulnerabilityAssessmentPropertiesProvisioningState{ - ServerVulnerabilityAssessmentPropertiesProvisioningStateCanceled, - ServerVulnerabilityAssessmentPropertiesProvisioningStateDeprovisioning, - ServerVulnerabilityAssessmentPropertiesProvisioningStateFailed, - ServerVulnerabilityAssessmentPropertiesProvisioningStateProvisioning, - ServerVulnerabilityAssessmentPropertiesProvisioningStateSucceeded, - } -} - -// ServerVulnerabilityAssessmentsAzureSettingSelectedProvider - The selected vulnerability assessments provider on Azure servers -// in the defined scope. -type ServerVulnerabilityAssessmentsAzureSettingSelectedProvider string - -const ( - // ServerVulnerabilityAssessmentsAzureSettingSelectedProviderMdeTvm - Microsoft Defender for Endpoints threat and vulnerability - // management. - ServerVulnerabilityAssessmentsAzureSettingSelectedProviderMdeTvm ServerVulnerabilityAssessmentsAzureSettingSelectedProvider = "MdeTvm" -) - -// PossibleServerVulnerabilityAssessmentsAzureSettingSelectedProviderValues returns the possible values for the ServerVulnerabilityAssessmentsAzureSettingSelectedProvider const type. -func PossibleServerVulnerabilityAssessmentsAzureSettingSelectedProviderValues() []ServerVulnerabilityAssessmentsAzureSettingSelectedProvider { - return []ServerVulnerabilityAssessmentsAzureSettingSelectedProvider{ - ServerVulnerabilityAssessmentsAzureSettingSelectedProviderMdeTvm, - } -} - -// ServerVulnerabilityAssessmentsSettingKind - The kind of the server vulnerability assessments setting -type ServerVulnerabilityAssessmentsSettingKind string - -const ( - ServerVulnerabilityAssessmentsSettingKindAzureServersSetting ServerVulnerabilityAssessmentsSettingKind = "AzureServersSetting" -) - -// PossibleServerVulnerabilityAssessmentsSettingKindValues returns the possible values for the ServerVulnerabilityAssessmentsSettingKind const type. -func PossibleServerVulnerabilityAssessmentsSettingKindValues() []ServerVulnerabilityAssessmentsSettingKind { - return []ServerVulnerabilityAssessmentsSettingKind{ - ServerVulnerabilityAssessmentsSettingKindAzureServersSetting, - } -} - -type ServerVulnerabilityAssessmentsSettingKindName string - -const ( - ServerVulnerabilityAssessmentsSettingKindNameAzureServersSetting ServerVulnerabilityAssessmentsSettingKindName = "azureServersSetting" -) - -// PossibleServerVulnerabilityAssessmentsSettingKindNameValues returns the possible values for the ServerVulnerabilityAssessmentsSettingKindName const type. -func PossibleServerVulnerabilityAssessmentsSettingKindNameValues() []ServerVulnerabilityAssessmentsSettingKindName { - return []ServerVulnerabilityAssessmentsSettingKindName{ - ServerVulnerabilityAssessmentsSettingKindNameAzureServersSetting, - } -} - -// SettingKind - the kind of the settings string -type SettingKind string - -const ( - SettingKindAlertSuppressionSetting SettingKind = "AlertSuppressionSetting" - SettingKindAlertSyncSettings SettingKind = "AlertSyncSettings" - SettingKindDataExportSettings SettingKind = "DataExportSettings" -) - -// PossibleSettingKindValues returns the possible values for the SettingKind const type. -func PossibleSettingKindValues() []SettingKind { - return []SettingKind{ - SettingKindAlertSuppressionSetting, - SettingKindAlertSyncSettings, - SettingKindDataExportSettings, - } -} - type SettingName string const ( @@ -2005,642 +26,3 @@ func PossibleSettingNameValues() []SettingName { SettingNameCurrent, } } - -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 -type Severity string - -const ( - SeverityHigh Severity = "High" - SeverityLow Severity = "Low" - SeverityMedium Severity = "Medium" -) - -// PossibleSeverityValues returns the possible values for the Severity const type. -func PossibleSeverityValues() []Severity { - return []Severity{ - SeverityHigh, - SeverityLow, - SeverityMedium, - } -} - -// SeverityEnum - The severity to relate to the assessments generated by this assessment automation. -type SeverityEnum string - -const ( - SeverityEnumHigh SeverityEnum = "High" - SeverityEnumLow SeverityEnum = "Low" - SeverityEnumMedium SeverityEnum = "Medium" -) - -// PossibleSeverityEnumValues returns the possible values for the SeverityEnum const type. -func PossibleSeverityEnumValues() []SeverityEnum { - return []SeverityEnum{ - SeverityEnumHigh, - SeverityEnumLow, - SeverityEnumMedium, - } -} - -// Source - The platform where the assessed resource resides -type Source string - -const ( - // SourceAzure - Resource is in Azure - SourceAzure Source = "Azure" - // SourceOnPremise - Resource in an on premise machine connected to Azure cloud - SourceOnPremise Source = "OnPremise" - // SourceOnPremiseSQL - SQL Resource in an on premise machine connected to Azure cloud - SourceOnPremiseSQL Source = "OnPremiseSql" -) - -// PossibleSourceValues returns the possible values for the Source const type. -func PossibleSourceValues() []Source { - return []Source{ - SourceAzure, - SourceOnPremise, - 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" - SourceTypeAttackPath SourceType = "AttackPath" -) - -// PossibleSourceTypeValues returns the possible values for the SourceType const type. -func PossibleSourceTypeValues() []SourceType { - return []SourceType{ - SourceTypeAlert, - SourceTypeAttackPath, - } -} - -// 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" - // 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 - StateSkipped State = "Skipped" - // StateUnsupported - No supported regulatory compliance data for the given standard - StateUnsupported State = "Unsupported" -) - -// PossibleStateValues returns the possible values for the State const type. -func PossibleStateValues() []State { - return []State{ - StateFailed, - StatePassed, - StateSkipped, - StateUnsupported, - } -} - -// Status - The status of the port -type Status string - -const ( - StatusInitiated Status = "Initiated" - StatusRevoked Status = "Revoked" -) - -// PossibleStatusValues returns the possible values for the Status const type. -func PossibleStatusValues() []Status { - return []Status{ - StatusInitiated, - StatusRevoked, - } -} - -// StatusName - The status of the health report -type StatusName string - -const ( - StatusNameHealthy StatusName = "Healthy" - StatusNameNotApplicable StatusName = "NotApplicable" - StatusNameNotHealthy StatusName = "NotHealthy" -) - -// PossibleStatusNameValues returns the possible values for the StatusName const type. -func PossibleStatusNameValues() []StatusName { - return []StatusName{ - StatusNameHealthy, - StatusNameNotApplicable, - StatusNameNotHealthy, - } -} - -// StatusReason - A description of why the status has its value -type StatusReason string - -const ( - StatusReasonExpired StatusReason = "Expired" - StatusReasonNewerRequestInitiated StatusReason = "NewerRequestInitiated" - StatusReasonUserRequested StatusReason = "UserRequested" -) - -// PossibleStatusReasonValues returns the possible values for the StatusReason const type. -func PossibleStatusReasonValues() []StatusReason { - return []StatusReason{ - StatusReasonExpired, - StatusReasonNewerRequestInitiated, - StatusReasonUserRequested, - } -} - -// SubAssessmentStatusCode - Programmatic code for the status of the assessment -type SubAssessmentStatusCode string - -const ( - // SubAssessmentStatusCodeHealthy - The resource is healthy - SubAssessmentStatusCodeHealthy SubAssessmentStatusCode = "Healthy" - // SubAssessmentStatusCodeNotApplicable - Assessment for this resource did not happen - SubAssessmentStatusCodeNotApplicable SubAssessmentStatusCode = "NotApplicable" - // SubAssessmentStatusCodeUnhealthy - The resource has a security issue that needs to be addressed - SubAssessmentStatusCodeUnhealthy SubAssessmentStatusCode = "Unhealthy" -) - -// PossibleSubAssessmentStatusCodeValues returns the possible values for the SubAssessmentStatusCode const type. -func PossibleSubAssessmentStatusCodeValues() []SubAssessmentStatusCode { - return []SubAssessmentStatusCode{ - SubAssessmentStatusCodeHealthy, - SubAssessmentStatusCodeNotApplicable, - SubAssessmentStatusCodeUnhealthy, - } -} - -// SubPlan - The available sub plans -type SubPlan string - -const ( - SubPlanP1 SubPlan = "P1" - SubPlanP2 SubPlan = "P2" -) - -// PossibleSubPlanValues returns the possible values for the SubPlan const type. -func PossibleSubPlanValues() []SubPlan { - return []SubPlan{ - SubPlanP1, - SubPlanP2, - } -} - -// SupportedCloudEnum - Relevant cloud for the custom assessment automation. -type SupportedCloudEnum string - -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" - TacticsPrivilegeEscalation Tactics = "Privilege Escalation" - TacticsReconnaissance Tactics = "Reconnaissance" - TacticsResourceDevelopment Tactics = "Resource Development" -) - -// PossibleTacticsValues returns the possible values for the Tactics const type. -func PossibleTacticsValues() []Tactics { - return []Tactics{ - TacticsCollection, - TacticsCommandAndControl, - TacticsCredentialAccess, - TacticsDefenseEvasion, - TacticsDiscovery, - TacticsExecution, - TacticsExfiltration, - TacticsImpact, - TacticsInitialAccess, - TacticsLateralMovement, - TacticsPersistence, - TacticsPrivilegeEscalation, - TacticsReconnaissance, - TacticsResourceDevelopment, - } -} - -type TaskUpdateActionType string - -const ( - TaskUpdateActionTypeActivate TaskUpdateActionType = "Activate" - TaskUpdateActionTypeClose TaskUpdateActionType = "Close" - TaskUpdateActionTypeDismiss TaskUpdateActionType = "Dismiss" - TaskUpdateActionTypeResolve TaskUpdateActionType = "Resolve" - TaskUpdateActionTypeStart TaskUpdateActionType = "Start" -) - -// PossibleTaskUpdateActionTypeValues returns the possible values for the TaskUpdateActionType const type. -func PossibleTaskUpdateActionTypeValues() []TaskUpdateActionType { - return []TaskUpdateActionType{ - TaskUpdateActionTypeActivate, - TaskUpdateActionTypeClose, - TaskUpdateActionTypeDismiss, - TaskUpdateActionTypeResolve, - TaskUpdateActionTypeStart, - } -} - -// Techniques - Techniques of the assessment -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" - 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" -) - -// PossibleTechniquesValues returns the possible values for the Techniques const type. -func PossibleTechniquesValues() []Techniques { - return []Techniques{ - TechniquesAbuseElevationControlMechanism, - TechniquesAccessTokenManipulation, - TechniquesAccountDiscovery, - TechniquesAccountManipulation, - TechniquesActiveScanning, - TechniquesApplicationLayerProtocol, - TechniquesAudioCapture, - TechniquesBootOrLogonAutostartExecution, - TechniquesBootOrLogonInitializationScripts, - TechniquesBruteForce, - TechniquesCloudInfrastructureDiscovery, - TechniquesCloudServiceDashboard, - TechniquesCloudServiceDiscovery, - TechniquesCommandAndScriptingInterpreter, - TechniquesCompromiseClientSoftwareBinary, - TechniquesCompromiseInfrastructure, - TechniquesContainerAndResourceDiscovery, - TechniquesCreateAccount, - TechniquesCreateOrModifySystemProcess, - TechniquesCredentialsFromPasswordStores, - TechniquesDataDestruction, - TechniquesDataEncryptedForImpact, - TechniquesDataFromCloudStorageObject, - TechniquesDataFromConfigurationRepository, - TechniquesDataFromInformationRepositories, - TechniquesDataFromLocalSystem, - TechniquesDataManipulation, - TechniquesDataStaged, - TechniquesDefacement, - TechniquesDeobfuscateDecodeFilesOrInformation, - TechniquesDiskWipe, - TechniquesDomainTrustDiscovery, - TechniquesDriveByCompromise, - TechniquesDynamicResolution, - TechniquesEndpointDenialOfService, - TechniquesEventTriggeredExecution, - TechniquesExfiltrationOverAlternativeProtocol, - TechniquesExploitPublicFacingApplication, - TechniquesExploitationForClientExecution, - TechniquesExploitationForCredentialAccess, - TechniquesExploitationForDefenseEvasion, - TechniquesExploitationForPrivilegeEscalation, - TechniquesExploitationOfRemoteServices, - TechniquesExternalRemoteServices, - TechniquesFallbackChannels, - TechniquesFileAndDirectoryDiscovery, - TechniquesFileAndDirectoryPermissionsModification, - TechniquesGatherVictimNetworkInformation, - TechniquesHideArtifacts, - TechniquesHijackExecutionFlow, - TechniquesImpairDefenses, - TechniquesImplantContainerImage, - TechniquesIndicatorRemovalOnHost, - TechniquesIndirectCommandExecution, - TechniquesIngressToolTransfer, - TechniquesInputCapture, - TechniquesInterProcessCommunication, - TechniquesLateralToolTransfer, - TechniquesManInTheMiddle, - TechniquesMasquerading, - TechniquesModifyAuthenticationProcess, - TechniquesModifyRegistry, - TechniquesNetworkDenialOfService, - TechniquesNetworkServiceScanning, - TechniquesNetworkSniffing, - TechniquesNonApplicationLayerProtocol, - TechniquesNonStandardPort, - TechniquesOSCredentialDumping, - TechniquesObfuscatedFilesOrInformation, - TechniquesObtainCapabilities, - TechniquesOfficeApplicationStartup, - TechniquesPermissionGroupsDiscovery, - TechniquesPhishing, - TechniquesPreOSBoot, - TechniquesProcessDiscovery, - TechniquesProcessInjection, - TechniquesProtocolTunneling, - TechniquesProxy, - TechniquesQueryRegistry, - TechniquesRemoteAccessSoftware, - TechniquesRemoteServiceSessionHijacking, - TechniquesRemoteServices, - TechniquesRemoteSystemDiscovery, - TechniquesResourceHijacking, - TechniquesSQLStoredProcedures, - TechniquesScheduledTaskJob, - TechniquesScreenCapture, - TechniquesSearchVictimOwnedWebsites, - TechniquesServerSoftwareComponent, - TechniquesServiceStop, - TechniquesSignedBinaryProxyExecution, - TechniquesSoftwareDeploymentTools, - TechniquesStealOrForgeKerberosTickets, - TechniquesSubvertTrustControls, - TechniquesSupplyChainCompromise, - TechniquesSystemInformationDiscovery, - TechniquesTaintSharedContent, - TechniquesTrafficSignaling, - TechniquesTransferDataToCloudAccount, - TechniquesTrustedRelationship, - TechniquesUnsecuredCredentials, - TechniquesUserExecution, - TechniquesValidAccounts, - TechniquesWindowsManagementInstrumentation, - } -} - -// Threats - Threats impact of the assessment -type Threats string - -const ( - ThreatsAccountBreach Threats = "accountBreach" - ThreatsDataExfiltration Threats = "dataExfiltration" - ThreatsDataSpillage Threats = "dataSpillage" - ThreatsDenialOfService Threats = "denialOfService" - ThreatsElevationOfPrivilege Threats = "elevationOfPrivilege" - ThreatsMaliciousInsider Threats = "maliciousInsider" - ThreatsMissingCoverage Threats = "missingCoverage" - ThreatsThreatResistance Threats = "threatResistance" -) - -// PossibleThreatsValues returns the possible values for the Threats const type. -func PossibleThreatsValues() []Threats { - return []Threats{ - ThreatsAccountBreach, - ThreatsDataExfiltration, - ThreatsDataSpillage, - ThreatsDenialOfService, - ThreatsElevationOfPrivilege, - ThreatsMaliciousInsider, - ThreatsMissingCoverage, - ThreatsThreatResistance, - } -} - -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 Type = "Qualys" - TypeTVM Type = "TVM" -) - -// PossibleTypeValues returns the possible values for the Type const type. -func PossibleTypeValues() []Type { - return []Type{ - TypeQualys, - TypeTVM, - } -} - -// UnmaskedIPLoggingStatus - Unmasked IP address logging status -type UnmaskedIPLoggingStatus string - -const ( - // UnmaskedIPLoggingStatusDisabled - Unmasked IP logging is disabled - UnmaskedIPLoggingStatusDisabled UnmaskedIPLoggingStatus = "Disabled" - // UnmaskedIPLoggingStatusEnabled - Unmasked IP logging is enabled - UnmaskedIPLoggingStatusEnabled UnmaskedIPLoggingStatus = "Enabled" -) - -// PossibleUnmaskedIPLoggingStatusValues returns the possible values for the UnmaskedIPLoggingStatus const type. -func PossibleUnmaskedIPLoggingStatusValues() []UnmaskedIPLoggingStatus { - return []UnmaskedIPLoggingStatus{ - UnmaskedIPLoggingStatusDisabled, - UnmaskedIPLoggingStatusEnabled, - } -} - -// UserImpact - The user impact of the assessment -type UserImpact string - -const ( - UserImpactHigh UserImpact = "High" - UserImpactLow UserImpact = "Low" - UserImpactModerate UserImpact = "Moderate" -) - -// PossibleUserImpactValues returns the possible values for the UserImpact const type. -func PossibleUserImpactValues() []UserImpact { - return []UserImpact{ - UserImpactHigh, - UserImpactLow, - UserImpactModerate, - } -} - -// ValueType - The value type of the items in the list. -type ValueType string - -const ( - // ValueTypeIPCidr - An IP range in CIDR format (e.g. '192.168.0.1/8'). - ValueTypeIPCidr ValueType = "IpCidr" - // ValueTypeString - Any string value. - ValueTypeString ValueType = "String" -) - -// PossibleValueTypeValues returns the possible values for the ValueType const type. -func PossibleValueTypeValues() []ValueType { - return []ValueType{ - ValueTypeIPCidr, - ValueTypeString, - } -} diff --git a/sdk/resourcemanager/security/armsecurity/contacts_client.go b/sdk/resourcemanager/security/armsecurity/contacts_client.go deleted file mode 100644 index 03c84051afa5..000000000000 --- a/sdk/resourcemanager/security/armsecurity/contacts_client.go +++ /dev/null @@ -1,269 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// ContactsClient contains the methods for the SecurityContacts group. -// Don't use this type directly, use NewContactsClient() instead. -type ContactsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewContactsClient creates a new instance of ContactsClient 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 NewContactsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContactsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ContactsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Create - Create security contact configurations for the subscription -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-12-01-preview -// - securityContactName - Name of the security contact object -// - securityContact - Security contact object -// - options - ContactsClientCreateOptions contains the optional parameters for the ContactsClient.Create method. -func (client *ContactsClient) Create(ctx context.Context, securityContactName SecurityContactName, securityContact Contact, options *ContactsClientCreateOptions) (ContactsClientCreateResponse, error) { - var err error - const operationName = "ContactsClient.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, securityContactName, securityContact, options) - if err != nil { - return ContactsClientCreateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ContactsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return ContactsClientCreateResponse{}, err - } - resp, err := client.createHandleResponse(httpResp) - return resp, err -} - -// createCreateRequest creates the Create request. -func (client *ContactsClient) createCreateRequest(ctx context.Context, securityContactName SecurityContactName, securityContact Contact, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if securityContactName == "" { - return nil, errors.New("parameter securityContactName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{securityContactName}", url.PathEscape(string(securityContactName))) - 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-12-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, securityContact); err != nil { - return nil, err - } - return req, nil -} - -// createHandleResponse handles the Create response. -func (client *ContactsClient) createHandleResponse(resp *http.Response) (ContactsClientCreateResponse, error) { - result := ContactsClientCreateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Contact); err != nil { - return ContactsClientCreateResponse{}, err - } - return result, nil -} - -// Delete - Delete security contact configurations for the subscription -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-12-01-preview -// - securityContactName - Name of the security contact object -// - options - ContactsClientDeleteOptions contains the optional parameters for the ContactsClient.Delete method. -func (client *ContactsClient) Delete(ctx context.Context, securityContactName SecurityContactName, options *ContactsClientDeleteOptions) (ContactsClientDeleteResponse, error) { - var err error - const operationName = "ContactsClient.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, securityContactName, options) - if err != nil { - return ContactsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ContactsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return ContactsClientDeleteResponse{}, err - } - return ContactsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *ContactsClient) deleteCreateRequest(ctx context.Context, securityContactName SecurityContactName, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if securityContactName == "" { - return nil, errors.New("parameter securityContactName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{securityContactName}", url.PathEscape(string(securityContactName))) - 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-12-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get Default Security contact configurations for the subscription -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-12-01-preview -// - securityContactName - Name of the security contact object -// - options - ContactsClientGetOptions contains the optional parameters for the ContactsClient.Get method. -func (client *ContactsClient) Get(ctx context.Context, securityContactName SecurityContactName, options *ContactsClientGetOptions) (ContactsClientGetResponse, error) { - var err error - const operationName = "ContactsClient.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, securityContactName, options) - if err != nil { - return ContactsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ContactsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ContactsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ContactsClient) getCreateRequest(ctx context.Context, securityContactName SecurityContactName, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if securityContactName == "" { - return nil, errors.New("parameter securityContactName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{securityContactName}", url.PathEscape(string(securityContactName))) - 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-12-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 *ContactsClient) getHandleResponse(resp *http.Response) (ContactsClientGetResponse, error) { - result := ContactsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Contact); err != nil { - return ContactsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - List all security contact configurations for the subscription -// -// Generated from API version 2023-12-01-preview -// - options - ContactsClientListOptions contains the optional parameters for the ContactsClient.NewListPager method. -func (client *ContactsClient) NewListPager(options *ContactsClientListOptions) *runtime.Pager[ContactsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[ContactsClientListResponse]{ - More: func(page ContactsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ContactsClientListResponse) (ContactsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ContactsClient.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 ContactsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *ContactsClient) listCreateRequest(ctx context.Context, options *ContactsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts" - 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", "2023-12-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 *ContactsClient) listHandleResponse(resp *http.Response) (ContactsClientListResponse, error) { - result := ContactsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ContactList); err != nil { - return ContactsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/contacts_client_example_test.go b/sdk/resourcemanager/security/armsecurity/contacts_client_example_test.go deleted file mode 100644 index 962914508889..000000000000 --- a/sdk/resourcemanager/security/armsecurity/contacts_client_example_test.go +++ /dev/null @@ -1,197 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// 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/2023-12-01-preview/examples/SecurityContacts/GetSecurityContactsSubscription_example.json -func ExampleContactsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewContactsClient().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.ContactList = armsecurity.ContactList{ - // Value: []*armsecurity.Contact{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/securityContact"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/securityContact/default"), - // Properties: &armsecurity.ContactProperties{ - // Emails: to.Ptr("john@contoso.com;Jane@contoso.com"), - // IsEnabled: to.Ptr(true), - // NotificationsByRole: &armsecurity.ContactPropertiesNotificationsByRole{ - // Roles: []*armsecurity.SecurityContactRole{ - // to.Ptr(armsecurity.SecurityContactRoleOwner), - // to.Ptr(armsecurity.SecurityContactRole("Admin"))}, - // State: to.Ptr(armsecurity.State("On")), - // }, - // NotificationsSources: []armsecurity.NotificationsSourceClassification{ - // &armsecurity.NotificationsSourceAttackPath{ - // SourceType: to.Ptr(armsecurity.SourceTypeAttackPath), - // MinimalRiskLevel: to.Ptr(armsecurity.MinimalRiskLevelCritical), - // }, - // &armsecurity.NotificationsSourceAlert{ - // SourceType: to.Ptr(armsecurity.SourceTypeAlert), - // MinimalSeverity: to.Ptr(armsecurity.MinimalSeverityMedium), - // }}, - // Phone: to.Ptr("(214)275-4038"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/SecurityContacts/GetSecurityContact_example.json -func ExampleContactsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewContactsClient().Get(ctx, armsecurity.SecurityContactNameDefault, 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.Contact = armsecurity.Contact{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/securityContacts"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/securityContacts/default"), - // Properties: &armsecurity.ContactProperties{ - // Emails: to.Ptr("john@contoso.com;jane@contoso.com"), - // IsEnabled: to.Ptr(true), - // NotificationsByRole: &armsecurity.ContactPropertiesNotificationsByRole{ - // Roles: []*armsecurity.SecurityContactRole{ - // to.Ptr(armsecurity.SecurityContactRoleOwner)}, - // State: to.Ptr(armsecurity.State("On")), - // }, - // NotificationsSources: []armsecurity.NotificationsSourceClassification{ - // &armsecurity.NotificationsSourceAttackPath{ - // SourceType: to.Ptr(armsecurity.SourceTypeAttackPath), - // MinimalRiskLevel: to.Ptr(armsecurity.MinimalRiskLevelCritical), - // }, - // &armsecurity.NotificationsSourceAlert{ - // SourceType: to.Ptr(armsecurity.SourceTypeAlert), - // MinimalSeverity: to.Ptr(armsecurity.MinimalSeverityMedium), - // }}, - // Phone: to.Ptr("(214)275-4038"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/SecurityContacts/CreateSecurityContact_example.json -func ExampleContactsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewContactsClient().Create(ctx, armsecurity.SecurityContactNameDefault, armsecurity.Contact{ - Properties: &armsecurity.ContactProperties{ - Emails: to.Ptr("john@contoso.com;jane@contoso.com"), - IsEnabled: to.Ptr(true), - NotificationsByRole: &armsecurity.ContactPropertiesNotificationsByRole{ - Roles: []*armsecurity.SecurityContactRole{ - to.Ptr(armsecurity.SecurityContactRoleOwner)}, - State: to.Ptr(armsecurity.State("On")), - }, - NotificationsSources: []armsecurity.NotificationsSourceClassification{ - &armsecurity.NotificationsSourceAttackPath{ - SourceType: to.Ptr(armsecurity.SourceTypeAttackPath), - MinimalRiskLevel: to.Ptr(armsecurity.MinimalRiskLevelCritical), - }, - &armsecurity.NotificationsSourceAlert{ - SourceType: to.Ptr(armsecurity.SourceTypeAlert), - MinimalSeverity: to.Ptr(armsecurity.MinimalSeverityMedium), - }}, - Phone: to.Ptr("(214)275-4038"), - }, - }, 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.Contact = armsecurity.Contact{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/securityContact"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/securityContacts/default"), - // Properties: &armsecurity.ContactProperties{ - // Emails: to.Ptr("john@microsoft.com;jane@microsoft.com"), - // IsEnabled: to.Ptr(true), - // NotificationsByRole: &armsecurity.ContactPropertiesNotificationsByRole{ - // Roles: []*armsecurity.SecurityContactRole{ - // to.Ptr(armsecurity.SecurityContactRoleOwner)}, - // State: to.Ptr(armsecurity.State("On")), - // }, - // NotificationsSources: []armsecurity.NotificationsSourceClassification{ - // &armsecurity.NotificationsSourceAttackPath{ - // SourceType: to.Ptr(armsecurity.SourceTypeAttackPath), - // MinimalRiskLevel: to.Ptr(armsecurity.MinimalRiskLevelCritical), - // }, - // &armsecurity.NotificationsSourceAlert{ - // SourceType: to.Ptr(armsecurity.SourceTypeAlert), - // MinimalSeverity: to.Ptr(armsecurity.MinimalSeverityMedium), - // }}, - // Phone: to.Ptr("(214)275-4038"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/SecurityContacts/DeleteSecurityContact_example.json -func ExampleContactsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewContactsClient().Delete(ctx, armsecurity.SecurityContactNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/customassessmentautomations_client.go b/sdk/resourcemanager/security/armsecurity/customassessmentautomations_client.go deleted file mode 100644 index 76b127c41a46..000000000000 --- a/sdk/resourcemanager/security/armsecurity/customassessmentautomations_client.go +++ /dev/null @@ -1,349 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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/customassessmentautomations_client_example_test.go b/sdk/resourcemanager/security/armsecurity/customassessmentautomations_client_example_test.go deleted file mode 100644 index 17c37faf746b..000000000000 --- a/sdk/resourcemanager/security/armsecurity/customassessmentautomations_client_example_test.go +++ /dev/null @@ -1,273 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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.go b/sdk/resourcemanager/security/armsecurity/customentitystoreassignments_client.go deleted file mode 100644 index 6d45ef8849fc..000000000000 --- a/sdk/resourcemanager/security/armsecurity/customentitystoreassignments_client.go +++ /dev/null @@ -1,348 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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/customentitystoreassignments_client_example_test.go b/sdk/resourcemanager/security/armsecurity/customentitystoreassignments_client_example_test.go deleted file mode 100644 index f68451699d45..000000000000 --- a/sdk/resourcemanager/security/armsecurity/customentitystoreassignments_client_example_test.go +++ /dev/null @@ -1,230 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/date_type.go b/sdk/resourcemanager/security/armsecurity/date_type.go deleted file mode 100644 index dc7c37d3a02a..000000000000 --- a/sdk/resourcemanager/security/armsecurity/date_type.go +++ /dev/null @@ -1,58 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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 3d11948729ac..f51f69cc02e4 100644 --- a/sdk/resourcemanager/security/armsecurity/defenderforstorage_client.go +++ b/sdk/resourcemanager/security/armsecurity/defenderforstorage_client.go @@ -40,10 +40,73 @@ 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 2024-10-01-preview +// - resourceID - The identifier of the resource. +// - settingName - 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, options *DefenderForStorageClientCancelMalwareScanOptions) (*policy.Request, error) { + urlPath := "/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/{settingName}/malwareScans/{scanId}/cancelScan" + 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", "2024-10-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 +// Generated from API version 2024-10-01-preview // - resourceID - The identifier of the resource. // - settingName - Defender for Storage setting name. // - defenderForStorageSetting - Defender for Storage Settings @@ -84,7 +147,7 @@ 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", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, defenderForStorageSetting); err != nil { @@ -105,7 +168,7 @@ 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 +// Generated from API version 2024-10-01-preview // - resourceID - The identifier of the resource. // - settingName - Defender for Storage setting name. // - options - DefenderForStorageClientGetOptions contains the optional parameters for the DefenderForStorageClient.Get method. @@ -144,7 +207,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", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -158,3 +221,124 @@ 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 2024-10-01-preview +// - resourceID - The identifier of the resource. +// - settingName - 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, options *DefenderForStorageClientGetMalwareScanOptions) (*policy.Request, error) { + urlPath := "/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/{settingName}/malwareScans/{scanId}" + 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", "2024-10-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 +} + +// StartMalwareScan - Initiate 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 2024-10-01-preview +// - resourceID - The identifier of the resource. +// - settingName - 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, options *DefenderForStorageClientStartMalwareScanOptions) (*policy.Request, error) { + urlPath := "/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/{settingName}/startMalwareScan" + 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", "2024-10-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/defenderforstorage_client_example_test.go b/sdk/resourcemanager/security/armsecurity/defenderforstorage_client_example_test.go deleted file mode 100644 index 5718ad3057fd..000000000000 --- a/sdk/resourcemanager/security/armsecurity/defenderforstorage_client_example_test.go +++ /dev/null @@ -1,118 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/2022-12-01-preview/examples/DefenderForStorage/GetDefenderForStorageSettings_example.json -func ExampleDefenderForStorageClient_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.NewDefenderForStorageClient().Get(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount", armsecurity.SettingNameCurrent, 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.DefenderForStorageSetting = armsecurity.DefenderForStorageSetting{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Security/defenderForStorageSettings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount/providers/Microsoft.Security/defenderForStorageSettings/current"), - // Properties: &armsecurity.DefenderForStorageSettingProperties{ - // IsEnabled: to.Ptr(true), - // MalwareScanning: &armsecurity.MalwareScanningProperties{ - // OnUpload: &armsecurity.OnUploadProperties{ - // CapGBPerMonth: to.Ptr[int32](-1), - // IsEnabled: to.Ptr(true), - // }, - // ScanResultsEventGridTopicResourceID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.EventGrid/topics/sampletopic"), - // }, - // OverrideSubscriptionLevelSettings: to.Ptr(true), - // SensitiveDataDiscovery: &armsecurity.SensitiveDataDiscoveryProperties{ - // IsEnabled: to.Ptr(false), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2022-12-01-preview/examples/DefenderForStorage/PutDefenderForStorageSettings_example.json -func ExampleDefenderForStorageClient_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.NewDefenderForStorageClient().Create(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount", armsecurity.SettingNameCurrent, armsecurity.DefenderForStorageSetting{ - Properties: &armsecurity.DefenderForStorageSettingProperties{ - IsEnabled: to.Ptr(true), - MalwareScanning: &armsecurity.MalwareScanningProperties{ - OnUpload: &armsecurity.OnUploadProperties{ - CapGBPerMonth: to.Ptr[int32](-1), - IsEnabled: to.Ptr(true), - }, - ScanResultsEventGridTopicResourceID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.EventGrid/topics/sampletopic"), - }, - OverrideSubscriptionLevelSettings: to.Ptr(true), - SensitiveDataDiscovery: &armsecurity.SensitiveDataDiscoveryProperties{ - IsEnabled: to.Ptr(true), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DefenderForStorageSetting = armsecurity.DefenderForStorageSetting{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Security/defenderForStorageSettings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount/providers/Microsoft.Security/defenderForStorageSettings/current"), - // Properties: &armsecurity.DefenderForStorageSettingProperties{ - // IsEnabled: to.Ptr(true), - // MalwareScanning: &armsecurity.MalwareScanningProperties{ - // OnUpload: &armsecurity.OnUploadProperties{ - // CapGBPerMonth: to.Ptr[int32](-1), - // IsEnabled: to.Ptr(true), - // }, - // OperationStatus: &armsecurity.OperationStatus{ - // Code: to.Ptr("Succeeded"), - // }, - // ScanResultsEventGridTopicResourceID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.EventGrid/topics/sampletopic"), - // }, - // OverrideSubscriptionLevelSettings: to.Ptr(true), - // SensitiveDataDiscovery: &armsecurity.SensitiveDataDiscoveryProperties{ - // IsEnabled: to.Ptr(true), - // OperationStatus: &armsecurity.OperationStatus{ - // Code: to.Ptr("Succeeded"), - // }, - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/devicesecuritygroups_client.go b/sdk/resourcemanager/security/armsecurity/devicesecuritygroups_client.go deleted file mode 100644 index a40731ca039b..000000000000 --- a/sdk/resourcemanager/security/armsecurity/devicesecuritygroups_client.go +++ /dev/null @@ -1,265 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// DeviceSecurityGroupsClient contains the methods for the DeviceSecurityGroups group. -// Don't use this type directly, use NewDeviceSecurityGroupsClient() instead. -type DeviceSecurityGroupsClient struct { - internal *arm.Client -} - -// 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. -func NewDeviceSecurityGroupsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*DeviceSecurityGroupsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &DeviceSecurityGroupsClient{ - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Use this method to creates or updates the device security group on a specified IoT Hub resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-08-01 -// - resourceID - The identifier of the resource. -// - deviceSecurityGroupName - The name of the device security group. Note that the name of the device security group is case -// insensitive. -// - deviceSecurityGroup - Security group object. -// - options - DeviceSecurityGroupsClientCreateOrUpdateOptions contains the optional parameters for the DeviceSecurityGroupsClient.CreateOrUpdate -// method. -func (client *DeviceSecurityGroupsClient) CreateOrUpdate(ctx context.Context, resourceID string, deviceSecurityGroupName string, deviceSecurityGroup DeviceSecurityGroup, options *DeviceSecurityGroupsClientCreateOrUpdateOptions) (DeviceSecurityGroupsClientCreateOrUpdateResponse, error) { - var err error - const operationName = "DeviceSecurityGroupsClient.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, deviceSecurityGroupName, deviceSecurityGroup, options) - if err != nil { - return DeviceSecurityGroupsClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DeviceSecurityGroupsClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return DeviceSecurityGroupsClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *DeviceSecurityGroupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceID string, deviceSecurityGroupName string, deviceSecurityGroup DeviceSecurityGroup, options *DeviceSecurityGroupsClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}" - urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) - if deviceSecurityGroupName == "" { - return nil, errors.New("parameter deviceSecurityGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{deviceSecurityGroupName}", url.PathEscape(deviceSecurityGroupName)) - 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", "2019-08-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, deviceSecurityGroup); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *DeviceSecurityGroupsClient) createOrUpdateHandleResponse(resp *http.Response) (DeviceSecurityGroupsClientCreateOrUpdateResponse, error) { - result := DeviceSecurityGroupsClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DeviceSecurityGroup); err != nil { - return DeviceSecurityGroupsClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - User this method to deletes the device security group. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-08-01 -// - resourceID - The 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 -// method. -func (client *DeviceSecurityGroupsClient) Delete(ctx context.Context, resourceID string, deviceSecurityGroupName string, options *DeviceSecurityGroupsClientDeleteOptions) (DeviceSecurityGroupsClientDeleteResponse, error) { - var err error - const operationName = "DeviceSecurityGroupsClient.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, deviceSecurityGroupName, options) - if err != nil { - return DeviceSecurityGroupsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DeviceSecurityGroupsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return DeviceSecurityGroupsClientDeleteResponse{}, err - } - return DeviceSecurityGroupsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *DeviceSecurityGroupsClient) deleteCreateRequest(ctx context.Context, resourceID string, deviceSecurityGroupName string, options *DeviceSecurityGroupsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}" - urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) - if deviceSecurityGroupName == "" { - return nil, errors.New("parameter deviceSecurityGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{deviceSecurityGroupName}", url.PathEscape(deviceSecurityGroupName)) - 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", "2019-08-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Use this method to get the device security group for the specified IoT Hub resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-08-01 -// - resourceID - The identifier of the resource. -// - 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 -// method. -func (client *DeviceSecurityGroupsClient) Get(ctx context.Context, resourceID string, deviceSecurityGroupName string, options *DeviceSecurityGroupsClientGetOptions) (DeviceSecurityGroupsClientGetResponse, error) { - var err error - const operationName = "DeviceSecurityGroupsClient.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, deviceSecurityGroupName, options) - if err != nil { - return DeviceSecurityGroupsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DeviceSecurityGroupsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return DeviceSecurityGroupsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *DeviceSecurityGroupsClient) getCreateRequest(ctx context.Context, resourceID string, deviceSecurityGroupName string, options *DeviceSecurityGroupsClientGetOptions) (*policy.Request, error) { - urlPath := "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}" - urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) - if deviceSecurityGroupName == "" { - return nil, errors.New("parameter deviceSecurityGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{deviceSecurityGroupName}", url.PathEscape(deviceSecurityGroupName)) - 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", "2019-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 *DeviceSecurityGroupsClient) getHandleResponse(resp *http.Response) (DeviceSecurityGroupsClientGetResponse, error) { - result := DeviceSecurityGroupsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DeviceSecurityGroup); err != nil { - return DeviceSecurityGroupsClientGetResponse{}, err - } - return result, nil -} - -// 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. -// - options - DeviceSecurityGroupsClientListOptions contains the optional parameters for the DeviceSecurityGroupsClient.NewListPager -// method. -func (client *DeviceSecurityGroupsClient) NewListPager(resourceID string, options *DeviceSecurityGroupsClientListOptions) *runtime.Pager[DeviceSecurityGroupsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[DeviceSecurityGroupsClientListResponse]{ - More: func(page DeviceSecurityGroupsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *DeviceSecurityGroupsClientListResponse) (DeviceSecurityGroupsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeviceSecurityGroupsClient.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 DeviceSecurityGroupsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *DeviceSecurityGroupsClient) listCreateRequest(ctx context.Context, resourceID string, options *DeviceSecurityGroupsClientListOptions) (*policy.Request, error) { - urlPath := "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups" - 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", "2019-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 *DeviceSecurityGroupsClient) listHandleResponse(resp *http.Response) (DeviceSecurityGroupsClientListResponse, error) { - result := DeviceSecurityGroupsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DeviceSecurityGroupList); err != nil { - return DeviceSecurityGroupsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/devicesecuritygroups_client_example_test.go b/sdk/resourcemanager/security/armsecurity/devicesecuritygroups_client_example_test.go deleted file mode 100644 index f2a8921ffbc0..000000000000 --- a/sdk/resourcemanager/security/armsecurity/devicesecuritygroups_client_example_test.go +++ /dev/null @@ -1,664 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/2019-08-01/examples/DeviceSecurityGroups/ListDeviceSecurityGroups_example.json -func ExampleDeviceSecurityGroupsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDeviceSecurityGroupsClient().NewListPager("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Devices/iotHubs/sampleiothub", 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.DeviceSecurityGroupList = armsecurity.DeviceSecurityGroupList{ - // Value: []*armsecurity.DeviceSecurityGroup{ - // { - // Name: to.Ptr("samplesecuritygroup"), - // Type: to.Ptr("Microsoft.Security/deviceSecurityGroups"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Devices/iotHubs/sampleiothub/providers/Microsoft.Security/deviceSecurityGroups/samplesecuritygroup"), - // Properties: &armsecurity.DeviceSecurityGroupProperties{ - // AllowlistRules: []armsecurity.AllowlistCustomAlertRuleClassification{ - // &armsecurity.ConnectionToIPNotAllowed{ - // Description: to.Ptr("Get an alert when an outbound connection is created between your device and an ip that isn't allowed"), - // DisplayName: to.Ptr("Outbound connection to an ip that isn't allowed"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("ConnectionToIpNotAllowed"), - // ValueType: to.Ptr(armsecurity.ValueTypeIPCidr), - // AllowlistValues: []*string{ - // }, - // }, - // &armsecurity.LocalUserNotAllowed{ - // Description: to.Ptr("Get an alert when a local user that isn't allowed logins to the device"), - // DisplayName: to.Ptr("Login by a local user that isn't allowed"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("LocalUserNotAllowed"), - // ValueType: to.Ptr(armsecurity.ValueTypeString), - // AllowlistValues: []*string{ - // }, - // }, - // &armsecurity.ProcessNotAllowed{ - // Description: to.Ptr("Get an alert when a process that isn't allowed is executed"), - // DisplayName: to.Ptr("Execution of a process that isn't allowed"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("ProcessNotAllowed"), - // ValueType: to.Ptr(armsecurity.ValueTypeString), - // AllowlistValues: []*string{ - // }, - // }}, - // DenylistRules: []*armsecurity.DenylistCustomAlertRule{ - // }, - // ThresholdRules: []armsecurity.ThresholdCustomAlertRuleClassification{ - // }, - // TimeWindowRules: []armsecurity.TimeWindowCustomAlertRuleClassification{ - // &armsecurity.ActiveConnectionsNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of active connections of a device in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of active connections is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("ActiveConnectionsNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.AmqpC2DMessagesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of cloud to device messages (AMQP protocol) in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of cloud to device messages (AMQP protocol) is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("AmqpC2DMessagesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.MqttC2DMessagesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of cloud to device messages (MQTT protocol) in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of cloud to device messages (MQTT protocol) is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("MqttC2DMessagesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.HTTPC2DMessagesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of cloud to device messages (HTTP protocol) in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of cloud to device messages (HTTP protocol) is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("HttpC2DMessagesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.AmqpC2DRejectedMessagesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of cloud to device messages (AMQP protocol) that were rejected by the device in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of rejected cloud to device messages (AMQP protocol) is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("AmqpC2DRejectedMessagesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.MqttC2DRejectedMessagesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of cloud to device messages (MQTT protocol) that were rejected by the device in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of rejected cloud to device messages (MQTT protocol) is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("MqttC2DRejectedMessagesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.HTTPC2DRejectedMessagesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of cloud to device messages (HTTP protocol) that were rejected by the device in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of rejected cloud to device messages (HTTP protocol) is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("HttpC2DRejectedMessagesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.AmqpD2CMessagesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of device to cloud messages (AMQP protocol) in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of device to cloud messages (AMQP protocol) is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("AmqpD2CMessagesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.MqttD2CMessagesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of device to cloud messages (MQTT protocol) in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of device to cloud messages (MQTT protocol) is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("MqttD2CMessagesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.HTTPD2CMessagesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of device to cloud messages (HTTP protocol) in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of device to cloud messages (HTTP protocol) is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("HttpD2CMessagesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.DirectMethodInvokesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of direct method invokes in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of direct method invokes is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("DirectMethodInvokesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.FailedLocalLoginsNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of failed local logins on the device in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of failed local logins is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("FailedLocalLoginsNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.FileUploadsNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of file uploads from the device to the cloud in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of file uploads is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("FileUploadsNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.QueuePurgesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of device queue purges in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of device queue purges is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("QueuePurgesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.TwinUpdatesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of twin updates (by the device or the service) in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of twin updates is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("TwinUpdatesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.UnauthorizedOperationsNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number unauthorized operations in the time window is not in the allowed range. Unauthorized operations are operations that affect the device (or done by it) that fail because of an unauthorized error"), - // DisplayName: to.Ptr("Number of unauthorized operations is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("UnauthorizedOperationsNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/DeviceSecurityGroups/GetDeviceSecurityGroups_example.json -func ExampleDeviceSecurityGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDeviceSecurityGroupsClient().Get(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Devices/iotHubs/sampleiothub", "samplesecuritygroup", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.DeviceSecurityGroup = armsecurity.DeviceSecurityGroup{ - // Name: to.Ptr("samplesecuritygroup"), - // Type: to.Ptr("Microsoft.Security/deviceSecurityGroups"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Devices/iotHubs/sampleiothub/providers/Microsoft.Security/deviceSecurityGroups/samplesecuritygroup"), - // Properties: &armsecurity.DeviceSecurityGroupProperties{ - // AllowlistRules: []armsecurity.AllowlistCustomAlertRuleClassification{ - // &armsecurity.ConnectionToIPNotAllowed{ - // Description: to.Ptr("Get an alert when an outbound connection is created between your device and an ip that isn't allowed"), - // DisplayName: to.Ptr("Outbound connection to an ip that isn't allowed"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("ConnectionToIpNotAllowed"), - // ValueType: to.Ptr(armsecurity.ValueTypeIPCidr), - // AllowlistValues: []*string{ - // }, - // }, - // &armsecurity.LocalUserNotAllowed{ - // Description: to.Ptr("Get an alert when a local user that isn't allowed logins to the device"), - // DisplayName: to.Ptr("Login by a local user that isn't allowed"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("LocalUserNotAllowed"), - // ValueType: to.Ptr(armsecurity.ValueTypeString), - // AllowlistValues: []*string{ - // }, - // }, - // &armsecurity.ProcessNotAllowed{ - // Description: to.Ptr("Get an alert when a process that isn't allowed is executed"), - // DisplayName: to.Ptr("Execution of a process that isn't allowed"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("ProcessNotAllowed"), - // ValueType: to.Ptr(armsecurity.ValueTypeString), - // AllowlistValues: []*string{ - // }, - // }}, - // DenylistRules: []*armsecurity.DenylistCustomAlertRule{ - // }, - // ThresholdRules: []armsecurity.ThresholdCustomAlertRuleClassification{ - // }, - // TimeWindowRules: []armsecurity.TimeWindowCustomAlertRuleClassification{ - // &armsecurity.ActiveConnectionsNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of active connections of a device in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of active connections is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("ActiveConnectionsNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.AmqpC2DMessagesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of cloud to device messages (AMQP protocol) in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of cloud to device messages (AMQP protocol) is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("AmqpC2DMessagesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.MqttC2DMessagesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of cloud to device messages (MQTT protocol) in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of cloud to device messages (MQTT protocol) is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("MqttC2DMessagesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.HTTPC2DMessagesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of cloud to device messages (HTTP protocol) in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of cloud to device messages (HTTP protocol) is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("HttpC2DMessagesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.AmqpC2DRejectedMessagesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of cloud to device messages (AMQP protocol) that were rejected by the device in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of rejected cloud to device messages (AMQP protocol) is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("AmqpC2DRejectedMessagesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.MqttC2DRejectedMessagesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of cloud to device messages (MQTT protocol) that were rejected by the device in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of rejected cloud to device messages (MQTT protocol) is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("MqttC2DRejectedMessagesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.HTTPC2DRejectedMessagesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of cloud to device messages (HTTP protocol) that were rejected by the device in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of rejected cloud to device messages (HTTP protocol) is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("HttpC2DRejectedMessagesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.AmqpD2CMessagesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of device to cloud messages (AMQP protocol) in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of device to cloud messages (AMQP protocol) is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("AmqpD2CMessagesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.MqttD2CMessagesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of device to cloud messages (MQTT protocol) in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of device to cloud messages (MQTT protocol) is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("MqttD2CMessagesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.HTTPD2CMessagesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of device to cloud messages (HTTP protocol) in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of device to cloud messages (HTTP protocol) is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("HttpD2CMessagesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.DirectMethodInvokesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of direct method invokes in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of direct method invokes is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("DirectMethodInvokesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.FailedLocalLoginsNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of failed local logins on the device in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of failed local logins is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("FailedLocalLoginsNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.FileUploadsNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of file uploads from the device to the cloud in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of file uploads is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("FileUploadsNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.QueuePurgesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of device queue purges in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of device queue purges is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("QueuePurgesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.TwinUpdatesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of twin updates (by the device or the service) in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of twin updates is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("TwinUpdatesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.UnauthorizedOperationsNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number unauthorized operations in the time window is not in the allowed range. Unauthorized operations are operations that affect the device (or done by it) that fail because of an unauthorized error"), - // DisplayName: to.Ptr("Number of unauthorized operations is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("UnauthorizedOperationsNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/DeviceSecurityGroups/PutDeviceSecurityGroups_example.json -func ExampleDeviceSecurityGroupsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDeviceSecurityGroupsClient().CreateOrUpdate(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Devices/iotHubs/sampleiothub", "samplesecuritygroup", armsecurity.DeviceSecurityGroup{ - Properties: &armsecurity.DeviceSecurityGroupProperties{ - TimeWindowRules: []armsecurity.TimeWindowCustomAlertRuleClassification{ - &armsecurity.ActiveConnectionsNotInAllowedRange{ - IsEnabled: to.Ptr(true), - RuleType: to.Ptr("ActiveConnectionsNotInAllowedRange"), - MaxThreshold: to.Ptr[int32](30), - MinThreshold: to.Ptr[int32](0), - TimeWindowSize: to.Ptr("PT05M"), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.DeviceSecurityGroup = armsecurity.DeviceSecurityGroup{ - // Name: to.Ptr("samplesecuritygroup"), - // Type: to.Ptr("Microsoft.Security/deviceSecurityGroups"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Devices/iotHubs/sampleiothub/providers/Microsoft.Security/deviceSecurityGroups/samplesecuritygroup"), - // Properties: &armsecurity.DeviceSecurityGroupProperties{ - // AllowlistRules: []armsecurity.AllowlistCustomAlertRuleClassification{ - // &armsecurity.ConnectionToIPNotAllowed{ - // Description: to.Ptr("Get an alert when an outbound connection is created between your device and an ip that isn't allowed"), - // DisplayName: to.Ptr("Outbound connection to an ip that isn't allowed"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("ConnectionToIpNotAllowed"), - // AllowlistValues: []*string{ - // }, - // }, - // &armsecurity.LocalUserNotAllowed{ - // Description: to.Ptr("Get an alert when a local user that isn't allowed logins to the device"), - // DisplayName: to.Ptr("Login by a local user that isn't allowed"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("LocalUserNotAllowed"), - // AllowlistValues: []*string{ - // }, - // }, - // &armsecurity.ProcessNotAllowed{ - // Description: to.Ptr("Get an alert when a process that isn't allowed is executed"), - // DisplayName: to.Ptr("Execution of a process that isn't allowed"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("ProcessNotAllowed"), - // AllowlistValues: []*string{ - // }, - // }}, - // DenylistRules: []*armsecurity.DenylistCustomAlertRule{ - // }, - // ThresholdRules: []armsecurity.ThresholdCustomAlertRuleClassification{ - // }, - // TimeWindowRules: []armsecurity.TimeWindowCustomAlertRuleClassification{ - // &armsecurity.ActiveConnectionsNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of active connections of a device in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of active connections is not in allowed range"), - // IsEnabled: to.Ptr(true), - // RuleType: to.Ptr("ActiveConnectionsNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](30), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT05M"), - // }, - // &armsecurity.AmqpC2DMessagesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of cloud to device messages (AMQP protocol) in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of cloud to device messages (AMQP protocol) is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("AmqpC2DMessagesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.MqttC2DMessagesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of cloud to device messages (MQTT protocol) in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of cloud to device messages (MQTT protocol) is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("MqttC2DMessagesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.HTTPC2DMessagesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of cloud to device messages (HTTP protocol) in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of cloud to device messages (HTTP protocol) is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("HttpC2DMessagesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.AmqpC2DRejectedMessagesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of cloud to device messages (AMQP protocol) that were rejected by the device in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of rejected cloud to device messages (AMQP protocol) is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("AmqpC2DRejectedMessagesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.MqttC2DRejectedMessagesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of cloud to device messages (MQTT protocol) that were rejected by the device in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of rejected cloud to device messages (MQTT protocol) is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("MqttC2DRejectedMessagesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.HTTPC2DRejectedMessagesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of cloud to device messages (HTTP protocol) that were rejected by the device in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of rejected cloud to device messages (HTTP protocol) is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("HttpC2DRejectedMessagesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.AmqpD2CMessagesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of device to cloud messages (AMQP protocol) in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of device to cloud messages (AMQP protocol) is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("AmqpD2CMessagesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.MqttD2CMessagesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of device to cloud messages (MQTT protocol) in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of device to cloud messages (MQTT protocol) is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("MqttD2CMessagesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.HTTPD2CMessagesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of device to cloud messages (HTTP protocol) in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of device to cloud messages (HTTP protocol) is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("HttpD2CMessagesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.DirectMethodInvokesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of direct method invokes in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of direct method invokes is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("DirectMethodInvokesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.FailedLocalLoginsNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of failed local logins on the device in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of failed local logins is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("FailedLocalLoginsNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.FileUploadsNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of file uploads from the device to the cloud in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of file uploads is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("FileUploadsNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.QueuePurgesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of device queue purges in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of device queue purges is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("QueuePurgesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.TwinUpdatesNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number of twin updates (by the device or the service) in the time window is not in the allowed range"), - // DisplayName: to.Ptr("Number of twin updates is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("TwinUpdatesNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }, - // &armsecurity.UnauthorizedOperationsNotInAllowedRange{ - // Description: to.Ptr("Get an alert when the number unauthorized operations in the time window is not in the allowed range. Unauthorized operations are operations that affect the device (or done by it) that fail because of an unauthorized error"), - // DisplayName: to.Ptr("Number of unauthorized operations is not in allowed range"), - // IsEnabled: to.Ptr(false), - // RuleType: to.Ptr("UnauthorizedOperationsNotInAllowedRange"), - // MaxThreshold: to.Ptr[int32](0), - // MinThreshold: to.Ptr[int32](0), - // TimeWindowSize: to.Ptr("PT15M"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/DeviceSecurityGroups/DeleteDeviceSecurityGroups_example.json -func ExampleDeviceSecurityGroupsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDeviceSecurityGroupsClient().Delete(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Devices/iotHubs/sampleiothub", "samplesecuritygroup", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/devopsconfigurations_client.go b/sdk/resourcemanager/security/armsecurity/devopsconfigurations_client.go deleted file mode 100644 index 9ef07d99c65b..000000000000 --- a/sdk/resourcemanager/security/armsecurity/devopsconfigurations_client.go +++ /dev/null @@ -1,412 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// DevOpsConfigurationsClient contains the methods for the DevOpsConfigurations group. -// Don't use this type directly, use NewDevOpsConfigurationsClient() instead. -type DevOpsConfigurationsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewDevOpsConfigurationsClient creates a new instance of DevOpsConfigurationsClient 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 NewDevOpsConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DevOpsConfigurationsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &DevOpsConfigurationsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreateOrUpdate - Creates or updates a DevOps Configuration. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-09-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. -// - options - DevOpsConfigurationsClientBeginCreateOrUpdateOptions contains the optional parameters for the DevOpsConfigurationsClient.BeginCreateOrUpdate -// method. -func (client *DevOpsConfigurationsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, securityConnectorName string, devOpsConfiguration DevOpsConfiguration, options *DevOpsConfigurationsClientBeginCreateOrUpdateOptions) (*runtime.Poller[DevOpsConfigurationsClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, securityConnectorName, devOpsConfiguration, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DevOpsConfigurationsClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DevOpsConfigurationsClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// CreateOrUpdate - Creates or updates a DevOps Configuration. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-09-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" - 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, securityConnectorName, devOpsConfiguration, 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, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *DevOpsConfigurationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, devOpsConfiguration DevOpsConfiguration, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if securityConnectorName == "" { - return nil, errors.New("parameter securityConnectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, devOpsConfiguration); err != nil { - return nil, err - } - return req, nil -} - -// BeginDelete - Deletes a DevOps Connector. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-09-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 -// method. -func (client *DevOpsConfigurationsClient) BeginDelete(ctx context.Context, resourceGroupName string, securityConnectorName string, options *DevOpsConfigurationsClientBeginDeleteOptions) (*runtime.Poller[DevOpsConfigurationsClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, securityConnectorName, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DevOpsConfigurationsClientDeleteResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DevOpsConfigurationsClientDeleteResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Delete - Deletes a DevOps Connector. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-09-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" - 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, securityConnectorName, 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, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *DevOpsConfigurationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if securityConnectorName == "" { - return nil, errors.New("parameter securityConnectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets a DevOps Configuration. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-09-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 -// method. -func (client *DevOpsConfigurationsClient) Get(ctx context.Context, resourceGroupName string, securityConnectorName string, options *DevOpsConfigurationsClientGetOptions) (DevOpsConfigurationsClientGetResponse, error) { - var err error - const operationName = "DevOpsConfigurationsClient.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, securityConnectorName, options) - if err != nil { - return DevOpsConfigurationsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DevOpsConfigurationsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return DevOpsConfigurationsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *DevOpsConfigurationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if securityConnectorName == "" { - return nil, errors.New("parameter securityConnectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-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 *DevOpsConfigurationsClient) getHandleResponse(resp *http.Response) (DevOpsConfigurationsClientGetResponse, error) { - result := DevOpsConfigurationsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DevOpsConfiguration); err != nil { - return DevOpsConfigurationsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - List DevOps Configurations. -// -// Generated from API version 2023-09-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 -// method. -func (client *DevOpsConfigurationsClient) NewListPager(resourceGroupName string, securityConnectorName string, options *DevOpsConfigurationsClientListOptions) *runtime.Pager[DevOpsConfigurationsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[DevOpsConfigurationsClientListResponse]{ - More: func(page DevOpsConfigurationsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *DevOpsConfigurationsClientListResponse) (DevOpsConfigurationsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DevOpsConfigurationsClient.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, securityConnectorName, options) - }, nil) - if err != nil { - return DevOpsConfigurationsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *DevOpsConfigurationsClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if securityConnectorName == "" { - return nil, errors.New("parameter securityConnectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-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 *DevOpsConfigurationsClient) listHandleResponse(resp *http.Response) (DevOpsConfigurationsClientListResponse, error) { - result := DevOpsConfigurationsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DevOpsConfigurationListResponse); err != nil { - return DevOpsConfigurationsClientListResponse{}, err - } - return result, nil -} - -// BeginUpdate - Updates a DevOps Configuration. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-09-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. -// - options - DevOpsConfigurationsClientBeginUpdateOptions contains the optional parameters for the DevOpsConfigurationsClient.BeginUpdate -// method. -func (client *DevOpsConfigurationsClient) BeginUpdate(ctx context.Context, resourceGroupName string, securityConnectorName string, devOpsConfiguration DevOpsConfiguration, options *DevOpsConfigurationsClientBeginUpdateOptions) (*runtime.Poller[DevOpsConfigurationsClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, securityConnectorName, devOpsConfiguration, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DevOpsConfigurationsClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DevOpsConfigurationsClientUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Update - Updates a DevOps Configuration. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-09-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" - 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, securityConnectorName, devOpsConfiguration, 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 -} - -// updateCreateRequest creates the Update request. -func (client *DevOpsConfigurationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, devOpsConfiguration DevOpsConfiguration, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if securityConnectorName == "" { - return nil, errors.New("parameter securityConnectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, devOpsConfiguration); err != nil { - return nil, err - } - return req, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/devopsconfigurations_client_example_test.go b/sdk/resourcemanager/security/armsecurity/devopsconfigurations_client_example_test.go deleted file mode 100644 index 8677e5c5dcda..000000000000 --- a/sdk/resourcemanager/security/armsecurity/devopsconfigurations_client_example_test.go +++ /dev/null @@ -1,269 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/2023-09-01-preview/examples/SecurityConnectorsDevOps/ListDevOpsConfigurations_example.json -func ExampleDevOpsConfigurationsClient_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.NewDevOpsConfigurationsClient().NewListPager("myRg", "mySecurityConnectorName", 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.DevOpsConfigurationListResponse = armsecurity.DevOpsConfigurationListResponse{ - // Value: []*armsecurity.DevOpsConfiguration{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default"), - // Properties: &armsecurity.DevOpsConfigurationProperties{ - // AutoDiscovery: to.Ptr(armsecurity.AutoDiscoveryEnabled), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-09-01-preview/examples/SecurityConnectorsDevOps/GetDevOpsConfigurations_example.json -func ExampleDevOpsConfigurationsClient_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.NewDevOpsConfigurationsClient().Get(ctx, "myRg", "mySecurityConnectorName", 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.DevOpsConfiguration = armsecurity.DevOpsConfiguration{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default"), - // Properties: &armsecurity.DevOpsConfigurationProperties{ - // AutoDiscovery: to.Ptr(armsecurity.AutoDiscoveryEnabled), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-09-01-preview/examples/SecurityConnectorsDevOps/CreateOrUpdateDevOpsConfigurationsOnboardCurrentAndFuture_example.json -func ExampleDevOpsConfigurationsClient_BeginCreateOrUpdate_createOrUpdateDevOpsConfigurationsOnboardCurrentAndFuture() { - 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.NewDevOpsConfigurationsClient().BeginCreateOrUpdate(ctx, "myRg", "mySecurityConnectorName", armsecurity.DevOpsConfiguration{ - Properties: &armsecurity.DevOpsConfigurationProperties{ - Authorization: &armsecurity.Authorization{ - Code: to.Ptr("00000000000000000000"), - }, - AutoDiscovery: to.Ptr(armsecurity.AutoDiscoveryEnabled), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %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.DevOpsConfiguration = armsecurity.DevOpsConfiguration{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default"), - // Properties: &armsecurity.DevOpsConfigurationProperties{ - // AutoDiscovery: to.Ptr(armsecurity.AutoDiscoveryEnabled), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-09-01-preview/examples/SecurityConnectorsDevOps/CreateOrUpdateDevOpsConfigurationsOnboardCurrentOnly_example.json -func ExampleDevOpsConfigurationsClient_BeginCreateOrUpdate_createOrUpdateDevOpsConfigurationsOnboardCurrentOnly() { - 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.NewDevOpsConfigurationsClient().BeginCreateOrUpdate(ctx, "myRg", "mySecurityConnectorName", armsecurity.DevOpsConfiguration{ - Properties: &armsecurity.DevOpsConfigurationProperties{ - Authorization: &armsecurity.Authorization{ - Code: to.Ptr("00000000000000000000"), - }, - AutoDiscovery: to.Ptr(armsecurity.AutoDiscoveryDisabled), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %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.DevOpsConfiguration = armsecurity.DevOpsConfiguration{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default"), - // Properties: &armsecurity.DevOpsConfigurationProperties{ - // AutoDiscovery: to.Ptr(armsecurity.AutoDiscoveryDisabled), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-09-01-preview/examples/SecurityConnectorsDevOps/CreateOrUpdateDevOpsConfigurationsOnboardSelected_example.json -func ExampleDevOpsConfigurationsClient_BeginCreateOrUpdate_createOrUpdateDevOpsConfigurationsOnboardSelected() { - 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.NewDevOpsConfigurationsClient().BeginCreateOrUpdate(ctx, "myRg", "mySecurityConnectorName", armsecurity.DevOpsConfiguration{ - Properties: &armsecurity.DevOpsConfigurationProperties{ - Authorization: &armsecurity.Authorization{ - Code: to.Ptr("00000000000000000000"), - }, - AutoDiscovery: to.Ptr(armsecurity.AutoDiscoveryDisabled), - TopLevelInventoryList: []*string{ - to.Ptr("org1"), - to.Ptr("org2")}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %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.DevOpsConfiguration = armsecurity.DevOpsConfiguration{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default"), - // Properties: &armsecurity.DevOpsConfigurationProperties{ - // AutoDiscovery: to.Ptr(armsecurity.AutoDiscoveryDisabled), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // TopLevelInventoryList: []*string{ - // to.Ptr("org1"), - // to.Ptr("org2")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-09-01-preview/examples/SecurityConnectorsDevOps/UpdateDevOpsConfigurations_example.json -func ExampleDevOpsConfigurationsClient_BeginUpdate() { - 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.NewDevOpsConfigurationsClient().BeginUpdate(ctx, "myRg", "mySecurityConnectorName", armsecurity.DevOpsConfiguration{ - Properties: &armsecurity.DevOpsConfigurationProperties{ - AutoDiscovery: to.Ptr(armsecurity.AutoDiscoveryEnabled), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %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.DevOpsConfiguration = armsecurity.DevOpsConfiguration{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default"), - // Properties: &armsecurity.DevOpsConfigurationProperties{ - // AutoDiscovery: to.Ptr(armsecurity.AutoDiscoveryEnabled), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-09-01-preview/examples/SecurityConnectorsDevOps/DeleteDevOpsConfigurations_example.json -func ExampleDevOpsConfigurationsClient_BeginDelete() { - 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.NewDevOpsConfigurationsClient().BeginDelete(ctx, "myRg", "mySecurityConnectorName", 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/devopsoperationresults_client.go b/sdk/resourcemanager/security/armsecurity/devopsoperationresults_client.go deleted file mode 100644 index 2d04fc1b90be..000000000000 --- a/sdk/resourcemanager/security/armsecurity/devopsoperationresults_client.go +++ /dev/null @@ -1,114 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// DevOpsOperationResultsClient contains the methods for the DevOpsOperationResults group. -// Don't use this type directly, use NewDevOpsOperationResultsClient() instead. -type DevOpsOperationResultsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewDevOpsOperationResultsClient creates a new instance of DevOpsOperationResultsClient 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 NewDevOpsOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DevOpsOperationResultsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &DevOpsOperationResultsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Get devops long running operation result. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-09-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) { - var err error - const operationName = "DevOpsOperationResultsClient.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, securityConnectorName, operationResultID, options) - if err != nil { - return DevOpsOperationResultsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DevOpsOperationResultsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return DevOpsOperationResultsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *DevOpsOperationResultsClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, operationResultID string, options *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") - } - 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 operationResultID == "" { - return nil, errors.New("parameter operationResultID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{operationResultId}", url.PathEscape(operationResultID)) - 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-09-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 *DevOpsOperationResultsClient) getHandleResponse(resp *http.Response) (DevOpsOperationResultsClientGetResponse, error) { - result := DevOpsOperationResultsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatusResult); err != nil { - return DevOpsOperationResultsClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/devopsoperationresults_client_example_test.go b/sdk/resourcemanager/security/armsecurity/devopsoperationresults_client_example_test.go deleted file mode 100644 index fa9a6bf9944c..000000000000 --- a/sdk/resourcemanager/security/armsecurity/devopsoperationresults_client_example_test.go +++ /dev/null @@ -1,78 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-09-01-preview/examples/SecurityConnectorsDevOps/GetDevOpsOperationResultsFailed_example.json -func ExampleDevOpsOperationResultsClient_Get_getDevOpsOperationResultsFailed() { - 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.NewDevOpsOperationResultsClient().Get(ctx, "myRg", "mySecurityConnectorName", "8d4caace-e7b3-4b3e-af99-73f76829ebcf", 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.OperationStatusResult = armsecurity.OperationStatusResult{ - // Name: to.Ptr("8d4caace-e7b3-4b3e-af99-73f76829ebcf"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-21T03:25:15.000Z"); return t}()), - // Error: &armsecurity.ErrorDetailAutoGenerated{ - // Code: to.Ptr("TokenExchangeFailed"), - // Message: to.Ptr("AzureDevOps OAuth token exchange failed"), - // }, - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/operationResults/8d4caace-e7b3-4b3e-af99-73f76829ebcf?api-version=2023-09-01-preview"), - // PercentComplete: to.Ptr[float32](100), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-21T03:23:15.000Z"); return t}()), - // Status: to.Ptr("Failed"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-09-01-preview/examples/SecurityConnectorsDevOps/GetDevOpsOperationResultsSucceeded_example.json -func ExampleDevOpsOperationResultsClient_Get_getDevOpsOperationResultsSucceeded() { - 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.NewDevOpsOperationResultsClient().Get(ctx, "myRg", "mySecurityConnectorName", "4e826cf1-5c36-4808-a7d2-fb4f5170978b", 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.OperationStatusResult = armsecurity.OperationStatusResult{ - // Name: to.Ptr("4e826cf1-5c36-4808-a7d2-fb4f5170978b"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-21T03:25:15.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/operationResults/4e826cf1-5c36-4808-a7d2-fb4f5170978b?api-version=2023-09-01-preview"), - // PercentComplete: to.Ptr[float32](100), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-21T03:23:15.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/discoveredsecuritysolutions_client.go b/sdk/resourcemanager/security/armsecurity/discoveredsecuritysolutions_client.go deleted file mode 100644 index fe50ee9a9696..000000000000 --- a/sdk/resourcemanager/security/armsecurity/discoveredsecuritysolutions_client.go +++ /dev/null @@ -1,229 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// DiscoveredSecuritySolutionsClient contains the methods for the DiscoveredSecuritySolutions group. -// Don't use this type directly, use NewDiscoveredSecuritySolutionsClient() instead. -type DiscoveredSecuritySolutionsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewDiscoveredSecuritySolutionsClient creates a new instance of DiscoveredSecuritySolutionsClient 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 NewDiscoveredSecuritySolutionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DiscoveredSecuritySolutionsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &DiscoveredSecuritySolutionsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Gets a specific discovered Security Solution. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-01-01 -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - discoveredSecuritySolutionName - Name of a discovered security solution. -// - options - DiscoveredSecuritySolutionsClientGetOptions contains the optional parameters for the DiscoveredSecuritySolutionsClient.Get -// method. -func (client *DiscoveredSecuritySolutionsClient) Get(ctx context.Context, resourceGroupName string, ascLocation string, discoveredSecuritySolutionName string, options *DiscoveredSecuritySolutionsClientGetOptions) (DiscoveredSecuritySolutionsClientGetResponse, error) { - var err error - const operationName = "DiscoveredSecuritySolutionsClient.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, ascLocation, discoveredSecuritySolutionName, options) - if err != nil { - return DiscoveredSecuritySolutionsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DiscoveredSecuritySolutionsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return DiscoveredSecuritySolutionsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *DiscoveredSecuritySolutionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, discoveredSecuritySolutionName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ascLocation == "" { - return nil, errors.New("parameter ascLocation cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ascLocation}", url.PathEscape(ascLocation)) - if discoveredSecuritySolutionName == "" { - return nil, errors.New("parameter discoveredSecuritySolutionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{discoveredSecuritySolutionName}", url.PathEscape(discoveredSecuritySolutionName)) - 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 *DiscoveredSecuritySolutionsClient) getHandleResponse(resp *http.Response) (DiscoveredSecuritySolutionsClientGetResponse, error) { - result := DiscoveredSecuritySolutionsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DiscoveredSecuritySolution); err != nil { - return DiscoveredSecuritySolutionsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Gets a list of discovered Security Solutions for the subscription. -// -// Generated from API version 2020-01-01 -// - options - DiscoveredSecuritySolutionsClientListOptions contains the optional parameters for the DiscoveredSecuritySolutionsClient.NewListPager -// method. -func (client *DiscoveredSecuritySolutionsClient) NewListPager(options *DiscoveredSecuritySolutionsClientListOptions) *runtime.Pager[DiscoveredSecuritySolutionsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[DiscoveredSecuritySolutionsClientListResponse]{ - More: func(page DiscoveredSecuritySolutionsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *DiscoveredSecuritySolutionsClientListResponse) (DiscoveredSecuritySolutionsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DiscoveredSecuritySolutionsClient.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 DiscoveredSecuritySolutionsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *DiscoveredSecuritySolutionsClient) listCreateRequest(ctx context.Context, options *DiscoveredSecuritySolutionsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/discoveredSecuritySolutions" - 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") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *DiscoveredSecuritySolutionsClient) listHandleResponse(resp *http.Response) (DiscoveredSecuritySolutionsClientListResponse, error) { - result := DiscoveredSecuritySolutionsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DiscoveredSecuritySolutionList); err != nil { - return DiscoveredSecuritySolutionsClientListResponse{}, err - } - return result, nil -} - -// NewListByHomeRegionPager - Gets a list of discovered Security Solutions for the subscription and location. -// -// Generated from API version 2020-01-01 -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - options - DiscoveredSecuritySolutionsClientListByHomeRegionOptions contains the optional parameters for the DiscoveredSecuritySolutionsClient.NewListByHomeRegionPager -// method. -func (client *DiscoveredSecuritySolutionsClient) NewListByHomeRegionPager(ascLocation string, options *DiscoveredSecuritySolutionsClientListByHomeRegionOptions) *runtime.Pager[DiscoveredSecuritySolutionsClientListByHomeRegionResponse] { - return runtime.NewPager(runtime.PagingHandler[DiscoveredSecuritySolutionsClientListByHomeRegionResponse]{ - More: func(page DiscoveredSecuritySolutionsClientListByHomeRegionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *DiscoveredSecuritySolutionsClientListByHomeRegionResponse) (DiscoveredSecuritySolutionsClientListByHomeRegionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DiscoveredSecuritySolutionsClient.NewListByHomeRegionPager") - 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.listByHomeRegionCreateRequest(ctx, ascLocation, options) - }, nil) - if err != nil { - return DiscoveredSecuritySolutionsClientListByHomeRegionResponse{}, err - } - return client.listByHomeRegionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByHomeRegionCreateRequest creates the ListByHomeRegion request. -func (client *DiscoveredSecuritySolutionsClient) listByHomeRegionCreateRequest(ctx context.Context, ascLocation string, options *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") - } - 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)) - 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 -} - -// listByHomeRegionHandleResponse handles the ListByHomeRegion response. -func (client *DiscoveredSecuritySolutionsClient) listByHomeRegionHandleResponse(resp *http.Response) (DiscoveredSecuritySolutionsClientListByHomeRegionResponse, error) { - result := DiscoveredSecuritySolutionsClientListByHomeRegionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DiscoveredSecuritySolutionList); err != nil { - return DiscoveredSecuritySolutionsClientListByHomeRegionResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/discoveredsecuritysolutions_client_example_test.go b/sdk/resourcemanager/security/armsecurity/discoveredsecuritysolutions_client_example_test.go deleted file mode 100644 index 883d1a77b207..000000000000 --- a/sdk/resourcemanager/security/armsecurity/discoveredsecuritysolutions_client_example_test.go +++ /dev/null @@ -1,154 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/DiscoveredSecuritySolutions/GetDiscoveredSecuritySolutionsSubscription_example.json -func ExampleDiscoveredSecuritySolutionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiscoveredSecuritySolutionsClient().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.DiscoveredSecuritySolutionList = armsecurity.DiscoveredSecuritySolutionList{ - // Value: []*armsecurity.DiscoveredSecuritySolution{ - // { - // Location: to.Ptr("eastus"), - // Name: to.Ptr("CP"), - // Type: to.Ptr("Microsoft.Security/locations/discoveredSecuritySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Security/locations/centralus/discoveredSecuritySolutions/CP"), - // Properties: &armsecurity.DiscoveredSecuritySolutionProperties{ - // Offer: to.Ptr("cisco-asav"), - // Publisher: to.Ptr("cisco"), - // SecurityFamily: to.Ptr(armsecurity.SecurityFamilyNgfw), - // SKU: to.Ptr("asav-azure-byol"), - // }, - // }, - // { - // Location: to.Ptr("eastus2"), - // Name: to.Ptr("paloalto7"), - // Type: to.Ptr("Microsoft.Security/locations/discoveredSecuritySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg2/providers/Microsoft.Security/locations/centralus/discoveredSecuritySolutions/paloalto7"), - // Properties: &armsecurity.DiscoveredSecuritySolutionProperties{ - // Offer: to.Ptr("vmseries1"), - // Publisher: to.Ptr("paloaltonetworks"), - // SecurityFamily: to.Ptr(armsecurity.SecurityFamilyNgfw), - // SKU: to.Ptr("byol"), - // }, - // }}, - // } - } -} - -// 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/DiscoveredSecuritySolutions/GetDiscoveredSecuritySolutionsSubscriptionLocation_example.json -func ExampleDiscoveredSecuritySolutionsClient_NewListByHomeRegionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiscoveredSecuritySolutionsClient().NewListByHomeRegionPager("centralus", 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.DiscoveredSecuritySolutionList = armsecurity.DiscoveredSecuritySolutionList{ - // Value: []*armsecurity.DiscoveredSecuritySolution{ - // { - // Location: to.Ptr("eastus"), - // Name: to.Ptr("CP"), - // Type: to.Ptr("Microsoft.Security/locations/discoveredSecuritySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Security/locations/centralus/discoveredSecuritySolutions/CP"), - // Properties: &armsecurity.DiscoveredSecuritySolutionProperties{ - // Offer: to.Ptr("cisco-asav"), - // Publisher: to.Ptr("cisco"), - // SecurityFamily: to.Ptr(armsecurity.SecurityFamilyNgfw), - // SKU: to.Ptr("asav-azure-byol"), - // }, - // }, - // { - // Location: to.Ptr("eastus2"), - // Name: to.Ptr("paloalto7"), - // Type: to.Ptr("Microsoft.Security/locations/discoveredSecuritySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg2/providers/Microsoft.Security/locations/centralus/discoveredSecuritySolutions/paloalto7"), - // Properties: &armsecurity.DiscoveredSecuritySolutionProperties{ - // Offer: to.Ptr("vmseries1"), - // Publisher: to.Ptr("paloaltonetworks"), - // SecurityFamily: to.Ptr(armsecurity.SecurityFamilyNgfw), - // SKU: to.Ptr("byol"), - // }, - // }}, - // } - } -} - -// 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/DiscoveredSecuritySolutions/GetDiscoveredSecuritySolutionResourceGroupLocation_example.json -func ExampleDiscoveredSecuritySolutionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiscoveredSecuritySolutionsClient().Get(ctx, "myRg2", "centralus", "paloalto7", 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.DiscoveredSecuritySolution = armsecurity.DiscoveredSecuritySolution{ - // Location: to.Ptr("eastus2"), - // Name: to.Ptr("paloalto7"), - // Type: to.Ptr("Microsoft.Security/locations/discoveredSecuritySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg2/providers/Microsoft.Security/locations/centralus/discoveredSecuritySolutions/paloalto7"), - // Properties: &armsecurity.DiscoveredSecuritySolutionProperties{ - // Offer: to.Ptr("vmseries1"), - // Publisher: to.Ptr("paloaltonetworks"), - // SecurityFamily: to.Ptr(armsecurity.SecurityFamilyNgfw), - // SKU: to.Ptr("byol"), - // }, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/externalsecuritysolutions_client.go b/sdk/resourcemanager/security/armsecurity/externalsecuritysolutions_client.go deleted file mode 100644 index 800cbabf9cea..000000000000 --- a/sdk/resourcemanager/security/armsecurity/externalsecuritysolutions_client.go +++ /dev/null @@ -1,229 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// ExternalSecuritySolutionsClient contains the methods for the ExternalSecuritySolutions group. -// Don't use this type directly, use NewExternalSecuritySolutionsClient() instead. -type ExternalSecuritySolutionsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewExternalSecuritySolutionsClient creates a new instance of ExternalSecuritySolutionsClient 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 NewExternalSecuritySolutionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExternalSecuritySolutionsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ExternalSecuritySolutionsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Gets a specific external Security Solution. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-01-01 -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - externalSecuritySolutionsName - Name of an external security solution. -// - options - ExternalSecuritySolutionsClientGetOptions contains the optional parameters for the ExternalSecuritySolutionsClient.Get -// method. -func (client *ExternalSecuritySolutionsClient) Get(ctx context.Context, resourceGroupName string, ascLocation string, externalSecuritySolutionsName string, options *ExternalSecuritySolutionsClientGetOptions) (ExternalSecuritySolutionsClientGetResponse, error) { - var err error - const operationName = "ExternalSecuritySolutionsClient.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, ascLocation, externalSecuritySolutionsName, options) - if err != nil { - return ExternalSecuritySolutionsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ExternalSecuritySolutionsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ExternalSecuritySolutionsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ExternalSecuritySolutionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, externalSecuritySolutionsName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ascLocation == "" { - return nil, errors.New("parameter ascLocation cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ascLocation}", url.PathEscape(ascLocation)) - if externalSecuritySolutionsName == "" { - return nil, errors.New("parameter externalSecuritySolutionsName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{externalSecuritySolutionsName}", url.PathEscape(externalSecuritySolutionsName)) - 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 *ExternalSecuritySolutionsClient) getHandleResponse(resp *http.Response) (ExternalSecuritySolutionsClientGetResponse, error) { - result := ExternalSecuritySolutionsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result); err != nil { - return ExternalSecuritySolutionsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Gets a list of external security solutions for the subscription. -// -// Generated from API version 2020-01-01 -// - options - ExternalSecuritySolutionsClientListOptions contains the optional parameters for the ExternalSecuritySolutionsClient.NewListPager -// method. -func (client *ExternalSecuritySolutionsClient) NewListPager(options *ExternalSecuritySolutionsClientListOptions) *runtime.Pager[ExternalSecuritySolutionsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[ExternalSecuritySolutionsClientListResponse]{ - More: func(page ExternalSecuritySolutionsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ExternalSecuritySolutionsClientListResponse) (ExternalSecuritySolutionsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ExternalSecuritySolutionsClient.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 ExternalSecuritySolutionsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *ExternalSecuritySolutionsClient) listCreateRequest(ctx context.Context, options *ExternalSecuritySolutionsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/externalSecuritySolutions" - 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") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *ExternalSecuritySolutionsClient) listHandleResponse(resp *http.Response) (ExternalSecuritySolutionsClientListResponse, error) { - result := ExternalSecuritySolutionsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ExternalSecuritySolutionList); err != nil { - return ExternalSecuritySolutionsClientListResponse{}, err - } - return result, nil -} - -// NewListByHomeRegionPager - Gets a list of external Security Solutions for the subscription and location. -// -// Generated from API version 2020-01-01 -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - options - ExternalSecuritySolutionsClientListByHomeRegionOptions contains the optional parameters for the ExternalSecuritySolutionsClient.NewListByHomeRegionPager -// method. -func (client *ExternalSecuritySolutionsClient) NewListByHomeRegionPager(ascLocation string, options *ExternalSecuritySolutionsClientListByHomeRegionOptions) *runtime.Pager[ExternalSecuritySolutionsClientListByHomeRegionResponse] { - return runtime.NewPager(runtime.PagingHandler[ExternalSecuritySolutionsClientListByHomeRegionResponse]{ - More: func(page ExternalSecuritySolutionsClientListByHomeRegionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ExternalSecuritySolutionsClientListByHomeRegionResponse) (ExternalSecuritySolutionsClientListByHomeRegionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ExternalSecuritySolutionsClient.NewListByHomeRegionPager") - 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.listByHomeRegionCreateRequest(ctx, ascLocation, options) - }, nil) - if err != nil { - return ExternalSecuritySolutionsClientListByHomeRegionResponse{}, err - } - return client.listByHomeRegionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByHomeRegionCreateRequest creates the ListByHomeRegion request. -func (client *ExternalSecuritySolutionsClient) listByHomeRegionCreateRequest(ctx context.Context, ascLocation string, options *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") - } - 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)) - 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 -} - -// listByHomeRegionHandleResponse handles the ListByHomeRegion response. -func (client *ExternalSecuritySolutionsClient) listByHomeRegionHandleResponse(resp *http.Response) (ExternalSecuritySolutionsClientListByHomeRegionResponse, error) { - result := ExternalSecuritySolutionsClientListByHomeRegionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ExternalSecuritySolutionList); err != nil { - return ExternalSecuritySolutionsClientListByHomeRegionResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/externalsecuritysolutions_client_example_test.go b/sdk/resourcemanager/security/armsecurity/externalsecuritysolutions_client_example_test.go deleted file mode 100644 index ee0dc59d4e10..000000000000 --- a/sdk/resourcemanager/security/armsecurity/externalsecuritysolutions_client_example_test.go +++ /dev/null @@ -1,345 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ExternalSecuritySolutions/GetExternalSecuritySolutionsSubscription_example.json -func ExampleExternalSecuritySolutionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExternalSecuritySolutionsClient().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.ExternalSecuritySolutionList = armsecurity.ExternalSecuritySolutionList{ - // Value: []armsecurity.ExternalSecuritySolutionClassification{ - // &armsecurity.AADExternalSecuritySolution{ - // Location: to.Ptr("eastus"), - // Name: to.Ptr("aad_defaultworkspace-20ff7fc3-e762-44dd-bd96-b71116dcdc23-eus"), - // Type: to.Ptr("Microsoft.Security/locations/externalSecuritySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/defaultresourcegroup-eus/providers/Microsoft.Security/locations/centralus/externalSecuritySolutions/aad_defaultworkspace-20ff7fc3-e762-44dd-bd96-b71116dcdc23-eus"), - // Kind: to.Ptr(armsecurity.ExternalSecuritySolutionKindAAD), - // Properties: &armsecurity.AADSolutionProperties{ - // DeviceType: to.Ptr("Azure Active Directory Identity Protection"), - // DeviceVendor: to.Ptr("Microsoft"), - // Workspace: &armsecurity.ConnectedWorkspace{ - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/defaultresourcegroup-eus/providers/Microsoft.OperationalInsights/workspaces/defaultworkspace-20ff7fc3-e762-44dd-bd96-b71116dcdc23-eus"), - // }, - // AdditionalProperties: map[string]any{ - // "connectivityState": "Discovered", - // }, - // }, - // }, - // &armsecurity.AADExternalSecuritySolution{ - // Location: to.Ptr("westeurope"), - // Name: to.Ptr("aad_defaultworkspace-20ff7fc3-e762-44dd-bd96-b71116dcdc23-weu"), - // Type: to.Ptr("Microsoft.Security/locations/externalSecuritySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/defaultresourcegroup-weu/providers/Microsoft.Security/locations/centralus/externalSecuritySolutions/aad_defaultworkspace-20ff7fc3-e762-44dd-bd96-b71116dcdc23-weu"), - // Kind: to.Ptr(armsecurity.ExternalSecuritySolutionKindAAD), - // Properties: &armsecurity.AADSolutionProperties{ - // DeviceType: to.Ptr("Azure Active Directory Identity Protection"), - // DeviceVendor: to.Ptr("Microsoft"), - // Workspace: &armsecurity.ConnectedWorkspace{ - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/defaultresourcegroup-weu/providers/Microsoft.OperationalInsights/workspaces/defaultworkspace-20ff7fc3-e762-44dd-bd96-b71116dcdc23-weu"), - // }, - // AdditionalProperties: map[string]any{ - // "connectivityState": "Discovered", - // }, - // }, - // }, - // &armsecurity.CefExternalSecuritySolution{ - // Location: to.Ptr("westcentralus"), - // Name: to.Ptr("cef_omsprd_barracudanetworks_waf_barracuda"), - // Type: to.Ptr("Microsoft.Security/locations/externalSecuritySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/unificationprod/providers/Microsoft.Security/locations/centralus/externalSecuritySolutions/cef_omsprd_barracudanetworks_waf_barracuda"), - // Kind: to.Ptr(armsecurity.ExternalSecuritySolutionKindCEF), - // Properties: &armsecurity.CefSolutionProperties{ - // DeviceType: to.Ptr("WAF"), - // DeviceVendor: to.Ptr("barracudanetworks"), - // Workspace: &armsecurity.ConnectedWorkspace{ - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/unificationprod/providers/Microsoft.OperationalInsights/workspaces/omsprd"), - // }, - // Hostname: to.Ptr("barracuda"), - // LastEventReceived: to.Ptr("2018-05-09T10:30:11.523Z"), - // }, - // }, - // &armsecurity.CefExternalSecuritySolution{ - // Location: to.Ptr("westcentralus"), - // Name: to.Ptr("cef_omsprd_virtualhoneypot_Microsoft_demovm20"), - // Type: to.Ptr("Microsoft.Security/locations/externalSecuritySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/unificationprod/providers/Microsoft.Security/locations/centralus/externalSecuritySolutions/cef_omsprd_virtualhoneypot_Microsoft_demovm20"), - // Kind: to.Ptr(armsecurity.ExternalSecuritySolutionKindCEF), - // Properties: &armsecurity.CefSolutionProperties{ - // DeviceType: to.Ptr("Microsoft"), - // DeviceVendor: to.Ptr("virtualHoneypot"), - // Workspace: &armsecurity.ConnectedWorkspace{ - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/unificationprod/providers/Microsoft.OperationalInsights/workspaces/omsprd"), - // }, - // Hostname: to.Ptr("demovm20"), - // LastEventReceived: to.Ptr("2018-05-08T15:42:22.57Z"), - // }, - // }, - // &armsecurity.CefExternalSecuritySolution{ - // Location: to.Ptr("westcentralus"), - // Name: to.Ptr("cef_omsprd_virtualhoneypot_Microsoft_demovm10"), - // Type: to.Ptr("Microsoft.Security/locations/externalSecuritySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/unificationprod/providers/Microsoft.Security/locations/centralus/externalSecuritySolutions/cef_omsprd_virtualhoneypot_Microsoft_demovm10"), - // Kind: to.Ptr(armsecurity.ExternalSecuritySolutionKindCEF), - // Properties: &armsecurity.CefSolutionProperties{ - // DeviceType: to.Ptr("Microsoft"), - // DeviceVendor: to.Ptr("virtualHoneypot"), - // Workspace: &armsecurity.ConnectedWorkspace{ - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/unificationprod/providers/Microsoft.OperationalInsights/workspaces/omsprd"), - // }, - // Hostname: to.Ptr("demovm10"), - // LastEventReceived: to.Ptr("2018-05-08T10:38:53.423Z"), - // }, - // }, - // &armsecurity.AADExternalSecuritySolution{ - // Location: to.Ptr("westcentralus"), - // Name: to.Ptr("aad_omsprd"), - // Type: to.Ptr("Microsoft.Security/locations/externalSecuritySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/unificationprod/providers/Microsoft.Security/locations/centralus/externalSecuritySolutions/aad_omsprd"), - // Kind: to.Ptr(armsecurity.ExternalSecuritySolutionKindAAD), - // Properties: &armsecurity.AADSolutionProperties{ - // DeviceType: to.Ptr("Azure Active Directory Identity Protection"), - // DeviceVendor: to.Ptr("Microsoft"), - // Workspace: &armsecurity.ConnectedWorkspace{ - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/unificationprod/providers/Microsoft.OperationalInsights/workspaces/omsprd"), - // }, - // AdditionalProperties: map[string]any{ - // "connectivityState": "Discovered", - // }, - // }, - // }, - // &armsecurity.AADExternalSecuritySolution{ - // Location: to.Ptr("japaneast"), - // Name: to.Ptr("aad_defaultworkspace-20ff7fc3-e762-44dd-bd96-b71116dcdc23-ejp"), - // Type: to.Ptr("Microsoft.Security/locations/externalSecuritySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/defaultresourcegroup-ejp/providers/Microsoft.Security/locations/centralus/externalSecuritySolutions/aad_defaultworkspace-20ff7fc3-e762-44dd-bd96-b71116dcdc23-ejp"), - // Kind: to.Ptr(armsecurity.ExternalSecuritySolutionKindAAD), - // Properties: &armsecurity.AADSolutionProperties{ - // DeviceType: to.Ptr("Azure Active Directory Identity Protection"), - // DeviceVendor: to.Ptr("Microsoft"), - // Workspace: &armsecurity.ConnectedWorkspace{ - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/defaultresourcegroup-ejp/providers/Microsoft.OperationalInsights/workspaces/defaultworkspace-20ff7fc3-e762-44dd-bd96-b71116dcdc23-ejp"), - // }, - // AdditionalProperties: map[string]any{ - // "connectivityState": "Discovered", - // }, - // }, - // }}, - // } - } -} - -// 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/ExternalSecuritySolutions/GetExternalSecuritySolutionsSubscriptionLocation_example.json -func ExampleExternalSecuritySolutionsClient_NewListByHomeRegionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExternalSecuritySolutionsClient().NewListByHomeRegionPager("centralus", 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.ExternalSecuritySolutionList = armsecurity.ExternalSecuritySolutionList{ - // Value: []armsecurity.ExternalSecuritySolutionClassification{ - // &armsecurity.AADExternalSecuritySolution{ - // Location: to.Ptr("eastus"), - // Name: to.Ptr("aad_defaultworkspace-20ff7fc3-e762-44dd-bd96-b71116dcdc23-eus"), - // Type: to.Ptr("Microsoft.Security/locations/externalSecuritySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/defaultresourcegroup-eus/providers/Microsoft.Security/locations/centralus/externalSecuritySolutions/aad_defaultworkspace-20ff7fc3-e762-44dd-bd96-b71116dcdc23-eus"), - // Kind: to.Ptr(armsecurity.ExternalSecuritySolutionKindAAD), - // Properties: &armsecurity.AADSolutionProperties{ - // DeviceType: to.Ptr("Azure Active Directory Identity Protection"), - // DeviceVendor: to.Ptr("Microsoft"), - // Workspace: &armsecurity.ConnectedWorkspace{ - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/defaultresourcegroup-eus/providers/Microsoft.OperationalInsights/workspaces/defaultworkspace-20ff7fc3-e762-44dd-bd96-b71116dcdc23-eus"), - // }, - // AdditionalProperties: map[string]any{ - // "connectivityState": "Discovered", - // }, - // }, - // }, - // &armsecurity.AADExternalSecuritySolution{ - // Location: to.Ptr("westeurope"), - // Name: to.Ptr("aad_defaultworkspace-20ff7fc3-e762-44dd-bd96-b71116dcdc23-weu"), - // Type: to.Ptr("Microsoft.Security/locations/externalSecuritySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/defaultresourcegroup-weu/providers/Microsoft.Security/locations/centralus/externalSecuritySolutions/aad_defaultworkspace-20ff7fc3-e762-44dd-bd96-b71116dcdc23-weu"), - // Kind: to.Ptr(armsecurity.ExternalSecuritySolutionKindAAD), - // Properties: &armsecurity.AADSolutionProperties{ - // DeviceType: to.Ptr("Azure Active Directory Identity Protection"), - // DeviceVendor: to.Ptr("Microsoft"), - // Workspace: &armsecurity.ConnectedWorkspace{ - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/defaultresourcegroup-weu/providers/Microsoft.OperationalInsights/workspaces/defaultworkspace-20ff7fc3-e762-44dd-bd96-b71116dcdc23-weu"), - // }, - // AdditionalProperties: map[string]any{ - // "connectivityState": "Discovered", - // }, - // }, - // }, - // &armsecurity.CefExternalSecuritySolution{ - // Location: to.Ptr("westcentralus"), - // Name: to.Ptr("cef_omsprd_barracudanetworks_waf_barracuda"), - // Type: to.Ptr("Microsoft.Security/locations/externalSecuritySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/unificationprod/providers/Microsoft.Security/locations/centralus/externalSecuritySolutions/cef_omsprd_barracudanetworks_waf_barracuda"), - // Kind: to.Ptr(armsecurity.ExternalSecuritySolutionKindCEF), - // Properties: &armsecurity.CefSolutionProperties{ - // DeviceType: to.Ptr("WAF"), - // DeviceVendor: to.Ptr("barracudanetworks"), - // Workspace: &armsecurity.ConnectedWorkspace{ - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/unificationprod/providers/Microsoft.OperationalInsights/workspaces/omsprd"), - // }, - // Hostname: to.Ptr("barracuda"), - // LastEventReceived: to.Ptr("2018-05-09T10:30:11.523Z"), - // }, - // }, - // &armsecurity.CefExternalSecuritySolution{ - // Location: to.Ptr("westcentralus"), - // Name: to.Ptr("cef_omsprd_virtualhoneypot_Microsoft_demovm20"), - // Type: to.Ptr("Microsoft.Security/locations/externalSecuritySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/unificationprod/providers/Microsoft.Security/locations/centralus/externalSecuritySolutions/cef_omsprd_virtualhoneypot_Microsoft_demovm20"), - // Kind: to.Ptr(armsecurity.ExternalSecuritySolutionKindCEF), - // Properties: &armsecurity.CefSolutionProperties{ - // DeviceType: to.Ptr("Microsoft"), - // DeviceVendor: to.Ptr("virtualHoneypot"), - // Workspace: &armsecurity.ConnectedWorkspace{ - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/unificationprod/providers/Microsoft.OperationalInsights/workspaces/omsprd"), - // }, - // Hostname: to.Ptr("demovm20"), - // LastEventReceived: to.Ptr("2018-05-08T15:42:22.57Z"), - // }, - // }, - // &armsecurity.CefExternalSecuritySolution{ - // Location: to.Ptr("westcentralus"), - // Name: to.Ptr("cef_omsprd_virtualhoneypot_Microsoft_demovm10"), - // Type: to.Ptr("Microsoft.Security/locations/externalSecuritySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/unificationprod/providers/Microsoft.Security/locations/centralus/externalSecuritySolutions/cef_omsprd_virtualhoneypot_Microsoft_demovm10"), - // Kind: to.Ptr(armsecurity.ExternalSecuritySolutionKindCEF), - // Properties: &armsecurity.CefSolutionProperties{ - // DeviceType: to.Ptr("Microsoft"), - // DeviceVendor: to.Ptr("virtualHoneypot"), - // Workspace: &armsecurity.ConnectedWorkspace{ - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/unificationprod/providers/Microsoft.OperationalInsights/workspaces/omsprd"), - // }, - // Hostname: to.Ptr("demovm10"), - // LastEventReceived: to.Ptr("2018-05-08T10:38:53.423Z"), - // }, - // }, - // &armsecurity.AADExternalSecuritySolution{ - // Location: to.Ptr("westcentralus"), - // Name: to.Ptr("aad_omsprd"), - // Type: to.Ptr("Microsoft.Security/locations/externalSecuritySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/unificationprod/providers/Microsoft.Security/locations/centralus/externalSecuritySolutions/aad_omsprd"), - // Kind: to.Ptr(armsecurity.ExternalSecuritySolutionKindAAD), - // Properties: &armsecurity.AADSolutionProperties{ - // DeviceType: to.Ptr("Azure Active Directory Identity Protection"), - // DeviceVendor: to.Ptr("Microsoft"), - // Workspace: &armsecurity.ConnectedWorkspace{ - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/unificationprod/providers/Microsoft.OperationalInsights/workspaces/omsprd"), - // }, - // AdditionalProperties: map[string]any{ - // "connectivityState": "Discovered", - // }, - // }, - // }, - // &armsecurity.AADExternalSecuritySolution{ - // Location: to.Ptr("japaneast"), - // Name: to.Ptr("aad_defaultworkspace-20ff7fc3-e762-44dd-bd96-b71116dcdc23-ejp"), - // Type: to.Ptr("Microsoft.Security/locations/externalSecuritySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/defaultresourcegroup-ejp/providers/Microsoft.Security/locations/centralus/externalSecuritySolutions/aad_defaultworkspace-20ff7fc3-e762-44dd-bd96-b71116dcdc23-ejp"), - // Kind: to.Ptr(armsecurity.ExternalSecuritySolutionKindAAD), - // Properties: &armsecurity.AADSolutionProperties{ - // DeviceType: to.Ptr("Azure Active Directory Identity Protection"), - // DeviceVendor: to.Ptr("Microsoft"), - // Workspace: &armsecurity.ConnectedWorkspace{ - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/defaultresourcegroup-ejp/providers/Microsoft.OperationalInsights/workspaces/defaultworkspace-20ff7fc3-e762-44dd-bd96-b71116dcdc23-ejp"), - // }, - // AdditionalProperties: map[string]any{ - // "connectivityState": "Discovered", - // }, - // }, - // }}, - // } - } -} - -// 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/ExternalSecuritySolutions/GetExternalSecuritySolution_example.json -func ExampleExternalSecuritySolutionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExternalSecuritySolutionsClient().Get(ctx, "defaultresourcegroup-eus", "centralus", "aad_defaultworkspace-20ff7fc3-e762-44dd-bd96-b71116dcdc23-eus", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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 = armsecurity.ExternalSecuritySolutionsClientGetResponse{ - // ExternalSecuritySolutionClassification: &armsecurity.AADExternalSecuritySolution{ - // Location: to.Ptr("eastus"), - // Name: to.Ptr("aad_defaultworkspace-20ff7fc3-e762-44dd-bd96-b71116dcdc23-eus"), - // Type: to.Ptr("Microsoft.Security/locations/externalSecuritySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/defaultresourcegroup-eus/providers/Microsoft.Security/locations/centralus/externalSecuritySolutions/aad_defaultworkspace-20ff7fc3-e762-44dd-bd96-b71116dcdc23-eus"), - // Kind: to.Ptr(armsecurity.ExternalSecuritySolutionKindAAD), - // Properties: &armsecurity.AADSolutionProperties{ - // DeviceType: to.Ptr("Azure Active Directory Identity Protection"), - // DeviceVendor: to.Ptr("Microsoft"), - // Workspace: &armsecurity.ConnectedWorkspace{ - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/defaultresourcegroup-eus/providers/Microsoft.OperationalInsights/workspaces/defaultworkspace-20ff7fc3-e762-44dd-bd96-b71116dcdc23-eus"), - // }, - // AdditionalProperties: map[string]any{ - // "connectivityState": "Discovered", - // }, - // }, - // }, - // } -} 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 87a473ac847c..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/accountconnectors_server.go +++ /dev/null @@ -1,214 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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 511ee65a3f4c..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/adaptiveapplicationcontrols_server.go +++ /dev/null @@ -1,238 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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 a89f90b1a236..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/adaptivenetworkhardenings_server.go +++ /dev/null @@ -1,240 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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 deleted file mode 100644 index eaa6e04bc4c3..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/advancedthreatprotection_server.go +++ /dev/null @@ -1,135 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// AdvancedThreatProtectionServer is a fake server for instances of the armsecurity.AdvancedThreatProtectionClient type. -type AdvancedThreatProtectionServer struct { - // Create is the fake for method AdvancedThreatProtectionClient.Create - // HTTP status codes to indicate success: http.StatusOK - Create func(ctx context.Context, resourceID string, advancedThreatProtectionSetting armsecurity.AdvancedThreatProtectionSetting, options *armsecurity.AdvancedThreatProtectionClientCreateOptions) (resp azfake.Responder[armsecurity.AdvancedThreatProtectionClientCreateResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method AdvancedThreatProtectionClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceID string, options *armsecurity.AdvancedThreatProtectionClientGetOptions) (resp azfake.Responder[armsecurity.AdvancedThreatProtectionClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewAdvancedThreatProtectionServerTransport creates a new instance of AdvancedThreatProtectionServerTransport with the provided implementation. -// The returned AdvancedThreatProtectionServerTransport instance is connected to an instance of armsecurity.AdvancedThreatProtectionClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAdvancedThreatProtectionServerTransport(srv *AdvancedThreatProtectionServer) *AdvancedThreatProtectionServerTransport { - return &AdvancedThreatProtectionServerTransport{srv: srv} -} - -// AdvancedThreatProtectionServerTransport connects instances of armsecurity.AdvancedThreatProtectionClient to instances of AdvancedThreatProtectionServer. -// Don't use this type directly, use NewAdvancedThreatProtectionServerTransport instead. -type AdvancedThreatProtectionServerTransport struct { - srv *AdvancedThreatProtectionServer -} - -// Do implements the policy.Transporter interface for AdvancedThreatProtectionServerTransport. -func (a *AdvancedThreatProtectionServerTransport) 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 "AdvancedThreatProtectionClient.Create": - resp, err = a.dispatchCreate(req) - case "AdvancedThreatProtectionClient.Get": - resp, err = a.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AdvancedThreatProtectionServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if a.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.AdvancedThreatProtectionSetting](req) - if err != nil { - return nil, err - } - resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Create(req.Context(), resourceIDParam, 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).AdvancedThreatProtectionSetting, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AdvancedThreatProtectionServerTransport) 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/advancedThreatProtectionSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - 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) - } - resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Get(req.Context(), 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).AdvancedThreatProtectionSetting, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/alerts_server.go b/sdk/resourcemanager/security/armsecurity/fake/alerts_server.go deleted file mode 100644 index 79ebfa4b7148..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/alerts_server.go +++ /dev/null @@ -1,706 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// AlertsServer is a fake server for instances of the armsecurity.AlertsClient type. -type AlertsServer struct { - // GetResourceGroupLevel is the fake for method AlertsClient.GetResourceGroupLevel - // HTTP status codes to indicate success: http.StatusOK - GetResourceGroupLevel func(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, options *armsecurity.AlertsClientGetResourceGroupLevelOptions) (resp azfake.Responder[armsecurity.AlertsClientGetResourceGroupLevelResponse], errResp azfake.ErrorResponder) - - // GetSubscriptionLevel is the fake for method AlertsClient.GetSubscriptionLevel - // HTTP status codes to indicate success: http.StatusOK - GetSubscriptionLevel func(ctx context.Context, ascLocation string, alertName string, options *armsecurity.AlertsClientGetSubscriptionLevelOptions) (resp azfake.Responder[armsecurity.AlertsClientGetSubscriptionLevelResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method AlertsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armsecurity.AlertsClientListOptions) (resp azfake.PagerResponder[armsecurity.AlertsClientListResponse]) - - // NewListByResourceGroupPager is the fake for method AlertsClient.NewListByResourceGroupPager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, options *armsecurity.AlertsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armsecurity.AlertsClientListByResourceGroupResponse]) - - // NewListResourceGroupLevelByRegionPager is the fake for method AlertsClient.NewListResourceGroupLevelByRegionPager - // HTTP status codes to indicate success: http.StatusOK - NewListResourceGroupLevelByRegionPager func(ascLocation string, resourceGroupName string, options *armsecurity.AlertsClientListResourceGroupLevelByRegionOptions) (resp azfake.PagerResponder[armsecurity.AlertsClientListResourceGroupLevelByRegionResponse]) - - // NewListSubscriptionLevelByRegionPager is the fake for method AlertsClient.NewListSubscriptionLevelByRegionPager - // HTTP status codes to indicate success: http.StatusOK - 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 - 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 - // HTTP status codes to indicate success: http.StatusNoContent - UpdateResourceGroupLevelStateToActivate func(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, options *armsecurity.AlertsClientUpdateResourceGroupLevelStateToActivateOptions) (resp azfake.Responder[armsecurity.AlertsClientUpdateResourceGroupLevelStateToActivateResponse], errResp azfake.ErrorResponder) - - // UpdateResourceGroupLevelStateToDismiss is the fake for method AlertsClient.UpdateResourceGroupLevelStateToDismiss - // HTTP status codes to indicate success: http.StatusNoContent - UpdateResourceGroupLevelStateToDismiss func(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, options *armsecurity.AlertsClientUpdateResourceGroupLevelStateToDismissOptions) (resp azfake.Responder[armsecurity.AlertsClientUpdateResourceGroupLevelStateToDismissResponse], errResp azfake.ErrorResponder) - - // UpdateResourceGroupLevelStateToInProgress is the fake for method AlertsClient.UpdateResourceGroupLevelStateToInProgress - // HTTP status codes to indicate success: http.StatusNoContent - UpdateResourceGroupLevelStateToInProgress func(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, options *armsecurity.AlertsClientUpdateResourceGroupLevelStateToInProgressOptions) (resp azfake.Responder[armsecurity.AlertsClientUpdateResourceGroupLevelStateToInProgressResponse], errResp azfake.ErrorResponder) - - // UpdateResourceGroupLevelStateToResolve is the fake for method AlertsClient.UpdateResourceGroupLevelStateToResolve - // HTTP status codes to indicate success: http.StatusNoContent - UpdateResourceGroupLevelStateToResolve func(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, options *armsecurity.AlertsClientUpdateResourceGroupLevelStateToResolveOptions) (resp azfake.Responder[armsecurity.AlertsClientUpdateResourceGroupLevelStateToResolveResponse], errResp azfake.ErrorResponder) - - // UpdateSubscriptionLevelStateToActivate is the fake for method AlertsClient.UpdateSubscriptionLevelStateToActivate - // HTTP status codes to indicate success: http.StatusNoContent - UpdateSubscriptionLevelStateToActivate func(ctx context.Context, ascLocation string, alertName string, options *armsecurity.AlertsClientUpdateSubscriptionLevelStateToActivateOptions) (resp azfake.Responder[armsecurity.AlertsClientUpdateSubscriptionLevelStateToActivateResponse], errResp azfake.ErrorResponder) - - // UpdateSubscriptionLevelStateToDismiss is the fake for method AlertsClient.UpdateSubscriptionLevelStateToDismiss - // HTTP status codes to indicate success: http.StatusNoContent - UpdateSubscriptionLevelStateToDismiss func(ctx context.Context, ascLocation string, alertName string, options *armsecurity.AlertsClientUpdateSubscriptionLevelStateToDismissOptions) (resp azfake.Responder[armsecurity.AlertsClientUpdateSubscriptionLevelStateToDismissResponse], errResp azfake.ErrorResponder) - - // UpdateSubscriptionLevelStateToInProgress is the fake for method AlertsClient.UpdateSubscriptionLevelStateToInProgress - // HTTP status codes to indicate success: http.StatusNoContent - UpdateSubscriptionLevelStateToInProgress func(ctx context.Context, ascLocation string, alertName string, options *armsecurity.AlertsClientUpdateSubscriptionLevelStateToInProgressOptions) (resp azfake.Responder[armsecurity.AlertsClientUpdateSubscriptionLevelStateToInProgressResponse], errResp azfake.ErrorResponder) - - // UpdateSubscriptionLevelStateToResolve is the fake for method AlertsClient.UpdateSubscriptionLevelStateToResolve - // HTTP status codes to indicate success: http.StatusNoContent - UpdateSubscriptionLevelStateToResolve func(ctx context.Context, ascLocation string, alertName string, options *armsecurity.AlertsClientUpdateSubscriptionLevelStateToResolveOptions) (resp azfake.Responder[armsecurity.AlertsClientUpdateSubscriptionLevelStateToResolveResponse], errResp azfake.ErrorResponder) -} - -// NewAlertsServerTransport creates a new instance of AlertsServerTransport with the provided implementation. -// The returned AlertsServerTransport instance is connected to an instance of armsecurity.AlertsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAlertsServerTransport(srv *AlertsServer) *AlertsServerTransport { - return &AlertsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.AlertsClientListResponse]](), - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armsecurity.AlertsClientListByResourceGroupResponse]](), - newListResourceGroupLevelByRegionPager: newTracker[azfake.PagerResponder[armsecurity.AlertsClientListResourceGroupLevelByRegionResponse]](), - newListSubscriptionLevelByRegionPager: newTracker[azfake.PagerResponder[armsecurity.AlertsClientListSubscriptionLevelByRegionResponse]](), - beginSimulate: newTracker[azfake.PollerResponder[armsecurity.AlertsClientSimulateResponse]](), - } -} - -// AlertsServerTransport connects instances of armsecurity.AlertsClient to instances of AlertsServer. -// Don't use this type directly, use NewAlertsServerTransport instead. -type AlertsServerTransport struct { - srv *AlertsServer - newListPager *tracker[azfake.PagerResponder[armsecurity.AlertsClientListResponse]] - newListByResourceGroupPager *tracker[azfake.PagerResponder[armsecurity.AlertsClientListByResourceGroupResponse]] - newListResourceGroupLevelByRegionPager *tracker[azfake.PagerResponder[armsecurity.AlertsClientListResourceGroupLevelByRegionResponse]] - newListSubscriptionLevelByRegionPager *tracker[azfake.PagerResponder[armsecurity.AlertsClientListSubscriptionLevelByRegionResponse]] - beginSimulate *tracker[azfake.PollerResponder[armsecurity.AlertsClientSimulateResponse]] -} - -// Do implements the policy.Transporter interface for AlertsServerTransport. -func (a *AlertsServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AlertsServerTransport) dispatchGetResourceGroupLevel(req *http.Request) (*http.Response, error) { - if a.srv.GetResourceGroupLevel == nil { - return nil, &nonRetriableError{errors.New("fake for method GetResourceGroupLevel not implemented")} - } - 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 { - 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 - } - ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) - if err != nil { - return nil, err - } - alertNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("alertName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.GetResourceGroupLevel(req.Context(), resourceGroupNameParam, ascLocationParam, alertNameParam, 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).Alert, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AlertsServerTransport) dispatchGetSubscriptionLevel(req *http.Request) (*http.Response, error) { - if a.srv.GetSubscriptionLevel == nil { - return nil, &nonRetriableError{errors.New("fake for method GetSubscriptionLevel not implemented")} - } - 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 { - 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 - } - alertNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("alertName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.GetSubscriptionLevel(req.Context(), ascLocationParam, alertNameParam, 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).Alert, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AlertsServerTransport) 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/alerts` - 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.AlertsClientListResponse, 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 -} - -func (a *AlertsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListByResourceGroupPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} - } - newListByResourceGroupPager := a.newListByResourceGroupPager.get(req) - if newListByResourceGroupPager == nil { - 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 { - 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.NewListByResourceGroupPager(resourceGroupNameParam, nil) - newListByResourceGroupPager = &resp - a.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armsecurity.AlertsClientListByResourceGroupResponse, 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) { - a.newListByResourceGroupPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByResourceGroupPager) { - a.newListByResourceGroupPager.remove(req) - } - return resp, nil -} - -func (a *AlertsServerTransport) dispatchNewListResourceGroupLevelByRegionPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListResourceGroupLevelByRegionPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListResourceGroupLevelByRegionPager not implemented")} - } - newListResourceGroupLevelByRegionPager := a.newListResourceGroupLevelByRegionPager.get(req) - if newListResourceGroupLevelByRegionPager == nil { - 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 { - 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 - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resp := a.srv.NewListResourceGroupLevelByRegionPager(ascLocationParam, resourceGroupNameParam, nil) - newListResourceGroupLevelByRegionPager = &resp - a.newListResourceGroupLevelByRegionPager.add(req, newListResourceGroupLevelByRegionPager) - server.PagerResponderInjectNextLinks(newListResourceGroupLevelByRegionPager, req, func(page *armsecurity.AlertsClientListResourceGroupLevelByRegionResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListResourceGroupLevelByRegionPager, req) - if err != nil { - return nil, err - } - if !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)} - } - if !server.PagerResponderMore(newListResourceGroupLevelByRegionPager) { - a.newListResourceGroupLevelByRegionPager.remove(req) - } - return resp, nil -} - -func (a *AlertsServerTransport) dispatchNewListSubscriptionLevelByRegionPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListSubscriptionLevelByRegionPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListSubscriptionLevelByRegionPager not implemented")} - } - newListSubscriptionLevelByRegionPager := a.newListSubscriptionLevelByRegionPager.get(req) - if newListSubscriptionLevelByRegionPager == nil { - 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 { - 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 - } - resp := a.srv.NewListSubscriptionLevelByRegionPager(ascLocationParam, nil) - newListSubscriptionLevelByRegionPager = &resp - a.newListSubscriptionLevelByRegionPager.add(req, newListSubscriptionLevelByRegionPager) - server.PagerResponderInjectNextLinks(newListSubscriptionLevelByRegionPager, req, func(page *armsecurity.AlertsClientListSubscriptionLevelByRegionResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListSubscriptionLevelByRegionPager, req) - if err != nil { - return nil, err - } - if !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)} - } - if !server.PagerResponderMore(newListSubscriptionLevelByRegionPager) { - a.newListSubscriptionLevelByRegionPager.remove(req) - } - return resp, nil -} - -func (a *AlertsServerTransport) dispatchBeginSimulate(req *http.Request) (*http.Response, error) { - if a.srv.BeginSimulate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginSimulate not implemented")} - } - beginSimulate := a.beginSimulate.get(req) - if beginSimulate == nil { - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.AlertSimulatorRequestBody](req) - if err != nil { - return nil, err - } - ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.BeginSimulate(req.Context(), ascLocationParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginSimulate = &respr - a.beginSimulate.add(req, beginSimulate) - } - - resp, err := server.PollerResponderNext(beginSimulate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { - a.beginSimulate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginSimulate) { - a.beginSimulate.remove(req) - } - - return resp, nil -} - -func (a *AlertsServerTransport) dispatchUpdateResourceGroupLevelStateToActivate(req *http.Request) (*http.Response, error) { - if a.srv.UpdateResourceGroupLevelStateToActivate == nil { - return nil, &nonRetriableError{errors.New("fake for method UpdateResourceGroupLevelStateToActivate not implemented")} - } - 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 { - 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 - } - ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) - if err != nil { - return nil, err - } - alertNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("alertName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.UpdateResourceGroupLevelStateToActivate(req.Context(), resourceGroupNameParam, ascLocationParam, alertNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !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) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AlertsServerTransport) dispatchUpdateResourceGroupLevelStateToDismiss(req *http.Request) (*http.Response, error) { - if a.srv.UpdateResourceGroupLevelStateToDismiss == nil { - return nil, &nonRetriableError{errors.New("fake for method UpdateResourceGroupLevelStateToDismiss not implemented")} - } - 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 { - 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 - } - ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) - if err != nil { - return nil, err - } - alertNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("alertName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.UpdateResourceGroupLevelStateToDismiss(req.Context(), resourceGroupNameParam, ascLocationParam, alertNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !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) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AlertsServerTransport) dispatchUpdateResourceGroupLevelStateToInProgress(req *http.Request) (*http.Response, error) { - if a.srv.UpdateResourceGroupLevelStateToInProgress == nil { - return nil, &nonRetriableError{errors.New("fake for method UpdateResourceGroupLevelStateToInProgress not implemented")} - } - 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 { - 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 - } - ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) - if err != nil { - return nil, err - } - alertNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("alertName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.UpdateResourceGroupLevelStateToInProgress(req.Context(), resourceGroupNameParam, ascLocationParam, alertNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !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) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AlertsServerTransport) dispatchUpdateResourceGroupLevelStateToResolve(req *http.Request) (*http.Response, error) { - if a.srv.UpdateResourceGroupLevelStateToResolve == nil { - return nil, &nonRetriableError{errors.New("fake for method UpdateResourceGroupLevelStateToResolve not implemented")} - } - 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 { - 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 - } - ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) - if err != nil { - return nil, err - } - alertNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("alertName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.UpdateResourceGroupLevelStateToResolve(req.Context(), resourceGroupNameParam, ascLocationParam, alertNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !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) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AlertsServerTransport) dispatchUpdateSubscriptionLevelStateToActivate(req *http.Request) (*http.Response, error) { - if a.srv.UpdateSubscriptionLevelStateToActivate == nil { - return nil, &nonRetriableError{errors.New("fake for method UpdateSubscriptionLevelStateToActivate not implemented")} - } - 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 { - 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 - } - alertNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("alertName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.UpdateSubscriptionLevelStateToActivate(req.Context(), ascLocationParam, alertNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !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) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AlertsServerTransport) dispatchUpdateSubscriptionLevelStateToDismiss(req *http.Request) (*http.Response, error) { - if a.srv.UpdateSubscriptionLevelStateToDismiss == nil { - return nil, &nonRetriableError{errors.New("fake for method UpdateSubscriptionLevelStateToDismiss not implemented")} - } - 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 { - 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 - } - alertNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("alertName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.UpdateSubscriptionLevelStateToDismiss(req.Context(), ascLocationParam, alertNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !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) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AlertsServerTransport) dispatchUpdateSubscriptionLevelStateToInProgress(req *http.Request) (*http.Response, error) { - if a.srv.UpdateSubscriptionLevelStateToInProgress == nil { - return nil, &nonRetriableError{errors.New("fake for method UpdateSubscriptionLevelStateToInProgress not implemented")} - } - 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 { - 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 - } - alertNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("alertName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.UpdateSubscriptionLevelStateToInProgress(req.Context(), ascLocationParam, alertNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !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) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AlertsServerTransport) dispatchUpdateSubscriptionLevelStateToResolve(req *http.Request) (*http.Response, error) { - if a.srv.UpdateSubscriptionLevelStateToResolve == nil { - return nil, &nonRetriableError{errors.New("fake for method UpdateSubscriptionLevelStateToResolve not implemented")} - } - 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 { - 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 - } - alertNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("alertName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.UpdateSubscriptionLevelStateToResolve(req.Context(), ascLocationParam, alertNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !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) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/alertssuppressionrules_server.go b/sdk/resourcemanager/security/armsecurity/fake/alertssuppressionrules_server.go deleted file mode 100644 index 2ef4892aedda..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/alertssuppressionrules_server.go +++ /dev/null @@ -1,226 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// AlertsSuppressionRulesServer is a fake server for instances of the armsecurity.AlertsSuppressionRulesClient type. -type AlertsSuppressionRulesServer struct { - // Delete is the fake for method AlertsSuppressionRulesClient.Delete - // HTTP status codes to indicate success: http.StatusNoContent - Delete func(ctx context.Context, alertsSuppressionRuleName string, options *armsecurity.AlertsSuppressionRulesClientDeleteOptions) (resp azfake.Responder[armsecurity.AlertsSuppressionRulesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method AlertsSuppressionRulesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, alertsSuppressionRuleName string, options *armsecurity.AlertsSuppressionRulesClientGetOptions) (resp azfake.Responder[armsecurity.AlertsSuppressionRulesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method AlertsSuppressionRulesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armsecurity.AlertsSuppressionRulesClientListOptions) (resp azfake.PagerResponder[armsecurity.AlertsSuppressionRulesClientListResponse]) - - // Update is the fake for method AlertsSuppressionRulesClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, alertsSuppressionRuleName string, alertsSuppressionRule armsecurity.AlertsSuppressionRule, options *armsecurity.AlertsSuppressionRulesClientUpdateOptions) (resp azfake.Responder[armsecurity.AlertsSuppressionRulesClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewAlertsSuppressionRulesServerTransport creates a new instance of AlertsSuppressionRulesServerTransport with the provided implementation. -// The returned AlertsSuppressionRulesServerTransport instance is connected to an instance of armsecurity.AlertsSuppressionRulesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAlertsSuppressionRulesServerTransport(srv *AlertsSuppressionRulesServer) *AlertsSuppressionRulesServerTransport { - return &AlertsSuppressionRulesServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.AlertsSuppressionRulesClientListResponse]](), - } -} - -// AlertsSuppressionRulesServerTransport connects instances of armsecurity.AlertsSuppressionRulesClient to instances of AlertsSuppressionRulesServer. -// Don't use this type directly, use NewAlertsSuppressionRulesServerTransport instead. -type AlertsSuppressionRulesServerTransport struct { - srv *AlertsSuppressionRulesServer - newListPager *tracker[azfake.PagerResponder[armsecurity.AlertsSuppressionRulesClientListResponse]] -} - -// Do implements the policy.Transporter interface for AlertsSuppressionRulesServerTransport. -func (a *AlertsSuppressionRulesServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AlertsSuppressionRulesServerTransport) 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/alertsSuppressionRules/(?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) - } - alertsSuppressionRuleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("alertsSuppressionRuleName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Delete(req.Context(), alertsSuppressionRuleNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !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) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AlertsSuppressionRulesServerTransport) 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/alertsSuppressionRules/(?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) - } - alertsSuppressionRuleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("alertsSuppressionRuleName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Get(req.Context(), alertsSuppressionRuleNameParam, 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).AlertsSuppressionRule, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AlertsSuppressionRulesServerTransport) 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/alertsSuppressionRules` - 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() - alertTypeUnescaped, err := url.QueryUnescape(qp.Get("AlertType")) - if err != nil { - return nil, err - } - alertTypeParam := getOptional(alertTypeUnescaped) - var options *armsecurity.AlertsSuppressionRulesClientListOptions - if alertTypeParam != nil { - options = &armsecurity.AlertsSuppressionRulesClientListOptions{ - AlertType: alertTypeParam, - } - } - resp := a.srv.NewListPager(options) - newListPager = &resp - a.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.AlertsSuppressionRulesClientListResponse, 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 -} - -func (a *AlertsSuppressionRulesServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if a.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.AlertsSuppressionRule](req) - if err != nil { - return nil, err - } - alertsSuppressionRuleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("alertsSuppressionRuleName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Update(req.Context(), alertsSuppressionRuleNameParam, 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).AlertsSuppressionRule, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/allowedconnections_server.go b/sdk/resourcemanager/security/armsecurity/fake/allowedconnections_server.go deleted file mode 100644 index bfc1b2aaead0..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/allowedconnections_server.go +++ /dev/null @@ -1,199 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// AllowedConnectionsServer is a fake server for instances of the armsecurity.AllowedConnectionsClient type. -type AllowedConnectionsServer struct { - // Get is the fake for method AllowedConnectionsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, ascLocation string, connectionType armsecurity.ConnectionType, options *armsecurity.AllowedConnectionsClientGetOptions) (resp azfake.Responder[armsecurity.AllowedConnectionsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method AllowedConnectionsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armsecurity.AllowedConnectionsClientListOptions) (resp azfake.PagerResponder[armsecurity.AllowedConnectionsClientListResponse]) - - // NewListByHomeRegionPager is the fake for method AllowedConnectionsClient.NewListByHomeRegionPager - // HTTP status codes to indicate success: http.StatusOK - NewListByHomeRegionPager func(ascLocation string, options *armsecurity.AllowedConnectionsClientListByHomeRegionOptions) (resp azfake.PagerResponder[armsecurity.AllowedConnectionsClientListByHomeRegionResponse]) -} - -// NewAllowedConnectionsServerTransport creates a new instance of AllowedConnectionsServerTransport with the provided implementation. -// The returned AllowedConnectionsServerTransport instance is connected to an instance of armsecurity.AllowedConnectionsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAllowedConnectionsServerTransport(srv *AllowedConnectionsServer) *AllowedConnectionsServerTransport { - return &AllowedConnectionsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.AllowedConnectionsClientListResponse]](), - newListByHomeRegionPager: newTracker[azfake.PagerResponder[armsecurity.AllowedConnectionsClientListByHomeRegionResponse]](), - } -} - -// AllowedConnectionsServerTransport connects instances of armsecurity.AllowedConnectionsClient to instances of AllowedConnectionsServer. -// Don't use this type directly, use NewAllowedConnectionsServerTransport instead. -type AllowedConnectionsServerTransport struct { - srv *AllowedConnectionsServer - newListPager *tracker[azfake.PagerResponder[armsecurity.AllowedConnectionsClientListResponse]] - newListByHomeRegionPager *tracker[azfake.PagerResponder[armsecurity.AllowedConnectionsClientListByHomeRegionResponse]] -} - -// Do implements the policy.Transporter interface for AllowedConnectionsServerTransport. -func (a *AllowedConnectionsServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AllowedConnectionsServerTransport) 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/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 { - 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 - } - ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) - if err != nil { - return nil, err - } - connectionTypeParam, err := parseWithCast(matches[regex.SubexpIndex("connectionType")], func(v string) (armsecurity.ConnectionType, error) { - p, unescapeErr := url.PathUnescape(v) - if unescapeErr != nil { - return "", unescapeErr - } - return armsecurity.ConnectionType(p), nil - }) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, ascLocationParam, connectionTypeParam, 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).AllowedConnectionsResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AllowedConnectionsServerTransport) 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/allowedConnections` - 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.AllowedConnectionsClientListResponse, 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 -} - -func (a *AllowedConnectionsServerTransport) dispatchNewListByHomeRegionPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListByHomeRegionPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByHomeRegionPager not implemented")} - } - newListByHomeRegionPager := a.newListByHomeRegionPager.get(req) - if newListByHomeRegionPager == nil { - 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 { - 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 - } - resp := a.srv.NewListByHomeRegionPager(ascLocationParam, nil) - newListByHomeRegionPager = &resp - a.newListByHomeRegionPager.add(req, newListByHomeRegionPager) - server.PagerResponderInjectNextLinks(newListByHomeRegionPager, req, func(page *armsecurity.AllowedConnectionsClientListByHomeRegionResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByHomeRegionPager, req) - if err != nil { - return nil, err - } - if !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)} - } - if !server.PagerResponderMore(newListByHomeRegionPager) { - a.newListByHomeRegionPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/apicollections_server.go b/sdk/resourcemanager/security/armsecurity/fake/apicollections_server.go deleted file mode 100644 index 39a225eb96db..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/apicollections_server.go +++ /dev/null @@ -1,341 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// APICollectionsServer is a fake server for instances of the armsecurity.APICollectionsClient type. -type APICollectionsServer struct { - // GetByAzureAPIManagementService is the fake for method APICollectionsClient.GetByAzureAPIManagementService - // HTTP status codes to indicate success: http.StatusOK - GetByAzureAPIManagementService func(ctx context.Context, resourceGroupName string, serviceName string, apiID string, options *armsecurity.APICollectionsClientGetByAzureAPIManagementServiceOptions) (resp azfake.Responder[armsecurity.APICollectionsClientGetByAzureAPIManagementServiceResponse], errResp azfake.ErrorResponder) - - // NewListByAzureAPIManagementServicePager is the fake for method APICollectionsClient.NewListByAzureAPIManagementServicePager - // HTTP status codes to indicate success: http.StatusOK - NewListByAzureAPIManagementServicePager func(resourceGroupName string, serviceName string, options *armsecurity.APICollectionsClientListByAzureAPIManagementServiceOptions) (resp azfake.PagerResponder[armsecurity.APICollectionsClientListByAzureAPIManagementServiceResponse]) - - // NewListByResourceGroupPager is the fake for method APICollectionsClient.NewListByResourceGroupPager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, options *armsecurity.APICollectionsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armsecurity.APICollectionsClientListByResourceGroupResponse]) - - // NewListBySubscriptionPager is the fake for method APICollectionsClient.NewListBySubscriptionPager - // HTTP status codes to indicate success: http.StatusOK - NewListBySubscriptionPager func(options *armsecurity.APICollectionsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armsecurity.APICollectionsClientListBySubscriptionResponse]) - - // OffboardAzureAPIManagementAPI is the fake for method APICollectionsClient.OffboardAzureAPIManagementAPI - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - OffboardAzureAPIManagementAPI func(ctx context.Context, resourceGroupName string, serviceName string, apiID string, options *armsecurity.APICollectionsClientOffboardAzureAPIManagementAPIOptions) (resp azfake.Responder[armsecurity.APICollectionsClientOffboardAzureAPIManagementAPIResponse], errResp azfake.ErrorResponder) - - // BeginOnboardAzureAPIManagementAPI is the fake for method APICollectionsClient.BeginOnboardAzureAPIManagementAPI - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginOnboardAzureAPIManagementAPI func(ctx context.Context, resourceGroupName string, serviceName string, apiID string, options *armsecurity.APICollectionsClientBeginOnboardAzureAPIManagementAPIOptions) (resp azfake.PollerResponder[armsecurity.APICollectionsClientOnboardAzureAPIManagementAPIResponse], errResp azfake.ErrorResponder) -} - -// NewAPICollectionsServerTransport creates a new instance of APICollectionsServerTransport with the provided implementation. -// The returned APICollectionsServerTransport instance is connected to an instance of armsecurity.APICollectionsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAPICollectionsServerTransport(srv *APICollectionsServer) *APICollectionsServerTransport { - return &APICollectionsServerTransport{ - srv: srv, - newListByAzureAPIManagementServicePager: newTracker[azfake.PagerResponder[armsecurity.APICollectionsClientListByAzureAPIManagementServiceResponse]](), - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armsecurity.APICollectionsClientListByResourceGroupResponse]](), - newListBySubscriptionPager: newTracker[azfake.PagerResponder[armsecurity.APICollectionsClientListBySubscriptionResponse]](), - beginOnboardAzureAPIManagementAPI: newTracker[azfake.PollerResponder[armsecurity.APICollectionsClientOnboardAzureAPIManagementAPIResponse]](), - } -} - -// APICollectionsServerTransport connects instances of armsecurity.APICollectionsClient to instances of APICollectionsServer. -// Don't use this type directly, use NewAPICollectionsServerTransport instead. -type APICollectionsServerTransport struct { - srv *APICollectionsServer - newListByAzureAPIManagementServicePager *tracker[azfake.PagerResponder[armsecurity.APICollectionsClientListByAzureAPIManagementServiceResponse]] - newListByResourceGroupPager *tracker[azfake.PagerResponder[armsecurity.APICollectionsClientListByResourceGroupResponse]] - newListBySubscriptionPager *tracker[azfake.PagerResponder[armsecurity.APICollectionsClientListBySubscriptionResponse]] - beginOnboardAzureAPIManagementAPI *tracker[azfake.PollerResponder[armsecurity.APICollectionsClientOnboardAzureAPIManagementAPIResponse]] -} - -// Do implements the policy.Transporter interface for APICollectionsServerTransport. -func (a *APICollectionsServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *APICollectionsServerTransport) dispatchGetByAzureAPIManagementService(req *http.Request) (*http.Response, error) { - if a.srv.GetByAzureAPIManagementService == nil { - return nil, &nonRetriableError{errors.New("fake for method GetByAzureAPIManagementService not implemented")} - } - 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 { - 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 - } - serviceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serviceName")]) - if err != nil { - return nil, err - } - apiIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("apiId")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.GetByAzureAPIManagementService(req.Context(), resourceGroupNameParam, serviceNameParam, apiIDParam, 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).APICollection, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *APICollectionsServerTransport) dispatchNewListByAzureAPIManagementServicePager(req *http.Request) (*http.Response, error) { - if a.srv.NewListByAzureAPIManagementServicePager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByAzureAPIManagementServicePager not implemented")} - } - newListByAzureAPIManagementServicePager := a.newListByAzureAPIManagementServicePager.get(req) - if newListByAzureAPIManagementServicePager == nil { - 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 { - 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 - } - serviceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serviceName")]) - if err != nil { - return nil, err - } - resp := a.srv.NewListByAzureAPIManagementServicePager(resourceGroupNameParam, serviceNameParam, nil) - newListByAzureAPIManagementServicePager = &resp - a.newListByAzureAPIManagementServicePager.add(req, newListByAzureAPIManagementServicePager) - server.PagerResponderInjectNextLinks(newListByAzureAPIManagementServicePager, req, func(page *armsecurity.APICollectionsClientListByAzureAPIManagementServiceResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByAzureAPIManagementServicePager, req) - if err != nil { - return nil, err - } - if !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)} - } - if !server.PagerResponderMore(newListByAzureAPIManagementServicePager) { - a.newListByAzureAPIManagementServicePager.remove(req) - } - return resp, nil -} - -func (a *APICollectionsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListByResourceGroupPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} - } - newListByResourceGroupPager := a.newListByResourceGroupPager.get(req) - if newListByResourceGroupPager == nil { - 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 { - 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.NewListByResourceGroupPager(resourceGroupNameParam, nil) - newListByResourceGroupPager = &resp - a.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armsecurity.APICollectionsClientListByResourceGroupResponse, 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) { - a.newListByResourceGroupPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByResourceGroupPager) { - a.newListByResourceGroupPager.remove(req) - } - return resp, nil -} - -func (a *APICollectionsServerTransport) 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/apiCollections` - 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.NewListBySubscriptionPager(nil) - newListBySubscriptionPager = &resp - a.newListBySubscriptionPager.add(req, newListBySubscriptionPager) - server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armsecurity.APICollectionsClientListBySubscriptionResponse, 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) { - 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 -} - -func (a *APICollectionsServerTransport) dispatchOffboardAzureAPIManagementAPI(req *http.Request) (*http.Response, error) { - if a.srv.OffboardAzureAPIManagementAPI == nil { - return nil, &nonRetriableError{errors.New("fake for method OffboardAzureAPIManagementAPI not implemented")} - } - 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 { - 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 - } - serviceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serviceName")]) - if err != nil { - return nil, err - } - apiIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("apiId")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.OffboardAzureAPIManagementAPI(req.Context(), resourceGroupNameParam, serviceNameParam, apiIDParam, 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 *APICollectionsServerTransport) dispatchBeginOnboardAzureAPIManagementAPI(req *http.Request) (*http.Response, error) { - if a.srv.BeginOnboardAzureAPIManagementAPI == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginOnboardAzureAPIManagementAPI not implemented")} - } - beginOnboardAzureAPIManagementAPI := a.beginOnboardAzureAPIManagementAPI.get(req) - if beginOnboardAzureAPIManagementAPI == nil { - 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 { - 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 - } - serviceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serviceName")]) - if err != nil { - return nil, err - } - apiIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("apiId")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.BeginOnboardAzureAPIManagementAPI(req.Context(), resourceGroupNameParam, serviceNameParam, apiIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginOnboardAzureAPIManagementAPI = &respr - a.beginOnboardAzureAPIManagementAPI.add(req, beginOnboardAzureAPIManagementAPI) - } - - resp, err := server.PollerResponderNext(beginOnboardAzureAPIManagementAPI, req) - if err != nil { - return nil, err - } - - if !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)} - } - if !server.PollerResponderMore(beginOnboardAzureAPIManagementAPI) { - a.beginOnboardAzureAPIManagementAPI.remove(req) - } - - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/application_server.go b/sdk/resourcemanager/security/armsecurity/fake/application_server.go deleted file mode 100644 index 7df622770449..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/application_server.go +++ /dev/null @@ -1,170 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// ApplicationServer is a fake server for instances of the armsecurity.ApplicationClient type. -type ApplicationServer struct { - // CreateOrUpdate is the fake for method ApplicationClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - CreateOrUpdate func(ctx context.Context, applicationID string, application armsecurity.Application, options *armsecurity.ApplicationClientCreateOrUpdateOptions) (resp azfake.Responder[armsecurity.ApplicationClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method ApplicationClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, applicationID string, options *armsecurity.ApplicationClientDeleteOptions) (resp azfake.Responder[armsecurity.ApplicationClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ApplicationClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, applicationID string, options *armsecurity.ApplicationClientGetOptions) (resp azfake.Responder[armsecurity.ApplicationClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewApplicationServerTransport creates a new instance of ApplicationServerTransport with the provided implementation. -// The returned ApplicationServerTransport instance is connected to an instance of armsecurity.ApplicationClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewApplicationServerTransport(srv *ApplicationServer) *ApplicationServerTransport { - return &ApplicationServerTransport{srv: srv} -} - -// ApplicationServerTransport connects instances of armsecurity.ApplicationClient to instances of ApplicationServer. -// Don't use this type directly, use NewApplicationServerTransport instead. -type ApplicationServerTransport struct { - srv *ApplicationServer -} - -// Do implements the policy.Transporter interface for ApplicationServerTransport. -func (a *ApplicationServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *ApplicationServerTransport) 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/applications/(?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.Application](req) - if err != nil { - return nil, err - } - applicationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("applicationId")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.CreateOrUpdate(req.Context(), applicationIDParam, 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).Application, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *ApplicationServerTransport) 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/applications/(?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) - } - applicationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("applicationId")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Delete(req.Context(), applicationIDParam, 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 *ApplicationServerTransport) 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/applications/(?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) - } - applicationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("applicationId")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Get(req.Context(), applicationIDParam, 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).Application, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/applications_server.go b/sdk/resourcemanager/security/armsecurity/fake/applications_server.go deleted file mode 100644 index 115355f33157..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/applications_server.go +++ /dev/null @@ -1,103 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" - "net/http" - "regexp" -) - -// ApplicationsServer is a fake server for instances of the armsecurity.ApplicationsClient type. -type ApplicationsServer struct { - // NewListPager is the fake for method ApplicationsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armsecurity.ApplicationsClientListOptions) (resp azfake.PagerResponder[armsecurity.ApplicationsClientListResponse]) -} - -// NewApplicationsServerTransport creates a new instance of ApplicationsServerTransport with the provided implementation. -// The returned ApplicationsServerTransport instance is connected to an instance of armsecurity.ApplicationsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewApplicationsServerTransport(srv *ApplicationsServer) *ApplicationsServerTransport { - return &ApplicationsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.ApplicationsClientListResponse]](), - } -} - -// ApplicationsServerTransport connects instances of armsecurity.ApplicationsClient to instances of ApplicationsServer. -// Don't use this type directly, use NewApplicationsServerTransport instead. -type ApplicationsServerTransport struct { - srv *ApplicationsServer - newListPager *tracker[azfake.PagerResponder[armsecurity.ApplicationsClientListResponse]] -} - -// Do implements the policy.Transporter interface for ApplicationsServerTransport. -func (a *ApplicationsServerTransport) 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 "ApplicationsClient.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 *ApplicationsServerTransport) 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/applications` - 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.ApplicationsClientListResponse, 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/assessments_server.go b/sdk/resourcemanager/security/armsecurity/fake/assessments_server.go deleted file mode 100644 index ac38bfc35836..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/assessments_server.go +++ /dev/null @@ -1,242 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// AssessmentsServer is a fake server for instances of the armsecurity.AssessmentsClient type. -type AssessmentsServer struct { - // CreateOrUpdate is the fake for method AssessmentsClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - CreateOrUpdate func(ctx context.Context, resourceID string, assessmentName string, assessment armsecurity.Assessment, options *armsecurity.AssessmentsClientCreateOrUpdateOptions) (resp azfake.Responder[armsecurity.AssessmentsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method AssessmentsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceID string, assessmentName string, options *armsecurity.AssessmentsClientDeleteOptions) (resp azfake.Responder[armsecurity.AssessmentsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method AssessmentsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceID string, assessmentName string, options *armsecurity.AssessmentsClientGetOptions) (resp azfake.Responder[armsecurity.AssessmentsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method AssessmentsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(scope string, options *armsecurity.AssessmentsClientListOptions) (resp azfake.PagerResponder[armsecurity.AssessmentsClientListResponse]) -} - -// NewAssessmentsServerTransport creates a new instance of AssessmentsServerTransport with the provided implementation. -// The returned AssessmentsServerTransport instance is connected to an instance of armsecurity.AssessmentsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAssessmentsServerTransport(srv *AssessmentsServer) *AssessmentsServerTransport { - return &AssessmentsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.AssessmentsClientListResponse]](), - } -} - -// AssessmentsServerTransport connects instances of armsecurity.AssessmentsClient to instances of AssessmentsServer. -// Don't use this type directly, use NewAssessmentsServerTransport instead. -type AssessmentsServerTransport struct { - srv *AssessmentsServer - newListPager *tracker[azfake.PagerResponder[armsecurity.AssessmentsClientListResponse]] -} - -// Do implements the policy.Transporter interface for AssessmentsServerTransport. -func (a *AssessmentsServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AssessmentsServerTransport) 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/assessments/(?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.Assessment](req) - if err != nil { - return nil, err - } - resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) - if err != nil { - return nil, err - } - assessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.CreateOrUpdate(req.Context(), resourceIDParam, assessmentNameParam, 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).AssessmentResponse, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AssessmentsServerTransport) 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/assessments/(?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) - } - resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) - if err != nil { - return nil, err - } - assessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Delete(req.Context(), resourceIDParam, assessmentNameParam, 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 *AssessmentsServerTransport) 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/assessments/(?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) - } - qp := req.URL.Query() - resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) - if err != nil { - return nil, err - } - assessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentName")]) - if err != nil { - return nil, err - } - expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) - if err != nil { - return nil, err - } - expandParam := getOptional(armsecurity.ExpandEnum(expandUnescaped)) - var options *armsecurity.AssessmentsClientGetOptions - if expandParam != nil { - options = &armsecurity.AssessmentsClientGetOptions{ - Expand: expandParam, - } - } - respr, errRespr := a.srv.Get(req.Context(), resourceIDParam, assessmentNameParam, 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).AssessmentResponse, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AssessmentsServerTransport) 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/assessments` - 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) - } - 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.AssessmentsClientListResponse, 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/assessmentsmetadata_server.go b/sdk/resourcemanager/security/armsecurity/fake/assessmentsmetadata_server.go deleted file mode 100644 index 046d8ddb412b..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/assessmentsmetadata_server.go +++ /dev/null @@ -1,284 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// AssessmentsMetadataServer is a fake server for instances of the armsecurity.AssessmentsMetadataClient type. -type AssessmentsMetadataServer struct { - // CreateInSubscription is the fake for method AssessmentsMetadataClient.CreateInSubscription - // HTTP status codes to indicate success: http.StatusOK - CreateInSubscription func(ctx context.Context, assessmentMetadataName string, assessmentMetadata armsecurity.AssessmentMetadataResponse, options *armsecurity.AssessmentsMetadataClientCreateInSubscriptionOptions) (resp azfake.Responder[armsecurity.AssessmentsMetadataClientCreateInSubscriptionResponse], errResp azfake.ErrorResponder) - - // DeleteInSubscription is the fake for method AssessmentsMetadataClient.DeleteInSubscription - // HTTP status codes to indicate success: http.StatusOK - DeleteInSubscription func(ctx context.Context, assessmentMetadataName string, options *armsecurity.AssessmentsMetadataClientDeleteInSubscriptionOptions) (resp azfake.Responder[armsecurity.AssessmentsMetadataClientDeleteInSubscriptionResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method AssessmentsMetadataClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, assessmentMetadataName string, options *armsecurity.AssessmentsMetadataClientGetOptions) (resp azfake.Responder[armsecurity.AssessmentsMetadataClientGetResponse], errResp azfake.ErrorResponder) - - // GetInSubscription is the fake for method AssessmentsMetadataClient.GetInSubscription - // HTTP status codes to indicate success: http.StatusOK - GetInSubscription func(ctx context.Context, assessmentMetadataName string, options *armsecurity.AssessmentsMetadataClientGetInSubscriptionOptions) (resp azfake.Responder[armsecurity.AssessmentsMetadataClientGetInSubscriptionResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method AssessmentsMetadataClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armsecurity.AssessmentsMetadataClientListOptions) (resp azfake.PagerResponder[armsecurity.AssessmentsMetadataClientListResponse]) - - // NewListBySubscriptionPager is the fake for method AssessmentsMetadataClient.NewListBySubscriptionPager - // HTTP status codes to indicate success: http.StatusOK - NewListBySubscriptionPager func(options *armsecurity.AssessmentsMetadataClientListBySubscriptionOptions) (resp azfake.PagerResponder[armsecurity.AssessmentsMetadataClientListBySubscriptionResponse]) -} - -// NewAssessmentsMetadataServerTransport creates a new instance of AssessmentsMetadataServerTransport with the provided implementation. -// The returned AssessmentsMetadataServerTransport instance is connected to an instance of armsecurity.AssessmentsMetadataClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAssessmentsMetadataServerTransport(srv *AssessmentsMetadataServer) *AssessmentsMetadataServerTransport { - return &AssessmentsMetadataServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.AssessmentsMetadataClientListResponse]](), - newListBySubscriptionPager: newTracker[azfake.PagerResponder[armsecurity.AssessmentsMetadataClientListBySubscriptionResponse]](), - } -} - -// AssessmentsMetadataServerTransport connects instances of armsecurity.AssessmentsMetadataClient to instances of AssessmentsMetadataServer. -// Don't use this type directly, use NewAssessmentsMetadataServerTransport instead. -type AssessmentsMetadataServerTransport struct { - srv *AssessmentsMetadataServer - newListPager *tracker[azfake.PagerResponder[armsecurity.AssessmentsMetadataClientListResponse]] - newListBySubscriptionPager *tracker[azfake.PagerResponder[armsecurity.AssessmentsMetadataClientListBySubscriptionResponse]] -} - -// Do implements the policy.Transporter interface for AssessmentsMetadataServerTransport. -func (a *AssessmentsMetadataServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AssessmentsMetadataServerTransport) dispatchCreateInSubscription(req *http.Request) (*http.Response, error) { - if a.srv.CreateInSubscription == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateInSubscription not implemented")} - } - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.AssessmentMetadataResponse](req) - if err != nil { - return nil, err - } - assessmentMetadataNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentMetadataName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.CreateInSubscription(req.Context(), assessmentMetadataNameParam, 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).AssessmentMetadataResponse, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AssessmentsMetadataServerTransport) dispatchDeleteInSubscription(req *http.Request) (*http.Response, error) { - if a.srv.DeleteInSubscription == nil { - return nil, &nonRetriableError{errors.New("fake for method DeleteInSubscription not implemented")} - } - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - assessmentMetadataNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentMetadataName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.DeleteInSubscription(req.Context(), assessmentMetadataNameParam, 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.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AssessmentsMetadataServerTransport) 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 = `/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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - assessmentMetadataNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentMetadataName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Get(req.Context(), assessmentMetadataNameParam, 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).AssessmentMetadataResponse, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AssessmentsMetadataServerTransport) dispatchGetInSubscription(req *http.Request) (*http.Response, error) { - if a.srv.GetInSubscription == nil { - return nil, &nonRetriableError{errors.New("fake for method GetInSubscription not implemented")} - } - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - assessmentMetadataNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentMetadataName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.GetInSubscription(req.Context(), assessmentMetadataNameParam, 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).AssessmentMetadataResponse, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AssessmentsMetadataServerTransport) 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 { - resp := a.srv.NewListPager(nil) - newListPager = &resp - a.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.AssessmentsMetadataClientListResponse, 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 -} - -func (a *AssessmentsMetadataServerTransport) 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/assessmentMetadata` - 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.NewListBySubscriptionPager(nil) - newListBySubscriptionPager = &resp - a.newListBySubscriptionPager.add(req, newListBySubscriptionPager) - server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armsecurity.AssessmentsMetadataClientListBySubscriptionResponse, 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) { - 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 -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/automations_server.go b/sdk/resourcemanager/security/armsecurity/fake/automations_server.go deleted file mode 100644 index 2c8b6ae682d6..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/automations_server.go +++ /dev/null @@ -1,357 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// AutomationsServer is a fake server for instances of the armsecurity.AutomationsClient type. -type AutomationsServer struct { - // CreateOrUpdate is the fake for method AutomationsClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - CreateOrUpdate func(ctx context.Context, resourceGroupName string, automationName string, automation armsecurity.Automation, options *armsecurity.AutomationsClientCreateOrUpdateOptions) (resp azfake.Responder[armsecurity.AutomationsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method AutomationsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, automationName string, options *armsecurity.AutomationsClientDeleteOptions) (resp azfake.Responder[armsecurity.AutomationsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method AutomationsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, automationName string, options *armsecurity.AutomationsClientGetOptions) (resp azfake.Responder[armsecurity.AutomationsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method AutomationsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armsecurity.AutomationsClientListOptions) (resp azfake.PagerResponder[armsecurity.AutomationsClientListResponse]) - - // NewListByResourceGroupPager is the fake for method AutomationsClient.NewListByResourceGroupPager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, options *armsecurity.AutomationsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armsecurity.AutomationsClientListByResourceGroupResponse]) - - // Update is the fake for method AutomationsClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, automationName string, automation armsecurity.AutomationUpdateModel, options *armsecurity.AutomationsClientUpdateOptions) (resp azfake.Responder[armsecurity.AutomationsClientUpdateResponse], errResp azfake.ErrorResponder) - - // Validate is the fake for method AutomationsClient.Validate - // HTTP status codes to indicate success: http.StatusOK - Validate func(ctx context.Context, resourceGroupName string, automationName string, automation armsecurity.Automation, options *armsecurity.AutomationsClientValidateOptions) (resp azfake.Responder[armsecurity.AutomationsClientValidateResponse], errResp azfake.ErrorResponder) -} - -// NewAutomationsServerTransport creates a new instance of AutomationsServerTransport with the provided implementation. -// The returned AutomationsServerTransport instance is connected to an instance of armsecurity.AutomationsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAutomationsServerTransport(srv *AutomationsServer) *AutomationsServerTransport { - return &AutomationsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.AutomationsClientListResponse]](), - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armsecurity.AutomationsClientListByResourceGroupResponse]](), - } -} - -// AutomationsServerTransport connects instances of armsecurity.AutomationsClient to instances of AutomationsServer. -// Don't use this type directly, use NewAutomationsServerTransport instead. -type AutomationsServerTransport struct { - srv *AutomationsServer - newListPager *tracker[azfake.PagerResponder[armsecurity.AutomationsClientListResponse]] - newListByResourceGroupPager *tracker[azfake.PagerResponder[armsecurity.AutomationsClientListByResourceGroupResponse]] -} - -// Do implements the policy.Transporter interface for AutomationsServerTransport. -func (a *AutomationsServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AutomationsServerTransport) 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/automations/(?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.Automation](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - automationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("automationName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, automationNameParam, 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).Automation, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AutomationsServerTransport) 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/automations/(?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 - } - automationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("automationName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Delete(req.Context(), resourceGroupNameParam, automationNameParam, 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 *AutomationsServerTransport) 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/automations/(?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 - } - automationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("automationName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, automationNameParam, 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).Automation, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AutomationsServerTransport) 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/automations` - 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.AutomationsClientListResponse, 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 -} - -func (a *AutomationsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListByResourceGroupPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} - } - newListByResourceGroupPager := a.newListByResourceGroupPager.get(req) - if newListByResourceGroupPager == nil { - 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 { - 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.NewListByResourceGroupPager(resourceGroupNameParam, nil) - newListByResourceGroupPager = &resp - a.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armsecurity.AutomationsClientListByResourceGroupResponse, 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) { - a.newListByResourceGroupPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByResourceGroupPager) { - a.newListByResourceGroupPager.remove(req) - } - return resp, nil -} - -func (a *AutomationsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if a.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/automations/(?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.AutomationUpdateModel](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - automationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("automationName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Update(req.Context(), resourceGroupNameParam, automationNameParam, 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).Automation, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AutomationsServerTransport) dispatchValidate(req *http.Request) (*http.Response, error) { - if a.srv.Validate == nil { - return nil, &nonRetriableError{errors.New("fake for method Validate not implemented")} - } - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.Automation](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - automationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("automationName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Validate(req.Context(), resourceGroupNameParam, automationNameParam, 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).AutomationValidationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/autoprovisioningsettings_server.go b/sdk/resourcemanager/security/armsecurity/fake/autoprovisioningsettings_server.go deleted file mode 100644 index c0ed6d6d0ee9..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/autoprovisioningsettings_server.go +++ /dev/null @@ -1,179 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// AutoProvisioningSettingsServer is a fake server for instances of the armsecurity.AutoProvisioningSettingsClient type. -type AutoProvisioningSettingsServer struct { - // Create is the fake for method AutoProvisioningSettingsClient.Create - // HTTP status codes to indicate success: http.StatusOK - Create func(ctx context.Context, settingName string, setting armsecurity.AutoProvisioningSetting, options *armsecurity.AutoProvisioningSettingsClientCreateOptions) (resp azfake.Responder[armsecurity.AutoProvisioningSettingsClientCreateResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method AutoProvisioningSettingsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, settingName string, options *armsecurity.AutoProvisioningSettingsClientGetOptions) (resp azfake.Responder[armsecurity.AutoProvisioningSettingsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method AutoProvisioningSettingsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armsecurity.AutoProvisioningSettingsClientListOptions) (resp azfake.PagerResponder[armsecurity.AutoProvisioningSettingsClientListResponse]) -} - -// NewAutoProvisioningSettingsServerTransport creates a new instance of AutoProvisioningSettingsServerTransport with the provided implementation. -// The returned AutoProvisioningSettingsServerTransport instance is connected to an instance of armsecurity.AutoProvisioningSettingsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAutoProvisioningSettingsServerTransport(srv *AutoProvisioningSettingsServer) *AutoProvisioningSettingsServerTransport { - return &AutoProvisioningSettingsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.AutoProvisioningSettingsClientListResponse]](), - } -} - -// AutoProvisioningSettingsServerTransport connects instances of armsecurity.AutoProvisioningSettingsClient to instances of AutoProvisioningSettingsServer. -// Don't use this type directly, use NewAutoProvisioningSettingsServerTransport instead. -type AutoProvisioningSettingsServerTransport struct { - srv *AutoProvisioningSettingsServer - newListPager *tracker[azfake.PagerResponder[armsecurity.AutoProvisioningSettingsClientListResponse]] -} - -// Do implements the policy.Transporter interface for AutoProvisioningSettingsServerTransport. -func (a *AutoProvisioningSettingsServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AutoProvisioningSettingsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if a.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.AutoProvisioningSetting](req) - if err != nil { - return nil, err - } - settingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("settingName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Create(req.Context(), settingNameParam, 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).AutoProvisioningSetting, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AutoProvisioningSettingsServerTransport) 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/autoProvisioningSettings/(?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) - } - settingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("settingName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Get(req.Context(), settingNameParam, 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).AutoProvisioningSetting, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AutoProvisioningSettingsServerTransport) 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/autoProvisioningSettings` - 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.AutoProvisioningSettingsClientListResponse, 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/azuredevopsorgs_server.go b/sdk/resourcemanager/security/armsecurity/fake/azuredevopsorgs_server.go deleted file mode 100644 index de560da51a81..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/azuredevopsorgs_server.go +++ /dev/null @@ -1,315 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// AzureDevOpsOrgsServer is a fake server for instances of the armsecurity.AzureDevOpsOrgsClient type. -type AzureDevOpsOrgsServer struct { - // BeginCreateOrUpdate is the fake for method AzureDevOpsOrgsClient.BeginCreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, azureDevOpsOrg armsecurity.AzureDevOpsOrg, options *armsecurity.AzureDevOpsOrgsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armsecurity.AzureDevOpsOrgsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method AzureDevOpsOrgsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, options *armsecurity.AzureDevOpsOrgsClientGetOptions) (resp azfake.Responder[armsecurity.AzureDevOpsOrgsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method AzureDevOpsOrgsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, securityConnectorName string, options *armsecurity.AzureDevOpsOrgsClientListOptions) (resp azfake.PagerResponder[armsecurity.AzureDevOpsOrgsClientListResponse]) - - // ListAvailable is the fake for method AzureDevOpsOrgsClient.ListAvailable - // HTTP status codes to indicate success: http.StatusOK - ListAvailable func(ctx context.Context, resourceGroupName string, securityConnectorName string, options *armsecurity.AzureDevOpsOrgsClientListAvailableOptions) (resp azfake.Responder[armsecurity.AzureDevOpsOrgsClientListAvailableResponse], errResp azfake.ErrorResponder) - - // BeginUpdate is the fake for method AzureDevOpsOrgsClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, azureDevOpsOrg armsecurity.AzureDevOpsOrg, options *armsecurity.AzureDevOpsOrgsClientBeginUpdateOptions) (resp azfake.PollerResponder[armsecurity.AzureDevOpsOrgsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewAzureDevOpsOrgsServerTransport creates a new instance of AzureDevOpsOrgsServerTransport with the provided implementation. -// The returned AzureDevOpsOrgsServerTransport instance is connected to an instance of armsecurity.AzureDevOpsOrgsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAzureDevOpsOrgsServerTransport(srv *AzureDevOpsOrgsServer) *AzureDevOpsOrgsServerTransport { - return &AzureDevOpsOrgsServerTransport{ - srv: srv, - beginCreateOrUpdate: newTracker[azfake.PollerResponder[armsecurity.AzureDevOpsOrgsClientCreateOrUpdateResponse]](), - newListPager: newTracker[azfake.PagerResponder[armsecurity.AzureDevOpsOrgsClientListResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armsecurity.AzureDevOpsOrgsClientUpdateResponse]](), - } -} - -// AzureDevOpsOrgsServerTransport connects instances of armsecurity.AzureDevOpsOrgsClient to instances of AzureDevOpsOrgsServer. -// Don't use this type directly, use NewAzureDevOpsOrgsServerTransport instead. -type AzureDevOpsOrgsServerTransport struct { - srv *AzureDevOpsOrgsServer - beginCreateOrUpdate *tracker[azfake.PollerResponder[armsecurity.AzureDevOpsOrgsClientCreateOrUpdateResponse]] - newListPager *tracker[azfake.PagerResponder[armsecurity.AzureDevOpsOrgsClientListResponse]] - beginUpdate *tracker[azfake.PollerResponder[armsecurity.AzureDevOpsOrgsClientUpdateResponse]] -} - -// Do implements the policy.Transporter interface for AzureDevOpsOrgsServerTransport. -func (a *AzureDevOpsOrgsServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AzureDevOpsOrgsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { - if a.srv.BeginCreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} - } - beginCreateOrUpdate := a.beginCreateOrUpdate.get(req) - if beginCreateOrUpdate == 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/azureDevOpsOrgs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.AzureDevOpsOrg](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 - } - orgNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("orgName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, securityConnectorNameParam, orgNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreateOrUpdate = &respr - a.beginCreateOrUpdate.add(req, beginCreateOrUpdate) - } - - resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) - if err != nil { - return nil, err - } - - if !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)} - } - if !server.PollerResponderMore(beginCreateOrUpdate) { - a.beginCreateOrUpdate.remove(req) - } - - return resp, nil -} - -func (a *AzureDevOpsOrgsServerTransport) 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/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 { - 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 - } - securityConnectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityConnectorName")]) - if err != nil { - return nil, err - } - orgNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("orgName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, securityConnectorNameParam, orgNameParam, 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).AzureDevOpsOrg, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AzureDevOpsOrgsServerTransport) 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/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 { - 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 - } - securityConnectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityConnectorName")]) - if err != nil { - return nil, err - } - resp := a.srv.NewListPager(resourceGroupNameParam, securityConnectorNameParam, nil) - newListPager = &resp - a.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.AzureDevOpsOrgsClientListResponse, 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 -} - -func (a *AzureDevOpsOrgsServerTransport) dispatchListAvailable(req *http.Request) (*http.Response, error) { - if a.srv.ListAvailable == nil { - return nil, &nonRetriableError{errors.New("fake for method ListAvailable not implemented")} - } - 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 { - 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 - } - securityConnectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityConnectorName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.ListAvailable(req.Context(), resourceGroupNameParam, securityConnectorNameParam, 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).AzureDevOpsOrgListResponse, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AzureDevOpsOrgsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if a.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} - } - beginUpdate := a.beginUpdate.get(req) - if beginUpdate == 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/azureDevOpsOrgs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.AzureDevOpsOrg](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 - } - orgNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("orgName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.BeginUpdate(req.Context(), resourceGroupNameParam, securityConnectorNameParam, orgNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginUpdate = &respr - a.beginUpdate.add(req, beginUpdate) - } - - resp, err := server.PollerResponderNext(beginUpdate, req) - if err != nil { - return nil, err - } - - if !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)} - } - if !server.PollerResponderMore(beginUpdate) { - a.beginUpdate.remove(req) - } - - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/azuredevopsprojects_server.go b/sdk/resourcemanager/security/armsecurity/fake/azuredevopsprojects_server.go deleted file mode 100644 index 1a9317eb5aab..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/azuredevopsprojects_server.go +++ /dev/null @@ -1,292 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// AzureDevOpsProjectsServer is a fake server for instances of the armsecurity.AzureDevOpsProjectsClient type. -type AzureDevOpsProjectsServer struct { - // BeginCreateOrUpdate is the fake for method AzureDevOpsProjectsClient.BeginCreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, azureDevOpsProject armsecurity.AzureDevOpsProject, options *armsecurity.AzureDevOpsProjectsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armsecurity.AzureDevOpsProjectsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method AzureDevOpsProjectsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, options *armsecurity.AzureDevOpsProjectsClientGetOptions) (resp azfake.Responder[armsecurity.AzureDevOpsProjectsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method AzureDevOpsProjectsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, securityConnectorName string, orgName string, options *armsecurity.AzureDevOpsProjectsClientListOptions) (resp azfake.PagerResponder[armsecurity.AzureDevOpsProjectsClientListResponse]) - - // BeginUpdate is the fake for method AzureDevOpsProjectsClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, azureDevOpsProject armsecurity.AzureDevOpsProject, options *armsecurity.AzureDevOpsProjectsClientBeginUpdateOptions) (resp azfake.PollerResponder[armsecurity.AzureDevOpsProjectsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewAzureDevOpsProjectsServerTransport creates a new instance of AzureDevOpsProjectsServerTransport with the provided implementation. -// The returned AzureDevOpsProjectsServerTransport instance is connected to an instance of armsecurity.AzureDevOpsProjectsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAzureDevOpsProjectsServerTransport(srv *AzureDevOpsProjectsServer) *AzureDevOpsProjectsServerTransport { - return &AzureDevOpsProjectsServerTransport{ - srv: srv, - beginCreateOrUpdate: newTracker[azfake.PollerResponder[armsecurity.AzureDevOpsProjectsClientCreateOrUpdateResponse]](), - newListPager: newTracker[azfake.PagerResponder[armsecurity.AzureDevOpsProjectsClientListResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armsecurity.AzureDevOpsProjectsClientUpdateResponse]](), - } -} - -// AzureDevOpsProjectsServerTransport connects instances of armsecurity.AzureDevOpsProjectsClient to instances of AzureDevOpsProjectsServer. -// Don't use this type directly, use NewAzureDevOpsProjectsServerTransport instead. -type AzureDevOpsProjectsServerTransport struct { - srv *AzureDevOpsProjectsServer - beginCreateOrUpdate *tracker[azfake.PollerResponder[armsecurity.AzureDevOpsProjectsClientCreateOrUpdateResponse]] - newListPager *tracker[azfake.PagerResponder[armsecurity.AzureDevOpsProjectsClientListResponse]] - beginUpdate *tracker[azfake.PollerResponder[armsecurity.AzureDevOpsProjectsClientUpdateResponse]] -} - -// Do implements the policy.Transporter interface for AzureDevOpsProjectsServerTransport. -func (a *AzureDevOpsProjectsServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AzureDevOpsProjectsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { - if a.srv.BeginCreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} - } - beginCreateOrUpdate := a.beginCreateOrUpdate.get(req) - if beginCreateOrUpdate == 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/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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.AzureDevOpsProject](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 - } - orgNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("orgName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, securityConnectorNameParam, orgNameParam, projectNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreateOrUpdate = &respr - a.beginCreateOrUpdate.add(req, beginCreateOrUpdate) - } - - resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) - if err != nil { - return nil, err - } - - if !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)} - } - if !server.PollerResponderMore(beginCreateOrUpdate) { - a.beginCreateOrUpdate.remove(req) - } - - return resp, nil -} - -func (a *AzureDevOpsProjectsServerTransport) 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/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 { - 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 - } - securityConnectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityConnectorName")]) - if err != nil { - return nil, err - } - orgNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("orgName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, securityConnectorNameParam, orgNameParam, projectNameParam, 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).AzureDevOpsProject, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AzureDevOpsProjectsServerTransport) 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/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 { - 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 - } - securityConnectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityConnectorName")]) - if err != nil { - return nil, err - } - orgNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("orgName")]) - if err != nil { - return nil, err - } - resp := a.srv.NewListPager(resourceGroupNameParam, securityConnectorNameParam, orgNameParam, nil) - newListPager = &resp - a.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.AzureDevOpsProjectsClientListResponse, 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 -} - -func (a *AzureDevOpsProjectsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if a.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} - } - beginUpdate := a.beginUpdate.get(req) - if beginUpdate == 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/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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.AzureDevOpsProject](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 - } - orgNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("orgName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.BeginUpdate(req.Context(), resourceGroupNameParam, securityConnectorNameParam, orgNameParam, projectNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginUpdate = &respr - a.beginUpdate.add(req, beginUpdate) - } - - resp, err := server.PollerResponderNext(beginUpdate, req) - if err != nil { - return nil, err - } - - if !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)} - } - if !server.PollerResponderMore(beginUpdate) { - a.beginUpdate.remove(req) - } - - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/azuredevopsrepos_server.go b/sdk/resourcemanager/security/armsecurity/fake/azuredevopsrepos_server.go deleted file mode 100644 index f82e267b33a7..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/azuredevopsrepos_server.go +++ /dev/null @@ -1,308 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// AzureDevOpsReposServer is a fake server for instances of the armsecurity.AzureDevOpsReposClient type. -type AzureDevOpsReposServer struct { - // BeginCreateOrUpdate is the fake for method AzureDevOpsReposClient.BeginCreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, repoName string, azureDevOpsRepository armsecurity.AzureDevOpsRepository, options *armsecurity.AzureDevOpsReposClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armsecurity.AzureDevOpsReposClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method AzureDevOpsReposClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, repoName string, options *armsecurity.AzureDevOpsReposClientGetOptions) (resp azfake.Responder[armsecurity.AzureDevOpsReposClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method AzureDevOpsReposClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, securityConnectorName string, orgName string, projectName string, options *armsecurity.AzureDevOpsReposClientListOptions) (resp azfake.PagerResponder[armsecurity.AzureDevOpsReposClientListResponse]) - - // BeginUpdate is the fake for method AzureDevOpsReposClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, repoName string, azureDevOpsRepository armsecurity.AzureDevOpsRepository, options *armsecurity.AzureDevOpsReposClientBeginUpdateOptions) (resp azfake.PollerResponder[armsecurity.AzureDevOpsReposClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewAzureDevOpsReposServerTransport creates a new instance of AzureDevOpsReposServerTransport with the provided implementation. -// The returned AzureDevOpsReposServerTransport instance is connected to an instance of armsecurity.AzureDevOpsReposClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAzureDevOpsReposServerTransport(srv *AzureDevOpsReposServer) *AzureDevOpsReposServerTransport { - return &AzureDevOpsReposServerTransport{ - srv: srv, - beginCreateOrUpdate: newTracker[azfake.PollerResponder[armsecurity.AzureDevOpsReposClientCreateOrUpdateResponse]](), - newListPager: newTracker[azfake.PagerResponder[armsecurity.AzureDevOpsReposClientListResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armsecurity.AzureDevOpsReposClientUpdateResponse]](), - } -} - -// AzureDevOpsReposServerTransport connects instances of armsecurity.AzureDevOpsReposClient to instances of AzureDevOpsReposServer. -// Don't use this type directly, use NewAzureDevOpsReposServerTransport instead. -type AzureDevOpsReposServerTransport struct { - srv *AzureDevOpsReposServer - beginCreateOrUpdate *tracker[azfake.PollerResponder[armsecurity.AzureDevOpsReposClientCreateOrUpdateResponse]] - newListPager *tracker[azfake.PagerResponder[armsecurity.AzureDevOpsReposClientListResponse]] - beginUpdate *tracker[azfake.PollerResponder[armsecurity.AzureDevOpsReposClientUpdateResponse]] -} - -// Do implements the policy.Transporter interface for AzureDevOpsReposServerTransport. -func (a *AzureDevOpsReposServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AzureDevOpsReposServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { - if a.srv.BeginCreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} - } - beginCreateOrUpdate := a.beginCreateOrUpdate.get(req) - if beginCreateOrUpdate == 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/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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.AzureDevOpsRepository](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 - } - orgNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("orgName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - repoNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("repoName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, securityConnectorNameParam, orgNameParam, projectNameParam, repoNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreateOrUpdate = &respr - a.beginCreateOrUpdate.add(req, beginCreateOrUpdate) - } - - resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) - if err != nil { - return nil, err - } - - if !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)} - } - if !server.PollerResponderMore(beginCreateOrUpdate) { - a.beginCreateOrUpdate.remove(req) - } - - return resp, nil -} - -func (a *AzureDevOpsReposServerTransport) 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/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 { - 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 - } - securityConnectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityConnectorName")]) - if err != nil { - return nil, err - } - orgNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("orgName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - repoNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("repoName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, securityConnectorNameParam, orgNameParam, projectNameParam, repoNameParam, 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).AzureDevOpsRepository, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AzureDevOpsReposServerTransport) 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/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 { - 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 - } - securityConnectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityConnectorName")]) - if err != nil { - return nil, err - } - orgNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("orgName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - resp := a.srv.NewListPager(resourceGroupNameParam, securityConnectorNameParam, orgNameParam, projectNameParam, nil) - newListPager = &resp - a.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.AzureDevOpsReposClientListResponse, 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 -} - -func (a *AzureDevOpsReposServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if a.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} - } - beginUpdate := a.beginUpdate.get(req) - if beginUpdate == 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/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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.AzureDevOpsRepository](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 - } - orgNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("orgName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - repoNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("repoName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.BeginUpdate(req.Context(), resourceGroupNameParam, securityConnectorNameParam, orgNameParam, projectNameParam, repoNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginUpdate = &respr - a.beginUpdate.add(req, beginUpdate) - } - - resp, err := server.PollerResponderNext(beginUpdate, req) - if err != nil { - return nil, err - } - - if !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)} - } - if !server.PollerResponderMore(beginUpdate) { - a.beginUpdate.remove(req) - } - - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/complianceresults_server.go b/sdk/resourcemanager/security/armsecurity/fake/complianceresults_server.go deleted file mode 100644 index 5a3803555629..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/complianceresults_server.go +++ /dev/null @@ -1,148 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// ComplianceResultsServer is a fake server for instances of the armsecurity.ComplianceResultsClient type. -type ComplianceResultsServer struct { - // Get is the fake for method ComplianceResultsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceID string, complianceResultName string, options *armsecurity.ComplianceResultsClientGetOptions) (resp azfake.Responder[armsecurity.ComplianceResultsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method ComplianceResultsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(scope string, options *armsecurity.ComplianceResultsClientListOptions) (resp azfake.PagerResponder[armsecurity.ComplianceResultsClientListResponse]) -} - -// NewComplianceResultsServerTransport creates a new instance of ComplianceResultsServerTransport with the provided implementation. -// The returned ComplianceResultsServerTransport instance is connected to an instance of armsecurity.ComplianceResultsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewComplianceResultsServerTransport(srv *ComplianceResultsServer) *ComplianceResultsServerTransport { - return &ComplianceResultsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.ComplianceResultsClientListResponse]](), - } -} - -// ComplianceResultsServerTransport connects instances of armsecurity.ComplianceResultsClient to instances of ComplianceResultsServer. -// Don't use this type directly, use NewComplianceResultsServerTransport instead. -type ComplianceResultsServerTransport struct { - srv *ComplianceResultsServer - newListPager *tracker[azfake.PagerResponder[armsecurity.ComplianceResultsClientListResponse]] -} - -// Do implements the policy.Transporter interface for ComplianceResultsServerTransport. -func (c *ComplianceResultsServerTransport) 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 "ComplianceResultsClient.Get": - resp, err = c.dispatchGet(req) - case "ComplianceResultsClient.NewListPager": - resp, err = c.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (c *ComplianceResultsServerTransport) 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/complianceResults/(?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) - } - resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) - if err != nil { - return nil, err - } - complianceResultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("complianceResultName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.Get(req.Context(), resourceIDParam, complianceResultNameParam, 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).ComplianceResult, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (c *ComplianceResultsServerTransport) 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/complianceResults` - 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) - } - 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.ComplianceResultsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - c.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - c.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/compliances_server.go b/sdk/resourcemanager/security/armsecurity/fake/compliances_server.go deleted file mode 100644 index 63b9b0d7ab5b..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/compliances_server.go +++ /dev/null @@ -1,148 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// CompliancesServer is a fake server for instances of the armsecurity.CompliancesClient type. -type CompliancesServer struct { - // Get is the fake for method CompliancesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, scope string, complianceName string, options *armsecurity.CompliancesClientGetOptions) (resp azfake.Responder[armsecurity.CompliancesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method CompliancesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(scope string, options *armsecurity.CompliancesClientListOptions) (resp azfake.PagerResponder[armsecurity.CompliancesClientListResponse]) -} - -// NewCompliancesServerTransport creates a new instance of CompliancesServerTransport with the provided implementation. -// The returned CompliancesServerTransport instance is connected to an instance of armsecurity.CompliancesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewCompliancesServerTransport(srv *CompliancesServer) *CompliancesServerTransport { - return &CompliancesServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.CompliancesClientListResponse]](), - } -} - -// CompliancesServerTransport connects instances of armsecurity.CompliancesClient to instances of CompliancesServer. -// Don't use this type directly, use NewCompliancesServerTransport instead. -type CompliancesServerTransport struct { - srv *CompliancesServer - newListPager *tracker[azfake.PagerResponder[armsecurity.CompliancesClientListResponse]] -} - -// Do implements the policy.Transporter interface for CompliancesServerTransport. -func (c *CompliancesServerTransport) 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 "CompliancesClient.Get": - resp, err = c.dispatchGet(req) - case "CompliancesClient.NewListPager": - resp, err = c.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (c *CompliancesServerTransport) 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/compliances/(?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) - } - scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) - if err != nil { - return nil, err - } - complianceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("complianceName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.Get(req.Context(), scopeParam, complianceNameParam, 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).Compliance, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (c *CompliancesServerTransport) 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/compliances` - 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) - } - 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.CompliancesClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - c.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - c.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/connectorapplication_server.go b/sdk/resourcemanager/security/armsecurity/fake/connectorapplication_server.go deleted file mode 100644 index e7eeee4258e7..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/connectorapplication_server.go +++ /dev/null @@ -1,194 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// ConnectorApplicationServer is a fake server for instances of the armsecurity.ConnectorApplicationClient type. -type ConnectorApplicationServer struct { - // CreateOrUpdate is the fake for method ConnectorApplicationClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - CreateOrUpdate func(ctx context.Context, resourceGroupName string, securityConnectorName string, applicationID string, application armsecurity.Application, options *armsecurity.ConnectorApplicationClientCreateOrUpdateOptions) (resp azfake.Responder[armsecurity.ConnectorApplicationClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method ConnectorApplicationClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, securityConnectorName string, applicationID string, options *armsecurity.ConnectorApplicationClientDeleteOptions) (resp azfake.Responder[armsecurity.ConnectorApplicationClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ConnectorApplicationClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, securityConnectorName string, applicationID string, options *armsecurity.ConnectorApplicationClientGetOptions) (resp azfake.Responder[armsecurity.ConnectorApplicationClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewConnectorApplicationServerTransport creates a new instance of ConnectorApplicationServerTransport with the provided implementation. -// The returned ConnectorApplicationServerTransport instance is connected to an instance of armsecurity.ConnectorApplicationClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewConnectorApplicationServerTransport(srv *ConnectorApplicationServer) *ConnectorApplicationServerTransport { - return &ConnectorApplicationServerTransport{srv: srv} -} - -// ConnectorApplicationServerTransport connects instances of armsecurity.ConnectorApplicationClient to instances of ConnectorApplicationServer. -// Don't use this type directly, use NewConnectorApplicationServerTransport instead. -type ConnectorApplicationServerTransport struct { - srv *ConnectorApplicationServer -} - -// Do implements the policy.Transporter interface for ConnectorApplicationServerTransport. -func (c *ConnectorApplicationServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (c *ConnectorApplicationServerTransport) 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 = `/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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.Application](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 - } - applicationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("applicationId")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, securityConnectorNameParam, applicationIDParam, 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).Application, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (c *ConnectorApplicationServerTransport) 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/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 { - 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 - } - securityConnectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityConnectorName")]) - if err != nil { - return nil, err - } - applicationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("applicationId")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.Delete(req.Context(), resourceGroupNameParam, securityConnectorNameParam, applicationIDParam, 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 *ConnectorApplicationServerTransport) 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/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 { - 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 - } - securityConnectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityConnectorName")]) - if err != nil { - return nil, err - } - applicationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("applicationId")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, securityConnectorNameParam, applicationIDParam, 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).Application, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/connectorapplications_server.go b/sdk/resourcemanager/security/armsecurity/fake/connectorapplications_server.go deleted file mode 100644 index 40e2915a5513..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/connectorapplications_server.go +++ /dev/null @@ -1,112 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" - "net/http" - "net/url" - "regexp" -) - -// ConnectorApplicationsServer is a fake server for instances of the armsecurity.ConnectorApplicationsClient type. -type ConnectorApplicationsServer struct { - // NewListPager is the fake for method ConnectorApplicationsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, securityConnectorName string, options *armsecurity.ConnectorApplicationsClientListOptions) (resp azfake.PagerResponder[armsecurity.ConnectorApplicationsClientListResponse]) -} - -// NewConnectorApplicationsServerTransport creates a new instance of ConnectorApplicationsServerTransport with the provided implementation. -// The returned ConnectorApplicationsServerTransport instance is connected to an instance of armsecurity.ConnectorApplicationsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewConnectorApplicationsServerTransport(srv *ConnectorApplicationsServer) *ConnectorApplicationsServerTransport { - return &ConnectorApplicationsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.ConnectorApplicationsClientListResponse]](), - } -} - -// ConnectorApplicationsServerTransport connects instances of armsecurity.ConnectorApplicationsClient to instances of ConnectorApplicationsServer. -// Don't use this type directly, use NewConnectorApplicationsServerTransport instead. -type ConnectorApplicationsServerTransport struct { - srv *ConnectorApplicationsServer - newListPager *tracker[azfake.PagerResponder[armsecurity.ConnectorApplicationsClientListResponse]] -} - -// Do implements the policy.Transporter interface for ConnectorApplicationsServerTransport. -func (c *ConnectorApplicationsServerTransport) 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 "ConnectorApplicationsClient.NewListPager": - resp, err = c.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (c *ConnectorApplicationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if c.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := c.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.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 { - 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 - } - securityConnectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityConnectorName")]) - if err != nil { - return nil, err - } - resp := c.srv.NewListPager(resourceGroupNameParam, securityConnectorNameParam, nil) - newListPager = &resp - c.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.ConnectorApplicationsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - c.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - c.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/connectors_server.go b/sdk/resourcemanager/security/armsecurity/fake/connectors_server.go deleted file mode 100644 index a3ae8491b13e..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/connectors_server.go +++ /dev/null @@ -1,314 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// ConnectorsServer is a fake server for instances of the armsecurity.ConnectorsClient type. -type ConnectorsServer struct { - // CreateOrUpdate is the fake for method ConnectorsClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - CreateOrUpdate func(ctx context.Context, resourceGroupName string, securityConnectorName string, securityConnector armsecurity.Connector, options *armsecurity.ConnectorsClientCreateOrUpdateOptions) (resp azfake.Responder[armsecurity.ConnectorsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method ConnectorsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, securityConnectorName string, options *armsecurity.ConnectorsClientDeleteOptions) (resp azfake.Responder[armsecurity.ConnectorsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ConnectorsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, securityConnectorName string, options *armsecurity.ConnectorsClientGetOptions) (resp azfake.Responder[armsecurity.ConnectorsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method ConnectorsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armsecurity.ConnectorsClientListOptions) (resp azfake.PagerResponder[armsecurity.ConnectorsClientListResponse]) - - // NewListByResourceGroupPager is the fake for method ConnectorsClient.NewListByResourceGroupPager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, options *armsecurity.ConnectorsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armsecurity.ConnectorsClientListByResourceGroupResponse]) - - // Update is the fake for method ConnectorsClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, securityConnectorName string, securityConnector armsecurity.Connector, options *armsecurity.ConnectorsClientUpdateOptions) (resp azfake.Responder[armsecurity.ConnectorsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewConnectorsServerTransport creates a new instance of ConnectorsServerTransport with the provided implementation. -// The returned ConnectorsServerTransport instance is connected to an instance of armsecurity.ConnectorsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewConnectorsServerTransport(srv *ConnectorsServer) *ConnectorsServerTransport { - return &ConnectorsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.ConnectorsClientListResponse]](), - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armsecurity.ConnectorsClientListByResourceGroupResponse]](), - } -} - -// ConnectorsServerTransport connects instances of armsecurity.ConnectorsClient to instances of ConnectorsServer. -// Don't use this type directly, use NewConnectorsServerTransport instead. -type ConnectorsServerTransport struct { - srv *ConnectorsServer - newListPager *tracker[azfake.PagerResponder[armsecurity.ConnectorsClientListResponse]] - newListByResourceGroupPager *tracker[azfake.PagerResponder[armsecurity.ConnectorsClientListByResourceGroupResponse]] -} - -// Do implements the policy.Transporter interface for ConnectorsServerTransport. -func (c *ConnectorsServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (c *ConnectorsServerTransport) 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 = `/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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.Connector](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 - } - respr, errRespr := c.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, securityConnectorNameParam, 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).Connector, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (c *ConnectorsServerTransport) 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/securityConnectors/(?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 - } - securityConnectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityConnectorName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.Delete(req.Context(), resourceGroupNameParam, securityConnectorNameParam, 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 *ConnectorsServerTransport) 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/securityConnectors/(?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 - } - securityConnectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityConnectorName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, securityConnectorNameParam, 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).Connector, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (c *ConnectorsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if c.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := c.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors` - 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.NewListPager(nil) - newListPager = &resp - c.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.ConnectorsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - c.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - c.newListPager.remove(req) - } - return resp, nil -} - -func (c *ConnectorsServerTransport) 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/securityConnectors` - 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.ConnectorsClientListByResourceGroupResponse, 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 *ConnectorsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if c.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/securityConnectors/(?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.Connector](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 - } - respr, errRespr := c.srv.Update(req.Context(), resourceGroupNameParam, securityConnectorNameParam, 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).Connector, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/contacts_server.go b/sdk/resourcemanager/security/armsecurity/fake/contacts_server.go deleted file mode 100644 index e546367d05d8..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/contacts_server.go +++ /dev/null @@ -1,232 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// ContactsServer is a fake server for instances of the armsecurity.ContactsClient type. -type ContactsServer struct { - // Create is the fake for method ContactsClient.Create - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Create func(ctx context.Context, securityContactName armsecurity.SecurityContactName, securityContact armsecurity.Contact, options *armsecurity.ContactsClientCreateOptions) (resp azfake.Responder[armsecurity.ContactsClientCreateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method ContactsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, securityContactName armsecurity.SecurityContactName, options *armsecurity.ContactsClientDeleteOptions) (resp azfake.Responder[armsecurity.ContactsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ContactsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, securityContactName armsecurity.SecurityContactName, options *armsecurity.ContactsClientGetOptions) (resp azfake.Responder[armsecurity.ContactsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method ContactsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armsecurity.ContactsClientListOptions) (resp azfake.PagerResponder[armsecurity.ContactsClientListResponse]) -} - -// NewContactsServerTransport creates a new instance of ContactsServerTransport with the provided implementation. -// The returned ContactsServerTransport instance is connected to an instance of armsecurity.ContactsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewContactsServerTransport(srv *ContactsServer) *ContactsServerTransport { - return &ContactsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.ContactsClientListResponse]](), - } -} - -// ContactsServerTransport connects instances of armsecurity.ContactsClient to instances of ContactsServer. -// Don't use this type directly, use NewContactsServerTransport instead. -type ContactsServerTransport struct { - srv *ContactsServer - newListPager *tracker[azfake.PagerResponder[armsecurity.ContactsClientListResponse]] -} - -// Do implements the policy.Transporter interface for ContactsServerTransport. -func (c *ContactsServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (c *ContactsServerTransport) 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~%@]+)/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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.Contact](req) - if err != nil { - return nil, err - } - securityContactNameParam, err := parseWithCast(matches[regex.SubexpIndex("securityContactName")], func(v string) (armsecurity.SecurityContactName, error) { - p, unescapeErr := url.PathUnescape(v) - if unescapeErr != nil { - return "", unescapeErr - } - return armsecurity.SecurityContactName(p), nil - }) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.Create(req.Context(), securityContactNameParam, 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).Contact, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (c *ContactsServerTransport) 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~%@]+)/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 { - 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) { - p, unescapeErr := url.PathUnescape(v) - if unescapeErr != nil { - return "", unescapeErr - } - return armsecurity.SecurityContactName(p), nil - }) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.Delete(req.Context(), securityContactNameParam, 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 *ContactsServerTransport) 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~%@]+)/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 { - 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) { - p, unescapeErr := url.PathUnescape(v) - if unescapeErr != nil { - return "", unescapeErr - } - return armsecurity.SecurityContactName(p), nil - }) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.Get(req.Context(), securityContactNameParam, 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).Contact, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (c *ContactsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if c.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := c.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityContacts` - 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.NewListPager(nil) - newListPager = &resp - c.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.ContactsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - c.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - c.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/customassessmentautomations_server.go b/sdk/resourcemanager/security/armsecurity/fake/customassessmentautomations_server.go deleted file mode 100644 index a463bb75db9c..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/customassessmentautomations_server.go +++ /dev/null @@ -1,271 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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 e6c1b8146c2d..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/customentitystoreassignments_server.go +++ /dev/null @@ -1,271 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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/date_type.go b/sdk/resourcemanager/security/armsecurity/fake/date_type.go deleted file mode 100644 index 6a8d61c6788c..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/date_type.go +++ /dev/null @@ -1,58 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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 00a893a000bf..77cfd70434eb 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/defenderforstorage_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/defenderforstorage_server.go @@ -23,6 +23,10 @@ import ( // 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) @@ -30,6 +34,14 @@ 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) + + // 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. @@ -57,10 +69,16 @@ func (d *DefenderForStorageServerTransport) Do(req *http.Request) (*http.Respons var err error switch method { + case "DefenderForStorageClient.CancelMalwareScan": + resp, err = d.dispatchCancelMalwareScan(req) case "DefenderForStorageClient.Create": resp, err = d.dispatchCreate(req) case "DefenderForStorageClient.Get": resp, err = d.dispatchGet(req) + case "DefenderForStorageClient.GetMalwareScan": + resp, err = d.dispatchGetMalwareScan(req) + case "DefenderForStorageClient.StartMalwareScan": + resp, err = d.dispatchStartMalwareScan(req) default: err = fmt.Errorf("unhandled API %s", method) } @@ -72,6 +90,49 @@ func (d *DefenderForStorageServerTransport) Do(req *http.Request) (*http.Respons return resp, nil } +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~%@]+)/cancelScan` + 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) + } + 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 !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) dispatchCreate(req *http.Request) (*http.Response, error) { if d.srv.Create == nil { return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} @@ -153,3 +214,85 @@ 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 matches == nil || 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 + } + 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 !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) 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 matches == nil || 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 + } + 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 !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 +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/devicesecuritygroups_server.go b/sdk/resourcemanager/security/armsecurity/fake/devicesecuritygroups_server.go deleted file mode 100644 index a8a07bef1ad7..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/devicesecuritygroups_server.go +++ /dev/null @@ -1,230 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// DeviceSecurityGroupsServer is a fake server for instances of the armsecurity.DeviceSecurityGroupsClient type. -type DeviceSecurityGroupsServer struct { - // CreateOrUpdate is the fake for method DeviceSecurityGroupsClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - CreateOrUpdate func(ctx context.Context, resourceID string, deviceSecurityGroupName string, deviceSecurityGroup armsecurity.DeviceSecurityGroup, options *armsecurity.DeviceSecurityGroupsClientCreateOrUpdateOptions) (resp azfake.Responder[armsecurity.DeviceSecurityGroupsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method DeviceSecurityGroupsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceID string, deviceSecurityGroupName string, options *armsecurity.DeviceSecurityGroupsClientDeleteOptions) (resp azfake.Responder[armsecurity.DeviceSecurityGroupsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method DeviceSecurityGroupsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceID string, deviceSecurityGroupName string, options *armsecurity.DeviceSecurityGroupsClientGetOptions) (resp azfake.Responder[armsecurity.DeviceSecurityGroupsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method DeviceSecurityGroupsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceID string, options *armsecurity.DeviceSecurityGroupsClientListOptions) (resp azfake.PagerResponder[armsecurity.DeviceSecurityGroupsClientListResponse]) -} - -// NewDeviceSecurityGroupsServerTransport creates a new instance of DeviceSecurityGroupsServerTransport with the provided implementation. -// The returned DeviceSecurityGroupsServerTransport instance is connected to an instance of armsecurity.DeviceSecurityGroupsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewDeviceSecurityGroupsServerTransport(srv *DeviceSecurityGroupsServer) *DeviceSecurityGroupsServerTransport { - return &DeviceSecurityGroupsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.DeviceSecurityGroupsClientListResponse]](), - } -} - -// DeviceSecurityGroupsServerTransport connects instances of armsecurity.DeviceSecurityGroupsClient to instances of DeviceSecurityGroupsServer. -// Don't use this type directly, use NewDeviceSecurityGroupsServerTransport instead. -type DeviceSecurityGroupsServerTransport struct { - srv *DeviceSecurityGroupsServer - newListPager *tracker[azfake.PagerResponder[armsecurity.DeviceSecurityGroupsClientListResponse]] -} - -// Do implements the policy.Transporter interface for DeviceSecurityGroupsServerTransport. -func (d *DeviceSecurityGroupsServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (d *DeviceSecurityGroupsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if d.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.DeviceSecurityGroup](req) - if err != nil { - return nil, err - } - resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) - if err != nil { - return nil, err - } - deviceSecurityGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deviceSecurityGroupName")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.CreateOrUpdate(req.Context(), resourceIDParam, deviceSecurityGroupNameParam, 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).DeviceSecurityGroup, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DeviceSecurityGroupsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if d.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - 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 { - 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 - } - deviceSecurityGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deviceSecurityGroupName")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.Delete(req.Context(), resourceIDParam, deviceSecurityGroupNameParam, 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 (d *DeviceSecurityGroupsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if d.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - 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 { - 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 - } - deviceSecurityGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deviceSecurityGroupName")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.Get(req.Context(), resourceIDParam, deviceSecurityGroupNameParam, 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).DeviceSecurityGroup, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DeviceSecurityGroupsServerTransport) 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/deviceSecurityGroups` - 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) - } - 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.DeviceSecurityGroupsClientListResponse, 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) { - 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 -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/devopsconfigurations_server.go b/sdk/resourcemanager/security/armsecurity/fake/devopsconfigurations_server.go deleted file mode 100644 index 766bb66f77a8..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/devopsconfigurations_server.go +++ /dev/null @@ -1,316 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// DevOpsConfigurationsServer is a fake server for instances of the armsecurity.DevOpsConfigurationsClient type. -type DevOpsConfigurationsServer struct { - // BeginCreateOrUpdate is the fake for method DevOpsConfigurationsClient.BeginCreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated, http.StatusAccepted - BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, securityConnectorName string, devOpsConfiguration armsecurity.DevOpsConfiguration, options *armsecurity.DevOpsConfigurationsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armsecurity.DevOpsConfigurationsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method DevOpsConfigurationsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, securityConnectorName string, options *armsecurity.DevOpsConfigurationsClientBeginDeleteOptions) (resp azfake.PollerResponder[armsecurity.DevOpsConfigurationsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method DevOpsConfigurationsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, securityConnectorName string, options *armsecurity.DevOpsConfigurationsClientGetOptions) (resp azfake.Responder[armsecurity.DevOpsConfigurationsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method DevOpsConfigurationsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, securityConnectorName string, options *armsecurity.DevOpsConfigurationsClientListOptions) (resp azfake.PagerResponder[armsecurity.DevOpsConfigurationsClientListResponse]) - - // BeginUpdate is the fake for method DevOpsConfigurationsClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, securityConnectorName string, devOpsConfiguration armsecurity.DevOpsConfiguration, options *armsecurity.DevOpsConfigurationsClientBeginUpdateOptions) (resp azfake.PollerResponder[armsecurity.DevOpsConfigurationsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewDevOpsConfigurationsServerTransport creates a new instance of DevOpsConfigurationsServerTransport with the provided implementation. -// The returned DevOpsConfigurationsServerTransport instance is connected to an instance of armsecurity.DevOpsConfigurationsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewDevOpsConfigurationsServerTransport(srv *DevOpsConfigurationsServer) *DevOpsConfigurationsServerTransport { - return &DevOpsConfigurationsServerTransport{ - srv: srv, - beginCreateOrUpdate: newTracker[azfake.PollerResponder[armsecurity.DevOpsConfigurationsClientCreateOrUpdateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armsecurity.DevOpsConfigurationsClientDeleteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armsecurity.DevOpsConfigurationsClientListResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armsecurity.DevOpsConfigurationsClientUpdateResponse]](), - } -} - -// DevOpsConfigurationsServerTransport connects instances of armsecurity.DevOpsConfigurationsClient to instances of DevOpsConfigurationsServer. -// Don't use this type directly, use NewDevOpsConfigurationsServerTransport instead. -type DevOpsConfigurationsServerTransport struct { - srv *DevOpsConfigurationsServer - beginCreateOrUpdate *tracker[azfake.PollerResponder[armsecurity.DevOpsConfigurationsClientCreateOrUpdateResponse]] - beginDelete *tracker[azfake.PollerResponder[armsecurity.DevOpsConfigurationsClientDeleteResponse]] - newListPager *tracker[azfake.PagerResponder[armsecurity.DevOpsConfigurationsClientListResponse]] - beginUpdate *tracker[azfake.PollerResponder[armsecurity.DevOpsConfigurationsClientUpdateResponse]] -} - -// Do implements the policy.Transporter interface for DevOpsConfigurationsServerTransport. -func (d *DevOpsConfigurationsServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (d *DevOpsConfigurationsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { - if d.srv.BeginCreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} - } - beginCreateOrUpdate := d.beginCreateOrUpdate.get(req) - if beginCreateOrUpdate == 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` - 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.DevOpsConfiguration](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 - } - respr, errRespr := d.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, securityConnectorNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreateOrUpdate = &respr - d.beginCreateOrUpdate.add(req, beginCreateOrUpdate) - } - - resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) - if err != nil { - return nil, err - } - - if !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)} - } - if !server.PollerResponderMore(beginCreateOrUpdate) { - d.beginCreateOrUpdate.remove(req) - } - - return resp, nil -} - -func (d *DevOpsConfigurationsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if d.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - beginDelete := d.beginDelete.get(req) - if beginDelete == 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` - 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 - } - securityConnectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityConnectorName")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.BeginDelete(req.Context(), resourceGroupNameParam, securityConnectorNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginDelete = &respr - d.beginDelete.add(req, beginDelete) - } - - resp, err := server.PollerResponderNext(beginDelete, req) - if err != nil { - return nil, err - } - - if !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)} - } - if !server.PollerResponderMore(beginDelete) { - d.beginDelete.remove(req) - } - - return resp, nil -} - -func (d *DevOpsConfigurationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if d.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/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default` - 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 - } - securityConnectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityConnectorName")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, securityConnectorNameParam, 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).DevOpsConfiguration, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DevOpsConfigurationsServerTransport) 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 = `/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 { - 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 - } - securityConnectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityConnectorName")]) - if err != nil { - return nil, err - } - resp := d.srv.NewListPager(resourceGroupNameParam, securityConnectorNameParam, nil) - newListPager = &resp - d.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.DevOpsConfigurationsClientListResponse, 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) { - 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 *DevOpsConfigurationsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if d.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} - } - beginUpdate := d.beginUpdate.get(req) - if beginUpdate == 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` - 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.DevOpsConfiguration](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 - } - respr, errRespr := d.srv.BeginUpdate(req.Context(), resourceGroupNameParam, securityConnectorNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginUpdate = &respr - d.beginUpdate.add(req, beginUpdate) - } - - resp, err := server.PollerResponderNext(beginUpdate, req) - if err != nil { - return nil, err - } - - if !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)} - } - if !server.PollerResponderMore(beginUpdate) { - d.beginUpdate.remove(req) - } - - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/devopsoperationresults_server.go b/sdk/resourcemanager/security/armsecurity/fake/devopsoperationresults_server.go deleted file mode 100644 index 4760ad6ab4c9..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/devopsoperationresults_server.go +++ /dev/null @@ -1,104 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// DevOpsOperationResultsServer is a fake server for instances of the armsecurity.DevOpsOperationResultsClient type. -type DevOpsOperationResultsServer struct { - // Get is the fake for method DevOpsOperationResultsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, securityConnectorName string, operationResultID string, options *armsecurity.DevOpsOperationResultsClientGetOptions) (resp azfake.Responder[armsecurity.DevOpsOperationResultsClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewDevOpsOperationResultsServerTransport creates a new instance of DevOpsOperationResultsServerTransport with the provided implementation. -// The returned DevOpsOperationResultsServerTransport instance is connected to an instance of armsecurity.DevOpsOperationResultsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewDevOpsOperationResultsServerTransport(srv *DevOpsOperationResultsServer) *DevOpsOperationResultsServerTransport { - return &DevOpsOperationResultsServerTransport{srv: srv} -} - -// DevOpsOperationResultsServerTransport connects instances of armsecurity.DevOpsOperationResultsClient to instances of DevOpsOperationResultsServer. -// Don't use this type directly, use NewDevOpsOperationResultsServerTransport instead. -type DevOpsOperationResultsServerTransport struct { - srv *DevOpsOperationResultsServer -} - -// Do implements the policy.Transporter interface for DevOpsOperationResultsServerTransport. -func (d *DevOpsOperationResultsServerTransport) 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 "DevOpsOperationResultsClient.Get": - resp, err = d.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (d *DevOpsOperationResultsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if d.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/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 { - 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 - } - securityConnectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityConnectorName")]) - if err != nil { - return nil, err - } - operationResultIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationResultId")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, securityConnectorNameParam, operationResultIDParam, 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).OperationStatusResult, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/discoveredsecuritysolutions_server.go b/sdk/resourcemanager/security/armsecurity/fake/discoveredsecuritysolutions_server.go deleted file mode 100644 index 776db7b38f60..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/discoveredsecuritysolutions_server.go +++ /dev/null @@ -1,193 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// DiscoveredSecuritySolutionsServer is a fake server for instances of the armsecurity.DiscoveredSecuritySolutionsClient type. -type DiscoveredSecuritySolutionsServer struct { - // Get is the fake for method DiscoveredSecuritySolutionsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, ascLocation string, discoveredSecuritySolutionName string, options *armsecurity.DiscoveredSecuritySolutionsClientGetOptions) (resp azfake.Responder[armsecurity.DiscoveredSecuritySolutionsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method DiscoveredSecuritySolutionsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armsecurity.DiscoveredSecuritySolutionsClientListOptions) (resp azfake.PagerResponder[armsecurity.DiscoveredSecuritySolutionsClientListResponse]) - - // NewListByHomeRegionPager is the fake for method DiscoveredSecuritySolutionsClient.NewListByHomeRegionPager - // HTTP status codes to indicate success: http.StatusOK - NewListByHomeRegionPager func(ascLocation string, options *armsecurity.DiscoveredSecuritySolutionsClientListByHomeRegionOptions) (resp azfake.PagerResponder[armsecurity.DiscoveredSecuritySolutionsClientListByHomeRegionResponse]) -} - -// NewDiscoveredSecuritySolutionsServerTransport creates a new instance of DiscoveredSecuritySolutionsServerTransport with the provided implementation. -// The returned DiscoveredSecuritySolutionsServerTransport instance is connected to an instance of armsecurity.DiscoveredSecuritySolutionsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewDiscoveredSecuritySolutionsServerTransport(srv *DiscoveredSecuritySolutionsServer) *DiscoveredSecuritySolutionsServerTransport { - return &DiscoveredSecuritySolutionsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.DiscoveredSecuritySolutionsClientListResponse]](), - newListByHomeRegionPager: newTracker[azfake.PagerResponder[armsecurity.DiscoveredSecuritySolutionsClientListByHomeRegionResponse]](), - } -} - -// DiscoveredSecuritySolutionsServerTransport connects instances of armsecurity.DiscoveredSecuritySolutionsClient to instances of DiscoveredSecuritySolutionsServer. -// Don't use this type directly, use NewDiscoveredSecuritySolutionsServerTransport instead. -type DiscoveredSecuritySolutionsServerTransport struct { - srv *DiscoveredSecuritySolutionsServer - newListPager *tracker[azfake.PagerResponder[armsecurity.DiscoveredSecuritySolutionsClientListResponse]] - newListByHomeRegionPager *tracker[azfake.PagerResponder[armsecurity.DiscoveredSecuritySolutionsClientListByHomeRegionResponse]] -} - -// Do implements the policy.Transporter interface for DiscoveredSecuritySolutionsServerTransport. -func (d *DiscoveredSecuritySolutionsServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (d *DiscoveredSecuritySolutionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if d.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/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 { - 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 - } - ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) - if err != nil { - return nil, err - } - discoveredSecuritySolutionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("discoveredSecuritySolutionName")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, ascLocationParam, discoveredSecuritySolutionNameParam, 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).DiscoveredSecuritySolution, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DiscoveredSecuritySolutionsServerTransport) 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 = `/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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := d.srv.NewListPager(nil) - newListPager = &resp - d.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.DiscoveredSecuritySolutionsClientListResponse, 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) { - 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 *DiscoveredSecuritySolutionsServerTransport) dispatchNewListByHomeRegionPager(req *http.Request) (*http.Response, error) { - if d.srv.NewListByHomeRegionPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByHomeRegionPager not implemented")} - } - newListByHomeRegionPager := d.newListByHomeRegionPager.get(req) - if newListByHomeRegionPager == nil { - 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 { - 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 - } - resp := d.srv.NewListByHomeRegionPager(ascLocationParam, nil) - newListByHomeRegionPager = &resp - d.newListByHomeRegionPager.add(req, newListByHomeRegionPager) - server.PagerResponderInjectNextLinks(newListByHomeRegionPager, req, func(page *armsecurity.DiscoveredSecuritySolutionsClientListByHomeRegionResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByHomeRegionPager, req) - if err != nil { - return nil, err - } - if !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)} - } - if !server.PagerResponderMore(newListByHomeRegionPager) { - d.newListByHomeRegionPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/externalsecuritysolutions_server.go b/sdk/resourcemanager/security/armsecurity/fake/externalsecuritysolutions_server.go deleted file mode 100644 index 484bc707a711..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/externalsecuritysolutions_server.go +++ /dev/null @@ -1,193 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// ExternalSecuritySolutionsServer is a fake server for instances of the armsecurity.ExternalSecuritySolutionsClient type. -type ExternalSecuritySolutionsServer struct { - // Get is the fake for method ExternalSecuritySolutionsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, ascLocation string, externalSecuritySolutionsName string, options *armsecurity.ExternalSecuritySolutionsClientGetOptions) (resp azfake.Responder[armsecurity.ExternalSecuritySolutionsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method ExternalSecuritySolutionsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armsecurity.ExternalSecuritySolutionsClientListOptions) (resp azfake.PagerResponder[armsecurity.ExternalSecuritySolutionsClientListResponse]) - - // NewListByHomeRegionPager is the fake for method ExternalSecuritySolutionsClient.NewListByHomeRegionPager - // HTTP status codes to indicate success: http.StatusOK - NewListByHomeRegionPager func(ascLocation string, options *armsecurity.ExternalSecuritySolutionsClientListByHomeRegionOptions) (resp azfake.PagerResponder[armsecurity.ExternalSecuritySolutionsClientListByHomeRegionResponse]) -} - -// NewExternalSecuritySolutionsServerTransport creates a new instance of ExternalSecuritySolutionsServerTransport with the provided implementation. -// The returned ExternalSecuritySolutionsServerTransport instance is connected to an instance of armsecurity.ExternalSecuritySolutionsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewExternalSecuritySolutionsServerTransport(srv *ExternalSecuritySolutionsServer) *ExternalSecuritySolutionsServerTransport { - return &ExternalSecuritySolutionsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.ExternalSecuritySolutionsClientListResponse]](), - newListByHomeRegionPager: newTracker[azfake.PagerResponder[armsecurity.ExternalSecuritySolutionsClientListByHomeRegionResponse]](), - } -} - -// ExternalSecuritySolutionsServerTransport connects instances of armsecurity.ExternalSecuritySolutionsClient to instances of ExternalSecuritySolutionsServer. -// Don't use this type directly, use NewExternalSecuritySolutionsServerTransport instead. -type ExternalSecuritySolutionsServerTransport struct { - srv *ExternalSecuritySolutionsServer - newListPager *tracker[azfake.PagerResponder[armsecurity.ExternalSecuritySolutionsClientListResponse]] - newListByHomeRegionPager *tracker[azfake.PagerResponder[armsecurity.ExternalSecuritySolutionsClientListByHomeRegionResponse]] -} - -// Do implements the policy.Transporter interface for ExternalSecuritySolutionsServerTransport. -func (e *ExternalSecuritySolutionsServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (e *ExternalSecuritySolutionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if e.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/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 { - 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 - } - ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) - if err != nil { - return nil, err - } - externalSecuritySolutionsNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("externalSecuritySolutionsName")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.Get(req.Context(), resourceGroupNameParam, ascLocationParam, externalSecuritySolutionsNameParam, 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).ExternalSecuritySolutionClassification, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (e *ExternalSecuritySolutionsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if e.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := e.newListPager.get(req) - if newListPager == nil { - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := e.srv.NewListPager(nil) - newListPager = &resp - e.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.ExternalSecuritySolutionsClientListResponse, 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) { - e.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - e.newListPager.remove(req) - } - return resp, nil -} - -func (e *ExternalSecuritySolutionsServerTransport) dispatchNewListByHomeRegionPager(req *http.Request) (*http.Response, error) { - if e.srv.NewListByHomeRegionPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByHomeRegionPager not implemented")} - } - newListByHomeRegionPager := e.newListByHomeRegionPager.get(req) - if newListByHomeRegionPager == nil { - 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 { - 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 - } - resp := e.srv.NewListByHomeRegionPager(ascLocationParam, nil) - newListByHomeRegionPager = &resp - e.newListByHomeRegionPager.add(req, newListByHomeRegionPager) - server.PagerResponderInjectNextLinks(newListByHomeRegionPager, req, func(page *armsecurity.ExternalSecuritySolutionsClientListByHomeRegionResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByHomeRegionPager, req) - if err != nil { - return nil, err - } - if !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)} - } - if !server.PagerResponderMore(newListByHomeRegionPager) { - e.newListByHomeRegionPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/githubowners_server.go b/sdk/resourcemanager/security/armsecurity/fake/githubowners_server.go deleted file mode 100644 index 00f74585a09d..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/githubowners_server.go +++ /dev/null @@ -1,195 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// GitHubOwnersServer is a fake server for instances of the armsecurity.GitHubOwnersClient type. -type GitHubOwnersServer struct { - // Get is the fake for method GitHubOwnersClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, securityConnectorName string, ownerName string, options *armsecurity.GitHubOwnersClientGetOptions) (resp azfake.Responder[armsecurity.GitHubOwnersClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method GitHubOwnersClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, securityConnectorName string, options *armsecurity.GitHubOwnersClientListOptions) (resp azfake.PagerResponder[armsecurity.GitHubOwnersClientListResponse]) - - // ListAvailable is the fake for method GitHubOwnersClient.ListAvailable - // HTTP status codes to indicate success: http.StatusOK - ListAvailable func(ctx context.Context, resourceGroupName string, securityConnectorName string, options *armsecurity.GitHubOwnersClientListAvailableOptions) (resp azfake.Responder[armsecurity.GitHubOwnersClientListAvailableResponse], errResp azfake.ErrorResponder) -} - -// NewGitHubOwnersServerTransport creates a new instance of GitHubOwnersServerTransport with the provided implementation. -// The returned GitHubOwnersServerTransport instance is connected to an instance of armsecurity.GitHubOwnersClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewGitHubOwnersServerTransport(srv *GitHubOwnersServer) *GitHubOwnersServerTransport { - return &GitHubOwnersServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.GitHubOwnersClientListResponse]](), - } -} - -// GitHubOwnersServerTransport connects instances of armsecurity.GitHubOwnersClient to instances of GitHubOwnersServer. -// Don't use this type directly, use NewGitHubOwnersServerTransport instead. -type GitHubOwnersServerTransport struct { - srv *GitHubOwnersServer - newListPager *tracker[azfake.PagerResponder[armsecurity.GitHubOwnersClientListResponse]] -} - -// Do implements the policy.Transporter interface for GitHubOwnersServerTransport. -func (g *GitHubOwnersServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (g *GitHubOwnersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if g.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/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 { - 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 - } - 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 - } - respr, errRespr := g.srv.Get(req.Context(), resourceGroupNameParam, securityConnectorNameParam, ownerNameParam, 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).GitHubOwner, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (g *GitHubOwnersServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if g.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := g.newListPager.get(req) - if newListPager == 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` - 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 - } - securityConnectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityConnectorName")]) - if err != nil { - return nil, err - } - resp := g.srv.NewListPager(resourceGroupNameParam, securityConnectorNameParam, nil) - newListPager = &resp - g.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.GitHubOwnersClientListResponse, 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) { - g.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - g.newListPager.remove(req) - } - return resp, nil -} - -func (g *GitHubOwnersServerTransport) dispatchListAvailable(req *http.Request) (*http.Response, error) { - if g.srv.ListAvailable == nil { - return nil, &nonRetriableError{errors.New("fake for method ListAvailable not implemented")} - } - 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 { - 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 - } - securityConnectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityConnectorName")]) - if err != nil { - return nil, err - } - respr, errRespr := g.srv.ListAvailable(req.Context(), resourceGroupNameParam, securityConnectorNameParam, 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).GitHubOwnerListResponse, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/githubrepos_server.go b/sdk/resourcemanager/security/armsecurity/fake/githubrepos_server.go deleted file mode 100644 index 8bd332f79483..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/githubrepos_server.go +++ /dev/null @@ -1,164 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// GitHubReposServer is a fake server for instances of the armsecurity.GitHubReposClient type. -type GitHubReposServer struct { - // Get is the fake for method GitHubReposClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, securityConnectorName string, ownerName string, repoName string, options *armsecurity.GitHubReposClientGetOptions) (resp azfake.Responder[armsecurity.GitHubReposClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method GitHubReposClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, securityConnectorName string, ownerName string, options *armsecurity.GitHubReposClientListOptions) (resp azfake.PagerResponder[armsecurity.GitHubReposClientListResponse]) -} - -// NewGitHubReposServerTransport creates a new instance of GitHubReposServerTransport with the provided implementation. -// The returned GitHubReposServerTransport instance is connected to an instance of armsecurity.GitHubReposClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewGitHubReposServerTransport(srv *GitHubReposServer) *GitHubReposServerTransport { - return &GitHubReposServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.GitHubReposClientListResponse]](), - } -} - -// GitHubReposServerTransport connects instances of armsecurity.GitHubReposClient to instances of GitHubReposServer. -// Don't use this type directly, use NewGitHubReposServerTransport instead. -type GitHubReposServerTransport struct { - srv *GitHubReposServer - newListPager *tracker[azfake.PagerResponder[armsecurity.GitHubReposClientListResponse]] -} - -// Do implements the policy.Transporter interface for GitHubReposServerTransport. -func (g *GitHubReposServerTransport) 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 "GitHubReposClient.Get": - resp, err = g.dispatchGet(req) - case "GitHubReposClient.NewListPager": - resp, err = g.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (g *GitHubReposServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if g.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/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 { - 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 - } - 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 - } - respr, errRespr := g.srv.Get(req.Context(), resourceGroupNameParam, securityConnectorNameParam, ownerNameParam, repoNameParam, 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).GitHubRepository, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (g *GitHubReposServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if g.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := g.newListPager.get(req) - if newListPager == 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` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - 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 - } - resp := g.srv.NewListPager(resourceGroupNameParam, securityConnectorNameParam, ownerNameParam, nil) - newListPager = &resp - g.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.GitHubReposClientListResponse, 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) { - g.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - g.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/gitlabgroups_server.go b/sdk/resourcemanager/security/armsecurity/fake/gitlabgroups_server.go deleted file mode 100644 index 19d6804afcae..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/gitlabgroups_server.go +++ /dev/null @@ -1,195 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// GitLabGroupsServer is a fake server for instances of the armsecurity.GitLabGroupsClient type. -type GitLabGroupsServer struct { - // Get is the fake for method GitLabGroupsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, securityConnectorName string, groupFQName string, options *armsecurity.GitLabGroupsClientGetOptions) (resp azfake.Responder[armsecurity.GitLabGroupsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method GitLabGroupsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, securityConnectorName string, options *armsecurity.GitLabGroupsClientListOptions) (resp azfake.PagerResponder[armsecurity.GitLabGroupsClientListResponse]) - - // ListAvailable is the fake for method GitLabGroupsClient.ListAvailable - // HTTP status codes to indicate success: http.StatusOK - ListAvailable func(ctx context.Context, resourceGroupName string, securityConnectorName string, options *armsecurity.GitLabGroupsClientListAvailableOptions) (resp azfake.Responder[armsecurity.GitLabGroupsClientListAvailableResponse], errResp azfake.ErrorResponder) -} - -// NewGitLabGroupsServerTransport creates a new instance of GitLabGroupsServerTransport with the provided implementation. -// The returned GitLabGroupsServerTransport instance is connected to an instance of armsecurity.GitLabGroupsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewGitLabGroupsServerTransport(srv *GitLabGroupsServer) *GitLabGroupsServerTransport { - return &GitLabGroupsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.GitLabGroupsClientListResponse]](), - } -} - -// GitLabGroupsServerTransport connects instances of armsecurity.GitLabGroupsClient to instances of GitLabGroupsServer. -// Don't use this type directly, use NewGitLabGroupsServerTransport instead. -type GitLabGroupsServerTransport struct { - srv *GitLabGroupsServer - newListPager *tracker[azfake.PagerResponder[armsecurity.GitLabGroupsClientListResponse]] -} - -// Do implements the policy.Transporter interface for GitLabGroupsServerTransport. -func (g *GitLabGroupsServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (g *GitLabGroupsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if g.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/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 { - 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 - } - securityConnectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityConnectorName")]) - if err != nil { - return nil, err - } - groupFQNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupFQName")]) - if err != nil { - return nil, err - } - respr, errRespr := g.srv.Get(req.Context(), resourceGroupNameParam, securityConnectorNameParam, groupFQNameParam, 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).GitLabGroup, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (g *GitLabGroupsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if g.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := g.newListPager.get(req) - if newListPager == 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/gitLabGroups` - 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 - } - securityConnectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityConnectorName")]) - if err != nil { - return nil, err - } - resp := g.srv.NewListPager(resourceGroupNameParam, securityConnectorNameParam, nil) - newListPager = &resp - g.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.GitLabGroupsClientListResponse, 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) { - g.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - g.newListPager.remove(req) - } - return resp, nil -} - -func (g *GitLabGroupsServerTransport) dispatchListAvailable(req *http.Request) (*http.Response, error) { - if g.srv.ListAvailable == nil { - return nil, &nonRetriableError{errors.New("fake for method ListAvailable not implemented")} - } - 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 { - 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 - } - securityConnectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityConnectorName")]) - if err != nil { - return nil, err - } - respr, errRespr := g.srv.ListAvailable(req.Context(), resourceGroupNameParam, securityConnectorNameParam, 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).GitLabGroupListResponse, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/gitlabprojects_server.go b/sdk/resourcemanager/security/armsecurity/fake/gitlabprojects_server.go deleted file mode 100644 index 1bc9dd065aac..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/gitlabprojects_server.go +++ /dev/null @@ -1,164 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// GitLabProjectsServer is a fake server for instances of the armsecurity.GitLabProjectsClient type. -type GitLabProjectsServer struct { - // Get is the fake for method GitLabProjectsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, securityConnectorName string, groupFQName string, projectName string, options *armsecurity.GitLabProjectsClientGetOptions) (resp azfake.Responder[armsecurity.GitLabProjectsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method GitLabProjectsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, securityConnectorName string, groupFQName string, options *armsecurity.GitLabProjectsClientListOptions) (resp azfake.PagerResponder[armsecurity.GitLabProjectsClientListResponse]) -} - -// NewGitLabProjectsServerTransport creates a new instance of GitLabProjectsServerTransport with the provided implementation. -// The returned GitLabProjectsServerTransport instance is connected to an instance of armsecurity.GitLabProjectsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewGitLabProjectsServerTransport(srv *GitLabProjectsServer) *GitLabProjectsServerTransport { - return &GitLabProjectsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.GitLabProjectsClientListResponse]](), - } -} - -// GitLabProjectsServerTransport connects instances of armsecurity.GitLabProjectsClient to instances of GitLabProjectsServer. -// Don't use this type directly, use NewGitLabProjectsServerTransport instead. -type GitLabProjectsServerTransport struct { - srv *GitLabProjectsServer - newListPager *tracker[azfake.PagerResponder[armsecurity.GitLabProjectsClientListResponse]] -} - -// Do implements the policy.Transporter interface for GitLabProjectsServerTransport. -func (g *GitLabProjectsServerTransport) 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 "GitLabProjectsClient.Get": - resp, err = g.dispatchGet(req) - case "GitLabProjectsClient.NewListPager": - resp, err = g.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (g *GitLabProjectsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if g.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/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 { - 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 - } - securityConnectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityConnectorName")]) - if err != nil { - return nil, err - } - groupFQNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupFQName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - respr, errRespr := g.srv.Get(req.Context(), resourceGroupNameParam, securityConnectorNameParam, groupFQNameParam, projectNameParam, 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).GitLabProject, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (g *GitLabProjectsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if g.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := g.newListPager.get(req) - if newListPager == 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/gitLabGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - securityConnectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityConnectorName")]) - if err != nil { - return nil, err - } - groupFQNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupFQName")]) - if err != nil { - return nil, err - } - resp := g.srv.NewListPager(resourceGroupNameParam, securityConnectorNameParam, groupFQNameParam, nil) - newListPager = &resp - g.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.GitLabProjectsClientListResponse, 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) { - g.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - g.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/gitlabsubgroups_server.go b/sdk/resourcemanager/security/armsecurity/fake/gitlabsubgroups_server.go deleted file mode 100644 index 686734d02292..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/gitlabsubgroups_server.go +++ /dev/null @@ -1,104 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// GitLabSubgroupsServer is a fake server for instances of the armsecurity.GitLabSubgroupsClient type. -type GitLabSubgroupsServer struct { - // List is the fake for method GitLabSubgroupsClient.List - // HTTP status codes to indicate success: http.StatusOK - List func(ctx context.Context, resourceGroupName string, securityConnectorName string, groupFQName string, options *armsecurity.GitLabSubgroupsClientListOptions) (resp azfake.Responder[armsecurity.GitLabSubgroupsClientListResponse], errResp azfake.ErrorResponder) -} - -// NewGitLabSubgroupsServerTransport creates a new instance of GitLabSubgroupsServerTransport with the provided implementation. -// The returned GitLabSubgroupsServerTransport instance is connected to an instance of armsecurity.GitLabSubgroupsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewGitLabSubgroupsServerTransport(srv *GitLabSubgroupsServer) *GitLabSubgroupsServerTransport { - return &GitLabSubgroupsServerTransport{srv: srv} -} - -// GitLabSubgroupsServerTransport connects instances of armsecurity.GitLabSubgroupsClient to instances of GitLabSubgroupsServer. -// Don't use this type directly, use NewGitLabSubgroupsServerTransport instead. -type GitLabSubgroupsServerTransport struct { - srv *GitLabSubgroupsServer -} - -// Do implements the policy.Transporter interface for GitLabSubgroupsServerTransport. -func (g *GitLabSubgroupsServerTransport) 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 "GitLabSubgroupsClient.List": - resp, err = g.dispatchList(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (g *GitLabSubgroupsServerTransport) dispatchList(req *http.Request) (*http.Response, error) { - if g.srv.List == nil { - return nil, &nonRetriableError{errors.New("fake for method List not implemented")} - } - 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 { - 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 - } - securityConnectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityConnectorName")]) - if err != nil { - return nil, err - } - groupFQNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupFQName")]) - if err != nil { - return nil, err - } - respr, errRespr := g.srv.List(req.Context(), resourceGroupNameParam, securityConnectorNameParam, groupFQNameParam, 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).GitLabGroupListResponse, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/governanceassignments_server.go b/sdk/resourcemanager/security/armsecurity/fake/governanceassignments_server.go deleted file mode 100644 index 243bc872b436..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/governanceassignments_server.go +++ /dev/null @@ -1,246 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// GovernanceAssignmentsServer is a fake server for instances of the armsecurity.GovernanceAssignmentsClient type. -type GovernanceAssignmentsServer struct { - // CreateOrUpdate is the fake for method GovernanceAssignmentsClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - CreateOrUpdate func(ctx context.Context, scope string, assessmentName string, assignmentKey string, governanceAssignment armsecurity.GovernanceAssignment, options *armsecurity.GovernanceAssignmentsClientCreateOrUpdateOptions) (resp azfake.Responder[armsecurity.GovernanceAssignmentsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method GovernanceAssignmentsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, scope string, assessmentName string, assignmentKey string, options *armsecurity.GovernanceAssignmentsClientDeleteOptions) (resp azfake.Responder[armsecurity.GovernanceAssignmentsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method GovernanceAssignmentsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, scope string, assessmentName string, assignmentKey string, options *armsecurity.GovernanceAssignmentsClientGetOptions) (resp azfake.Responder[armsecurity.GovernanceAssignmentsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method GovernanceAssignmentsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(scope string, assessmentName string, options *armsecurity.GovernanceAssignmentsClientListOptions) (resp azfake.PagerResponder[armsecurity.GovernanceAssignmentsClientListResponse]) -} - -// NewGovernanceAssignmentsServerTransport creates a new instance of GovernanceAssignmentsServerTransport with the provided implementation. -// The returned GovernanceAssignmentsServerTransport instance is connected to an instance of armsecurity.GovernanceAssignmentsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewGovernanceAssignmentsServerTransport(srv *GovernanceAssignmentsServer) *GovernanceAssignmentsServerTransport { - return &GovernanceAssignmentsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.GovernanceAssignmentsClientListResponse]](), - } -} - -// GovernanceAssignmentsServerTransport connects instances of armsecurity.GovernanceAssignmentsClient to instances of GovernanceAssignmentsServer. -// Don't use this type directly, use NewGovernanceAssignmentsServerTransport instead. -type GovernanceAssignmentsServerTransport struct { - srv *GovernanceAssignmentsServer - newListPager *tracker[azfake.PagerResponder[armsecurity.GovernanceAssignmentsClientListResponse]] -} - -// Do implements the policy.Transporter interface for GovernanceAssignmentsServerTransport. -func (g *GovernanceAssignmentsServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (g *GovernanceAssignmentsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if g.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.GovernanceAssignment](req) - if err != nil { - return nil, err - } - scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) - if err != nil { - return nil, err - } - assessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentName")]) - if err != nil { - return nil, err - } - assignmentKeyParam, err := url.PathUnescape(matches[regex.SubexpIndex("assignmentKey")]) - if err != nil { - return nil, err - } - respr, errRespr := g.srv.CreateOrUpdate(req.Context(), scopeParam, assessmentNameParam, assignmentKeyParam, 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).GovernanceAssignment, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (g *GovernanceAssignmentsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if g.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - 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 { - 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 - } - assessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentName")]) - if err != nil { - return nil, err - } - assignmentKeyParam, err := url.PathUnescape(matches[regex.SubexpIndex("assignmentKey")]) - if err != nil { - return nil, err - } - respr, errRespr := g.srv.Delete(req.Context(), scopeParam, assessmentNameParam, assignmentKeyParam, 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 (g *GovernanceAssignmentsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if g.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - 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 { - 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 - } - assessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentName")]) - if err != nil { - return nil, err - } - assignmentKeyParam, err := url.PathUnescape(matches[regex.SubexpIndex("assignmentKey")]) - if err != nil { - return nil, err - } - respr, errRespr := g.srv.Get(req.Context(), scopeParam, assessmentNameParam, assignmentKeyParam, 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).GovernanceAssignment, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (g *GovernanceAssignmentsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if g.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := g.newListPager.get(req) - if newListPager == nil { - 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 { - 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 - } - assessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentName")]) - if err != nil { - return nil, err - } - resp := g.srv.NewListPager(scopeParam, assessmentNameParam, nil) - newListPager = &resp - g.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.GovernanceAssignmentsClientListResponse, 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) { - g.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - g.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/governancerules_server.go b/sdk/resourcemanager/security/armsecurity/fake/governancerules_server.go deleted file mode 100644 index df9e1741c2c4..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/governancerules_server.go +++ /dev/null @@ -1,352 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" - "reflect" - "regexp" -) - -// GovernanceRulesServer is a fake server for instances of the armsecurity.GovernanceRulesClient type. -type GovernanceRulesServer struct { - // CreateOrUpdate is the fake for method GovernanceRulesClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - CreateOrUpdate func(ctx context.Context, scope string, ruleID string, governanceRule armsecurity.GovernanceRule, options *armsecurity.GovernanceRulesClientCreateOrUpdateOptions) (resp azfake.Responder[armsecurity.GovernanceRulesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method GovernanceRulesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - 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 - 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 - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, scope string, ruleID string, options *armsecurity.GovernanceRulesClientGetOptions) (resp azfake.Responder[armsecurity.GovernanceRulesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method GovernanceRulesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(scope string, options *armsecurity.GovernanceRulesClientListOptions) (resp azfake.PagerResponder[armsecurity.GovernanceRulesClientListResponse]) - - // OperationResults is the fake for method GovernanceRulesClient.OperationResults - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - OperationResults func(ctx context.Context, scope string, ruleID string, operationID string, options *armsecurity.GovernanceRulesClientOperationResultsOptions) (resp azfake.Responder[armsecurity.GovernanceRulesClientOperationResultsResponse], errResp azfake.ErrorResponder) -} - -// NewGovernanceRulesServerTransport creates a new instance of GovernanceRulesServerTransport with the provided implementation. -// The returned GovernanceRulesServerTransport instance is connected to an instance of armsecurity.GovernanceRulesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewGovernanceRulesServerTransport(srv *GovernanceRulesServer) *GovernanceRulesServerTransport { - return &GovernanceRulesServerTransport{ - srv: srv, - beginDelete: newTracker[azfake.PollerResponder[armsecurity.GovernanceRulesClientDeleteResponse]](), - beginExecute: newTracker[azfake.PollerResponder[armsecurity.GovernanceRulesClientExecuteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armsecurity.GovernanceRulesClientListResponse]](), - } -} - -// GovernanceRulesServerTransport connects instances of armsecurity.GovernanceRulesClient to instances of GovernanceRulesServer. -// Don't use this type directly, use NewGovernanceRulesServerTransport instead. -type GovernanceRulesServerTransport struct { - srv *GovernanceRulesServer - beginDelete *tracker[azfake.PollerResponder[armsecurity.GovernanceRulesClientDeleteResponse]] - beginExecute *tracker[azfake.PollerResponder[armsecurity.GovernanceRulesClientExecuteResponse]] - newListPager *tracker[azfake.PagerResponder[armsecurity.GovernanceRulesClientListResponse]] -} - -// Do implements the policy.Transporter interface for GovernanceRulesServerTransport. -func (g *GovernanceRulesServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (g *GovernanceRulesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if g.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.GovernanceRule](req) - if err != nil { - return nil, err - } - scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) - if err != nil { - return nil, err - } - ruleIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleId")]) - if err != nil { - return nil, err - } - respr, errRespr := g.srv.CreateOrUpdate(req.Context(), scopeParam, ruleIDParam, 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).GovernanceRule, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (g *GovernanceRulesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if g.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - beginDelete := g.beginDelete.get(req) - if beginDelete == nil { - 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 { - 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 - } - ruleIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleId")]) - if err != nil { - return nil, err - } - respr, errRespr := g.srv.BeginDelete(req.Context(), scopeParam, ruleIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginDelete = &respr - g.beginDelete.add(req, beginDelete) - } - - resp, err := server.PollerResponderNext(beginDelete, req) - if err != nil { - return nil, err - } - - if !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)} - } - if !server.PollerResponderMore(beginDelete) { - g.beginDelete.remove(req) - } - - return resp, nil -} - -func (g *GovernanceRulesServerTransport) dispatchBeginExecute(req *http.Request) (*http.Response, error) { - if g.srv.BeginExecute == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginExecute not implemented")} - } - beginExecute := g.beginExecute.get(req) - if beginExecute == nil { - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.ExecuteGovernanceRuleParams](req) - if err != nil { - return nil, err - } - scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) - if err != nil { - return nil, err - } - ruleIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleId")]) - if err != nil { - return nil, err - } - var options *armsecurity.GovernanceRulesClientBeginExecuteOptions - if !reflect.ValueOf(body).IsZero() { - options = &armsecurity.GovernanceRulesClientBeginExecuteOptions{ - ExecuteGovernanceRuleParams: &body, - } - } - respr, errRespr := g.srv.BeginExecute(req.Context(), scopeParam, ruleIDParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginExecute = &respr - g.beginExecute.add(req, beginExecute) - } - - resp, err := server.PollerResponderNext(beginExecute, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { - g.beginExecute.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginExecute) { - g.beginExecute.remove(req) - } - - return resp, nil -} - -func (g *GovernanceRulesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if g.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - 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 { - 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 - } - ruleIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleId")]) - if err != nil { - return nil, err - } - respr, errRespr := g.srv.Get(req.Context(), scopeParam, ruleIDParam, 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).GovernanceRule, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (g *GovernanceRulesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if g.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := g.newListPager.get(req) - if newListPager == nil { - 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 { - 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 := g.srv.NewListPager(scopeParam, nil) - newListPager = &resp - g.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.GovernanceRulesClientListResponse, 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) { - g.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - g.newListPager.remove(req) - } - return resp, nil -} - -func (g *GovernanceRulesServerTransport) dispatchOperationResults(req *http.Request) (*http.Response, error) { - if g.srv.OperationResults == nil { - return nil, &nonRetriableError{errors.New("fake for method OperationResults not implemented")} - } - 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 { - 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 - } - ruleIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleId")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := g.srv.OperationResults(req.Context(), scopeParam, ruleIDParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !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) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).Location; val != nil { - resp.Header.Set("location", *val) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/healthreports_server.go b/sdk/resourcemanager/security/armsecurity/fake/healthreports_server.go deleted file mode 100644 index a6392e906238..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/healthreports_server.go +++ /dev/null @@ -1,148 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// HealthReportsServer is a fake server for instances of the armsecurity.HealthReportsClient type. -type HealthReportsServer struct { - // Get is the fake for method HealthReportsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceID string, healthReportName string, options *armsecurity.HealthReportsClientGetOptions) (resp azfake.Responder[armsecurity.HealthReportsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method HealthReportsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(scope string, options *armsecurity.HealthReportsClientListOptions) (resp azfake.PagerResponder[armsecurity.HealthReportsClientListResponse]) -} - -// NewHealthReportsServerTransport creates a new instance of HealthReportsServerTransport with the provided implementation. -// The returned HealthReportsServerTransport instance is connected to an instance of armsecurity.HealthReportsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewHealthReportsServerTransport(srv *HealthReportsServer) *HealthReportsServerTransport { - return &HealthReportsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.HealthReportsClientListResponse]](), - } -} - -// HealthReportsServerTransport connects instances of armsecurity.HealthReportsClient to instances of HealthReportsServer. -// Don't use this type directly, use NewHealthReportsServerTransport instead. -type HealthReportsServerTransport struct { - srv *HealthReportsServer - newListPager *tracker[azfake.PagerResponder[armsecurity.HealthReportsClientListResponse]] -} - -// Do implements the policy.Transporter interface for HealthReportsServerTransport. -func (h *HealthReportsServerTransport) 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 "HealthReportsClient.Get": - resp, err = h.dispatchGet(req) - case "HealthReportsClient.NewListPager": - resp, err = h.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (h *HealthReportsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if h.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - 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 { - 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 - } - healthReportNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("healthReportName")]) - if err != nil { - return nil, err - } - respr, errRespr := h.srv.Get(req.Context(), resourceIDParam, healthReportNameParam, 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).HealthReport, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (h *HealthReportsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if h.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := h.newListPager.get(req) - if newListPager == nil { - 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 { - 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 := h.srv.NewListPager(scopeParam, nil) - newListPager = &resp - h.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.HealthReportsClientListResponse, 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) { - h.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - h.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/informationprotectionpolicies_server.go b/sdk/resourcemanager/security/armsecurity/fake/informationprotectionpolicies_server.go deleted file mode 100644 index b7401c808ecc..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/informationprotectionpolicies_server.go +++ /dev/null @@ -1,203 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// InformationProtectionPoliciesServer is a fake server for instances of the armsecurity.InformationProtectionPoliciesClient type. -type InformationProtectionPoliciesServer struct { - // CreateOrUpdate is the fake for method InformationProtectionPoliciesClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - CreateOrUpdate func(ctx context.Context, scope string, informationProtectionPolicyName armsecurity.InformationProtectionPolicyName, informationProtectionPolicy armsecurity.InformationProtectionPolicy, options *armsecurity.InformationProtectionPoliciesClientCreateOrUpdateOptions) (resp azfake.Responder[armsecurity.InformationProtectionPoliciesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method InformationProtectionPoliciesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, scope string, informationProtectionPolicyName armsecurity.InformationProtectionPolicyName, options *armsecurity.InformationProtectionPoliciesClientGetOptions) (resp azfake.Responder[armsecurity.InformationProtectionPoliciesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method InformationProtectionPoliciesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(scope string, options *armsecurity.InformationProtectionPoliciesClientListOptions) (resp azfake.PagerResponder[armsecurity.InformationProtectionPoliciesClientListResponse]) -} - -// NewInformationProtectionPoliciesServerTransport creates a new instance of InformationProtectionPoliciesServerTransport with the provided implementation. -// The returned InformationProtectionPoliciesServerTransport instance is connected to an instance of armsecurity.InformationProtectionPoliciesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewInformationProtectionPoliciesServerTransport(srv *InformationProtectionPoliciesServer) *InformationProtectionPoliciesServerTransport { - return &InformationProtectionPoliciesServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.InformationProtectionPoliciesClientListResponse]](), - } -} - -// InformationProtectionPoliciesServerTransport connects instances of armsecurity.InformationProtectionPoliciesClient to instances of InformationProtectionPoliciesServer. -// Don't use this type directly, use NewInformationProtectionPoliciesServerTransport instead. -type InformationProtectionPoliciesServerTransport struct { - srv *InformationProtectionPoliciesServer - newListPager *tracker[azfake.PagerResponder[armsecurity.InformationProtectionPoliciesClientListResponse]] -} - -// Do implements the policy.Transporter interface for InformationProtectionPoliciesServerTransport. -func (i *InformationProtectionPoliciesServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (i *InformationProtectionPoliciesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if i.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.InformationProtectionPolicy](req) - if err != nil { - return nil, err - } - scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) - if err != nil { - return nil, err - } - informationProtectionPolicyNameParam, err := parseWithCast(matches[regex.SubexpIndex("informationProtectionPolicyName")], func(v string) (armsecurity.InformationProtectionPolicyName, error) { - p, unescapeErr := url.PathUnescape(v) - if unescapeErr != nil { - return "", unescapeErr - } - return armsecurity.InformationProtectionPolicyName(p), nil - }) - if err != nil { - return nil, err - } - respr, errRespr := i.srv.CreateOrUpdate(req.Context(), scopeParam, informationProtectionPolicyNameParam, 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).InformationProtectionPolicy, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (i *InformationProtectionPoliciesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if i.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - 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 { - 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 - } - informationProtectionPolicyNameParam, err := parseWithCast(matches[regex.SubexpIndex("informationProtectionPolicyName")], func(v string) (armsecurity.InformationProtectionPolicyName, error) { - p, unescapeErr := url.PathUnescape(v) - if unescapeErr != nil { - return "", unescapeErr - } - return armsecurity.InformationProtectionPolicyName(p), nil - }) - if err != nil { - return nil, err - } - respr, errRespr := i.srv.Get(req.Context(), scopeParam, informationProtectionPolicyNameParam, 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).InformationProtectionPolicy, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (i *InformationProtectionPoliciesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if i.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := i.newListPager.get(req) - if newListPager == nil { - 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 { - 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 := i.srv.NewListPager(scopeParam, nil) - newListPager = &resp - i.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.InformationProtectionPoliciesClientListResponse, 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) { - i.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - i.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/internal.go b/sdk/resourcemanager/security/armsecurity/fake/internal.go index 40041750dbe9..0fc1237f39d8 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/internal.go +++ b/sdk/resourcemanager/security/armsecurity/fake/internal.go @@ -8,14 +8,6 @@ package fake -import ( - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "io" - "net/http" - "reflect" - "sync" -) - type nonRetriableError struct { error } @@ -33,24 +25,6 @@ func contains[T comparable](s []T, v T) bool { return false } -func getOptional[T any](v T) *T { - if reflect.ValueOf(v).IsZero() { - return nil - } - return &v -} - -func parseOptional[T any](v string, parse func(v string) (T, error)) (*T, error) { - if v == "" { - return nil, nil - } - t, err := parse(v) - if err != nil { - return nil, err - } - return &t, err -} - func parseWithCast[T any](v string, parse func(v string) (T, error)) (T, error) { t, err := parse(v) if err != nil { @@ -58,47 +32,3 @@ func parseWithCast[T any](v string, parse func(v string) (T, error)) (T, error) } return t, err } - -func readRequestBody(req *http.Request) ([]byte, error) { - if req.Body == nil { - return nil, nil - } - body, err := io.ReadAll(req.Body) - if err != nil { - return nil, err - } - req.Body.Close() - return body, nil -} - -func newTracker[T any]() *tracker[T] { - return &tracker[T]{ - items: map[string]*T{}, - } -} - -type tracker[T any] struct { - items map[string]*T - mu sync.Mutex -} - -func (p *tracker[T]) get(req *http.Request) *T { - p.mu.Lock() - defer p.mu.Unlock() - if item, ok := p.items[server.SanitizePagerPollerPath(req.URL.Path)]; ok { - return item - } - return nil -} - -func (p *tracker[T]) add(req *http.Request, item *T) { - p.mu.Lock() - defer p.mu.Unlock() - p.items[server.SanitizePagerPollerPath(req.URL.Path)] = item -} - -func (p *tracker[T]) remove(req *http.Request) { - p.mu.Lock() - defer p.mu.Unlock() - delete(p.items, server.SanitizePagerPollerPath(req.URL.Path)) -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolution_server.go b/sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolution_server.go deleted file mode 100644 index b04e15637707..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolution_server.go +++ /dev/null @@ -1,338 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// IotSecuritySolutionServer is a fake server for instances of the armsecurity.IotSecuritySolutionClient type. -type IotSecuritySolutionServer struct { - // CreateOrUpdate is the fake for method IotSecuritySolutionClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - CreateOrUpdate func(ctx context.Context, resourceGroupName string, solutionName string, iotSecuritySolutionData armsecurity.IoTSecuritySolutionModel, options *armsecurity.IotSecuritySolutionClientCreateOrUpdateOptions) (resp azfake.Responder[armsecurity.IotSecuritySolutionClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method IotSecuritySolutionClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, solutionName string, options *armsecurity.IotSecuritySolutionClientDeleteOptions) (resp azfake.Responder[armsecurity.IotSecuritySolutionClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method IotSecuritySolutionClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, solutionName string, options *armsecurity.IotSecuritySolutionClientGetOptions) (resp azfake.Responder[armsecurity.IotSecuritySolutionClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByResourceGroupPager is the fake for method IotSecuritySolutionClient.NewListByResourceGroupPager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, options *armsecurity.IotSecuritySolutionClientListByResourceGroupOptions) (resp azfake.PagerResponder[armsecurity.IotSecuritySolutionClientListByResourceGroupResponse]) - - // NewListBySubscriptionPager is the fake for method IotSecuritySolutionClient.NewListBySubscriptionPager - // HTTP status codes to indicate success: http.StatusOK - NewListBySubscriptionPager func(options *armsecurity.IotSecuritySolutionClientListBySubscriptionOptions) (resp azfake.PagerResponder[armsecurity.IotSecuritySolutionClientListBySubscriptionResponse]) - - // Update is the fake for method IotSecuritySolutionClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, solutionName string, updateIotSecuritySolutionData armsecurity.UpdateIotSecuritySolutionData, options *armsecurity.IotSecuritySolutionClientUpdateOptions) (resp azfake.Responder[armsecurity.IotSecuritySolutionClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewIotSecuritySolutionServerTransport creates a new instance of IotSecuritySolutionServerTransport with the provided implementation. -// The returned IotSecuritySolutionServerTransport instance is connected to an instance of armsecurity.IotSecuritySolutionClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewIotSecuritySolutionServerTransport(srv *IotSecuritySolutionServer) *IotSecuritySolutionServerTransport { - return &IotSecuritySolutionServerTransport{ - srv: srv, - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armsecurity.IotSecuritySolutionClientListByResourceGroupResponse]](), - newListBySubscriptionPager: newTracker[azfake.PagerResponder[armsecurity.IotSecuritySolutionClientListBySubscriptionResponse]](), - } -} - -// IotSecuritySolutionServerTransport connects instances of armsecurity.IotSecuritySolutionClient to instances of IotSecuritySolutionServer. -// Don't use this type directly, use NewIotSecuritySolutionServerTransport instead. -type IotSecuritySolutionServerTransport struct { - srv *IotSecuritySolutionServer - newListByResourceGroupPager *tracker[azfake.PagerResponder[armsecurity.IotSecuritySolutionClientListByResourceGroupResponse]] - newListBySubscriptionPager *tracker[azfake.PagerResponder[armsecurity.IotSecuritySolutionClientListBySubscriptionResponse]] -} - -// Do implements the policy.Transporter interface for IotSecuritySolutionServerTransport. -func (i *IotSecuritySolutionServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (i *IotSecuritySolutionServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if i.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/iotSecuritySolutions/(?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.IoTSecuritySolutionModel](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - solutionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("solutionName")]) - if err != nil { - return nil, err - } - respr, errRespr := i.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, solutionNameParam, 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).IoTSecuritySolutionModel, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (i *IotSecuritySolutionServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if i.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/iotSecuritySolutions/(?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 - } - solutionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("solutionName")]) - if err != nil { - return nil, err - } - respr, errRespr := i.srv.Delete(req.Context(), resourceGroupNameParam, solutionNameParam, 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 (i *IotSecuritySolutionServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if i.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/iotSecuritySolutions/(?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 - } - solutionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("solutionName")]) - if err != nil { - return nil, err - } - respr, errRespr := i.srv.Get(req.Context(), resourceGroupNameParam, solutionNameParam, 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).IoTSecuritySolutionModel, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (i *IotSecuritySolutionServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { - if i.srv.NewListByResourceGroupPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} - } - newListByResourceGroupPager := i.newListByResourceGroupPager.get(req) - if newListByResourceGroupPager == nil { - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - var options *armsecurity.IotSecuritySolutionClientListByResourceGroupOptions - if filterParam != nil { - options = &armsecurity.IotSecuritySolutionClientListByResourceGroupOptions{ - Filter: filterParam, - } - } - resp := i.srv.NewListByResourceGroupPager(resourceGroupNameParam, options) - newListByResourceGroupPager = &resp - i.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armsecurity.IotSecuritySolutionClientListByResourceGroupResponse, 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) { - i.newListByResourceGroupPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByResourceGroupPager) { - i.newListByResourceGroupPager.remove(req) - } - return resp, nil -} - -func (i *IotSecuritySolutionServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { - if i.srv.NewListBySubscriptionPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} - } - newListBySubscriptionPager := i.newListBySubscriptionPager.get(req) - if newListBySubscriptionPager == nil { - 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 { - 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) - var options *armsecurity.IotSecuritySolutionClientListBySubscriptionOptions - if filterParam != nil { - options = &armsecurity.IotSecuritySolutionClientListBySubscriptionOptions{ - Filter: filterParam, - } - } - resp := i.srv.NewListBySubscriptionPager(options) - newListBySubscriptionPager = &resp - i.newListBySubscriptionPager.add(req, newListBySubscriptionPager) - server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armsecurity.IotSecuritySolutionClientListBySubscriptionResponse, 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) { - i.newListBySubscriptionPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListBySubscriptionPager) { - i.newListBySubscriptionPager.remove(req) - } - return resp, nil -} - -func (i *IotSecuritySolutionServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if i.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/iotSecuritySolutions/(?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.UpdateIotSecuritySolutionData](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - solutionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("solutionName")]) - if err != nil { - return nil, err - } - respr, errRespr := i.srv.Update(req.Context(), resourceGroupNameParam, solutionNameParam, 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).IoTSecuritySolutionModel, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolutionanalytics_server.go b/sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolutionanalytics_server.go deleted file mode 100644 index e72af2df67e6..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolutionanalytics_server.go +++ /dev/null @@ -1,139 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// IotSecuritySolutionAnalyticsServer is a fake server for instances of the armsecurity.IotSecuritySolutionAnalyticsClient type. -type IotSecuritySolutionAnalyticsServer struct { - // Get is the fake for method IotSecuritySolutionAnalyticsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, solutionName string, options *armsecurity.IotSecuritySolutionAnalyticsClientGetOptions) (resp azfake.Responder[armsecurity.IotSecuritySolutionAnalyticsClientGetResponse], errResp azfake.ErrorResponder) - - // List is the fake for method IotSecuritySolutionAnalyticsClient.List - // HTTP status codes to indicate success: http.StatusOK - List func(ctx context.Context, resourceGroupName string, solutionName string, options *armsecurity.IotSecuritySolutionAnalyticsClientListOptions) (resp azfake.Responder[armsecurity.IotSecuritySolutionAnalyticsClientListResponse], errResp azfake.ErrorResponder) -} - -// NewIotSecuritySolutionAnalyticsServerTransport creates a new instance of IotSecuritySolutionAnalyticsServerTransport with the provided implementation. -// The returned IotSecuritySolutionAnalyticsServerTransport instance is connected to an instance of armsecurity.IotSecuritySolutionAnalyticsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewIotSecuritySolutionAnalyticsServerTransport(srv *IotSecuritySolutionAnalyticsServer) *IotSecuritySolutionAnalyticsServerTransport { - return &IotSecuritySolutionAnalyticsServerTransport{srv: srv} -} - -// IotSecuritySolutionAnalyticsServerTransport connects instances of armsecurity.IotSecuritySolutionAnalyticsClient to instances of IotSecuritySolutionAnalyticsServer. -// Don't use this type directly, use NewIotSecuritySolutionAnalyticsServerTransport instead. -type IotSecuritySolutionAnalyticsServerTransport struct { - srv *IotSecuritySolutionAnalyticsServer -} - -// Do implements the policy.Transporter interface for IotSecuritySolutionAnalyticsServerTransport. -func (i *IotSecuritySolutionAnalyticsServerTransport) 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 "IotSecuritySolutionAnalyticsClient.Get": - resp, err = i.dispatchGet(req) - case "IotSecuritySolutionAnalyticsClient.List": - resp, err = i.dispatchList(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (i *IotSecuritySolutionAnalyticsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if i.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/iotSecuritySolutions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/analyticsModels/default` - 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 - } - solutionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("solutionName")]) - if err != nil { - return nil, err - } - respr, errRespr := i.srv.Get(req.Context(), resourceGroupNameParam, solutionNameParam, 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).IoTSecuritySolutionAnalyticsModel, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (i *IotSecuritySolutionAnalyticsServerTransport) dispatchList(req *http.Request) (*http.Response, error) { - if i.srv.List == nil { - return nil, &nonRetriableError{errors.New("fake for method List not implemented")} - } - 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 { - 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 - } - solutionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("solutionName")]) - if err != nil { - return nil, err - } - respr, errRespr := i.srv.List(req.Context(), resourceGroupNameParam, solutionNameParam, 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).IoTSecuritySolutionAnalyticsModelList, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolutionsanalyticsaggregatedalert_server.go b/sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolutionsanalyticsaggregatedalert_server.go deleted file mode 100644 index f111382454be..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolutionsanalyticsaggregatedalert_server.go +++ /dev/null @@ -1,221 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" - "strconv" -) - -// IotSecuritySolutionsAnalyticsAggregatedAlertServer is a fake server for instances of the armsecurity.IotSecuritySolutionsAnalyticsAggregatedAlertClient type. -type IotSecuritySolutionsAnalyticsAggregatedAlertServer struct { - // Dismiss is the fake for method IotSecuritySolutionsAnalyticsAggregatedAlertClient.Dismiss - // HTTP status codes to indicate success: http.StatusOK - Dismiss func(ctx context.Context, resourceGroupName string, solutionName string, aggregatedAlertName string, options *armsecurity.IotSecuritySolutionsAnalyticsAggregatedAlertClientDismissOptions) (resp azfake.Responder[armsecurity.IotSecuritySolutionsAnalyticsAggregatedAlertClientDismissResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method IotSecuritySolutionsAnalyticsAggregatedAlertClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, solutionName string, aggregatedAlertName string, options *armsecurity.IotSecuritySolutionsAnalyticsAggregatedAlertClientGetOptions) (resp azfake.Responder[armsecurity.IotSecuritySolutionsAnalyticsAggregatedAlertClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method IotSecuritySolutionsAnalyticsAggregatedAlertClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, solutionName string, options *armsecurity.IotSecuritySolutionsAnalyticsAggregatedAlertClientListOptions) (resp azfake.PagerResponder[armsecurity.IotSecuritySolutionsAnalyticsAggregatedAlertClientListResponse]) -} - -// NewIotSecuritySolutionsAnalyticsAggregatedAlertServerTransport creates a new instance of IotSecuritySolutionsAnalyticsAggregatedAlertServerTransport with the provided implementation. -// The returned IotSecuritySolutionsAnalyticsAggregatedAlertServerTransport instance is connected to an instance of armsecurity.IotSecuritySolutionsAnalyticsAggregatedAlertClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewIotSecuritySolutionsAnalyticsAggregatedAlertServerTransport(srv *IotSecuritySolutionsAnalyticsAggregatedAlertServer) *IotSecuritySolutionsAnalyticsAggregatedAlertServerTransport { - return &IotSecuritySolutionsAnalyticsAggregatedAlertServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.IotSecuritySolutionsAnalyticsAggregatedAlertClientListResponse]](), - } -} - -// IotSecuritySolutionsAnalyticsAggregatedAlertServerTransport connects instances of armsecurity.IotSecuritySolutionsAnalyticsAggregatedAlertClient to instances of IotSecuritySolutionsAnalyticsAggregatedAlertServer. -// Don't use this type directly, use NewIotSecuritySolutionsAnalyticsAggregatedAlertServerTransport instead. -type IotSecuritySolutionsAnalyticsAggregatedAlertServerTransport struct { - srv *IotSecuritySolutionsAnalyticsAggregatedAlertServer - newListPager *tracker[azfake.PagerResponder[armsecurity.IotSecuritySolutionsAnalyticsAggregatedAlertClientListResponse]] -} - -// Do implements the policy.Transporter interface for IotSecuritySolutionsAnalyticsAggregatedAlertServerTransport. -func (i *IotSecuritySolutionsAnalyticsAggregatedAlertServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (i *IotSecuritySolutionsAnalyticsAggregatedAlertServerTransport) dispatchDismiss(req *http.Request) (*http.Response, error) { - if i.srv.Dismiss == nil { - return nil, &nonRetriableError{errors.New("fake for method Dismiss not implemented")} - } - 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 { - 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 - } - solutionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("solutionName")]) - if err != nil { - return nil, err - } - aggregatedAlertNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("aggregatedAlertName")]) - if err != nil { - return nil, err - } - respr, errRespr := i.srv.Dismiss(req.Context(), resourceGroupNameParam, solutionNameParam, aggregatedAlertNameParam, 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.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (i *IotSecuritySolutionsAnalyticsAggregatedAlertServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if i.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/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 { - 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 - } - solutionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("solutionName")]) - if err != nil { - return nil, err - } - aggregatedAlertNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("aggregatedAlertName")]) - if err != nil { - return nil, err - } - respr, errRespr := i.srv.Get(req.Context(), resourceGroupNameParam, solutionNameParam, aggregatedAlertNameParam, 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).IoTSecurityAggregatedAlert, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (i *IotSecuritySolutionsAnalyticsAggregatedAlertServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if i.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := i.newListPager.get(req) - if newListPager == nil { - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - solutionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("solutionName")]) - if err != nil { - return nil, err - } - topUnescaped, err := url.QueryUnescape(qp.Get("$top")) - if err != nil { - return nil, err - } - topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { - p, parseErr := strconv.ParseInt(v, 10, 32) - if parseErr != nil { - return 0, parseErr - } - return int32(p), nil - }) - if err != nil { - return nil, err - } - var options *armsecurity.IotSecuritySolutionsAnalyticsAggregatedAlertClientListOptions - if topParam != nil { - options = &armsecurity.IotSecuritySolutionsAnalyticsAggregatedAlertClientListOptions{ - Top: topParam, - } - } - resp := i.srv.NewListPager(resourceGroupNameParam, solutionNameParam, options) - newListPager = &resp - i.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.IotSecuritySolutionsAnalyticsAggregatedAlertClientListResponse, 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) { - i.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - i.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolutionsanalyticsrecommendation_server.go b/sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolutionsanalyticsrecommendation_server.go deleted file mode 100644 index d99b15a61679..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolutionsanalyticsrecommendation_server.go +++ /dev/null @@ -1,178 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" - "strconv" -) - -// IotSecuritySolutionsAnalyticsRecommendationServer is a fake server for instances of the armsecurity.IotSecuritySolutionsAnalyticsRecommendationClient type. -type IotSecuritySolutionsAnalyticsRecommendationServer struct { - // Get is the fake for method IotSecuritySolutionsAnalyticsRecommendationClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, solutionName string, aggregatedRecommendationName string, options *armsecurity.IotSecuritySolutionsAnalyticsRecommendationClientGetOptions) (resp azfake.Responder[armsecurity.IotSecuritySolutionsAnalyticsRecommendationClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method IotSecuritySolutionsAnalyticsRecommendationClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, solutionName string, options *armsecurity.IotSecuritySolutionsAnalyticsRecommendationClientListOptions) (resp azfake.PagerResponder[armsecurity.IotSecuritySolutionsAnalyticsRecommendationClientListResponse]) -} - -// NewIotSecuritySolutionsAnalyticsRecommendationServerTransport creates a new instance of IotSecuritySolutionsAnalyticsRecommendationServerTransport with the provided implementation. -// The returned IotSecuritySolutionsAnalyticsRecommendationServerTransport instance is connected to an instance of armsecurity.IotSecuritySolutionsAnalyticsRecommendationClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewIotSecuritySolutionsAnalyticsRecommendationServerTransport(srv *IotSecuritySolutionsAnalyticsRecommendationServer) *IotSecuritySolutionsAnalyticsRecommendationServerTransport { - return &IotSecuritySolutionsAnalyticsRecommendationServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.IotSecuritySolutionsAnalyticsRecommendationClientListResponse]](), - } -} - -// IotSecuritySolutionsAnalyticsRecommendationServerTransport connects instances of armsecurity.IotSecuritySolutionsAnalyticsRecommendationClient to instances of IotSecuritySolutionsAnalyticsRecommendationServer. -// Don't use this type directly, use NewIotSecuritySolutionsAnalyticsRecommendationServerTransport instead. -type IotSecuritySolutionsAnalyticsRecommendationServerTransport struct { - srv *IotSecuritySolutionsAnalyticsRecommendationServer - newListPager *tracker[azfake.PagerResponder[armsecurity.IotSecuritySolutionsAnalyticsRecommendationClientListResponse]] -} - -// Do implements the policy.Transporter interface for IotSecuritySolutionsAnalyticsRecommendationServerTransport. -func (i *IotSecuritySolutionsAnalyticsRecommendationServerTransport) 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 "IotSecuritySolutionsAnalyticsRecommendationClient.Get": - resp, err = i.dispatchGet(req) - case "IotSecuritySolutionsAnalyticsRecommendationClient.NewListPager": - resp, err = i.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (i *IotSecuritySolutionsAnalyticsRecommendationServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if i.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/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 { - 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 - } - solutionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("solutionName")]) - if err != nil { - return nil, err - } - aggregatedRecommendationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("aggregatedRecommendationName")]) - if err != nil { - return nil, err - } - respr, errRespr := i.srv.Get(req.Context(), resourceGroupNameParam, solutionNameParam, aggregatedRecommendationNameParam, 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).IoTSecurityAggregatedRecommendation, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (i *IotSecuritySolutionsAnalyticsRecommendationServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if i.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := i.newListPager.get(req) - if newListPager == nil { - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - solutionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("solutionName")]) - if err != nil { - return nil, err - } - topUnescaped, err := url.QueryUnescape(qp.Get("$top")) - if err != nil { - return nil, err - } - topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { - p, parseErr := strconv.ParseInt(v, 10, 32) - if parseErr != nil { - return 0, parseErr - } - return int32(p), nil - }) - if err != nil { - return nil, err - } - var options *armsecurity.IotSecuritySolutionsAnalyticsRecommendationClientListOptions - if topParam != nil { - options = &armsecurity.IotSecuritySolutionsAnalyticsRecommendationClientListOptions{ - Top: topParam, - } - } - resp := i.srv.NewListPager(resourceGroupNameParam, solutionNameParam, options) - newListPager = &resp - i.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.IotSecuritySolutionsAnalyticsRecommendationClientListResponse, 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) { - i.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - i.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/jitnetworkaccesspolicies_server.go b/sdk/resourcemanager/security/armsecurity/fake/jitnetworkaccesspolicies_server.go deleted file mode 100644 index d2f5091ccb01..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/jitnetworkaccesspolicies_server.go +++ /dev/null @@ -1,424 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// JitNetworkAccessPoliciesServer is a fake server for instances of the armsecurity.JitNetworkAccessPoliciesClient type. -type JitNetworkAccessPoliciesServer struct { - // CreateOrUpdate is the fake for method JitNetworkAccessPoliciesClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK - CreateOrUpdate func(ctx context.Context, resourceGroupName string, ascLocation string, jitNetworkAccessPolicyName string, body armsecurity.JitNetworkAccessPolicy, options *armsecurity.JitNetworkAccessPoliciesClientCreateOrUpdateOptions) (resp azfake.Responder[armsecurity.JitNetworkAccessPoliciesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method JitNetworkAccessPoliciesClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, ascLocation string, jitNetworkAccessPolicyName string, options *armsecurity.JitNetworkAccessPoliciesClientDeleteOptions) (resp azfake.Responder[armsecurity.JitNetworkAccessPoliciesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method JitNetworkAccessPoliciesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, ascLocation string, jitNetworkAccessPolicyName string, options *armsecurity.JitNetworkAccessPoliciesClientGetOptions) (resp azfake.Responder[armsecurity.JitNetworkAccessPoliciesClientGetResponse], errResp azfake.ErrorResponder) - - // Initiate is the fake for method JitNetworkAccessPoliciesClient.Initiate - // HTTP status codes to indicate success: http.StatusAccepted - Initiate func(ctx context.Context, resourceGroupName string, ascLocation string, jitNetworkAccessPolicyName string, body armsecurity.JitNetworkAccessPolicyInitiateRequest, options *armsecurity.JitNetworkAccessPoliciesClientInitiateOptions) (resp azfake.Responder[armsecurity.JitNetworkAccessPoliciesClientInitiateResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method JitNetworkAccessPoliciesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armsecurity.JitNetworkAccessPoliciesClientListOptions) (resp azfake.PagerResponder[armsecurity.JitNetworkAccessPoliciesClientListResponse]) - - // NewListByRegionPager is the fake for method JitNetworkAccessPoliciesClient.NewListByRegionPager - // HTTP status codes to indicate success: http.StatusOK - NewListByRegionPager func(ascLocation string, options *armsecurity.JitNetworkAccessPoliciesClientListByRegionOptions) (resp azfake.PagerResponder[armsecurity.JitNetworkAccessPoliciesClientListByRegionResponse]) - - // NewListByResourceGroupPager is the fake for method JitNetworkAccessPoliciesClient.NewListByResourceGroupPager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, options *armsecurity.JitNetworkAccessPoliciesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armsecurity.JitNetworkAccessPoliciesClientListByResourceGroupResponse]) - - // NewListByResourceGroupAndRegionPager is the fake for method JitNetworkAccessPoliciesClient.NewListByResourceGroupAndRegionPager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupAndRegionPager func(resourceGroupName string, ascLocation string, options *armsecurity.JitNetworkAccessPoliciesClientListByResourceGroupAndRegionOptions) (resp azfake.PagerResponder[armsecurity.JitNetworkAccessPoliciesClientListByResourceGroupAndRegionResponse]) -} - -// NewJitNetworkAccessPoliciesServerTransport creates a new instance of JitNetworkAccessPoliciesServerTransport with the provided implementation. -// The returned JitNetworkAccessPoliciesServerTransport instance is connected to an instance of armsecurity.JitNetworkAccessPoliciesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewJitNetworkAccessPoliciesServerTransport(srv *JitNetworkAccessPoliciesServer) *JitNetworkAccessPoliciesServerTransport { - return &JitNetworkAccessPoliciesServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.JitNetworkAccessPoliciesClientListResponse]](), - newListByRegionPager: newTracker[azfake.PagerResponder[armsecurity.JitNetworkAccessPoliciesClientListByRegionResponse]](), - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armsecurity.JitNetworkAccessPoliciesClientListByResourceGroupResponse]](), - newListByResourceGroupAndRegionPager: newTracker[azfake.PagerResponder[armsecurity.JitNetworkAccessPoliciesClientListByResourceGroupAndRegionResponse]](), - } -} - -// JitNetworkAccessPoliciesServerTransport connects instances of armsecurity.JitNetworkAccessPoliciesClient to instances of JitNetworkAccessPoliciesServer. -// Don't use this type directly, use NewJitNetworkAccessPoliciesServerTransport instead. -type JitNetworkAccessPoliciesServerTransport struct { - srv *JitNetworkAccessPoliciesServer - newListPager *tracker[azfake.PagerResponder[armsecurity.JitNetworkAccessPoliciesClientListResponse]] - newListByRegionPager *tracker[azfake.PagerResponder[armsecurity.JitNetworkAccessPoliciesClientListByRegionResponse]] - newListByResourceGroupPager *tracker[azfake.PagerResponder[armsecurity.JitNetworkAccessPoliciesClientListByResourceGroupResponse]] - newListByResourceGroupAndRegionPager *tracker[azfake.PagerResponder[armsecurity.JitNetworkAccessPoliciesClientListByResourceGroupAndRegionResponse]] -} - -// Do implements the policy.Transporter interface for JitNetworkAccessPoliciesServerTransport. -func (j *JitNetworkAccessPoliciesServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (j *JitNetworkAccessPoliciesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if j.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/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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.JitNetworkAccessPolicy](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) - if err != nil { - return nil, err - } - jitNetworkAccessPolicyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("jitNetworkAccessPolicyName")]) - if err != nil { - return nil, err - } - respr, errRespr := j.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, ascLocationParam, jitNetworkAccessPolicyNameParam, 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).JitNetworkAccessPolicy, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (j *JitNetworkAccessPoliciesServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if j.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/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 { - 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 - } - ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) - if err != nil { - return nil, err - } - jitNetworkAccessPolicyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("jitNetworkAccessPolicyName")]) - if err != nil { - return nil, err - } - respr, errRespr := j.srv.Delete(req.Context(), resourceGroupNameParam, ascLocationParam, jitNetworkAccessPolicyNameParam, 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 (j *JitNetworkAccessPoliciesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if j.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/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 { - 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 - } - ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) - if err != nil { - return nil, err - } - jitNetworkAccessPolicyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("jitNetworkAccessPolicyName")]) - if err != nil { - return nil, err - } - respr, errRespr := j.srv.Get(req.Context(), resourceGroupNameParam, ascLocationParam, jitNetworkAccessPolicyNameParam, 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).JitNetworkAccessPolicy, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (j *JitNetworkAccessPoliciesServerTransport) dispatchInitiate(req *http.Request) (*http.Response, error) { - if j.srv.Initiate == nil { - return nil, &nonRetriableError{errors.New("fake for method Initiate not implemented")} - } - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.JitNetworkAccessPolicyInitiateRequest](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) - if err != nil { - return nil, err - } - jitNetworkAccessPolicyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("jitNetworkAccessPolicyName")]) - if err != nil { - return nil, err - } - respr, errRespr := j.srv.Initiate(req.Context(), resourceGroupNameParam, ascLocationParam, jitNetworkAccessPolicyNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !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) - if err != nil { - return nil, err - } - return resp, nil -} - -func (j *JitNetworkAccessPoliciesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if j.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := j.newListPager.get(req) - if newListPager == nil { - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := j.srv.NewListPager(nil) - newListPager = &resp - j.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.JitNetworkAccessPoliciesClientListResponse, 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) { - j.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - j.newListPager.remove(req) - } - return resp, nil -} - -func (j *JitNetworkAccessPoliciesServerTransport) dispatchNewListByRegionPager(req *http.Request) (*http.Response, error) { - if j.srv.NewListByRegionPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByRegionPager not implemented")} - } - newListByRegionPager := j.newListByRegionPager.get(req) - if newListByRegionPager == nil { - 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 { - 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 - } - resp := j.srv.NewListByRegionPager(ascLocationParam, nil) - newListByRegionPager = &resp - j.newListByRegionPager.add(req, newListByRegionPager) - server.PagerResponderInjectNextLinks(newListByRegionPager, req, func(page *armsecurity.JitNetworkAccessPoliciesClientListByRegionResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByRegionPager, req) - if err != nil { - return nil, err - } - if !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)} - } - if !server.PagerResponderMore(newListByRegionPager) { - j.newListByRegionPager.remove(req) - } - return resp, nil -} - -func (j *JitNetworkAccessPoliciesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { - if j.srv.NewListByResourceGroupPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} - } - newListByResourceGroupPager := j.newListByResourceGroupPager.get(req) - if newListByResourceGroupPager == nil { - 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 { - 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 := j.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) - newListByResourceGroupPager = &resp - j.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armsecurity.JitNetworkAccessPoliciesClientListByResourceGroupResponse, 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) { - j.newListByResourceGroupPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByResourceGroupPager) { - j.newListByResourceGroupPager.remove(req) - } - return resp, nil -} - -func (j *JitNetworkAccessPoliciesServerTransport) dispatchNewListByResourceGroupAndRegionPager(req *http.Request) (*http.Response, error) { - if j.srv.NewListByResourceGroupAndRegionPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupAndRegionPager not implemented")} - } - newListByResourceGroupAndRegionPager := j.newListByResourceGroupAndRegionPager.get(req) - if newListByResourceGroupAndRegionPager == nil { - 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 { - 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 - } - ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) - if err != nil { - return nil, err - } - resp := j.srv.NewListByResourceGroupAndRegionPager(resourceGroupNameParam, ascLocationParam, nil) - newListByResourceGroupAndRegionPager = &resp - j.newListByResourceGroupAndRegionPager.add(req, newListByResourceGroupAndRegionPager) - server.PagerResponderInjectNextLinks(newListByResourceGroupAndRegionPager, req, func(page *armsecurity.JitNetworkAccessPoliciesClientListByResourceGroupAndRegionResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByResourceGroupAndRegionPager, req) - if err != nil { - return nil, err - } - if !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)} - } - if !server.PagerResponderMore(newListByResourceGroupAndRegionPager) { - j.newListByResourceGroupAndRegionPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/locations_server.go b/sdk/resourcemanager/security/armsecurity/fake/locations_server.go deleted file mode 100644 index 2499d9eb0c06..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/locations_server.go +++ /dev/null @@ -1,140 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// LocationsServer is a fake server for instances of the armsecurity.LocationsClient type. -type LocationsServer struct { - // Get is the fake for method LocationsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, ascLocation string, options *armsecurity.LocationsClientGetOptions) (resp azfake.Responder[armsecurity.LocationsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method LocationsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armsecurity.LocationsClientListOptions) (resp azfake.PagerResponder[armsecurity.LocationsClientListResponse]) -} - -// NewLocationsServerTransport creates a new instance of LocationsServerTransport with the provided implementation. -// The returned LocationsServerTransport instance is connected to an instance of armsecurity.LocationsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewLocationsServerTransport(srv *LocationsServer) *LocationsServerTransport { - return &LocationsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.LocationsClientListResponse]](), - } -} - -// LocationsServerTransport connects instances of armsecurity.LocationsClient to instances of LocationsServer. -// Don't use this type directly, use NewLocationsServerTransport instead. -type LocationsServerTransport struct { - srv *LocationsServer - newListPager *tracker[azfake.PagerResponder[armsecurity.LocationsClientListResponse]] -} - -// Do implements the policy.Transporter interface for LocationsServerTransport. -func (l *LocationsServerTransport) 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 "LocationsClient.Get": - resp, err = l.dispatchGet(req) - case "LocationsClient.NewListPager": - resp, err = l.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (l *LocationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if l.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~%@]+)` - 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) - } - ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) - if err != nil { - return nil, err - } - respr, errRespr := l.srv.Get(req.Context(), ascLocationParam, 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).AscLocation, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (l *LocationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if l.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := l.newListPager.get(req) - if newListPager == nil { - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := l.srv.NewListPager(nil) - newListPager = &resp - l.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.LocationsClientListResponse, 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) { - l.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - l.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/mdeonboardings_server.go b/sdk/resourcemanager/security/armsecurity/fake/mdeonboardings_server.go deleted file mode 100644 index 51729b233301..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/mdeonboardings_server.go +++ /dev/null @@ -1,122 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" - "regexp" -) - -// MdeOnboardingsServer is a fake server for instances of the armsecurity.MdeOnboardingsClient type. -type MdeOnboardingsServer struct { - // Get is the fake for method MdeOnboardingsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, options *armsecurity.MdeOnboardingsClientGetOptions) (resp azfake.Responder[armsecurity.MdeOnboardingsClientGetResponse], errResp azfake.ErrorResponder) - - // List is the fake for method MdeOnboardingsClient.List - // HTTP status codes to indicate success: http.StatusOK - List func(ctx context.Context, options *armsecurity.MdeOnboardingsClientListOptions) (resp azfake.Responder[armsecurity.MdeOnboardingsClientListResponse], errResp azfake.ErrorResponder) -} - -// NewMdeOnboardingsServerTransport creates a new instance of MdeOnboardingsServerTransport with the provided implementation. -// The returned MdeOnboardingsServerTransport instance is connected to an instance of armsecurity.MdeOnboardingsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewMdeOnboardingsServerTransport(srv *MdeOnboardingsServer) *MdeOnboardingsServerTransport { - return &MdeOnboardingsServerTransport{srv: srv} -} - -// MdeOnboardingsServerTransport connects instances of armsecurity.MdeOnboardingsClient to instances of MdeOnboardingsServer. -// Don't use this type directly, use NewMdeOnboardingsServerTransport instead. -type MdeOnboardingsServerTransport struct { - srv *MdeOnboardingsServer -} - -// Do implements the policy.Transporter interface for MdeOnboardingsServerTransport. -func (m *MdeOnboardingsServerTransport) 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 "MdeOnboardingsClient.Get": - resp, err = m.dispatchGet(req) - case "MdeOnboardingsClient.List": - resp, err = m.dispatchList(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (m *MdeOnboardingsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if m.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/mdeOnboardings/default` - 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) - } - respr, errRespr := m.srv.Get(req.Context(), 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).MdeOnboardingData, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (m *MdeOnboardingsServerTransport) dispatchList(req *http.Request) (*http.Response, error) { - if m.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/mdeOnboardings` - 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) - } - respr, errRespr := m.srv.List(req.Context(), 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).MdeOnboardingDataList, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/operations_server.go b/sdk/resourcemanager/security/armsecurity/fake/operations_server.go deleted file mode 100644 index c4bd7d723bba..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/operations_server.go +++ /dev/null @@ -1,96 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" - "net/http" -) - -// OperationsServer is a fake server for instances of the armsecurity.OperationsClient type. -type OperationsServer struct { - // NewListPager is the fake for method OperationsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armsecurity.OperationsClientListOptions) (resp azfake.PagerResponder[armsecurity.OperationsClientListResponse]) -} - -// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. -// The returned OperationsServerTransport instance is connected to an instance of armsecurity.OperationsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { - return &OperationsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.OperationsClientListResponse]](), - } -} - -// OperationsServerTransport connects instances of armsecurity.OperationsClient to instances of OperationsServer. -// Don't use this type directly, use NewOperationsServerTransport instead. -type OperationsServerTransport struct { - srv *OperationsServer - newListPager *tracker[azfake.PagerResponder[armsecurity.OperationsClientListResponse]] -} - -// Do implements the policy.Transporter interface for OperationsServerTransport. -func (o *OperationsServerTransport) 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 "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (o *OperationsServerTransport) 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 { - resp := o.srv.NewListPager(nil) - newListPager = &resp - o.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.OperationsClientListResponse, 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) { - o.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - o.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/operators_server.go b/sdk/resourcemanager/security/armsecurity/fake/operators_server.go deleted file mode 100644 index 2e00229c0d38..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/operators_server.go +++ /dev/null @@ -1,213 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// OperatorsServer is a fake server for instances of the armsecurity.OperatorsClient type. -type OperatorsServer struct { - // CreateOrUpdate is the fake for method OperatorsClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK - CreateOrUpdate func(ctx context.Context, pricingName string, securityOperatorName string, options *armsecurity.OperatorsClientCreateOrUpdateOptions) (resp azfake.Responder[armsecurity.OperatorsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method OperatorsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, pricingName string, securityOperatorName string, options *armsecurity.OperatorsClientDeleteOptions) (resp azfake.Responder[armsecurity.OperatorsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method OperatorsClient.Get - // 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 - // 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) -} - -// 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} -} - -// OperatorsServerTransport connects instances of armsecurity.OperatorsClient to instances of OperatorsServer. -// Don't use this type directly, use NewOperatorsServerTransport instead. -type OperatorsServerTransport struct { - srv *OperatorsServer -} - -// Do implements the policy.Transporter interface for OperatorsServerTransport. -func (o *OperatorsServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (o *OperatorsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if o.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/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 { - 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 - } - securityOperatorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityOperatorName")]) - if err != nil { - return nil, err - } - respr, errRespr := o.srv.CreateOrUpdate(req.Context(), pricingNameParam, securityOperatorNameParam, 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).OperatorResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (o *OperatorsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if o.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/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 { - 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 - } - securityOperatorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityOperatorName")]) - if err != nil { - return nil, err - } - respr, errRespr := o.srv.Delete(req.Context(), pricingNameParam, securityOperatorNameParam, 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 (o *OperatorsServerTransport) 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/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 { - 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 - } - securityOperatorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityOperatorName")]) - if err != nil { - return nil, err - } - respr, errRespr := o.srv.Get(req.Context(), pricingNameParam, securityOperatorNameParam, 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).OperatorResource, req) - if err != nil { - return nil, err - } - 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")]) - 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 - } - 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 - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/polymorphic_helpers.go b/sdk/resourcemanager/security/armsecurity/fake/polymorphic_helpers.go deleted file mode 100644 index 39cc59321940..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/polymorphic_helpers.go +++ /dev/null @@ -1,58 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -func unmarshalServerVulnerabilityAssessmentsSettingClassification(rawMsg json.RawMessage) (armsecurity.ServerVulnerabilityAssessmentsSettingClassification, 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 armsecurity.ServerVulnerabilityAssessmentsSettingClassification - switch m["kind"] { - case string(armsecurity.ServerVulnerabilityAssessmentsSettingKindAzureServersSetting): - b = &armsecurity.AzureServersSetting{} - default: - b = &armsecurity.ServerVulnerabilityAssessmentsSetting{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalSettingClassification(rawMsg json.RawMessage) (armsecurity.SettingClassification, 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 armsecurity.SettingClassification - switch m["kind"] { - case string(armsecurity.SettingKindAlertSyncSettings): - b = &armsecurity.AlertSyncSettings{} - case string(armsecurity.SettingKindDataExportSettings): - b = &armsecurity.DataExportSettings{} - default: - b = &armsecurity.Setting{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/pricings_server.go b/sdk/resourcemanager/security/armsecurity/fake/pricings_server.go deleted file mode 100644 index 4b3546990e24..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/pricings_server.go +++ /dev/null @@ -1,229 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// PricingsServer is a fake server for instances of the armsecurity.PricingsClient type. -type PricingsServer struct { - // Delete is the fake for method PricingsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, scopeID string, pricingName string, options *armsecurity.PricingsClientDeleteOptions) (resp azfake.Responder[armsecurity.PricingsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method PricingsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, scopeID string, pricingName string, options *armsecurity.PricingsClientGetOptions) (resp azfake.Responder[armsecurity.PricingsClientGetResponse], errResp azfake.ErrorResponder) - - // List is the fake for method PricingsClient.List - // HTTP status codes to indicate success: http.StatusOK - List func(ctx context.Context, scopeID string, options *armsecurity.PricingsClientListOptions) (resp azfake.Responder[armsecurity.PricingsClientListResponse], errResp azfake.ErrorResponder) - - // Update is the fake for method PricingsClient.Update - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Update func(ctx context.Context, scopeID string, pricingName string, pricing armsecurity.Pricing, options *armsecurity.PricingsClientUpdateOptions) (resp azfake.Responder[armsecurity.PricingsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewPricingsServerTransport creates a new instance of PricingsServerTransport with the provided implementation. -// The returned PricingsServerTransport instance is connected to an instance of armsecurity.PricingsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewPricingsServerTransport(srv *PricingsServer) *PricingsServerTransport { - return &PricingsServerTransport{srv: srv} -} - -// PricingsServerTransport connects instances of armsecurity.PricingsClient to instances of PricingsServer. -// Don't use this type directly, use NewPricingsServerTransport instead. -type PricingsServerTransport struct { - srv *PricingsServer -} - -// Do implements the policy.Transporter interface for PricingsServerTransport. -func (p *PricingsServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *PricingsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if p.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - scopeIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeId")]) - if err != nil { - return nil, err - } - pricingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("pricingName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Delete(req.Context(), scopeIDParam, pricingNameParam, 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 (p *PricingsServerTransport) 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 = `/(?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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - scopeIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeId")]) - if err != nil { - return nil, err - } - pricingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("pricingName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), scopeIDParam, pricingNameParam, 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).Pricing, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (p *PricingsServerTransport) dispatchList(req *http.Request) (*http.Response, error) { - if p.srv.List == nil { - return nil, &nonRetriableError{errors.New("fake for method List not implemented")} - } - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - scopeIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeId")]) - if err != nil { - return nil, err - } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - var options *armsecurity.PricingsClientListOptions - if filterParam != nil { - options = &armsecurity.PricingsClientListOptions{ - Filter: filterParam, - } - } - respr, errRespr := p.srv.List(req.Context(), scopeIDParam, 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).PricingList, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (p *PricingsServerTransport) 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 = `/(?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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.Pricing](req) - if err != nil { - return nil, err - } - scopeIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeId")]) - if err != nil { - return nil, err - } - pricingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("pricingName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Update(req.Context(), scopeIDParam, pricingNameParam, 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).Pricing, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/regulatorycomplianceassessments_server.go b/sdk/resourcemanager/security/armsecurity/fake/regulatorycomplianceassessments_server.go deleted file mode 100644 index 3ad46f025b9d..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/regulatorycomplianceassessments_server.go +++ /dev/null @@ -1,168 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// RegulatoryComplianceAssessmentsServer is a fake server for instances of the armsecurity.RegulatoryComplianceAssessmentsClient type. -type RegulatoryComplianceAssessmentsServer struct { - // Get is the fake for method RegulatoryComplianceAssessmentsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, regulatoryComplianceStandardName string, regulatoryComplianceControlName string, regulatoryComplianceAssessmentName string, options *armsecurity.RegulatoryComplianceAssessmentsClientGetOptions) (resp azfake.Responder[armsecurity.RegulatoryComplianceAssessmentsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method RegulatoryComplianceAssessmentsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(regulatoryComplianceStandardName string, regulatoryComplianceControlName string, options *armsecurity.RegulatoryComplianceAssessmentsClientListOptions) (resp azfake.PagerResponder[armsecurity.RegulatoryComplianceAssessmentsClientListResponse]) -} - -// NewRegulatoryComplianceAssessmentsServerTransport creates a new instance of RegulatoryComplianceAssessmentsServerTransport with the provided implementation. -// The returned RegulatoryComplianceAssessmentsServerTransport instance is connected to an instance of armsecurity.RegulatoryComplianceAssessmentsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewRegulatoryComplianceAssessmentsServerTransport(srv *RegulatoryComplianceAssessmentsServer) *RegulatoryComplianceAssessmentsServerTransport { - return &RegulatoryComplianceAssessmentsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.RegulatoryComplianceAssessmentsClientListResponse]](), - } -} - -// RegulatoryComplianceAssessmentsServerTransport connects instances of armsecurity.RegulatoryComplianceAssessmentsClient to instances of RegulatoryComplianceAssessmentsServer. -// Don't use this type directly, use NewRegulatoryComplianceAssessmentsServerTransport instead. -type RegulatoryComplianceAssessmentsServerTransport struct { - srv *RegulatoryComplianceAssessmentsServer - newListPager *tracker[azfake.PagerResponder[armsecurity.RegulatoryComplianceAssessmentsClientListResponse]] -} - -// Do implements the policy.Transporter interface for RegulatoryComplianceAssessmentsServerTransport. -func (r *RegulatoryComplianceAssessmentsServerTransport) 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 "RegulatoryComplianceAssessmentsClient.Get": - resp, err = r.dispatchGet(req) - case "RegulatoryComplianceAssessmentsClient.NewListPager": - resp, err = r.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (r *RegulatoryComplianceAssessmentsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if r.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/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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - regulatoryComplianceStandardNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("regulatoryComplianceStandardName")]) - if err != nil { - return nil, err - } - regulatoryComplianceControlNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("regulatoryComplianceControlName")]) - if err != nil { - return nil, err - } - regulatoryComplianceAssessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("regulatoryComplianceAssessmentName")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.Get(req.Context(), regulatoryComplianceStandardNameParam, regulatoryComplianceControlNameParam, regulatoryComplianceAssessmentNameParam, 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).RegulatoryComplianceAssessment, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (r *RegulatoryComplianceAssessmentsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if r.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := r.newListPager.get(req) - if newListPager == nil { - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - regulatoryComplianceStandardNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("regulatoryComplianceStandardName")]) - if err != nil { - return nil, err - } - regulatoryComplianceControlNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("regulatoryComplianceControlName")]) - if err != nil { - return nil, err - } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - var options *armsecurity.RegulatoryComplianceAssessmentsClientListOptions - if filterParam != nil { - options = &armsecurity.RegulatoryComplianceAssessmentsClientListOptions{ - Filter: filterParam, - } - } - resp := r.srv.NewListPager(regulatoryComplianceStandardNameParam, regulatoryComplianceControlNameParam, options) - newListPager = &resp - r.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.RegulatoryComplianceAssessmentsClientListResponse, 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) { - r.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - r.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/regulatorycompliancecontrols_server.go b/sdk/resourcemanager/security/armsecurity/fake/regulatorycompliancecontrols_server.go deleted file mode 100644 index 3e12e55f8f37..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/regulatorycompliancecontrols_server.go +++ /dev/null @@ -1,160 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// RegulatoryComplianceControlsServer is a fake server for instances of the armsecurity.RegulatoryComplianceControlsClient type. -type RegulatoryComplianceControlsServer struct { - // Get is the fake for method RegulatoryComplianceControlsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, regulatoryComplianceStandardName string, regulatoryComplianceControlName string, options *armsecurity.RegulatoryComplianceControlsClientGetOptions) (resp azfake.Responder[armsecurity.RegulatoryComplianceControlsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method RegulatoryComplianceControlsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(regulatoryComplianceStandardName string, options *armsecurity.RegulatoryComplianceControlsClientListOptions) (resp azfake.PagerResponder[armsecurity.RegulatoryComplianceControlsClientListResponse]) -} - -// NewRegulatoryComplianceControlsServerTransport creates a new instance of RegulatoryComplianceControlsServerTransport with the provided implementation. -// The returned RegulatoryComplianceControlsServerTransport instance is connected to an instance of armsecurity.RegulatoryComplianceControlsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewRegulatoryComplianceControlsServerTransport(srv *RegulatoryComplianceControlsServer) *RegulatoryComplianceControlsServerTransport { - return &RegulatoryComplianceControlsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.RegulatoryComplianceControlsClientListResponse]](), - } -} - -// RegulatoryComplianceControlsServerTransport connects instances of armsecurity.RegulatoryComplianceControlsClient to instances of RegulatoryComplianceControlsServer. -// Don't use this type directly, use NewRegulatoryComplianceControlsServerTransport instead. -type RegulatoryComplianceControlsServerTransport struct { - srv *RegulatoryComplianceControlsServer - newListPager *tracker[azfake.PagerResponder[armsecurity.RegulatoryComplianceControlsClientListResponse]] -} - -// Do implements the policy.Transporter interface for RegulatoryComplianceControlsServerTransport. -func (r *RegulatoryComplianceControlsServerTransport) 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 "RegulatoryComplianceControlsClient.Get": - resp, err = r.dispatchGet(req) - case "RegulatoryComplianceControlsClient.NewListPager": - resp, err = r.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (r *RegulatoryComplianceControlsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if r.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/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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - regulatoryComplianceStandardNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("regulatoryComplianceStandardName")]) - if err != nil { - return nil, err - } - regulatoryComplianceControlNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("regulatoryComplianceControlName")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.Get(req.Context(), regulatoryComplianceStandardNameParam, regulatoryComplianceControlNameParam, 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).RegulatoryComplianceControl, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (r *RegulatoryComplianceControlsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if r.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := r.newListPager.get(req) - if newListPager == nil { - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - regulatoryComplianceStandardNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("regulatoryComplianceStandardName")]) - if err != nil { - return nil, err - } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - var options *armsecurity.RegulatoryComplianceControlsClientListOptions - if filterParam != nil { - options = &armsecurity.RegulatoryComplianceControlsClientListOptions{ - Filter: filterParam, - } - } - resp := r.srv.NewListPager(regulatoryComplianceStandardNameParam, options) - newListPager = &resp - r.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.RegulatoryComplianceControlsClientListResponse, 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) { - r.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - r.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/regulatorycompliancestandards_server.go b/sdk/resourcemanager/security/armsecurity/fake/regulatorycompliancestandards_server.go deleted file mode 100644 index 6f5fe6abb5a0..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/regulatorycompliancestandards_server.go +++ /dev/null @@ -1,152 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// RegulatoryComplianceStandardsServer is a fake server for instances of the armsecurity.RegulatoryComplianceStandardsClient type. -type RegulatoryComplianceStandardsServer struct { - // Get is the fake for method RegulatoryComplianceStandardsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, regulatoryComplianceStandardName string, options *armsecurity.RegulatoryComplianceStandardsClientGetOptions) (resp azfake.Responder[armsecurity.RegulatoryComplianceStandardsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method RegulatoryComplianceStandardsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armsecurity.RegulatoryComplianceStandardsClientListOptions) (resp azfake.PagerResponder[armsecurity.RegulatoryComplianceStandardsClientListResponse]) -} - -// NewRegulatoryComplianceStandardsServerTransport creates a new instance of RegulatoryComplianceStandardsServerTransport with the provided implementation. -// The returned RegulatoryComplianceStandardsServerTransport instance is connected to an instance of armsecurity.RegulatoryComplianceStandardsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewRegulatoryComplianceStandardsServerTransport(srv *RegulatoryComplianceStandardsServer) *RegulatoryComplianceStandardsServerTransport { - return &RegulatoryComplianceStandardsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.RegulatoryComplianceStandardsClientListResponse]](), - } -} - -// RegulatoryComplianceStandardsServerTransport connects instances of armsecurity.RegulatoryComplianceStandardsClient to instances of RegulatoryComplianceStandardsServer. -// Don't use this type directly, use NewRegulatoryComplianceStandardsServerTransport instead. -type RegulatoryComplianceStandardsServerTransport struct { - srv *RegulatoryComplianceStandardsServer - newListPager *tracker[azfake.PagerResponder[armsecurity.RegulatoryComplianceStandardsClientListResponse]] -} - -// Do implements the policy.Transporter interface for RegulatoryComplianceStandardsServerTransport. -func (r *RegulatoryComplianceStandardsServerTransport) 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 "RegulatoryComplianceStandardsClient.Get": - resp, err = r.dispatchGet(req) - case "RegulatoryComplianceStandardsClient.NewListPager": - resp, err = r.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (r *RegulatoryComplianceStandardsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if r.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/regulatoryComplianceStandards/(?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) - } - regulatoryComplianceStandardNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("regulatoryComplianceStandardName")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.Get(req.Context(), regulatoryComplianceStandardNameParam, 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).RegulatoryComplianceStandard, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (r *RegulatoryComplianceStandardsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if r.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := r.newListPager.get(req) - if newListPager == nil { - 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 { - 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) - var options *armsecurity.RegulatoryComplianceStandardsClientListOptions - if filterParam != nil { - options = &armsecurity.RegulatoryComplianceStandardsClientListOptions{ - Filter: filterParam, - } - } - resp := r.srv.NewListPager(options) - newListPager = &resp - r.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.RegulatoryComplianceStandardsClientListResponse, 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) { - r.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - r.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/securescorecontroldefinitions_server.go b/sdk/resourcemanager/security/armsecurity/fake/securescorecontroldefinitions_server.go deleted file mode 100644 index cb8c5f14c327..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/securescorecontroldefinitions_server.go +++ /dev/null @@ -1,138 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" - "net/http" - "regexp" -) - -// SecureScoreControlDefinitionsServer is a fake server for instances of the armsecurity.SecureScoreControlDefinitionsClient type. -type SecureScoreControlDefinitionsServer struct { - // NewListPager is the fake for method SecureScoreControlDefinitionsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armsecurity.SecureScoreControlDefinitionsClientListOptions) (resp azfake.PagerResponder[armsecurity.SecureScoreControlDefinitionsClientListResponse]) - - // NewListBySubscriptionPager is the fake for method SecureScoreControlDefinitionsClient.NewListBySubscriptionPager - // HTTP status codes to indicate success: http.StatusOK - NewListBySubscriptionPager func(options *armsecurity.SecureScoreControlDefinitionsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armsecurity.SecureScoreControlDefinitionsClientListBySubscriptionResponse]) -} - -// NewSecureScoreControlDefinitionsServerTransport creates a new instance of SecureScoreControlDefinitionsServerTransport with the provided implementation. -// The returned SecureScoreControlDefinitionsServerTransport instance is connected to an instance of armsecurity.SecureScoreControlDefinitionsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewSecureScoreControlDefinitionsServerTransport(srv *SecureScoreControlDefinitionsServer) *SecureScoreControlDefinitionsServerTransport { - return &SecureScoreControlDefinitionsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.SecureScoreControlDefinitionsClientListResponse]](), - newListBySubscriptionPager: newTracker[azfake.PagerResponder[armsecurity.SecureScoreControlDefinitionsClientListBySubscriptionResponse]](), - } -} - -// SecureScoreControlDefinitionsServerTransport connects instances of armsecurity.SecureScoreControlDefinitionsClient to instances of SecureScoreControlDefinitionsServer. -// Don't use this type directly, use NewSecureScoreControlDefinitionsServerTransport instead. -type SecureScoreControlDefinitionsServerTransport struct { - srv *SecureScoreControlDefinitionsServer - newListPager *tracker[azfake.PagerResponder[armsecurity.SecureScoreControlDefinitionsClientListResponse]] - newListBySubscriptionPager *tracker[azfake.PagerResponder[armsecurity.SecureScoreControlDefinitionsClientListBySubscriptionResponse]] -} - -// Do implements the policy.Transporter interface for SecureScoreControlDefinitionsServerTransport. -func (s *SecureScoreControlDefinitionsServerTransport) 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 "SecureScoreControlDefinitionsClient.NewListPager": - resp, err = s.dispatchNewListPager(req) - case "SecureScoreControlDefinitionsClient.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 *SecureScoreControlDefinitionsServerTransport) 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 { - resp := s.srv.NewListPager(nil) - newListPager = &resp - s.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.SecureScoreControlDefinitionsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - s.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - s.newListPager.remove(req) - } - return resp, nil -} - -func (s *SecureScoreControlDefinitionsServerTransport) 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/secureScoreControlDefinitions` - 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.SecureScoreControlDefinitionsClientListBySubscriptionResponse, 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/securescorecontrols_server.go b/sdk/resourcemanager/security/armsecurity/fake/securescorecontrols_server.go deleted file mode 100644 index 1878ffc37202..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/securescorecontrols_server.go +++ /dev/null @@ -1,173 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" - "net/http" - "net/url" - "regexp" -) - -// SecureScoreControlsServer is a fake server for instances of the armsecurity.SecureScoreControlsClient type. -type SecureScoreControlsServer struct { - // NewListPager is the fake for method SecureScoreControlsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armsecurity.SecureScoreControlsClientListOptions) (resp azfake.PagerResponder[armsecurity.SecureScoreControlsClientListResponse]) - - // NewListBySecureScorePager is the fake for method SecureScoreControlsClient.NewListBySecureScorePager - // HTTP status codes to indicate success: http.StatusOK - NewListBySecureScorePager func(secureScoreName string, options *armsecurity.SecureScoreControlsClientListBySecureScoreOptions) (resp azfake.PagerResponder[armsecurity.SecureScoreControlsClientListBySecureScoreResponse]) -} - -// NewSecureScoreControlsServerTransport creates a new instance of SecureScoreControlsServerTransport with the provided implementation. -// The returned SecureScoreControlsServerTransport instance is connected to an instance of armsecurity.SecureScoreControlsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewSecureScoreControlsServerTransport(srv *SecureScoreControlsServer) *SecureScoreControlsServerTransport { - return &SecureScoreControlsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.SecureScoreControlsClientListResponse]](), - newListBySecureScorePager: newTracker[azfake.PagerResponder[armsecurity.SecureScoreControlsClientListBySecureScoreResponse]](), - } -} - -// SecureScoreControlsServerTransport connects instances of armsecurity.SecureScoreControlsClient to instances of SecureScoreControlsServer. -// Don't use this type directly, use NewSecureScoreControlsServerTransport instead. -type SecureScoreControlsServerTransport struct { - srv *SecureScoreControlsServer - newListPager *tracker[azfake.PagerResponder[armsecurity.SecureScoreControlsClientListResponse]] - newListBySecureScorePager *tracker[azfake.PagerResponder[armsecurity.SecureScoreControlsClientListBySecureScoreResponse]] -} - -// Do implements the policy.Transporter interface for SecureScoreControlsServerTransport. -func (s *SecureScoreControlsServerTransport) 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 "SecureScoreControlsClient.NewListPager": - resp, err = s.dispatchNewListPager(req) - case "SecureScoreControlsClient.NewListBySecureScorePager": - resp, err = s.dispatchNewListBySecureScorePager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (s *SecureScoreControlsServerTransport) 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~%@]+)/providers/Microsoft\.Security/secureScoreControls` - 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() - expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) - if err != nil { - return nil, err - } - expandParam := getOptional(armsecurity.ExpandControlsEnum(expandUnescaped)) - var options *armsecurity.SecureScoreControlsClientListOptions - if expandParam != nil { - options = &armsecurity.SecureScoreControlsClientListOptions{ - Expand: expandParam, - } - } - resp := s.srv.NewListPager(options) - newListPager = &resp - s.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.SecureScoreControlsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - s.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - s.newListPager.remove(req) - } - return resp, nil -} - -func (s *SecureScoreControlsServerTransport) dispatchNewListBySecureScorePager(req *http.Request) (*http.Response, error) { - if s.srv.NewListBySecureScorePager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListBySecureScorePager not implemented")} - } - newListBySecureScorePager := s.newListBySecureScorePager.get(req) - if newListBySecureScorePager == nil { - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - secureScoreNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("secureScoreName")]) - if err != nil { - return nil, err - } - expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) - if err != nil { - return nil, err - } - expandParam := getOptional(armsecurity.ExpandControlsEnum(expandUnescaped)) - var options *armsecurity.SecureScoreControlsClientListBySecureScoreOptions - if expandParam != nil { - options = &armsecurity.SecureScoreControlsClientListBySecureScoreOptions{ - Expand: expandParam, - } - } - resp := s.srv.NewListBySecureScorePager(secureScoreNameParam, options) - newListBySecureScorePager = &resp - s.newListBySecureScorePager.add(req, newListBySecureScorePager) - server.PagerResponderInjectNextLinks(newListBySecureScorePager, req, func(page *armsecurity.SecureScoreControlsClientListBySecureScoreResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListBySecureScorePager, req) - if err != nil { - return nil, err - } - if !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)} - } - if !server.PagerResponderMore(newListBySecureScorePager) { - s.newListBySecureScorePager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/securescores_server.go b/sdk/resourcemanager/security/armsecurity/fake/securescores_server.go deleted file mode 100644 index bb3d57aefbf0..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/securescores_server.go +++ /dev/null @@ -1,140 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// SecureScoresServer is a fake server for instances of the armsecurity.SecureScoresClient type. -type SecureScoresServer struct { - // Get is the fake for method SecureScoresClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, secureScoreName string, options *armsecurity.SecureScoresClientGetOptions) (resp azfake.Responder[armsecurity.SecureScoresClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method SecureScoresClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armsecurity.SecureScoresClientListOptions) (resp azfake.PagerResponder[armsecurity.SecureScoresClientListResponse]) -} - -// NewSecureScoresServerTransport creates a new instance of SecureScoresServerTransport with the provided implementation. -// The returned SecureScoresServerTransport instance is connected to an instance of armsecurity.SecureScoresClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewSecureScoresServerTransport(srv *SecureScoresServer) *SecureScoresServerTransport { - return &SecureScoresServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.SecureScoresClientListResponse]](), - } -} - -// SecureScoresServerTransport connects instances of armsecurity.SecureScoresClient to instances of SecureScoresServer. -// Don't use this type directly, use NewSecureScoresServerTransport instead. -type SecureScoresServerTransport struct { - srv *SecureScoresServer - newListPager *tracker[azfake.PagerResponder[armsecurity.SecureScoresClientListResponse]] -} - -// Do implements the policy.Transporter interface for SecureScoresServerTransport. -func (s *SecureScoresServerTransport) 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 "SecureScoresClient.Get": - resp, err = s.dispatchGet(req) - case "SecureScoresClient.NewListPager": - resp, err = s.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (s *SecureScoresServerTransport) 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~%@]+)/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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - secureScoreNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("secureScoreName")]) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.Get(req.Context(), secureScoreNameParam, 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).SecureScoreItem, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (s *SecureScoresServerTransport) 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~%@]+)/providers/Microsoft\.Security/secureScores` - 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.NewListPager(nil) - newListPager = &resp - s.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.SecureScoresClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - s.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - s.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/sensitivitysettings_server.go b/sdk/resourcemanager/security/armsecurity/fake/sensitivitysettings_server.go deleted file mode 100644 index 72c977be612d..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/sensitivitysettings_server.go +++ /dev/null @@ -1,138 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// SensitivitySettingsServer is a fake server for instances of the armsecurity.SensitivitySettingsClient type. -type SensitivitySettingsServer struct { - // CreateOrUpdate is the fake for method SensitivitySettingsClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK - CreateOrUpdate func(ctx context.Context, sensitivitySettings armsecurity.UpdateSensitivitySettingsRequest, options *armsecurity.SensitivitySettingsClientCreateOrUpdateOptions) (resp azfake.Responder[armsecurity.SensitivitySettingsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method SensitivitySettingsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, options *armsecurity.SensitivitySettingsClientGetOptions) (resp azfake.Responder[armsecurity.SensitivitySettingsClientGetResponse], errResp azfake.ErrorResponder) - - // List is the fake for method SensitivitySettingsClient.List - // HTTP status codes to indicate success: http.StatusOK - List func(ctx context.Context, options *armsecurity.SensitivitySettingsClientListOptions) (resp azfake.Responder[armsecurity.SensitivitySettingsClientListResponse], errResp azfake.ErrorResponder) -} - -// NewSensitivitySettingsServerTransport creates a new instance of SensitivitySettingsServerTransport with the provided implementation. -// The returned SensitivitySettingsServerTransport instance is connected to an instance of armsecurity.SensitivitySettingsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewSensitivitySettingsServerTransport(srv *SensitivitySettingsServer) *SensitivitySettingsServerTransport { - return &SensitivitySettingsServerTransport{srv: srv} -} - -// SensitivitySettingsServerTransport connects instances of armsecurity.SensitivitySettingsClient to instances of SensitivitySettingsServer. -// Don't use this type directly, use NewSensitivitySettingsServerTransport instead. -type SensitivitySettingsServerTransport struct { - srv *SensitivitySettingsServer -} - -// Do implements the policy.Transporter interface for SensitivitySettingsServerTransport. -func (s *SensitivitySettingsServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (s *SensitivitySettingsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if s.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.UpdateSensitivitySettingsRequest](req) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.CreateOrUpdate(req.Context(), 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).GetSensitivitySettingsResponse, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (s *SensitivitySettingsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if s.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - respr, errRespr := s.srv.Get(req.Context(), 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).GetSensitivitySettingsResponse, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (s *SensitivitySettingsServerTransport) dispatchList(req *http.Request) (*http.Response, error) { - if s.srv.List == nil { - return nil, &nonRetriableError{errors.New("fake for method List not implemented")} - } - respr, errRespr := s.srv.List(req.Context(), 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).GetSensitivitySettingsListResponse, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/server_factory.go b/sdk/resourcemanager/security/armsecurity/fake/server_factory.go index 8925f6234015..ecef46c06d8f 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/server_factory.go +++ b/sdk/resourcemanager/security/armsecurity/fake/server_factory.go @@ -19,76 +19,7 @@ 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 - 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 + DefenderForStorageServer DefenderForStorageServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -103,78 +34,9 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { // ServerFactoryTransport connects instances of armsecurity.ClientFactory to instances of ServerFactory. // Don't use this type directly, use NewServerFactoryTransport instead. type ServerFactoryTransport struct { - srv *ServerFactory - trMu sync.Mutex - trAPICollectionsServer *APICollectionsServerTransport - trAccountConnectorsServer *AccountConnectorsServerTransport - trAdaptiveApplicationControlsServer *AdaptiveApplicationControlsServerTransport - trAdaptiveNetworkHardeningsServer *AdaptiveNetworkHardeningsServerTransport - trAdvancedThreatProtectionServer *AdvancedThreatProtectionServerTransport - trAlertsServer *AlertsServerTransport - trAlertsSuppressionRulesServer *AlertsSuppressionRulesServerTransport - trAllowedConnectionsServer *AllowedConnectionsServerTransport - trApplicationServer *ApplicationServerTransport - trApplicationsServer *ApplicationsServerTransport - trAssessmentsServer *AssessmentsServerTransport - trAssessmentsMetadataServer *AssessmentsMetadataServerTransport - trAutoProvisioningSettingsServer *AutoProvisioningSettingsServerTransport - trAutomationsServer *AutomationsServerTransport - trAzureDevOpsOrgsServer *AzureDevOpsOrgsServerTransport - trAzureDevOpsProjectsServer *AzureDevOpsProjectsServerTransport - trAzureDevOpsReposServer *AzureDevOpsReposServerTransport - trComplianceResultsServer *ComplianceResultsServerTransport - trCompliancesServer *CompliancesServerTransport - trConnectorApplicationServer *ConnectorApplicationServerTransport - trConnectorApplicationsServer *ConnectorApplicationsServerTransport - trConnectorsServer *ConnectorsServerTransport - trContactsServer *ContactsServerTransport - trCustomAssessmentAutomationsServer *CustomAssessmentAutomationsServerTransport - trCustomEntityStoreAssignmentsServer *CustomEntityStoreAssignmentsServerTransport - trDefenderForStorageServer *DefenderForStorageServerTransport - trDevOpsConfigurationsServer *DevOpsConfigurationsServerTransport - trDevOpsOperationResultsServer *DevOpsOperationResultsServerTransport - trDeviceSecurityGroupsServer *DeviceSecurityGroupsServerTransport - trDiscoveredSecuritySolutionsServer *DiscoveredSecuritySolutionsServerTransport - trExternalSecuritySolutionsServer *ExternalSecuritySolutionsServerTransport - trGitHubOwnersServer *GitHubOwnersServerTransport - trGitHubReposServer *GitHubReposServerTransport - trGitLabGroupsServer *GitLabGroupsServerTransport - trGitLabProjectsServer *GitLabProjectsServerTransport - trGitLabSubgroupsServer *GitLabSubgroupsServerTransport - trGovernanceAssignmentsServer *GovernanceAssignmentsServerTransport - trGovernanceRulesServer *GovernanceRulesServerTransport - trHealthReportsServer *HealthReportsServerTransport - trInformationProtectionPoliciesServer *InformationProtectionPoliciesServerTransport - trIotSecuritySolutionAnalyticsServer *IotSecuritySolutionAnalyticsServerTransport - trIotSecuritySolutionServer *IotSecuritySolutionServerTransport - trIotSecuritySolutionsAnalyticsAggregatedAlertServer *IotSecuritySolutionsAnalyticsAggregatedAlertServerTransport - trIotSecuritySolutionsAnalyticsRecommendationServer *IotSecuritySolutionsAnalyticsRecommendationServerTransport - trJitNetworkAccessPoliciesServer *JitNetworkAccessPoliciesServerTransport - trLocationsServer *LocationsServerTransport - trMdeOnboardingsServer *MdeOnboardingsServerTransport - trOperationsServer *OperationsServerTransport - trOperatorsServer *OperatorsServerTransport - trPricingsServer *PricingsServerTransport - trRegulatoryComplianceAssessmentsServer *RegulatoryComplianceAssessmentsServerTransport - trRegulatoryComplianceControlsServer *RegulatoryComplianceControlsServerTransport - trRegulatoryComplianceStandardsServer *RegulatoryComplianceStandardsServerTransport - trSQLVulnerabilityAssessmentBaselineRulesServer *SQLVulnerabilityAssessmentBaselineRulesServerTransport - trSQLVulnerabilityAssessmentScanResultsServer *SQLVulnerabilityAssessmentScanResultsServerTransport - trSQLVulnerabilityAssessmentScansServer *SQLVulnerabilityAssessmentScansServerTransport - trSecureScoreControlDefinitionsServer *SecureScoreControlDefinitionsServerTransport - trSecureScoreControlsServer *SecureScoreControlsServerTransport - trSecureScoresServer *SecureScoresServerTransport - trSensitivitySettingsServer *SensitivitySettingsServerTransport - trServerVulnerabilityAssessmentServer *ServerVulnerabilityAssessmentServerTransport - trServerVulnerabilityAssessmentsSettingsServer *ServerVulnerabilityAssessmentsSettingsServerTransport - trSettingsServer *SettingsServerTransport - trSoftwareInventoriesServer *SoftwareInventoriesServerTransport - trSolutionsServer *SolutionsServerTransport - trSolutionsReferenceDataServer *SolutionsReferenceDataServerTransport - trSubAssessmentsServer *SubAssessmentsServerTransport - trTasksServer *TasksServerTransport - trTopologyServer *TopologyServerTransport - trWorkspaceSettingsServer *WorkspaceSettingsServerTransport + srv *ServerFactory + trMu sync.Mutex + trDefenderForStorageServer *DefenderForStorageServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -190,316 +52,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { var err error switch client { - case "APICollectionsClient": - initServer(s, &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 { - return NewAdvancedThreatProtectionServerTransport(&s.srv.AdvancedThreatProtectionServer) - }) - resp, err = s.trAdvancedThreatProtectionServer.Do(req) - case "AlertsClient": - initServer(s, &s.trAlertsServer, func() *AlertsServerTransport { return NewAlertsServerTransport(&s.srv.AlertsServer) }) - resp, err = s.trAlertsServer.Do(req) - case "AlertsSuppressionRulesClient": - initServer(s, &s.trAlertsSuppressionRulesServer, func() *AlertsSuppressionRulesServerTransport { - return NewAlertsSuppressionRulesServerTransport(&s.srv.AlertsSuppressionRulesServer) - }) - resp, err = s.trAlertsSuppressionRulesServer.Do(req) - case "AllowedConnectionsClient": - initServer(s, &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) }) - resp, err = s.trApplicationServer.Do(req) - case "ApplicationsClient": - initServer(s, &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) }) - resp, err = s.trAssessmentsServer.Do(req) - case "AssessmentsMetadataClient": - initServer(s, &s.trAssessmentsMetadataServer, func() *AssessmentsMetadataServerTransport { - return NewAssessmentsMetadataServerTransport(&s.srv.AssessmentsMetadataServer) - }) - resp, err = s.trAssessmentsMetadataServer.Do(req) - case "AutoProvisioningSettingsClient": - initServer(s, &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) }) - resp, err = s.trAutomationsServer.Do(req) - case "AzureDevOpsOrgsClient": - initServer(s, &s.trAzureDevOpsOrgsServer, func() *AzureDevOpsOrgsServerTransport { - return NewAzureDevOpsOrgsServerTransport(&s.srv.AzureDevOpsOrgsServer) - }) - resp, err = s.trAzureDevOpsOrgsServer.Do(req) - case "AzureDevOpsProjectsClient": - initServer(s, &s.trAzureDevOpsProjectsServer, func() *AzureDevOpsProjectsServerTransport { - return NewAzureDevOpsProjectsServerTransport(&s.srv.AzureDevOpsProjectsServer) - }) - resp, err = s.trAzureDevOpsProjectsServer.Do(req) - case "AzureDevOpsReposClient": - initServer(s, &s.trAzureDevOpsReposServer, func() *AzureDevOpsReposServerTransport { - return NewAzureDevOpsReposServerTransport(&s.srv.AzureDevOpsReposServer) - }) - resp, err = s.trAzureDevOpsReposServer.Do(req) - case "ComplianceResultsClient": - initServer(s, &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) }) - resp, err = s.trCompliancesServer.Do(req) - case "ConnectorApplicationClient": - initServer(s, &s.trConnectorApplicationServer, func() *ConnectorApplicationServerTransport { - return NewConnectorApplicationServerTransport(&s.srv.ConnectorApplicationServer) - }) - resp, err = s.trConnectorApplicationServer.Do(req) - case "ConnectorApplicationsClient": - initServer(s, &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) }) - resp, err = s.trConnectorsServer.Do(req) - case "ContactsClient": - initServer(s, &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) - }) - resp, err = s.trCustomEntityStoreAssignmentsServer.Do(req) case "DefenderForStorageClient": initServer(s, &s.trDefenderForStorageServer, func() *DefenderForStorageServerTransport { return NewDefenderForStorageServerTransport(&s.srv.DefenderForStorageServer) }) resp, err = s.trDefenderForStorageServer.Do(req) - case "DevOpsConfigurationsClient": - initServer(s, &s.trDevOpsConfigurationsServer, func() *DevOpsConfigurationsServerTransport { - return NewDevOpsConfigurationsServerTransport(&s.srv.DevOpsConfigurationsServer) - }) - resp, err = s.trDevOpsConfigurationsServer.Do(req) - case "DevOpsOperationResultsClient": - initServer(s, &s.trDevOpsOperationResultsServer, func() *DevOpsOperationResultsServerTransport { - return NewDevOpsOperationResultsServerTransport(&s.srv.DevOpsOperationResultsServer) - }) - resp, err = s.trDevOpsOperationResultsServer.Do(req) - case "DeviceSecurityGroupsClient": - initServer(s, &s.trDeviceSecurityGroupsServer, func() *DeviceSecurityGroupsServerTransport { - return NewDeviceSecurityGroupsServerTransport(&s.srv.DeviceSecurityGroupsServer) - }) - resp, err = s.trDeviceSecurityGroupsServer.Do(req) - case "DiscoveredSecuritySolutionsClient": - initServer(s, &s.trDiscoveredSecuritySolutionsServer, func() *DiscoveredSecuritySolutionsServerTransport { - return NewDiscoveredSecuritySolutionsServerTransport(&s.srv.DiscoveredSecuritySolutionsServer) - }) - resp, err = s.trDiscoveredSecuritySolutionsServer.Do(req) - case "ExternalSecuritySolutionsClient": - initServer(s, &s.trExternalSecuritySolutionsServer, func() *ExternalSecuritySolutionsServerTransport { - return NewExternalSecuritySolutionsServerTransport(&s.srv.ExternalSecuritySolutionsServer) - }) - resp, err = s.trExternalSecuritySolutionsServer.Do(req) - case "GitHubOwnersClient": - initServer(s, &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) }) - resp, err = s.trGitHubReposServer.Do(req) - case "GitLabGroupsClient": - initServer(s, &s.trGitLabGroupsServer, func() *GitLabGroupsServerTransport { return NewGitLabGroupsServerTransport(&s.srv.GitLabGroupsServer) }) - resp, err = s.trGitLabGroupsServer.Do(req) - case "GitLabProjectsClient": - initServer(s, &s.trGitLabProjectsServer, func() *GitLabProjectsServerTransport { - return NewGitLabProjectsServerTransport(&s.srv.GitLabProjectsServer) - }) - resp, err = s.trGitLabProjectsServer.Do(req) - case "GitLabSubgroupsClient": - initServer(s, &s.trGitLabSubgroupsServer, func() *GitLabSubgroupsServerTransport { - return NewGitLabSubgroupsServerTransport(&s.srv.GitLabSubgroupsServer) - }) - resp, err = s.trGitLabSubgroupsServer.Do(req) - case "GovernanceAssignmentsClient": - initServer(s, &s.trGovernanceAssignmentsServer, func() *GovernanceAssignmentsServerTransport { - return NewGovernanceAssignmentsServerTransport(&s.srv.GovernanceAssignmentsServer) - }) - resp, err = s.trGovernanceAssignmentsServer.Do(req) - case "GovernanceRulesClient": - initServer(s, &s.trGovernanceRulesServer, func() *GovernanceRulesServerTransport { - return NewGovernanceRulesServerTransport(&s.srv.GovernanceRulesServer) - }) - resp, err = s.trGovernanceRulesServer.Do(req) - case "HealthReportsClient": - initServer(s, &s.trHealthReportsServer, func() *HealthReportsServerTransport { - return NewHealthReportsServerTransport(&s.srv.HealthReportsServer) - }) - resp, err = s.trHealthReportsServer.Do(req) - case "InformationProtectionPoliciesClient": - initServer(s, &s.trInformationProtectionPoliciesServer, func() *InformationProtectionPoliciesServerTransport { - return NewInformationProtectionPoliciesServerTransport(&s.srv.InformationProtectionPoliciesServer) - }) - resp, err = s.trInformationProtectionPoliciesServer.Do(req) - case "IotSecuritySolutionAnalyticsClient": - initServer(s, &s.trIotSecuritySolutionAnalyticsServer, func() *IotSecuritySolutionAnalyticsServerTransport { - return NewIotSecuritySolutionAnalyticsServerTransport(&s.srv.IotSecuritySolutionAnalyticsServer) - }) - resp, err = s.trIotSecuritySolutionAnalyticsServer.Do(req) - case "IotSecuritySolutionClient": - initServer(s, &s.trIotSecuritySolutionServer, func() *IotSecuritySolutionServerTransport { - return NewIotSecuritySolutionServerTransport(&s.srv.IotSecuritySolutionServer) - }) - resp, err = s.trIotSecuritySolutionServer.Do(req) - case "IotSecuritySolutionsAnalyticsAggregatedAlertClient": - initServer(s, &s.trIotSecuritySolutionsAnalyticsAggregatedAlertServer, func() *IotSecuritySolutionsAnalyticsAggregatedAlertServerTransport { - return NewIotSecuritySolutionsAnalyticsAggregatedAlertServerTransport(&s.srv.IotSecuritySolutionsAnalyticsAggregatedAlertServer) - }) - resp, err = s.trIotSecuritySolutionsAnalyticsAggregatedAlertServer.Do(req) - case "IotSecuritySolutionsAnalyticsRecommendationClient": - initServer(s, &s.trIotSecuritySolutionsAnalyticsRecommendationServer, func() *IotSecuritySolutionsAnalyticsRecommendationServerTransport { - return NewIotSecuritySolutionsAnalyticsRecommendationServerTransport(&s.srv.IotSecuritySolutionsAnalyticsRecommendationServer) - }) - resp, err = s.trIotSecuritySolutionsAnalyticsRecommendationServer.Do(req) - case "JitNetworkAccessPoliciesClient": - initServer(s, &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) }) - resp, err = s.trLocationsServer.Do(req) - case "MdeOnboardingsClient": - initServer(s, &s.trMdeOnboardingsServer, func() *MdeOnboardingsServerTransport { - return NewMdeOnboardingsServerTransport(&s.srv.MdeOnboardingsServer) - }) - resp, err = s.trMdeOnboardingsServer.Do(req) - case "OperationsClient": - initServer(s, &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) }) - resp, err = s.trOperatorsServer.Do(req) - case "PricingsClient": - initServer(s, &s.trPricingsServer, func() *PricingsServerTransport { return NewPricingsServerTransport(&s.srv.PricingsServer) }) - resp, err = s.trPricingsServer.Do(req) - case "RegulatoryComplianceAssessmentsClient": - initServer(s, &s.trRegulatoryComplianceAssessmentsServer, func() *RegulatoryComplianceAssessmentsServerTransport { - return NewRegulatoryComplianceAssessmentsServerTransport(&s.srv.RegulatoryComplianceAssessmentsServer) - }) - resp, err = s.trRegulatoryComplianceAssessmentsServer.Do(req) - case "RegulatoryComplianceControlsClient": - initServer(s, &s.trRegulatoryComplianceControlsServer, func() *RegulatoryComplianceControlsServerTransport { - return NewRegulatoryComplianceControlsServerTransport(&s.srv.RegulatoryComplianceControlsServer) - }) - resp, err = s.trRegulatoryComplianceControlsServer.Do(req) - case "RegulatoryComplianceStandardsClient": - initServer(s, &s.trRegulatoryComplianceStandardsServer, func() *RegulatoryComplianceStandardsServerTransport { - return NewRegulatoryComplianceStandardsServerTransport(&s.srv.RegulatoryComplianceStandardsServer) - }) - resp, err = s.trRegulatoryComplianceStandardsServer.Do(req) - case "SQLVulnerabilityAssessmentBaselineRulesClient": - initServer(s, &s.trSQLVulnerabilityAssessmentBaselineRulesServer, func() *SQLVulnerabilityAssessmentBaselineRulesServerTransport { - return NewSQLVulnerabilityAssessmentBaselineRulesServerTransport(&s.srv.SQLVulnerabilityAssessmentBaselineRulesServer) - }) - resp, err = s.trSQLVulnerabilityAssessmentBaselineRulesServer.Do(req) - case "SQLVulnerabilityAssessmentScanResultsClient": - initServer(s, &s.trSQLVulnerabilityAssessmentScanResultsServer, func() *SQLVulnerabilityAssessmentScanResultsServerTransport { - return NewSQLVulnerabilityAssessmentScanResultsServerTransport(&s.srv.SQLVulnerabilityAssessmentScanResultsServer) - }) - resp, err = s.trSQLVulnerabilityAssessmentScanResultsServer.Do(req) - case "SQLVulnerabilityAssessmentScansClient": - initServer(s, &s.trSQLVulnerabilityAssessmentScansServer, func() *SQLVulnerabilityAssessmentScansServerTransport { - return NewSQLVulnerabilityAssessmentScansServerTransport(&s.srv.SQLVulnerabilityAssessmentScansServer) - }) - resp, err = s.trSQLVulnerabilityAssessmentScansServer.Do(req) - case "SecureScoreControlDefinitionsClient": - initServer(s, &s.trSecureScoreControlDefinitionsServer, func() *SecureScoreControlDefinitionsServerTransport { - return NewSecureScoreControlDefinitionsServerTransport(&s.srv.SecureScoreControlDefinitionsServer) - }) - resp, err = s.trSecureScoreControlDefinitionsServer.Do(req) - case "SecureScoreControlsClient": - initServer(s, &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) }) - resp, err = s.trSecureScoresServer.Do(req) - case "SensitivitySettingsClient": - initServer(s, &s.trSensitivitySettingsServer, func() *SensitivitySettingsServerTransport { - return NewSensitivitySettingsServerTransport(&s.srv.SensitivitySettingsServer) - }) - resp, err = s.trSensitivitySettingsServer.Do(req) - case "ServerVulnerabilityAssessmentClient": - initServer(s, &s.trServerVulnerabilityAssessmentServer, func() *ServerVulnerabilityAssessmentServerTransport { - return NewServerVulnerabilityAssessmentServerTransport(&s.srv.ServerVulnerabilityAssessmentServer) - }) - resp, err = s.trServerVulnerabilityAssessmentServer.Do(req) - case "ServerVulnerabilityAssessmentsSettingsClient": - initServer(s, &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) }) - 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) }) - resp, err = s.trSolutionsServer.Do(req) - case "SolutionsReferenceDataClient": - initServer(s, &s.trSolutionsReferenceDataServer, func() *SolutionsReferenceDataServerTransport { - return NewSolutionsReferenceDataServerTransport(&s.srv.SolutionsReferenceDataServer) - }) - resp, err = s.trSolutionsReferenceDataServer.Do(req) - case "SubAssessmentsClient": - initServer(s, &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) }) - resp, err = s.trTasksServer.Do(req) - case "TopologyClient": - initServer(s, &s.trTopologyServer, func() *TopologyServerTransport { return NewTopologyServerTransport(&s.srv.TopologyServer) }) - resp, err = s.trTopologyServer.Do(req) - case "WorkspaceSettingsClient": - initServer(s, &s.trWorkspaceSettingsServer, func() *WorkspaceSettingsServerTransport { - return NewWorkspaceSettingsServerTransport(&s.srv.WorkspaceSettingsServer) - }) - resp, err = s.trWorkspaceSettingsServer.Do(req) default: err = fmt.Errorf("unhandled client %s", client) } diff --git a/sdk/resourcemanager/security/armsecurity/fake/servervulnerabilityassessment_server.go b/sdk/resourcemanager/security/armsecurity/fake/servervulnerabilityassessment_server.go deleted file mode 100644 index dec766753e12..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/servervulnerabilityassessment_server.go +++ /dev/null @@ -1,264 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// ServerVulnerabilityAssessmentServer is a fake server for instances of the armsecurity.ServerVulnerabilityAssessmentClient type. -type ServerVulnerabilityAssessmentServer struct { - // CreateOrUpdate is the fake for method ServerVulnerabilityAssessmentClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusAccepted - CreateOrUpdate func(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, options *armsecurity.ServerVulnerabilityAssessmentClientCreateOrUpdateOptions) (resp azfake.Responder[armsecurity.ServerVulnerabilityAssessmentClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method ServerVulnerabilityAssessmentClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, options *armsecurity.ServerVulnerabilityAssessmentClientBeginDeleteOptions) (resp azfake.PollerResponder[armsecurity.ServerVulnerabilityAssessmentClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ServerVulnerabilityAssessmentClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, options *armsecurity.ServerVulnerabilityAssessmentClientGetOptions) (resp azfake.Responder[armsecurity.ServerVulnerabilityAssessmentClientGetResponse], errResp azfake.ErrorResponder) - - // ListByExtendedResource is the fake for method ServerVulnerabilityAssessmentClient.ListByExtendedResource - // HTTP status codes to indicate success: http.StatusOK - ListByExtendedResource func(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, options *armsecurity.ServerVulnerabilityAssessmentClientListByExtendedResourceOptions) (resp azfake.Responder[armsecurity.ServerVulnerabilityAssessmentClientListByExtendedResourceResponse], errResp azfake.ErrorResponder) -} - -// NewServerVulnerabilityAssessmentServerTransport creates a new instance of ServerVulnerabilityAssessmentServerTransport with the provided implementation. -// The returned ServerVulnerabilityAssessmentServerTransport instance is connected to an instance of armsecurity.ServerVulnerabilityAssessmentClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewServerVulnerabilityAssessmentServerTransport(srv *ServerVulnerabilityAssessmentServer) *ServerVulnerabilityAssessmentServerTransport { - return &ServerVulnerabilityAssessmentServerTransport{ - srv: srv, - beginDelete: newTracker[azfake.PollerResponder[armsecurity.ServerVulnerabilityAssessmentClientDeleteResponse]](), - } -} - -// ServerVulnerabilityAssessmentServerTransport connects instances of armsecurity.ServerVulnerabilityAssessmentClient to instances of ServerVulnerabilityAssessmentServer. -// Don't use this type directly, use NewServerVulnerabilityAssessmentServerTransport instead. -type ServerVulnerabilityAssessmentServerTransport struct { - srv *ServerVulnerabilityAssessmentServer - beginDelete *tracker[azfake.PollerResponder[armsecurity.ServerVulnerabilityAssessmentClientDeleteResponse]] -} - -// Do implements the policy.Transporter interface for ServerVulnerabilityAssessmentServerTransport. -func (s *ServerVulnerabilityAssessmentServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (s *ServerVulnerabilityAssessmentServerTransport) 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/(?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 { - 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 - } - respr, errRespr := s.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, resourceNamespaceParam, resourceTypeParam, resourceNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !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) - if err != nil { - return nil, err - } - return resp, nil -} - -func (s *ServerVulnerabilityAssessmentServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if s.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - beginDelete := s.beginDelete.get(req) - if beginDelete == 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/serverVulnerabilityAssessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - 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 - } - respr, errRespr := s.srv.BeginDelete(req.Context(), resourceGroupNameParam, resourceNamespaceParam, resourceTypeParam, resourceNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginDelete = &respr - s.beginDelete.add(req, beginDelete) - } - - resp, err := server.PollerResponderNext(beginDelete, req) - if err != nil { - return nil, err - } - - if !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)} - } - if !server.PollerResponderMore(beginDelete) { - s.beginDelete.remove(req) - } - - return resp, nil -} - -func (s *ServerVulnerabilityAssessmentServerTransport) 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/serverVulnerabilityAssessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - 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 - } - respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, resourceNamespaceParam, resourceTypeParam, resourceNameParam, 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).ServerVulnerabilityAssessment, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (s *ServerVulnerabilityAssessmentServerTransport) dispatchListByExtendedResource(req *http.Request) (*http.Response, error) { - if s.srv.ListByExtendedResource == nil { - return nil, &nonRetriableError{errors.New("fake for method ListByExtendedResource 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/serverVulnerabilityAssessments` - 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 - } - respr, errRespr := s.srv.ListByExtendedResource(req.Context(), resourceGroupNameParam, resourceNamespaceParam, resourceTypeParam, resourceNameParam, 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).ServerVulnerabilityAssessmentsList, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/servervulnerabilityassessmentssettings_server.go b/sdk/resourcemanager/security/armsecurity/fake/servervulnerabilityassessmentssettings_server.go deleted file mode 100644 index 1b38b9a20580..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/servervulnerabilityassessmentssettings_server.go +++ /dev/null @@ -1,236 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// ServerVulnerabilityAssessmentsSettingsServer is a fake server for instances of the armsecurity.ServerVulnerabilityAssessmentsSettingsClient type. -type ServerVulnerabilityAssessmentsSettingsServer struct { - // CreateOrUpdate is the fake for method ServerVulnerabilityAssessmentsSettingsClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - CreateOrUpdate func(ctx context.Context, settingKind armsecurity.ServerVulnerabilityAssessmentsSettingKindName, serverVulnerabilityAssessmentsSetting armsecurity.ServerVulnerabilityAssessmentsSettingClassification, options *armsecurity.ServerVulnerabilityAssessmentsSettingsClientCreateOrUpdateOptions) (resp azfake.Responder[armsecurity.ServerVulnerabilityAssessmentsSettingsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method ServerVulnerabilityAssessmentsSettingsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, settingKind armsecurity.ServerVulnerabilityAssessmentsSettingKindName, options *armsecurity.ServerVulnerabilityAssessmentsSettingsClientDeleteOptions) (resp azfake.Responder[armsecurity.ServerVulnerabilityAssessmentsSettingsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ServerVulnerabilityAssessmentsSettingsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, settingKind armsecurity.ServerVulnerabilityAssessmentsSettingKindName, options *armsecurity.ServerVulnerabilityAssessmentsSettingsClientGetOptions) (resp azfake.Responder[armsecurity.ServerVulnerabilityAssessmentsSettingsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListBySubscriptionPager is the fake for method ServerVulnerabilityAssessmentsSettingsClient.NewListBySubscriptionPager - // HTTP status codes to indicate success: http.StatusOK - NewListBySubscriptionPager func(options *armsecurity.ServerVulnerabilityAssessmentsSettingsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armsecurity.ServerVulnerabilityAssessmentsSettingsClientListBySubscriptionResponse]) -} - -// NewServerVulnerabilityAssessmentsSettingsServerTransport creates a new instance of ServerVulnerabilityAssessmentsSettingsServerTransport with the provided implementation. -// The returned ServerVulnerabilityAssessmentsSettingsServerTransport instance is connected to an instance of armsecurity.ServerVulnerabilityAssessmentsSettingsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewServerVulnerabilityAssessmentsSettingsServerTransport(srv *ServerVulnerabilityAssessmentsSettingsServer) *ServerVulnerabilityAssessmentsSettingsServerTransport { - return &ServerVulnerabilityAssessmentsSettingsServerTransport{ - srv: srv, - newListBySubscriptionPager: newTracker[azfake.PagerResponder[armsecurity.ServerVulnerabilityAssessmentsSettingsClientListBySubscriptionResponse]](), - } -} - -// ServerVulnerabilityAssessmentsSettingsServerTransport connects instances of armsecurity.ServerVulnerabilityAssessmentsSettingsClient to instances of ServerVulnerabilityAssessmentsSettingsServer. -// Don't use this type directly, use NewServerVulnerabilityAssessmentsSettingsServerTransport instead. -type ServerVulnerabilityAssessmentsSettingsServerTransport struct { - srv *ServerVulnerabilityAssessmentsSettingsServer - newListBySubscriptionPager *tracker[azfake.PagerResponder[armsecurity.ServerVulnerabilityAssessmentsSettingsClientListBySubscriptionResponse]] -} - -// Do implements the policy.Transporter interface for ServerVulnerabilityAssessmentsSettingsServerTransport. -func (s *ServerVulnerabilityAssessmentsSettingsServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (s *ServerVulnerabilityAssessmentsSettingsServerTransport) 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~%@]+)/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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - raw, err := readRequestBody(req) - if err != nil { - return nil, err - } - body, err := unmarshalServerVulnerabilityAssessmentsSettingClassification(raw) - if err != nil { - return nil, err - } - settingKindParam, err := parseWithCast(matches[regex.SubexpIndex("settingKind")], func(v string) (armsecurity.ServerVulnerabilityAssessmentsSettingKindName, error) { - p, unescapeErr := url.PathUnescape(v) - if unescapeErr != nil { - return "", unescapeErr - } - return armsecurity.ServerVulnerabilityAssessmentsSettingKindName(p), nil - }) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.CreateOrUpdate(req.Context(), settingKindParam, 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).ServerVulnerabilityAssessmentsSettingClassification, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (s *ServerVulnerabilityAssessmentsSettingsServerTransport) 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~%@]+)/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 { - 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) { - p, unescapeErr := url.PathUnescape(v) - if unescapeErr != nil { - return "", unescapeErr - } - return armsecurity.ServerVulnerabilityAssessmentsSettingKindName(p), nil - }) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.Delete(req.Context(), settingKindParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (s *ServerVulnerabilityAssessmentsSettingsServerTransport) 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~%@]+)/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 { - 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) { - p, unescapeErr := url.PathUnescape(v) - if unescapeErr != nil { - return "", unescapeErr - } - return armsecurity.ServerVulnerabilityAssessmentsSettingKindName(p), nil - }) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.Get(req.Context(), settingKindParam, 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).ServerVulnerabilityAssessmentsSettingClassification, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (s *ServerVulnerabilityAssessmentsSettingsServerTransport) 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/serverVulnerabilityAssessmentsSettings` - 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.ServerVulnerabilityAssessmentsSettingsClientListBySubscriptionResponse, 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/settings_server.go b/sdk/resourcemanager/security/armsecurity/fake/settings_server.go deleted file mode 100644 index 2cfbe5e67dda..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/settings_server.go +++ /dev/null @@ -1,195 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// 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) - - // NewListPager is the fake for method SettingsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armsecurity.SettingsClientListOptions) (resp azfake.PagerResponder[armsecurity.SettingsClientListResponse]) - - // 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) -} - -// NewSettingsServerTransport creates a new instance of SettingsServerTransport with the provided implementation. -// The returned SettingsServerTransport instance is connected to an instance of armsecurity.SettingsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewSettingsServerTransport(srv *SettingsServer) *SettingsServerTransport { - return &SettingsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.SettingsClientListResponse]](), - } -} - -// SettingsServerTransport connects instances of armsecurity.SettingsClient to instances of SettingsServer. -// Don't use this type directly, use NewSettingsServerTransport instead. -type SettingsServerTransport struct { - srv *SettingsServer - newListPager *tracker[azfake.PagerResponder[armsecurity.SettingsClientListResponse]] -} - -// Do implements the policy.Transporter interface for SettingsServerTransport. -func (s *SettingsServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (s *SettingsServerTransport) 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~%@]+)/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 { - 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) { - p, unescapeErr := url.PathUnescape(v) - if unescapeErr != nil { - return "", unescapeErr - } - return armsecurity.SettingNameAutoGenerated(p), nil - }) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.Get(req.Context(), settingNameParam, 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).SettingClassification, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (s *SettingsServerTransport) 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~%@]+)/providers/Microsoft\.Security/settings` - 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.NewListPager(nil) - newListPager = &resp - s.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.SettingsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - s.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - s.newListPager.remove(req) - } - return resp, nil -} - -func (s *SettingsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if s.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - raw, err := readRequestBody(req) - if err != nil { - return nil, err - } - body, err := unmarshalSettingClassification(raw) - if err != nil { - return nil, err - } - settingNameParam, err := parseWithCast(matches[regex.SubexpIndex("settingName")], func(v string) (armsecurity.SettingNameAutoGenerated, error) { - p, unescapeErr := url.PathUnescape(v) - if unescapeErr != nil { - return "", unescapeErr - } - return armsecurity.SettingNameAutoGenerated(p), nil - }) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.Update(req.Context(), settingNameParam, 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).SettingClassification, req) - if err != nil { - return nil, err - } - return resp, nil -} 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 7a8e5248afbc..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/softwareinventories_server.go +++ /dev/null @@ -1,213 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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 deleted file mode 100644 index b8d72b092a7a..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/solutions_server.go +++ /dev/null @@ -1,148 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// SolutionsServer is a fake server for instances of the armsecurity.SolutionsClient type. -type SolutionsServer struct { - // Get is the fake for method SolutionsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, ascLocation string, securitySolutionName string, options *armsecurity.SolutionsClientGetOptions) (resp azfake.Responder[armsecurity.SolutionsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method SolutionsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armsecurity.SolutionsClientListOptions) (resp azfake.PagerResponder[armsecurity.SolutionsClientListResponse]) -} - -// NewSolutionsServerTransport creates a new instance of SolutionsServerTransport with the provided implementation. -// The returned SolutionsServerTransport instance is connected to an instance of armsecurity.SolutionsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewSolutionsServerTransport(srv *SolutionsServer) *SolutionsServerTransport { - return &SolutionsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.SolutionsClientListResponse]](), - } -} - -// SolutionsServerTransport connects instances of armsecurity.SolutionsClient to instances of SolutionsServer. -// Don't use this type directly, use NewSolutionsServerTransport instead. -type SolutionsServerTransport struct { - srv *SolutionsServer - newListPager *tracker[azfake.PagerResponder[armsecurity.SolutionsClientListResponse]] -} - -// Do implements the policy.Transporter interface for SolutionsServerTransport. -func (s *SolutionsServerTransport) 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 "SolutionsClient.Get": - resp, err = s.dispatchGet(req) - case "SolutionsClient.NewListPager": - resp, err = s.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (s *SolutionsServerTransport) 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/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 { - 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 - } - ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) - if err != nil { - return nil, err - } - securitySolutionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securitySolutionName")]) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, ascLocationParam, securitySolutionNameParam, 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).Solution, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (s *SolutionsServerTransport) 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~%@]+)/providers/Microsoft\.Security/securitySolutions` - 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.NewListPager(nil) - newListPager = &resp - s.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.SolutionsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - s.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - s.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/solutionsreferencedata_server.go b/sdk/resourcemanager/security/armsecurity/fake/solutionsreferencedata_server.go deleted file mode 100644 index c5a0fe3d04d2..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/solutionsreferencedata_server.go +++ /dev/null @@ -1,127 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// SolutionsReferenceDataServer is a fake server for instances of the armsecurity.SolutionsReferenceDataClient type. -type SolutionsReferenceDataServer struct { - // List is the fake for method SolutionsReferenceDataClient.List - // HTTP status codes to indicate success: http.StatusOK - List func(ctx context.Context, options *armsecurity.SolutionsReferenceDataClientListOptions) (resp azfake.Responder[armsecurity.SolutionsReferenceDataClientListResponse], errResp azfake.ErrorResponder) - - // ListByHomeRegion is the fake for method SolutionsReferenceDataClient.ListByHomeRegion - // HTTP status codes to indicate success: http.StatusOK - ListByHomeRegion func(ctx context.Context, ascLocation string, options *armsecurity.SolutionsReferenceDataClientListByHomeRegionOptions) (resp azfake.Responder[armsecurity.SolutionsReferenceDataClientListByHomeRegionResponse], errResp azfake.ErrorResponder) -} - -// NewSolutionsReferenceDataServerTransport creates a new instance of SolutionsReferenceDataServerTransport with the provided implementation. -// The returned SolutionsReferenceDataServerTransport instance is connected to an instance of armsecurity.SolutionsReferenceDataClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewSolutionsReferenceDataServerTransport(srv *SolutionsReferenceDataServer) *SolutionsReferenceDataServerTransport { - return &SolutionsReferenceDataServerTransport{srv: srv} -} - -// SolutionsReferenceDataServerTransport connects instances of armsecurity.SolutionsReferenceDataClient to instances of SolutionsReferenceDataServer. -// Don't use this type directly, use NewSolutionsReferenceDataServerTransport instead. -type SolutionsReferenceDataServerTransport struct { - srv *SolutionsReferenceDataServer -} - -// Do implements the policy.Transporter interface for SolutionsReferenceDataServerTransport. -func (s *SolutionsReferenceDataServerTransport) 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 "SolutionsReferenceDataClient.List": - resp, err = s.dispatchList(req) - case "SolutionsReferenceDataClient.ListByHomeRegion": - resp, err = s.dispatchListByHomeRegion(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (s *SolutionsReferenceDataServerTransport) 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 = `/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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - respr, errRespr := s.srv.List(req.Context(), 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).SolutionsReferenceDataList, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (s *SolutionsReferenceDataServerTransport) dispatchListByHomeRegion(req *http.Request) (*http.Response, error) { - if s.srv.ListByHomeRegion == nil { - return nil, &nonRetriableError{errors.New("fake for method ListByHomeRegion not implemented")} - } - 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 { - 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 - } - respr, errRespr := s.srv.ListByHomeRegion(req.Context(), ascLocationParam, 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).SolutionsReferenceDataList, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/sqlvulnerabilityassessmentbaselinerules_server.go b/sdk/resourcemanager/security/armsecurity/fake/sqlvulnerabilityassessmentbaselinerules_server.go deleted file mode 100644 index 2f1da94110ae..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/sqlvulnerabilityassessmentbaselinerules_server.go +++ /dev/null @@ -1,294 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" - "reflect" - "regexp" -) - -// 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) - - // 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) - - // 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) - - // 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) - - // List is the fake for method SQLVulnerabilityAssessmentBaselineRulesClient.List - // 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) -} - -// 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} -} - -// SQLVulnerabilityAssessmentBaselineRulesServerTransport connects instances of armsecurity.SQLVulnerabilityAssessmentBaselineRulesClient to instances of SQLVulnerabilityAssessmentBaselineRulesServer. -// Don't use this type directly, use NewSQLVulnerabilityAssessmentBaselineRulesServerTransport instead. -type SQLVulnerabilityAssessmentBaselineRulesServerTransport struct { - srv *SQLVulnerabilityAssessmentBaselineRulesServer -} - -// Do implements the policy.Transporter interface for SQLVulnerabilityAssessmentBaselineRulesServerTransport. -func (s *SQLVulnerabilityAssessmentBaselineRulesServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (s *SQLVulnerabilityAssessmentBaselineRulesServerTransport) dispatchAdd(req *http.Request) (*http.Response, error) { - if s.srv.Add == nil { - return nil, &nonRetriableError{errors.New("fake for method Add 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() - body, err := server.UnmarshalRequestAsJSON[armsecurity.RulesResultsInput](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 - } - var options *armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientAddOptions - if !reflect.ValueOf(body).IsZero() { - options = &armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientAddOptions{ - Body: &body, - } - } - respr, errRespr := s.srv.Add(req.Context(), workspaceIDParam, resourceIDParam, 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).RulesResults, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (s *SQLVulnerabilityAssessmentBaselineRulesServerTransport) 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/baselineRules/(?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) - } - qp := req.URL.Query() - body, err := server.UnmarshalRequestAsJSON[armsecurity.RuleResultsInput](req) - 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")) - if err != nil { - return nil, err - } - resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) - if err != nil { - return nil, err - } - var options *armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateOptions{ - Body: &body, - } - } - respr, errRespr := s.srv.CreateOrUpdate(req.Context(), ruleIDParam, workspaceIDParam, resourceIDParam, 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).RuleResults, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (s *SQLVulnerabilityAssessmentBaselineRulesServerTransport) 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/baselineRules/(?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) - } - qp := req.URL.Query() - ruleIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleId")]) - 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 - } - respr, errRespr := s.srv.Delete(req.Context(), ruleIDParam, workspaceIDParam, resourceIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (s *SQLVulnerabilityAssessmentBaselineRulesServerTransport) 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/baselineRules/(?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) - } - qp := req.URL.Query() - ruleIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleId")]) - 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 - } - respr, errRespr := s.srv.Get(req.Context(), ruleIDParam, 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).RuleResults, req) - if err != nil { - return nil, err - } - 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")]) - 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 - } - 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 - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/sqlvulnerabilityassessmentscanresults_server.go b/sdk/resourcemanager/security/armsecurity/fake/sqlvulnerabilityassessmentscanresults_server.go deleted file mode 100644 index 84d56e014ade..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/sqlvulnerabilityassessmentscanresults_server.go +++ /dev/null @@ -1,153 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// 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) - - // List is the fake for method SQLVulnerabilityAssessmentScanResultsClient.List - // 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) -} - -// 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} -} - -// SQLVulnerabilityAssessmentScanResultsServerTransport connects instances of armsecurity.SQLVulnerabilityAssessmentScanResultsClient to instances of SQLVulnerabilityAssessmentScanResultsServer. -// Don't use this type directly, use NewSQLVulnerabilityAssessmentScanResultsServerTransport instead. -type SQLVulnerabilityAssessmentScanResultsServerTransport struct { - srv *SQLVulnerabilityAssessmentScanResultsServer -} - -// Do implements the policy.Transporter interface for SQLVulnerabilityAssessmentScanResultsServerTransport. -func (s *SQLVulnerabilityAssessmentScanResultsServerTransport) 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 "SQLVulnerabilityAssessmentScanResultsClient.Get": - resp, err = s.dispatchGet(req) - case "SQLVulnerabilityAssessmentScanResultsClient.List": - resp, err = s.dispatchList(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (s *SQLVulnerabilityAssessmentScanResultsServerTransport) 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/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 { - 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 - } - scanResultIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("scanResultId")]) - 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 - } - respr, errRespr := s.srv.Get(req.Context(), scanIDParam, scanResultIDParam, 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).ScanResult, req) - if err != nil { - return nil, err - } - 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")]) - 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 - } - 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 - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/sqlvulnerabilityassessmentscans_server.go b/sdk/resourcemanager/security/armsecurity/fake/sqlvulnerabilityassessmentscans_server.go deleted file mode 100644 index fac898be5e02..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/sqlvulnerabilityassessmentscans_server.go +++ /dev/null @@ -1,145 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// 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) - - // List is the fake for method SQLVulnerabilityAssessmentScansClient.List - // 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) -} - -// 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} -} - -// SQLVulnerabilityAssessmentScansServerTransport connects instances of armsecurity.SQLVulnerabilityAssessmentScansClient to instances of SQLVulnerabilityAssessmentScansServer. -// Don't use this type directly, use NewSQLVulnerabilityAssessmentScansServerTransport instead. -type SQLVulnerabilityAssessmentScansServerTransport struct { - srv *SQLVulnerabilityAssessmentScansServer -} - -// Do implements the policy.Transporter interface for SQLVulnerabilityAssessmentScansServerTransport. -func (s *SQLVulnerabilityAssessmentScansServerTransport) 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 "SQLVulnerabilityAssessmentScansClient.Get": - resp, err = s.dispatchGet(req) - case "SQLVulnerabilityAssessmentScansClient.List": - resp, err = s.dispatchList(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (s *SQLVulnerabilityAssessmentScansServerTransport) 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/scans/(?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) - } - qp := req.URL.Query() - scanIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("scanId")]) - 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 - } - respr, errRespr := s.srv.Get(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).Scan, 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")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/sqlVulnerabilityAssessments/default/scans` - 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")]) - 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 - } - 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).Scans, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/subassessments_server.go b/sdk/resourcemanager/security/armsecurity/fake/subassessments_server.go deleted file mode 100644 index 72776f0554cd..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/subassessments_server.go +++ /dev/null @@ -1,201 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// SubAssessmentsServer is a fake server for instances of the armsecurity.SubAssessmentsClient type. -type SubAssessmentsServer struct { - // Get is the fake for method SubAssessmentsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, scope string, assessmentName string, subAssessmentName string, options *armsecurity.SubAssessmentsClientGetOptions) (resp azfake.Responder[armsecurity.SubAssessmentsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method SubAssessmentsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(scope string, assessmentName string, options *armsecurity.SubAssessmentsClientListOptions) (resp azfake.PagerResponder[armsecurity.SubAssessmentsClientListResponse]) - - // NewListAllPager is the fake for method SubAssessmentsClient.NewListAllPager - // HTTP status codes to indicate success: http.StatusOK - NewListAllPager func(scope string, options *armsecurity.SubAssessmentsClientListAllOptions) (resp azfake.PagerResponder[armsecurity.SubAssessmentsClientListAllResponse]) -} - -// NewSubAssessmentsServerTransport creates a new instance of SubAssessmentsServerTransport with the provided implementation. -// The returned SubAssessmentsServerTransport instance is connected to an instance of armsecurity.SubAssessmentsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewSubAssessmentsServerTransport(srv *SubAssessmentsServer) *SubAssessmentsServerTransport { - return &SubAssessmentsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.SubAssessmentsClientListResponse]](), - newListAllPager: newTracker[azfake.PagerResponder[armsecurity.SubAssessmentsClientListAllResponse]](), - } -} - -// SubAssessmentsServerTransport connects instances of armsecurity.SubAssessmentsClient to instances of SubAssessmentsServer. -// Don't use this type directly, use NewSubAssessmentsServerTransport instead. -type SubAssessmentsServerTransport struct { - srv *SubAssessmentsServer - newListPager *tracker[azfake.PagerResponder[armsecurity.SubAssessmentsClientListResponse]] - newListAllPager *tracker[azfake.PagerResponder[armsecurity.SubAssessmentsClientListAllResponse]] -} - -// Do implements the policy.Transporter interface for SubAssessmentsServerTransport. -func (s *SubAssessmentsServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (s *SubAssessmentsServerTransport) 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/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 { - 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 - } - assessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentName")]) - if err != nil { - return nil, err - } - subAssessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("subAssessmentName")]) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.Get(req.Context(), scopeParam, assessmentNameParam, subAssessmentNameParam, 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).SubAssessment, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (s *SubAssessmentsServerTransport) 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/assessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/subAssessments` - 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) - } - scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) - if err != nil { - return nil, err - } - assessmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentName")]) - if err != nil { - return nil, err - } - resp := s.srv.NewListPager(scopeParam, assessmentNameParam, nil) - newListPager = &resp - s.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.SubAssessmentsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - s.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - s.newListPager.remove(req) - } - return resp, nil -} - -func (s *SubAssessmentsServerTransport) dispatchNewListAllPager(req *http.Request) (*http.Response, error) { - if s.srv.NewListAllPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListAllPager not implemented")} - } - newListAllPager := s.newListAllPager.get(req) - if newListAllPager == nil { - 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 { - 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.NewListAllPager(scopeParam, nil) - newListAllPager = &resp - s.newListAllPager.add(req, newListAllPager) - server.PagerResponderInjectNextLinks(newListAllPager, req, func(page *armsecurity.SubAssessmentsClientListAllResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListAllPager, req) - if err != nil { - return nil, err - } - if !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)} - } - if !server.PagerResponderMore(newListAllPager) { - s.newListAllPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/tasks_server.go b/sdk/resourcemanager/security/armsecurity/fake/tasks_server.go deleted file mode 100644 index bbdb2e7bdf15..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/tasks_server.go +++ /dev/null @@ -1,419 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// TasksServer is a fake server for instances of the armsecurity.TasksClient type. -type TasksServer struct { - // GetResourceGroupLevelTask is the fake for method TasksClient.GetResourceGroupLevelTask - // HTTP status codes to indicate success: http.StatusOK - GetResourceGroupLevelTask func(ctx context.Context, resourceGroupName string, ascLocation string, taskName string, options *armsecurity.TasksClientGetResourceGroupLevelTaskOptions) (resp azfake.Responder[armsecurity.TasksClientGetResourceGroupLevelTaskResponse], errResp azfake.ErrorResponder) - - // GetSubscriptionLevelTask is the fake for method TasksClient.GetSubscriptionLevelTask - // HTTP status codes to indicate success: http.StatusOK - GetSubscriptionLevelTask func(ctx context.Context, ascLocation string, taskName string, options *armsecurity.TasksClientGetSubscriptionLevelTaskOptions) (resp azfake.Responder[armsecurity.TasksClientGetSubscriptionLevelTaskResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method TasksClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armsecurity.TasksClientListOptions) (resp azfake.PagerResponder[armsecurity.TasksClientListResponse]) - - // NewListByHomeRegionPager is the fake for method TasksClient.NewListByHomeRegionPager - // HTTP status codes to indicate success: http.StatusOK - NewListByHomeRegionPager func(ascLocation string, options *armsecurity.TasksClientListByHomeRegionOptions) (resp azfake.PagerResponder[armsecurity.TasksClientListByHomeRegionResponse]) - - // NewListByResourceGroupPager is the fake for method TasksClient.NewListByResourceGroupPager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, ascLocation string, options *armsecurity.TasksClientListByResourceGroupOptions) (resp azfake.PagerResponder[armsecurity.TasksClientListByResourceGroupResponse]) - - // UpdateResourceGroupLevelTaskState is the fake for method TasksClient.UpdateResourceGroupLevelTaskState - // HTTP status codes to indicate success: http.StatusNoContent - UpdateResourceGroupLevelTaskState func(ctx context.Context, resourceGroupName string, ascLocation string, taskName string, taskUpdateActionType armsecurity.TaskUpdateActionType, options *armsecurity.TasksClientUpdateResourceGroupLevelTaskStateOptions) (resp azfake.Responder[armsecurity.TasksClientUpdateResourceGroupLevelTaskStateResponse], errResp azfake.ErrorResponder) - - // UpdateSubscriptionLevelTaskState is the fake for method TasksClient.UpdateSubscriptionLevelTaskState - // HTTP status codes to indicate success: http.StatusNoContent - UpdateSubscriptionLevelTaskState func(ctx context.Context, ascLocation string, taskName string, taskUpdateActionType armsecurity.TaskUpdateActionType, options *armsecurity.TasksClientUpdateSubscriptionLevelTaskStateOptions) (resp azfake.Responder[armsecurity.TasksClientUpdateSubscriptionLevelTaskStateResponse], errResp azfake.ErrorResponder) -} - -// NewTasksServerTransport creates a new instance of TasksServerTransport with the provided implementation. -// The returned TasksServerTransport instance is connected to an instance of armsecurity.TasksClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewTasksServerTransport(srv *TasksServer) *TasksServerTransport { - return &TasksServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.TasksClientListResponse]](), - newListByHomeRegionPager: newTracker[azfake.PagerResponder[armsecurity.TasksClientListByHomeRegionResponse]](), - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armsecurity.TasksClientListByResourceGroupResponse]](), - } -} - -// TasksServerTransport connects instances of armsecurity.TasksClient to instances of TasksServer. -// Don't use this type directly, use NewTasksServerTransport instead. -type TasksServerTransport struct { - srv *TasksServer - newListPager *tracker[azfake.PagerResponder[armsecurity.TasksClientListResponse]] - newListByHomeRegionPager *tracker[azfake.PagerResponder[armsecurity.TasksClientListByHomeRegionResponse]] - newListByResourceGroupPager *tracker[azfake.PagerResponder[armsecurity.TasksClientListByResourceGroupResponse]] -} - -// Do implements the policy.Transporter interface for TasksServerTransport. -func (t *TasksServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (t *TasksServerTransport) dispatchGetResourceGroupLevelTask(req *http.Request) (*http.Response, error) { - if t.srv.GetResourceGroupLevelTask == nil { - return nil, &nonRetriableError{errors.New("fake for method GetResourceGroupLevelTask not implemented")} - } - 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 { - 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 - } - ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) - if err != nil { - return nil, err - } - taskNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("taskName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.GetResourceGroupLevelTask(req.Context(), resourceGroupNameParam, ascLocationParam, taskNameParam, 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).Task, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (t *TasksServerTransport) dispatchGetSubscriptionLevelTask(req *http.Request) (*http.Response, error) { - if t.srv.GetSubscriptionLevelTask == nil { - return nil, &nonRetriableError{errors.New("fake for method GetSubscriptionLevelTask not implemented")} - } - 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 { - 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 - } - taskNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("taskName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.GetSubscriptionLevelTask(req.Context(), ascLocationParam, taskNameParam, 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).Task, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (t *TasksServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if t.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := t.newListPager.get(req) - if newListPager == nil { - 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 { - 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) - var options *armsecurity.TasksClientListOptions - if filterParam != nil { - options = &armsecurity.TasksClientListOptions{ - Filter: filterParam, - } - } - resp := t.srv.NewListPager(options) - newListPager = &resp - t.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.TasksClientListResponse, 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) { - t.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - t.newListPager.remove(req) - } - return resp, nil -} - -func (t *TasksServerTransport) dispatchNewListByHomeRegionPager(req *http.Request) (*http.Response, error) { - if t.srv.NewListByHomeRegionPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByHomeRegionPager not implemented")} - } - newListByHomeRegionPager := t.newListByHomeRegionPager.get(req) - if newListByHomeRegionPager == nil { - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) - if err != nil { - return nil, err - } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - var options *armsecurity.TasksClientListByHomeRegionOptions - if filterParam != nil { - options = &armsecurity.TasksClientListByHomeRegionOptions{ - Filter: filterParam, - } - } - resp := t.srv.NewListByHomeRegionPager(ascLocationParam, options) - newListByHomeRegionPager = &resp - t.newListByHomeRegionPager.add(req, newListByHomeRegionPager) - server.PagerResponderInjectNextLinks(newListByHomeRegionPager, req, func(page *armsecurity.TasksClientListByHomeRegionResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByHomeRegionPager, req) - if err != nil { - return nil, err - } - if !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)} - } - if !server.PagerResponderMore(newListByHomeRegionPager) { - t.newListByHomeRegionPager.remove(req) - } - return resp, nil -} - -func (t *TasksServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { - if t.srv.NewListByResourceGroupPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} - } - newListByResourceGroupPager := t.newListByResourceGroupPager.get(req) - if newListByResourceGroupPager == nil { - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) - if err != nil { - return nil, err - } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - var options *armsecurity.TasksClientListByResourceGroupOptions - if filterParam != nil { - options = &armsecurity.TasksClientListByResourceGroupOptions{ - Filter: filterParam, - } - } - resp := t.srv.NewListByResourceGroupPager(resourceGroupNameParam, ascLocationParam, options) - newListByResourceGroupPager = &resp - t.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armsecurity.TasksClientListByResourceGroupResponse, 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) { - t.newListByResourceGroupPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByResourceGroupPager) { - t.newListByResourceGroupPager.remove(req) - } - return resp, nil -} - -func (t *TasksServerTransport) dispatchUpdateResourceGroupLevelTaskState(req *http.Request) (*http.Response, error) { - if t.srv.UpdateResourceGroupLevelTaskState == nil { - return nil, &nonRetriableError{errors.New("fake for method UpdateResourceGroupLevelTaskState not implemented")} - } - 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 { - 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 - } - ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) - if err != nil { - return nil, err - } - taskNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("taskName")]) - if err != nil { - return nil, err - } - taskUpdateActionTypeParam, err := parseWithCast(matches[regex.SubexpIndex("taskUpdateActionType")], func(v string) (armsecurity.TaskUpdateActionType, error) { - p, unescapeErr := url.PathUnescape(v) - if unescapeErr != nil { - return "", unescapeErr - } - return armsecurity.TaskUpdateActionType(p), nil - }) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.UpdateResourceGroupLevelTaskState(req.Context(), resourceGroupNameParam, ascLocationParam, taskNameParam, taskUpdateActionTypeParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !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) - if err != nil { - return nil, err - } - return resp, nil -} - -func (t *TasksServerTransport) dispatchUpdateSubscriptionLevelTaskState(req *http.Request) (*http.Response, error) { - if t.srv.UpdateSubscriptionLevelTaskState == nil { - return nil, &nonRetriableError{errors.New("fake for method UpdateSubscriptionLevelTaskState not implemented")} - } - 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 { - 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 - } - taskNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("taskName")]) - if err != nil { - return nil, err - } - taskUpdateActionTypeParam, err := parseWithCast(matches[regex.SubexpIndex("taskUpdateActionType")], func(v string) (armsecurity.TaskUpdateActionType, error) { - p, unescapeErr := url.PathUnescape(v) - if unescapeErr != nil { - return "", unescapeErr - } - return armsecurity.TaskUpdateActionType(p), nil - }) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.UpdateSubscriptionLevelTaskState(req.Context(), ascLocationParam, taskNameParam, taskUpdateActionTypeParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !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) - if err != nil { - return nil, err - } - return resp, nil -} 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 81f308b0d343..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/time_rfc3339.go +++ /dev/null @@ -1,110 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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 deleted file mode 100644 index 89d962d25f0a..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/topology_server.go +++ /dev/null @@ -1,193 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// TopologyServer is a fake server for instances of the armsecurity.TopologyClient type. -type TopologyServer struct { - // Get is the fake for method TopologyClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, ascLocation string, topologyResourceName string, options *armsecurity.TopologyClientGetOptions) (resp azfake.Responder[armsecurity.TopologyClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method TopologyClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armsecurity.TopologyClientListOptions) (resp azfake.PagerResponder[armsecurity.TopologyClientListResponse]) - - // NewListByHomeRegionPager is the fake for method TopologyClient.NewListByHomeRegionPager - // HTTP status codes to indicate success: http.StatusOK - NewListByHomeRegionPager func(ascLocation string, options *armsecurity.TopologyClientListByHomeRegionOptions) (resp azfake.PagerResponder[armsecurity.TopologyClientListByHomeRegionResponse]) -} - -// NewTopologyServerTransport creates a new instance of TopologyServerTransport with the provided implementation. -// The returned TopologyServerTransport instance is connected to an instance of armsecurity.TopologyClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewTopologyServerTransport(srv *TopologyServer) *TopologyServerTransport { - return &TopologyServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.TopologyClientListResponse]](), - newListByHomeRegionPager: newTracker[azfake.PagerResponder[armsecurity.TopologyClientListByHomeRegionResponse]](), - } -} - -// TopologyServerTransport connects instances of armsecurity.TopologyClient to instances of TopologyServer. -// Don't use this type directly, use NewTopologyServerTransport instead. -type TopologyServerTransport struct { - srv *TopologyServer - newListPager *tracker[azfake.PagerResponder[armsecurity.TopologyClientListResponse]] - newListByHomeRegionPager *tracker[azfake.PagerResponder[armsecurity.TopologyClientListByHomeRegionResponse]] -} - -// Do implements the policy.Transporter interface for TopologyServerTransport. -func (t *TopologyServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (t *TopologyServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if t.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/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 { - 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 - } - ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) - if err != nil { - return nil, err - } - topologyResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("topologyResourceName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.Get(req.Context(), resourceGroupNameParam, ascLocationParam, topologyResourceNameParam, 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).TopologyResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (t *TopologyServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if t.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := t.newListPager.get(req) - if newListPager == nil { - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := t.srv.NewListPager(nil) - newListPager = &resp - t.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.TopologyClientListResponse, 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) { - t.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - t.newListPager.remove(req) - } - return resp, nil -} - -func (t *TopologyServerTransport) dispatchNewListByHomeRegionPager(req *http.Request) (*http.Response, error) { - if t.srv.NewListByHomeRegionPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByHomeRegionPager not implemented")} - } - newListByHomeRegionPager := t.newListByHomeRegionPager.get(req) - if newListByHomeRegionPager == nil { - 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 { - 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 - } - resp := t.srv.NewListByHomeRegionPager(ascLocationParam, nil) - newListByHomeRegionPager = &resp - t.newListByHomeRegionPager.add(req, newListByHomeRegionPager) - server.PagerResponderInjectNextLinks(newListByHomeRegionPager, req, func(page *armsecurity.TopologyClientListByHomeRegionResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByHomeRegionPager, req) - if err != nil { - return nil, err - } - if !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)} - } - if !server.PagerResponderMore(newListByHomeRegionPager) { - t.newListByHomeRegionPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/workspacesettings_server.go b/sdk/resourcemanager/security/armsecurity/fake/workspacesettings_server.go deleted file mode 100644 index 829b6ddf6a44..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/workspacesettings_server.go +++ /dev/null @@ -1,253 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// WorkspaceSettingsServer is a fake server for instances of the armsecurity.WorkspaceSettingsClient type. -type WorkspaceSettingsServer struct { - // Create is the fake for method WorkspaceSettingsClient.Create - // HTTP status codes to indicate success: http.StatusOK - Create func(ctx context.Context, workspaceSettingName string, workspaceSetting armsecurity.WorkspaceSetting, options *armsecurity.WorkspaceSettingsClientCreateOptions) (resp azfake.Responder[armsecurity.WorkspaceSettingsClientCreateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method WorkspaceSettingsClient.Delete - // HTTP status codes to indicate success: http.StatusNoContent - Delete func(ctx context.Context, workspaceSettingName string, options *armsecurity.WorkspaceSettingsClientDeleteOptions) (resp azfake.Responder[armsecurity.WorkspaceSettingsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method WorkspaceSettingsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, workspaceSettingName string, options *armsecurity.WorkspaceSettingsClientGetOptions) (resp azfake.Responder[armsecurity.WorkspaceSettingsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method WorkspaceSettingsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armsecurity.WorkspaceSettingsClientListOptions) (resp azfake.PagerResponder[armsecurity.WorkspaceSettingsClientListResponse]) - - // Update is the fake for method WorkspaceSettingsClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, workspaceSettingName string, workspaceSetting armsecurity.WorkspaceSetting, options *armsecurity.WorkspaceSettingsClientUpdateOptions) (resp azfake.Responder[armsecurity.WorkspaceSettingsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewWorkspaceSettingsServerTransport creates a new instance of WorkspaceSettingsServerTransport with the provided implementation. -// The returned WorkspaceSettingsServerTransport instance is connected to an instance of armsecurity.WorkspaceSettingsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewWorkspaceSettingsServerTransport(srv *WorkspaceSettingsServer) *WorkspaceSettingsServerTransport { - return &WorkspaceSettingsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.WorkspaceSettingsClientListResponse]](), - } -} - -// WorkspaceSettingsServerTransport connects instances of armsecurity.WorkspaceSettingsClient to instances of WorkspaceSettingsServer. -// Don't use this type directly, use NewWorkspaceSettingsServerTransport instead. -type WorkspaceSettingsServerTransport struct { - srv *WorkspaceSettingsServer - newListPager *tracker[azfake.PagerResponder[armsecurity.WorkspaceSettingsClientListResponse]] -} - -// Do implements the policy.Transporter interface for WorkspaceSettingsServerTransport. -func (w *WorkspaceSettingsServerTransport) 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 "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) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (w *WorkspaceSettingsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if w.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.WorkspaceSetting](req) - if err != nil { - return nil, err - } - workspaceSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceSettingName")]) - if err != nil { - return nil, err - } - respr, errRespr := w.srv.Create(req.Context(), workspaceSettingNameParam, 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).WorkspaceSetting, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (w *WorkspaceSettingsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if w.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/workspaceSettings/(?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) - } - workspaceSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceSettingName")]) - if err != nil { - return nil, err - } - respr, errRespr := w.srv.Delete(req.Context(), workspaceSettingNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !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) - if err != nil { - return nil, err - } - return resp, nil -} - -func (w *WorkspaceSettingsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if w.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/workspaceSettings/(?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) - } - workspaceSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceSettingName")]) - if err != nil { - return nil, err - } - respr, errRespr := w.srv.Get(req.Context(), workspaceSettingNameParam, 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).WorkspaceSetting, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (w *WorkspaceSettingsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if w.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := w.newListPager.get(req) - if newListPager == nil { - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := w.srv.NewListPager(nil) - newListPager = &resp - w.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.WorkspaceSettingsClientListResponse, 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) { - w.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - w.newListPager.remove(req) - } - return resp, nil -} - -func (w *WorkspaceSettingsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if w.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - 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 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.WorkspaceSetting](req) - if err != nil { - return nil, err - } - workspaceSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceSettingName")]) - if err != nil { - return nil, err - } - respr, errRespr := w.srv.Update(req.Context(), workspaceSettingNameParam, 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).WorkspaceSetting, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/githubowners_client.go b/sdk/resourcemanager/security/armsecurity/githubowners_client.go deleted file mode 100644 index c4fdc71f9e3c..000000000000 --- a/sdk/resourcemanager/security/armsecurity/githubowners_client.go +++ /dev/null @@ -1,242 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// GitHubOwnersClient contains the methods for the GitHubOwners group. -// Don't use this type directly, use NewGitHubOwnersClient() instead. -type GitHubOwnersClient struct { - internal *arm.Client - subscriptionID string -} - -// NewGitHubOwnersClient creates a new instance of GitHubOwnersClient 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 NewGitHubOwnersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GitHubOwnersClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &GitHubOwnersClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Returns a monitored GitHub owner. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-09-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 - const operationName = "GitHubOwnersClient.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, securityConnectorName, ownerName, options) - if err != nil { - return GitHubOwnersClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return GitHubOwnersClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return GitHubOwnersClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *GitHubOwnersClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, ownerName string, options *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") - } - 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)) - 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-09-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 *GitHubOwnersClient) getHandleResponse(resp *http.Response) (GitHubOwnersClientGetResponse, error) { - result := GitHubOwnersClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.GitHubOwner); err != nil { - return GitHubOwnersClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Returns a list of GitHub owners onboarded to the connector. -// -// Generated from API version 2023-09-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. -func (client *GitHubOwnersClient) NewListPager(resourceGroupName string, securityConnectorName string, options *GitHubOwnersClientListOptions) *runtime.Pager[GitHubOwnersClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[GitHubOwnersClientListResponse]{ - More: func(page GitHubOwnersClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *GitHubOwnersClientListResponse) (GitHubOwnersClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "GitHubOwnersClient.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, securityConnectorName, options) - }, nil) - if err != nil { - return GitHubOwnersClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *GitHubOwnersClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if securityConnectorName == "" { - return nil, errors.New("parameter securityConnectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-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 *GitHubOwnersClient) listHandleResponse(resp *http.Response) (GitHubOwnersClientListResponse, error) { - result := GitHubOwnersClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.GitHubOwnerListResponse); err != nil { - return GitHubOwnersClientListResponse{}, err - } - return result, nil -} - -// ListAvailable - 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 -// - 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 -// method. -func (client *GitHubOwnersClient) ListAvailable(ctx context.Context, resourceGroupName string, securityConnectorName string, options *GitHubOwnersClientListAvailableOptions) (GitHubOwnersClientListAvailableResponse, error) { - var err error - const operationName = "GitHubOwnersClient.ListAvailable" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listAvailableCreateRequest(ctx, resourceGroupName, securityConnectorName, options) - if err != nil { - return GitHubOwnersClientListAvailableResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return GitHubOwnersClientListAvailableResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return GitHubOwnersClientListAvailableResponse{}, err - } - resp, err := client.listAvailableHandleResponse(httpResp) - return resp, err -} - -// listAvailableCreateRequest creates the ListAvailable request. -func (client *GitHubOwnersClient) listAvailableCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if securityConnectorName == "" { - return nil, errors.New("parameter securityConnectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listAvailableHandleResponse handles the ListAvailable response. -func (client *GitHubOwnersClient) listAvailableHandleResponse(resp *http.Response) (GitHubOwnersClientListAvailableResponse, error) { - result := GitHubOwnersClientListAvailableResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.GitHubOwnerListResponse); err != nil { - return GitHubOwnersClientListAvailableResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/githubowners_client_example_test.go b/sdk/resourcemanager/security/armsecurity/githubowners_client_example_test.go deleted file mode 100644 index 3fbdc75f3a1f..000000000000 --- a/sdk/resourcemanager/security/armsecurity/githubowners_client_example_test.go +++ /dev/null @@ -1,138 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-09-01-preview/examples/SecurityConnectorsDevOps/ListAvailableGitHubOwners_example.json -func ExampleGitHubOwnersClient_ListAvailable() { - 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.NewGitHubOwnersClient().ListAvailable(ctx, "myRg", "mySecurityConnectorName", 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.GitHubOwnerListResponse = armsecurity.GitHubOwnerListResponse{ - // Value: []*armsecurity.GitHubOwner{ - // { - // Name: to.Ptr("myGitHubOwner"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops/gitHubOwners"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/gitHubOwners/myGitHubOwner"), - // Properties: &armsecurity.GitHubOwnerProperties{ - // OnboardingState: to.Ptr(armsecurity.OnboardingStateOnboarded), - // OwnerURL: to.Ptr("https://github.com/myGitHubOwner"), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("anotherGitHubOwner"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops/gitHubOwners"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/gitHubOwners/anotherGitHubOwner"), - // Properties: &armsecurity.GitHubOwnerProperties{ - // OnboardingState: to.Ptr(armsecurity.OnboardingStateOnboardedByOtherConnector), - // OwnerURL: to.Ptr("https://github.com/anotherGitHubOwner"), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("notOnboardedOwner"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops/gitHubOwners"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/gitHubOwners/notOnboardedOwner"), - // Properties: &armsecurity.GitHubOwnerProperties{ - // OnboardingState: to.Ptr(armsecurity.OnboardingStateNotOnboarded), - // OwnerURL: to.Ptr("https://github.com/notOnboardedOwner"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-09-01-preview/examples/SecurityConnectorsDevOps/ListGitHubOwners_example.json -func ExampleGitHubOwnersClient_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.NewGitHubOwnersClient().NewListPager("myRg", "mySecurityConnectorName", 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.GitHubOwnerListResponse = armsecurity.GitHubOwnerListResponse{ - // Value: []*armsecurity.GitHubOwner{ - // { - // Name: to.Ptr("myGitHubOwner"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops/gitHubOwners"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/gitHubOwners/myGitHubOwner"), - // Properties: &armsecurity.GitHubOwnerProperties{ - // OnboardingState: to.Ptr(armsecurity.OnboardingStateOnboarded), - // OwnerURL: to.Ptr("https://github.com/myGitHubOwner"), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-09-01-preview/examples/SecurityConnectorsDevOps/GetGitHubOwners_example.json -func ExampleGitHubOwnersClient_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.NewGitHubOwnersClient().Get(ctx, "myRg", "mySecurityConnectorName", "myGitHubOwner", 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.GitHubOwner = armsecurity.GitHubOwner{ - // Name: to.Ptr("myGitHubOwner"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops/gitHubOwners"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/gitHubOwners/myGitHubOwner"), - // Properties: &armsecurity.GitHubOwnerProperties{ - // OnboardingState: to.Ptr(armsecurity.OnboardingStateOnboarded), - // OwnerURL: to.Ptr("https://github.com/myGitHubOwner"), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // }, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/githubrepos_client.go b/sdk/resourcemanager/security/armsecurity/githubrepos_client.go deleted file mode 100644 index e0ddc54d0729..000000000000 --- a/sdk/resourcemanager/security/armsecurity/githubrepos_client.go +++ /dev/null @@ -1,187 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// GitHubReposClient contains the methods for the GitHubRepos group. -// Don't use this type directly, use NewGitHubReposClient() instead. -type GitHubReposClient struct { - internal *arm.Client - subscriptionID string -} - -// NewGitHubReposClient creates a new instance of GitHubReposClient 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 NewGitHubReposClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GitHubReposClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &GitHubReposClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Returns a monitored GitHub repository. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-09-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 - const operationName = "GitHubReposClient.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, securityConnectorName, ownerName, repoName, options) - if err != nil { - return GitHubReposClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return GitHubReposClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return GitHubReposClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// 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) { - 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") - } - 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.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-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 *GitHubReposClient) getHandleResponse(resp *http.Response) (GitHubReposClientGetResponse, error) { - result := GitHubReposClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.GitHubRepository); err != nil { - return GitHubReposClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Returns a list of GitHub repositories onboarded to the connector. -// -// Generated from API version 2023-09-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]{ - More: func(page GitHubReposClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *GitHubReposClientListResponse) (GitHubReposClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "GitHubReposClient.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, securityConnectorName, ownerName, options) - }, nil) - if err != nil { - return GitHubReposClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *GitHubReposClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, ownerName string, options *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") - } - 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)) - 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-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 *GitHubReposClient) listHandleResponse(resp *http.Response) (GitHubReposClientListResponse, error) { - result := GitHubReposClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.GitHubRepositoryListResponse); err != nil { - return GitHubReposClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/githubrepos_client_example_test.go b/sdk/resourcemanager/security/armsecurity/githubrepos_client_example_test.go deleted file mode 100644 index b5daa86a7e6c..000000000000 --- a/sdk/resourcemanager/security/armsecurity/githubrepos_client_example_test.go +++ /dev/null @@ -1,92 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-09-01-preview/examples/SecurityConnectorsDevOps/ListGitHubRepos_example.json -func ExampleGitHubReposClient_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.NewGitHubReposClient().NewListPager("myRg", "mySecurityConnectorName", "myGitHubOwner", 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.GitHubRepositoryListResponse = armsecurity.GitHubRepositoryListResponse{ - // Value: []*armsecurity.GitHubRepository{ - // { - // Name: to.Ptr("myGitHubRepo"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops/gitHubOwners/repos"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/gitHubOwners/myGitHubOwner/repos/myGitHubRepo"), - // Properties: &armsecurity.GitHubRepositoryProperties{ - // OnboardingState: to.Ptr(armsecurity.OnboardingStateOnboarded), - // ParentOwnerName: to.Ptr("myGitHubOwner"), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // RepoFullName: to.Ptr("myGitHubOwner/myGitHubRepo"), - // RepoName: to.Ptr("myGitHubRepo"), - // RepoURL: to.Ptr("https://github.com/myGitHubOwner/myGitHubRepo"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-09-01-preview/examples/SecurityConnectorsDevOps/GetGitHubRepos_example.json -func ExampleGitHubReposClient_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.NewGitHubReposClient().Get(ctx, "myRg", "mySecurityConnectorName", "myGitHubOwner", "myGitHubRepo", 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.GitHubRepository = armsecurity.GitHubRepository{ - // Name: to.Ptr("myGitHubRepo"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops/gitHubOwners/repos"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/gitHubOwners/myGitHubOwner/repos/myGitHubRepo"), - // Properties: &armsecurity.GitHubRepositoryProperties{ - // OnboardingState: to.Ptr(armsecurity.OnboardingStateOnboarded), - // ParentOwnerName: to.Ptr("myGitHubOwner"), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // RepoFullName: to.Ptr("myGitHubOwner/myGitHubRepo"), - // RepoName: to.Ptr("myGitHubRepo"), - // RepoURL: to.Ptr("https://github.com/myGitHubOwner/myGitHubRepo"), - // }, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/gitlabgroups_client.go b/sdk/resourcemanager/security/armsecurity/gitlabgroups_client.go deleted file mode 100644 index b0696c710ce1..000000000000 --- a/sdk/resourcemanager/security/armsecurity/gitlabgroups_client.go +++ /dev/null @@ -1,242 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// GitLabGroupsClient contains the methods for the GitLabGroups group. -// Don't use this type directly, use NewGitLabGroupsClient() instead. -type GitLabGroupsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewGitLabGroupsClient creates a new instance of GitLabGroupsClient 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 NewGitLabGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GitLabGroupsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &GitLabGroupsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - 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 -// - 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 - const operationName = "GitLabGroupsClient.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, securityConnectorName, groupFQName, options) - if err != nil { - return GitLabGroupsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return GitLabGroupsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return GitLabGroupsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *GitLabGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, groupFQName string, options *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") - } - 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 groupFQName == "" { - return nil, errors.New("parameter groupFQName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupFQName}", url.PathEscape(groupFQName)) - 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-09-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 *GitLabGroupsClient) getHandleResponse(resp *http.Response) (GitLabGroupsClientGetResponse, error) { - result := GitLabGroupsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.GitLabGroup); err != nil { - return GitLabGroupsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Returns a list of GitLab groups onboarded to the connector. -// -// Generated from API version 2023-09-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. -func (client *GitLabGroupsClient) NewListPager(resourceGroupName string, securityConnectorName string, options *GitLabGroupsClientListOptions) *runtime.Pager[GitLabGroupsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[GitLabGroupsClientListResponse]{ - More: func(page GitLabGroupsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *GitLabGroupsClientListResponse) (GitLabGroupsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "GitLabGroupsClient.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, securityConnectorName, options) - }, nil) - if err != nil { - return GitLabGroupsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *GitLabGroupsClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if securityConnectorName == "" { - return nil, errors.New("parameter securityConnectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-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 *GitLabGroupsClient) listHandleResponse(resp *http.Response) (GitLabGroupsClientListResponse, error) { - result := GitLabGroupsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.GitLabGroupListResponse); err != nil { - return GitLabGroupsClientListResponse{}, err - } - return result, nil -} - -// ListAvailable - 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 -// - 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 -// method. -func (client *GitLabGroupsClient) ListAvailable(ctx context.Context, resourceGroupName string, securityConnectorName string, options *GitLabGroupsClientListAvailableOptions) (GitLabGroupsClientListAvailableResponse, error) { - var err error - const operationName = "GitLabGroupsClient.ListAvailable" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listAvailableCreateRequest(ctx, resourceGroupName, securityConnectorName, options) - if err != nil { - return GitLabGroupsClientListAvailableResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return GitLabGroupsClientListAvailableResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return GitLabGroupsClientListAvailableResponse{}, err - } - resp, err := client.listAvailableHandleResponse(httpResp) - return resp, err -} - -// listAvailableCreateRequest creates the ListAvailable request. -func (client *GitLabGroupsClient) listAvailableCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if securityConnectorName == "" { - return nil, errors.New("parameter securityConnectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listAvailableHandleResponse handles the ListAvailable response. -func (client *GitLabGroupsClient) listAvailableHandleResponse(resp *http.Response) (GitLabGroupsClientListAvailableResponse, error) { - result := GitLabGroupsClientListAvailableResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.GitLabGroupListResponse); err != nil { - return GitLabGroupsClientListAvailableResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/gitlabgroups_client_example_test.go b/sdk/resourcemanager/security/armsecurity/gitlabgroups_client_example_test.go deleted file mode 100644 index 2e85a883e681..000000000000 --- a/sdk/resourcemanager/security/armsecurity/gitlabgroups_client_example_test.go +++ /dev/null @@ -1,143 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-09-01-preview/examples/SecurityConnectorsDevOps/ListAvailableGitLabGroups_example.json -func ExampleGitLabGroupsClient_ListAvailable() { - 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.NewGitLabGroupsClient().ListAvailable(ctx, "myRg", "mySecurityConnectorName", 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.GitLabGroupListResponse = armsecurity.GitLabGroupListResponse{ - // Value: []*armsecurity.GitLabGroup{ - // { - // Name: to.Ptr("myGitLabGroup$mySubGroup"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops/gitLabGroups"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/gitLabGroups/myGitLabGroup$mySubGroup"), - // Properties: &armsecurity.GitLabGroupProperties{ - // FullyQualifiedName: to.Ptr("myGitLabGroup$mySubGroup"), - // OnboardingState: to.Ptr(armsecurity.OnboardingStateOnboarded), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // URL: to.Ptr("https://gitlab.example.com/myGitLabGroup/mySubGroup"), - // }, - // }, - // { - // Name: to.Ptr("myGitLabGroup"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops/gitLabGroups"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/gitLabGroups/myGitLabGroup"), - // Properties: &armsecurity.GitLabGroupProperties{ - // FullyQualifiedName: to.Ptr("myGitLabGroup"), - // OnboardingState: to.Ptr(armsecurity.OnboardingStateOnboardedByOtherConnector), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // URL: to.Ptr("https://gitlab.example.com/myGitLabGroup"), - // }, - // }, - // { - // Name: to.Ptr("anotherGitLabGroup"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops/gitLabGroups"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/gitLabGroups/anotherGitLabGroup"), - // Properties: &armsecurity.GitLabGroupProperties{ - // FullyQualifiedName: to.Ptr("anotherGitLabGroup"), - // OnboardingState: to.Ptr(armsecurity.OnboardingStateNotOnboarded), - // URL: to.Ptr("https://gitlab.example.com/anotherGitLabGroup"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-09-01-preview/examples/SecurityConnectorsDevOps/ListGitLabGroups_example.json -func ExampleGitLabGroupsClient_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.NewGitLabGroupsClient().NewListPager("myRg", "mySecurityConnectorName", 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.GitLabGroupListResponse = armsecurity.GitLabGroupListResponse{ - // Value: []*armsecurity.GitLabGroup{ - // { - // Name: to.Ptr("myGitLabGroup$mySubGroup"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops/gitLabGroups"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/gitLabGroups/myGitLabGroup$mySubGroup"), - // Properties: &armsecurity.GitLabGroupProperties{ - // FullyQualifiedName: to.Ptr("myGitLabGroup$mySubGroup"), - // OnboardingState: to.Ptr(armsecurity.OnboardingStateOnboarded), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // URL: to.Ptr("https://gitlab.example.com/myGitLabGroup/mySubGroup"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-09-01-preview/examples/SecurityConnectorsDevOps/GetGitLabGroups_example.json -func ExampleGitLabGroupsClient_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.NewGitLabGroupsClient().Get(ctx, "myRg", "mySecurityConnectorName", "myGitLabGroup$mySubGroup", 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.GitLabGroup = armsecurity.GitLabGroup{ - // Name: to.Ptr("myGitLabGroup$mySubGroup"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops/gitLabGroups"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/gitLabGroups/myGitLabGroup$mySubGroup"), - // Properties: &armsecurity.GitLabGroupProperties{ - // FullyQualifiedName: to.Ptr("myGitLabGroup$mySubGroup"), - // OnboardingState: to.Ptr(armsecurity.OnboardingStateOnboarded), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // URL: to.Ptr("https://gitlab.example.com/myGitLabGroup/mySubGroup"), - // }, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/gitlabprojects_client.go b/sdk/resourcemanager/security/armsecurity/gitlabprojects_client.go deleted file mode 100644 index 45c14ba71c8c..000000000000 --- a/sdk/resourcemanager/security/armsecurity/gitlabprojects_client.go +++ /dev/null @@ -1,187 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// GitLabProjectsClient contains the methods for the GitLabProjects group. -// Don't use this type directly, use NewGitLabProjectsClient() instead. -type GitLabProjectsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewGitLabProjectsClient creates a new instance of GitLabProjectsClient 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 NewGitLabProjectsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GitLabProjectsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &GitLabProjectsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - 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 -// - 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 - const operationName = "GitLabProjectsClient.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, securityConnectorName, groupFQName, projectName, options) - if err != nil { - return GitLabProjectsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return GitLabProjectsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return GitLabProjectsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// 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) { - 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") - } - 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 groupFQName == "" { - return nil, errors.New("parameter groupFQName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupFQName}", url.PathEscape(groupFQName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - 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-09-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 *GitLabProjectsClient) getHandleResponse(resp *http.Response) (GitLabProjectsClientGetResponse, error) { - result := GitLabProjectsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.GitLabProject); err != nil { - return GitLabProjectsClientGetResponse{}, err - } - return result, nil -} - -// 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 -// - 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]{ - More: func(page GitLabProjectsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *GitLabProjectsClientListResponse) (GitLabProjectsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "GitLabProjectsClient.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, securityConnectorName, groupFQName, options) - }, nil) - if err != nil { - return GitLabProjectsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *GitLabProjectsClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, groupFQName string, options *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") - } - 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 groupFQName == "" { - return nil, errors.New("parameter groupFQName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupFQName}", url.PathEscape(groupFQName)) - 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-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 *GitLabProjectsClient) listHandleResponse(resp *http.Response) (GitLabProjectsClientListResponse, error) { - result := GitLabProjectsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.GitLabProjectListResponse); err != nil { - return GitLabProjectsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/gitlabprojects_client_example_test.go b/sdk/resourcemanager/security/armsecurity/gitlabprojects_client_example_test.go deleted file mode 100644 index e81f094e2b27..000000000000 --- a/sdk/resourcemanager/security/armsecurity/gitlabprojects_client_example_test.go +++ /dev/null @@ -1,90 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-09-01-preview/examples/SecurityConnectorsDevOps/ListGitLabProjects_example.json -func ExampleGitLabProjectsClient_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.NewGitLabProjectsClient().NewListPager("myRg", "mySecurityConnectorName", "myGitLabGroup$mySubGroup", 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.GitLabProjectListResponse = armsecurity.GitLabProjectListResponse{ - // Value: []*armsecurity.GitLabProject{ - // { - // Name: to.Ptr("myGitLabProject"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops/gitLabGroups/projects"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/gitLabGroups/myGitLabGroup$mySubGroup/projects/myGitLabProject"), - // Properties: &armsecurity.GitLabProjectProperties{ - // FullyQualifiedName: to.Ptr("myGitLabGroup$mySubGroup$myGitLabProject"), - // FullyQualifiedParentGroupName: to.Ptr("myGitLabGroup$mySubGroup"), - // OnboardingState: to.Ptr(armsecurity.OnboardingStateOnboarded), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // URL: to.Ptr("https://gitlab.example.com/myGitLabGroup/mySubGroup/myGitLabProject"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-09-01-preview/examples/SecurityConnectorsDevOps/GetGitLabProjects_example.json -func ExampleGitLabProjectsClient_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.NewGitLabProjectsClient().Get(ctx, "myRg", "mySecurityConnectorName", "myGitLabGroup$mySubGroup", "myGitLabProject", 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.GitLabProject = armsecurity.GitLabProject{ - // Name: to.Ptr("myGitLabProject"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops/gitLabGroups/projects"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/gitLabGroups/myGitLabGroup$mySubGroup/projects/myGitLabProject"), - // Properties: &armsecurity.GitLabProjectProperties{ - // FullyQualifiedName: to.Ptr("myGitLabGroup$mySubGroup$myGitLabProject"), - // FullyQualifiedParentGroupName: to.Ptr("myGitLabGroup$mySubGroup"), - // OnboardingState: to.Ptr(armsecurity.OnboardingStateOnboarded), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // URL: to.Ptr("https://gitlab.example.com/myGitLabGroup/mySubGroup/myGitLabProject"), - // }, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/gitlabsubgroups_client.go b/sdk/resourcemanager/security/armsecurity/gitlabsubgroups_client.go deleted file mode 100644 index 83a9056516d0..000000000000 --- a/sdk/resourcemanager/security/armsecurity/gitlabsubgroups_client.go +++ /dev/null @@ -1,113 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// GitLabSubgroupsClient contains the methods for the GitLabSubgroups group. -// Don't use this type directly, use NewGitLabSubgroupsClient() instead. -type GitLabSubgroupsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewGitLabSubgroupsClient creates a new instance of GitLabSubgroupsClient 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 NewGitLabSubgroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GitLabSubgroupsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &GitLabSubgroupsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// List - 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 -// - 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 - const operationName = "GitLabSubgroupsClient.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, resourceGroupName, securityConnectorName, groupFQName, options) - if err != nil { - return GitLabSubgroupsClientListResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return GitLabSubgroupsClientListResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return GitLabSubgroupsClientListResponse{}, err - } - resp, err := client.listHandleResponse(httpResp) - return resp, err -} - -// listCreateRequest creates the List request. -func (client *GitLabSubgroupsClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, groupFQName string, options *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") - } - 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 groupFQName == "" { - return nil, errors.New("parameter groupFQName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupFQName}", url.PathEscape(groupFQName)) - 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-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 *GitLabSubgroupsClient) listHandleResponse(resp *http.Response) (GitLabSubgroupsClientListResponse, error) { - result := GitLabSubgroupsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.GitLabGroupListResponse); err != nil { - return GitLabSubgroupsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/gitlabsubgroups_client_example_test.go b/sdk/resourcemanager/security/armsecurity/gitlabsubgroups_client_example_test.go deleted file mode 100644 index 6add328158ad..000000000000 --- a/sdk/resourcemanager/security/armsecurity/gitlabsubgroups_client_example_test.go +++ /dev/null @@ -1,52 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-09-01-preview/examples/SecurityConnectorsDevOps/ListGitLabSubgroups_example.json -func ExampleGitLabSubgroupsClient_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.NewGitLabSubgroupsClient().List(ctx, "myRg", "mySecurityConnectorName", "myGitLabGroup", 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.GitLabGroupListResponse = armsecurity.GitLabGroupListResponse{ - // Value: []*armsecurity.GitLabGroup{ - // { - // Name: to.Ptr("myGitLabGroup$mySubGroup"), - // Type: to.Ptr("Microsoft.Security/securityConnectors/devops/gitLabGroups"), - // ID: to.Ptr("/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourceGroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/gitLabGroups/myGitLabGroup$mySubGroup"), - // Properties: &armsecurity.GitLabGroupProperties{ - // FullyQualifiedName: to.Ptr("myGitLabGroup$mySubGroup"), - // OnboardingState: to.Ptr(armsecurity.OnboardingStateOnboarded), - // ProvisioningState: to.Ptr(armsecurity.DevOpsProvisioningStateSucceeded), - // URL: to.Ptr("https://gitlab.example.com/myGitLabGroup/mySubGroup"), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/go.mod b/sdk/resourcemanager/security/armsecurity/go.mod index 5478369b872d..e82a7509d32b 100644 --- a/sdk/resourcemanager/security/armsecurity/go.mod +++ b/sdk/resourcemanager/security/armsecurity/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurit go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.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.25.0 // indirect golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect ) diff --git a/sdk/resourcemanager/security/armsecurity/go.sum b/sdk/resourcemanager/security/armsecurity/go.sum index 09d275cb9a37..917448a001b7 100644 --- a/sdk/resourcemanager/security/armsecurity/go.sum +++ b/sdk/resourcemanager/security/armsecurity/go.sum @@ -1,29 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/security/armsecurity/governanceassignments_client.go b/sdk/resourcemanager/security/armsecurity/governanceassignments_client.go deleted file mode 100644 index 6a5db35e4a77..000000000000 --- a/sdk/resourcemanager/security/armsecurity/governanceassignments_client.go +++ /dev/null @@ -1,301 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// GovernanceAssignmentsClient contains the methods for the GovernanceAssignments group. -// Don't use this type directly, use NewGovernanceAssignmentsClient() instead. -type GovernanceAssignmentsClient struct { - internal *arm.Client -} - -// NewGovernanceAssignmentsClient creates a new instance of GovernanceAssignmentsClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewGovernanceAssignmentsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*GovernanceAssignmentsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &GovernanceAssignmentsClient{ - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Creates or updates a governance assignment on the given subscription. -// 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 -// - governanceAssignment - Governance assignment over a subscription scope -// - options - GovernanceAssignmentsClientCreateOrUpdateOptions contains the optional parameters for the GovernanceAssignmentsClient.CreateOrUpdate -// method. -func (client *GovernanceAssignmentsClient) CreateOrUpdate(ctx context.Context, scope string, assessmentName string, assignmentKey string, governanceAssignment GovernanceAssignment, options *GovernanceAssignmentsClientCreateOrUpdateOptions) (GovernanceAssignmentsClientCreateOrUpdateResponse, error) { - var err error - const operationName = "GovernanceAssignmentsClient.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, assessmentName, assignmentKey, governanceAssignment, options) - if err != nil { - return GovernanceAssignmentsClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return GovernanceAssignmentsClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return GovernanceAssignmentsClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *GovernanceAssignmentsClient) createOrUpdateCreateRequest(ctx context.Context, scope string, assessmentName string, assignmentKey string, governanceAssignment GovernanceAssignment, options *GovernanceAssignmentsClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) - if assessmentName == "" { - return nil, errors.New("parameter assessmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) - if assignmentKey == "" { - return nil, errors.New("parameter assignmentKey cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assignmentKey}", url.PathEscape(assignmentKey)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, governanceAssignment); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *GovernanceAssignmentsClient) createOrUpdateHandleResponse(resp *http.Response) (GovernanceAssignmentsClientCreateOrUpdateResponse, error) { - result := GovernanceAssignmentsClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.GovernanceAssignment); err != nil { - return GovernanceAssignmentsClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Delete a GovernanceAssignment over a given scope -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-01-preview -// - scope - 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 -// - 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) { - var err error - const operationName = "GovernanceAssignmentsClient.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, assessmentName, assignmentKey, options) - if err != nil { - return GovernanceAssignmentsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return GovernanceAssignmentsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return GovernanceAssignmentsClientDeleteResponse{}, err - } - return GovernanceAssignmentsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *GovernanceAssignmentsClient) deleteCreateRequest(ctx context.Context, scope string, assessmentName string, assignmentKey string, options *GovernanceAssignmentsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) - if assessmentName == "" { - return nil, errors.New("parameter assessmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) - if assignmentKey == "" { - return nil, errors.New("parameter assignmentKey cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assignmentKey}", url.PathEscape(assignmentKey)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - return req, nil -} - -// Get - Get a specific governanceAssignment for the requested scope by AssignmentKey -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-01-preview -// - scope - 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 -// - 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) { - var err error - const operationName = "GovernanceAssignmentsClient.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, assessmentName, assignmentKey, options) - if err != nil { - return GovernanceAssignmentsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return GovernanceAssignmentsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return GovernanceAssignmentsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *GovernanceAssignmentsClient) getCreateRequest(ctx context.Context, scope string, assessmentName string, assignmentKey string, options *GovernanceAssignmentsClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) - if assessmentName == "" { - return nil, errors.New("parameter assessmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) - if assignmentKey == "" { - return nil, errors.New("parameter assignmentKey cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assignmentKey}", url.PathEscape(assignmentKey)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *GovernanceAssignmentsClient) getHandleResponse(resp *http.Response) (GovernanceAssignmentsClientGetResponse, error) { - result := GovernanceAssignmentsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.GovernanceAssignment); err != nil { - return GovernanceAssignmentsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Get 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 -// - options - GovernanceAssignmentsClientListOptions contains the optional parameters for the GovernanceAssignmentsClient.NewListPager -// method. -func (client *GovernanceAssignmentsClient) NewListPager(scope string, assessmentName string, options *GovernanceAssignmentsClientListOptions) *runtime.Pager[GovernanceAssignmentsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[GovernanceAssignmentsClientListResponse]{ - More: func(page GovernanceAssignmentsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *GovernanceAssignmentsClientListResponse) (GovernanceAssignmentsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "GovernanceAssignmentsClient.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, assessmentName, options) - }, nil) - if err != nil { - return GovernanceAssignmentsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *GovernanceAssignmentsClient) listCreateRequest(ctx context.Context, scope string, assessmentName string, options *GovernanceAssignmentsClientListOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) - if assessmentName == "" { - return nil, errors.New("parameter assessmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *GovernanceAssignmentsClient) listHandleResponse(resp *http.Response) (GovernanceAssignmentsClientListResponse, error) { - result := GovernanceAssignmentsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.GovernanceAssignmentsList); err != nil { - return GovernanceAssignmentsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/governanceassignments_client_example_test.go b/sdk/resourcemanager/security/armsecurity/governanceassignments_client_example_test.go deleted file mode 100644 index c2b4da826da5..000000000000 --- a/sdk/resourcemanager/security/armsecurity/governanceassignments_client_example_test.go +++ /dev/null @@ -1,209 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceAssignments/ListGovernanceAssignments_example.json -func ExampleGovernanceAssignmentsClient_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.NewGovernanceAssignmentsClient().NewListPager("subscriptions/c32e05d9-7207-4e22-bdf4-4f7d9c72e5fd", "6b9421dd-5555-2251-9b3d-2be58e2f82cd", 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.GovernanceAssignmentsList = armsecurity.GovernanceAssignmentsList{ - // Value: []*armsecurity.GovernanceAssignment{ - // { - // Name: to.Ptr("6634ff9f-127b-4bf2-8e6e-b1737f5e789c"), - // Type: to.Ptr("Microsoft.Security/assessments/governanceAssignments"), - // ID: to.Ptr("/subscriptions/c32e05d9-7207-4e22-bdf4-4f7d9c72e5fd/resourceGroups/compute_servers/providers/Microsoft.Compute/virtualMachines/win2012/providers/Microsoft.Security/assessments/6b9421dd-5555-2251-9b3d-2be58e2f82cd/governanceAssignments/6634ff9f-127b-4bf2-8e6e-b1737f5e789c"), - // Properties: &armsecurity.GovernanceAssignmentProperties{ - // AdditionalData: &armsecurity.GovernanceAssignmentAdditionalData{ - // TicketLink: to.Ptr("https://snow.com"), - // TicketNumber: to.Ptr[int32](123123), - // TicketStatus: to.Ptr("Active"), - // }, - // IsGracePeriod: to.Ptr(true), - // Owner: to.Ptr("user@contoso.com"), - // RemediationDueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-07T13:00:00.000Z"); return t}()), - // RemediationEta: &armsecurity.RemediationEta{ - // Eta: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-08T13:00:00.000Z"); return t}()), - // Justification: to.Ptr("Justification of ETA"), - // }, - // }, - // }, - // { - // Name: to.Ptr("41fb92a5-43dc-4c00-a969-469c16cef7a7"), - // Type: to.Ptr("Microsoft.Security/assessments/governanceAssignments"), - // ID: to.Ptr("/subscriptions/c32e05d9-7207-4e22-bdf4-4f7d9c72e5fd/resourceGroups/compute_servers/providers/Microsoft.Compute/virtualMachines/win2011/providers/Microsoft.Security/assessments/6b9421dd-5555-2251-9b3d-2be58e2f82cd/governanceAssignments/41fb92a5-43dc-4c00-a969-469c16cef7a7"), - // Properties: &armsecurity.GovernanceAssignmentProperties{ - // AdditionalData: &armsecurity.GovernanceAssignmentAdditionalData{ - // TicketLink: to.Ptr("https://snow.com"), - // TicketNumber: to.Ptr[int32](653424), - // TicketStatus: to.Ptr("Active"), - // }, - // IsGracePeriod: to.Ptr(true), - // Owner: to.Ptr("user2@contoso.com"), - // RemediationDueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-07T13:00:00.000Z"); return t}()), - // RemediationEta: &armsecurity.RemediationEta{ - // Eta: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-08T13:00:00.000Z"); return t}()), - // Justification: to.Ptr("Justification of ETA"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceAssignments/GetGovernanceAssignment_example.json -func ExampleGovernanceAssignmentsClient_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.NewGovernanceAssignmentsClient().Get(ctx, "subscriptions/c32e05d9-7207-4e22-bdf4-4f7d9c72e5fd/resourceGroups/compute_servers/providers/Microsoft.Compute/virtualMachines/win2012", "6b9421dd-5555-2251-9b3d-2be58e2f82cd", "6634ff9f-127b-4bf2-8e6e-b1737f5e789c", 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.GovernanceAssignment = armsecurity.GovernanceAssignment{ - // Name: to.Ptr("6634ff9f-127b-4bf2-8e6e-b1737f5e789c"), - // Type: to.Ptr("Microsoft.Security/assessments/governanceAssignments"), - // ID: to.Ptr("/subscriptions/c32e05d9-7207-4e22-bdf4-4f7d9c72e5fd/resourceGroups/compute_servers/providers/Microsoft.Compute/virtualMachines/win2012/providers/Microsoft.Security/assessments/6b9421dd-5555-2251-9b3d-2be58e2f82cd/governanceAssignments/6634ff9f-127b-4bf2-8e6e-b1737f5e789c"), - // Properties: &armsecurity.GovernanceAssignmentProperties{ - // AdditionalData: &armsecurity.GovernanceAssignmentAdditionalData{ - // TicketLink: to.Ptr("https://snow.com"), - // TicketNumber: to.Ptr[int32](123123), - // TicketStatus: to.Ptr("Active"), - // }, - // GovernanceEmailNotification: &armsecurity.GovernanceEmailNotification{ - // DisableManagerEmailNotification: to.Ptr(false), - // DisableOwnerEmailNotification: to.Ptr(false), - // }, - // IsGracePeriod: to.Ptr(true), - // Owner: to.Ptr("user@contoso.com"), - // RemediationDueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-07T13:00:00.000Z"); return t}()), - // RemediationEta: &armsecurity.RemediationEta{ - // Eta: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-08T13:00:00.000Z"); return t}()), - // Justification: to.Ptr("Justification of ETA"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceAssignments/PutGovernanceAssignment_example.json -func ExampleGovernanceAssignmentsClient_CreateOrUpdate() { - 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.NewGovernanceAssignmentsClient().CreateOrUpdate(ctx, "subscriptions/c32e05d9-7207-4e22-bdf4-4f7d9c72e5fd/resourceGroups/compute_servers/providers/Microsoft.Compute/virtualMachines/win2012", "6b9421dd-5555-2251-9b3d-2be58e2f82cd", "6634ff9f-127b-4bf2-8e6e-b1737f5e789c", armsecurity.GovernanceAssignment{ - Properties: &armsecurity.GovernanceAssignmentProperties{ - AdditionalData: &armsecurity.GovernanceAssignmentAdditionalData{ - TicketLink: to.Ptr("https://snow.com"), - TicketNumber: to.Ptr[int32](123123), - TicketStatus: to.Ptr("Active"), - }, - GovernanceEmailNotification: &armsecurity.GovernanceEmailNotification{ - DisableManagerEmailNotification: to.Ptr(false), - DisableOwnerEmailNotification: to.Ptr(false), - }, - IsGracePeriod: to.Ptr(true), - Owner: to.Ptr("user@contoso.com"), - RemediationDueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-07T13:00:00.000Z"); return t }()), - RemediationEta: &armsecurity.RemediationEta{ - Eta: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-08T13:00:00.000Z"); return t }()), - Justification: to.Ptr("Justification of ETA"), - }, - }, - }, 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.GovernanceAssignment = armsecurity.GovernanceAssignment{ - // Name: to.Ptr("6634ff9f-127b-4bf2-8e6e-b1737f5e789c"), - // Type: to.Ptr("Microsoft.Security/assessments/governanceAssignments"), - // ID: to.Ptr("/subscriptions/c32e05d9-7207-4e22-bdf4-4f7d9c72e5fd/resourceGroups/compute_servers/providers/Microsoft.Compute/virtualMachines/win2012/providers/Microsoft.Security/assessments/6b9421dd-5555-2251-9b3d-2be58e2f82cd/governanceAssignments/6634ff9f-127b-4bf2-8e6e-b1737f5e789c"), - // Properties: &armsecurity.GovernanceAssignmentProperties{ - // AdditionalData: &armsecurity.GovernanceAssignmentAdditionalData{ - // TicketLink: to.Ptr("https://snow.com"), - // TicketNumber: to.Ptr[int32](123123), - // TicketStatus: to.Ptr("Active"), - // }, - // GovernanceEmailNotification: &armsecurity.GovernanceEmailNotification{ - // DisableManagerEmailNotification: to.Ptr(false), - // DisableOwnerEmailNotification: to.Ptr(false), - // }, - // IsGracePeriod: to.Ptr(true), - // Owner: to.Ptr("user@contoso.com"), - // RemediationDueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-07T13:00:00.000Z"); return t}()), - // RemediationEta: &armsecurity.RemediationEta{ - // Eta: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-08T13:00:00.000Z"); return t}()), - // Justification: to.Ptr("Justification of ETA"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceAssignments/DeleteGovernanceAssignment_example.json -func ExampleGovernanceAssignmentsClient_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.NewGovernanceAssignmentsClient().Delete(ctx, "subscriptions/c32e05d9-7207-4e22-bdf4-4f7d9c72e5fd/resourceGroups/compute_servers/providers/Microsoft.Compute/virtualMachines/win2012", "6b9421dd-5555-2251-9b3d-2be58e2f82cd", "6634ff9f-127b-4bf2-8e6e-b1737f5e789c", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/governancerules_client.go b/sdk/resourcemanager/security/armsecurity/governancerules_client.go deleted file mode 100644 index 48a227d805f9..000000000000 --- a/sdk/resourcemanager/security/armsecurity/governancerules_client.go +++ /dev/null @@ -1,460 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// GovernanceRulesClient contains the methods for the GovernanceRules group. -// Don't use this type directly, use NewGovernanceRulesClient() instead. -type GovernanceRulesClient struct { - internal *arm.Client -} - -// 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. -func NewGovernanceRulesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*GovernanceRulesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &GovernanceRulesClient{ - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Creates or updates a governance rule over a given scope -// 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) -// - governanceRule - Governance rule over a given scope -// - options - GovernanceRulesClientCreateOrUpdateOptions contains the optional parameters for the GovernanceRulesClient.CreateOrUpdate -// method. -func (client *GovernanceRulesClient) CreateOrUpdate(ctx context.Context, scope string, ruleID string, governanceRule GovernanceRule, options *GovernanceRulesClientCreateOrUpdateOptions) (GovernanceRulesClientCreateOrUpdateResponse, error) { - var err error - const operationName = "GovernanceRulesClient.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, ruleID, governanceRule, options) - if err != nil { - return GovernanceRulesClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return GovernanceRulesClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return GovernanceRulesClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *GovernanceRulesClient) createOrUpdateCreateRequest(ctx context.Context, scope string, ruleID string, governanceRule GovernanceRule, options *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)) - if ruleID == "" { - return nil, errors.New("parameter ruleID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ruleId}", url.PathEscape(ruleID)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, governanceRule); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *GovernanceRulesClient) createOrUpdateHandleResponse(resp *http.Response) (GovernanceRulesClientCreateOrUpdateResponse, error) { - result := GovernanceRulesClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.GovernanceRule); err != nil { - return GovernanceRulesClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// BeginDelete - Delete a Governance rule over a given scope -// 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) -// - options - GovernanceRulesClientBeginDeleteOptions contains the optional parameters for the GovernanceRulesClient.BeginDelete -// method. -func (client *GovernanceRulesClient) BeginDelete(ctx context.Context, scope string, ruleID string, options *GovernanceRulesClientBeginDeleteOptions) (*runtime.Poller[GovernanceRulesClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, scope, ruleID, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GovernanceRulesClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GovernanceRulesClientDeleteResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Delete - Delete a Governance rule over a given scope -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-01-preview -func (client *GovernanceRulesClient) deleteOperation(ctx context.Context, scope string, ruleID string, options *GovernanceRulesClientBeginDeleteOptions) (*http.Response, error) { - var err error - const operationName = "GovernanceRulesClient.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, scope, ruleID, 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, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *GovernanceRulesClient) deleteCreateRequest(ctx context.Context, scope string, ruleID string, options *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)) - if ruleID == "" { - return nil, errors.New("parameter ruleID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ruleId}", url.PathEscape(ruleID)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - return req, nil -} - -// BeginExecute - Execute a governance rule -// 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) -// - options - GovernanceRulesClientBeginExecuteOptions contains the optional parameters for the GovernanceRulesClient.BeginExecute -// method. -func (client *GovernanceRulesClient) BeginExecute(ctx context.Context, scope string, ruleID string, options *GovernanceRulesClientBeginExecuteOptions) (*runtime.Poller[GovernanceRulesClientExecuteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.execute(ctx, scope, ruleID, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GovernanceRulesClientExecuteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GovernanceRulesClientExecuteResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Execute - Execute a governance rule -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-01-preview -func (client *GovernanceRulesClient) execute(ctx context.Context, scope string, ruleID string, options *GovernanceRulesClientBeginExecuteOptions) (*http.Response, error) { - var err error - const operationName = "GovernanceRulesClient.BeginExecute" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.executeCreateRequest(ctx, scope, ruleID, 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 -} - -// executeCreateRequest creates the Execute request. -func (client *GovernanceRulesClient) executeCreateRequest(ctx context.Context, scope string, ruleID string, options *GovernanceRulesClientBeginExecuteOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}/execute" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) - if ruleID == "" { - return nil, errors.New("parameter ruleID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ruleId}", url.PathEscape(ruleID)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.ExecuteGovernanceRuleParams != nil { - if err := runtime.MarshalAsJSON(req, *options.ExecuteGovernanceRuleParams); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// Get - Get a specific governance rule for the requested scope by ruleId -// 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) -// - 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) { - var err error - const operationName = "GovernanceRulesClient.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, ruleID, options) - if err != nil { - return GovernanceRulesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return GovernanceRulesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return GovernanceRulesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *GovernanceRulesClient) getCreateRequest(ctx context.Context, scope string, ruleID string, options *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)) - if ruleID == "" { - return nil, errors.New("parameter ruleID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ruleId}", url.PathEscape(ruleID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *GovernanceRulesClient) getHandleResponse(resp *http.Response) (GovernanceRulesClientGetResponse, error) { - result := GovernanceRulesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.GovernanceRule); err != nil { - return GovernanceRulesClientGetResponse{}, err - } - return result, nil -} - -// 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})' -// - options - GovernanceRulesClientListOptions contains the optional parameters for the GovernanceRulesClient.NewListPager -// method. -func (client *GovernanceRulesClient) NewListPager(scope string, options *GovernanceRulesClientListOptions) *runtime.Pager[GovernanceRulesClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[GovernanceRulesClientListResponse]{ - More: func(page GovernanceRulesClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *GovernanceRulesClientListResponse) (GovernanceRulesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "GovernanceRulesClient.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 GovernanceRulesClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *GovernanceRulesClient) listCreateRequest(ctx context.Context, scope string, options *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)) - 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", "2022-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *GovernanceRulesClient) listHandleResponse(resp *http.Response) (GovernanceRulesClientListResponse, error) { - result := GovernanceRulesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.GovernanceRuleList); err != nil { - return GovernanceRulesClientListResponse{}, err - } - return result, nil -} - -// OperationResults - Get governance rules long run operation result for the requested scope by ruleId and operationId -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-01-01-preview -// - 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 -// - 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) { - var err error - const operationName = "GovernanceRulesClient.OperationResults" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.operationResultsCreateRequest(ctx, scope, ruleID, operationID, options) - if err != nil { - return GovernanceRulesClientOperationResultsResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return GovernanceRulesClientOperationResultsResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return GovernanceRulesClientOperationResultsResponse{}, err - } - resp, err := client.operationResultsHandleResponse(httpResp) - return resp, err -} - -// operationResultsCreateRequest creates the OperationResults request. -func (client *GovernanceRulesClient) operationResultsCreateRequest(ctx context.Context, scope string, ruleID string, operationID string, options *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)) - if ruleID == "" { - return nil, errors.New("parameter ruleID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ruleId}", url.PathEscape(ruleID)) - if operationID == "" { - return nil, errors.New("parameter operationID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// operationResultsHandleResponse handles the OperationResults response. -func (client *GovernanceRulesClient) operationResultsHandleResponse(resp *http.Response) (GovernanceRulesClientOperationResultsResponse, error) { - result := GovernanceRulesClientOperationResultsResponse{} - if val := resp.Header.Get("location"); val != "" { - result.Location = &val - } - if err := runtime.UnmarshalAsJSON(resp, &result.OperationResultAutoGenerated); err != nil { - return GovernanceRulesClientOperationResultsResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/governancerules_client_example_test.go b/sdk/resourcemanager/security/armsecurity/governancerules_client_example_test.go deleted file mode 100644 index b7c07290a619..000000000000 --- a/sdk/resourcemanager/security/armsecurity/governancerules_client_example_test.go +++ /dev/null @@ -1,1020 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/2022-01-01-preview/examples/GovernanceRules/ListByManagementGroupGovernanceRules_example.json -func ExampleGovernanceRulesClient_NewListPager_listGovernanceRulesByManagementGroupScope() { - 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.NewGovernanceRulesClient().NewListPager("providers/Microsoft.Management/managementGroups/contoso", 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.GovernanceRuleList = armsecurity.GovernanceRuleList{ - // Value: []*armsecurity.GovernanceRule{ - // { - // Name: to.Ptr("ad9a8e26-29d9-4829-bb30-e597a58cdbb8"), - // Type: to.Ptr("Microsoft.Security/governanceRules"), - // ID: to.Ptr("providers/Microsoft.Management/managementGroups/contoso/providers/Microsoft.Security/governanceRules/ad9a8e26-29d9-4829-bb30-e597a58cdbb8"), - // Properties: &armsecurity.GovernanceRuleProperties{ - // Description: to.Ptr("A rule for a management group"), - // ConditionSets: []any{ - // map[string]any{ - // "conditions":[]any{ - // map[string]any{ - // "operator": "In", - // "property": "$.AssessmentKey", - // "value": "[\"b1cd27e0-4ecc-4246-939f-49c426d9d72f\", \"fe83f80b-073d-4ccf-93d9-6797eb870201\"]", - // }, - // }, - // }}, - // DisplayName: to.Ptr("Management group rule"), - // GovernanceEmailNotification: &armsecurity.GovernanceRuleEmailNotification{ - // DisableManagerEmailNotification: to.Ptr(false), - // DisableOwnerEmailNotification: to.Ptr(false), - // }, - // IsDisabled: to.Ptr(false), - // IsGracePeriod: to.Ptr(true), - // Metadata: &armsecurity.GovernanceRuleMetadata{ - // CreatedBy: to.Ptr("c23b5354-ff0a-4b2a-9f92-6f144effd936"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-10T08:31:26.799Z"); return t}()), - // UpdatedBy: to.Ptr("c23b5354-ff0a-4b2a-9f92-6f144effd936"), - // UpdatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-10T08:31:26.799Z"); return t}()), - // }, - // OwnerSource: &armsecurity.GovernanceRuleOwnerSource{ - // Type: to.Ptr(armsecurity.GovernanceRuleOwnerSourceTypeManually), - // Value: to.Ptr("user@contoso.com"), - // }, - // RemediationTimeframe: to.Ptr("7.00:00:00"), - // RulePriority: to.Ptr[int32](100), - // RuleType: to.Ptr(armsecurity.GovernanceRuleTypeIntegrated), - // SourceResourceType: to.Ptr(armsecurity.GovernanceRuleSourceResourceTypeAssessments), - // TenantID: to.Ptr("f0b6d37b-e4bc-4719-9291-c066c3194f23"), - // }, - // }, - // { - // Name: to.Ptr("4106f43c-6d82-4fc8-a92c-dcfe50799d1d"), - // Type: to.Ptr("Microsoft.Security/governanceRules"), - // ID: to.Ptr("providers/Microsoft.Management/managementGroups/contoso/providers/Microsoft.Security/governanceRules/4106f43c-6d82-4fc8-a92c-dcfe50799d1d"), - // Properties: &armsecurity.GovernanceRuleProperties{ - // Description: to.Ptr("A rule for a management group"), - // ConditionSets: []any{ - // map[string]any{ - // "conditions":[]any{ - // map[string]any{ - // "operator": "Equals", - // "property": "$.Metadata.Severity", - // "value": "Low", - // }, - // }, - // }}, - // DisplayName: to.Ptr("Management group rule 2"), - // ExcludedScopes: []*string{ - // to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23")}, - // GovernanceEmailNotification: &armsecurity.GovernanceRuleEmailNotification{ - // DisableManagerEmailNotification: to.Ptr(false), - // DisableOwnerEmailNotification: to.Ptr(false), - // }, - // IncludeMemberScopes: to.Ptr(false), - // IsDisabled: to.Ptr(false), - // IsGracePeriod: to.Ptr(true), - // Metadata: &armsecurity.GovernanceRuleMetadata{ - // CreatedBy: to.Ptr("c23b5354-ff0a-4b2a-9f92-6f144effd936"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-10T08:31:26.799Z"); return t}()), - // UpdatedBy: to.Ptr("c23b5354-ff0a-4b2a-9f92-6f144effd936"), - // UpdatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-10T08:31:26.799Z"); return t}()), - // }, - // OwnerSource: &armsecurity.GovernanceRuleOwnerSource{ - // Type: to.Ptr(armsecurity.GovernanceRuleOwnerSourceTypeManually), - // Value: to.Ptr("user@contoso.com"), - // }, - // RemediationTimeframe: to.Ptr("7.00:00:00"), - // RulePriority: to.Ptr[int32](200), - // RuleType: to.Ptr(armsecurity.GovernanceRuleTypeIntegrated), - // SourceResourceType: to.Ptr(armsecurity.GovernanceRuleSourceResourceTypeAssessments), - // TenantID: to.Ptr("f0b6d37b-e4bc-4719-9291-c066c3194f23"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ListBySecurityConnectorGovernanceRules_example.json -func ExampleGovernanceRulesClient_NewListPager_listGovernanceRulesBySecurityConnectorScope() { - 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.NewGovernanceRulesClient().NewListPager("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", 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.GovernanceRuleList = armsecurity.GovernanceRuleList{ - // Value: []*armsecurity.GovernanceRule{ - // { - // Name: to.Ptr("ad9a8e26-29d9-4829-bb30-e597a58cdbb8"), - // Type: to.Ptr("Microsoft.Security/governanceRules"), - // ID: to.Ptr("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector/providers/Microsoft.Security/governanceRules/ad9a8e26-29d9-4829-bb30-e597a58cdbb8"), - // Properties: &armsecurity.GovernanceRuleProperties{ - // Description: to.Ptr("A rule on critical GCP recommendations"), - // ConditionSets: []any{ - // map[string]any{ - // "conditions":[]any{ - // map[string]any{ - // "operator": "In", - // "property": "$.AssessmentKey", - // "value": "[\"b1cd27e0-4ecc-4246-939f-49c426d9d72f\", \"fe83f80b-073d-4ccf-93d9-6797eb870201\"]", - // }, - // }, - // }}, - // DisplayName: to.Ptr("Admin's GCP rule"), - // ExcludedScopes: []*string{ - // }, - // GovernanceEmailNotification: &armsecurity.GovernanceRuleEmailNotification{ - // DisableManagerEmailNotification: to.Ptr(false), - // DisableOwnerEmailNotification: to.Ptr(false), - // }, - // IncludeMemberScopes: to.Ptr(false), - // IsDisabled: to.Ptr(false), - // IsGracePeriod: to.Ptr(true), - // Metadata: &armsecurity.GovernanceRuleMetadata{ - // CreatedBy: to.Ptr("c23b5354-ff0a-4b2a-9f92-6f144effd936"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-10T08:31:26.799Z"); return t}()), - // UpdatedBy: to.Ptr("c23b5354-ff0a-4b2a-9f92-6f144effd936"), - // UpdatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-10T08:31:26.799Z"); return t}()), - // }, - // OwnerSource: &armsecurity.GovernanceRuleOwnerSource{ - // Type: to.Ptr(armsecurity.GovernanceRuleOwnerSourceTypeManually), - // Value: to.Ptr("user@contoso.com"), - // }, - // RemediationTimeframe: to.Ptr("7.00:00:00"), - // RulePriority: to.Ptr[int32](100), - // RuleType: to.Ptr(armsecurity.GovernanceRuleTypeIntegrated), - // SourceResourceType: to.Ptr(armsecurity.GovernanceRuleSourceResourceTypeAssessments), - // TenantID: to.Ptr("f0b6d37b-e4bc-4719-9291-c066c3194f23"), - // }, - // }, - // { - // Name: to.Ptr("4106f43c-6d82-4fc8-a92c-dcfe50799d1d"), - // Type: to.Ptr("Microsoft.Security/governanceRules"), - // ID: to.Ptr("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector/providers/Microsoft.Security/governanceRules/4106f43c-6d82-4fc8-a92c-dcfe50799d1d"), - // Properties: &armsecurity.GovernanceRuleProperties{ - // Description: to.Ptr("A rule on critical GCP recommendations"), - // ConditionSets: []any{ - // map[string]any{ - // "conditions":[]any{ - // map[string]any{ - // "operator": "Equals", - // "property": "$.Metadata.Severity", - // "value": "Low", - // }, - // }, - // }}, - // DisplayName: to.Ptr("GCP Admin's rule"), - // ExcludedScopes: []*string{ - // }, - // GovernanceEmailNotification: &armsecurity.GovernanceRuleEmailNotification{ - // DisableManagerEmailNotification: to.Ptr(false), - // DisableOwnerEmailNotification: to.Ptr(false), - // }, - // IncludeMemberScopes: to.Ptr(false), - // IsDisabled: to.Ptr(false), - // IsGracePeriod: to.Ptr(true), - // Metadata: &armsecurity.GovernanceRuleMetadata{ - // CreatedBy: to.Ptr("c23b5354-ff0a-4b2a-9f92-6f144effd936"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-10T08:31:26.799Z"); return t}()), - // UpdatedBy: to.Ptr("c23b5354-ff0a-4b2a-9f92-6f144effd936"), - // UpdatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-10T08:31:26.799Z"); return t}()), - // }, - // OwnerSource: &armsecurity.GovernanceRuleOwnerSource{ - // Type: to.Ptr(armsecurity.GovernanceRuleOwnerSourceTypeManually), - // Value: to.Ptr("user@contoso.com"), - // }, - // RemediationTimeframe: to.Ptr("7.00:00:00"), - // RulePriority: to.Ptr[int32](200), - // RuleType: to.Ptr(armsecurity.GovernanceRuleTypeIntegrated), - // SourceResourceType: to.Ptr(armsecurity.GovernanceRuleSourceResourceTypeAssessments), - // TenantID: to.Ptr("f0b6d37b-e4bc-4719-9291-c066c3194f23"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ListBySubscriptionGovernanceRules_example.json -func ExampleGovernanceRulesClient_NewListPager_listGovernanceRulesBySubscriptionScope() { - 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.NewGovernanceRulesClient().NewListPager("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", 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.GovernanceRuleList = armsecurity.GovernanceRuleList{ - // Value: []*armsecurity.GovernanceRule{ - // { - // Name: to.Ptr("ad9a8e26-29d9-4829-bb30-e597a58cdbb8"), - // Type: to.Ptr("Microsoft.Security/governanceRules"), - // ID: to.Ptr("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/governanceRules/ad9a8e26-29d9-4829-bb30-e597a58cdbb8"), - // Properties: &armsecurity.GovernanceRuleProperties{ - // Description: to.Ptr("A rule for critical recommendations"), - // ConditionSets: []any{ - // map[string]any{ - // "conditions":[]any{ - // map[string]any{ - // "operator": "In", - // "property": "$.AssessmentKey", - // "value": "[\"b1cd27e0-4ecc-4246-939f-49c426d9d72f\", \"fe83f80b-073d-4ccf-93d9-6797eb870201\"]", - // }, - // }, - // }}, - // DisplayName: to.Ptr("Admin's rule"), - // ExcludedScopes: []*string{ - // }, - // GovernanceEmailNotification: &armsecurity.GovernanceRuleEmailNotification{ - // DisableManagerEmailNotification: to.Ptr(false), - // DisableOwnerEmailNotification: to.Ptr(false), - // }, - // IncludeMemberScopes: to.Ptr(false), - // IsDisabled: to.Ptr(false), - // IsGracePeriod: to.Ptr(true), - // Metadata: &armsecurity.GovernanceRuleMetadata{ - // CreatedBy: to.Ptr("c23b5354-ff0a-4b2a-9f92-6f144effd936"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-10T08:31:26.799Z"); return t}()), - // UpdatedBy: to.Ptr("c23b5354-ff0a-4b2a-9f92-6f144effd936"), - // UpdatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-10T08:31:26.799Z"); return t}()), - // }, - // OwnerSource: &armsecurity.GovernanceRuleOwnerSource{ - // Type: to.Ptr(armsecurity.GovernanceRuleOwnerSourceTypeManually), - // Value: to.Ptr("user@contoso.com"), - // }, - // RemediationTimeframe: to.Ptr("7.00:00:00"), - // RulePriority: to.Ptr[int32](100), - // RuleType: to.Ptr(armsecurity.GovernanceRuleTypeIntegrated), - // SourceResourceType: to.Ptr(armsecurity.GovernanceRuleSourceResourceTypeAssessments), - // TenantID: to.Ptr("f0b6d37b-e4bc-4719-9291-c066c3194f23"), - // }, - // }, - // { - // Name: to.Ptr("4106f43c-6d82-4fc8-a92c-dcfe50799d1d"), - // Type: to.Ptr("Microsoft.Security/governanceRules"), - // ID: to.Ptr("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/governanceRules/4106f43c-6d82-4fc8-a92c-dcfe50799d1d"), - // Properties: &armsecurity.GovernanceRuleProperties{ - // Description: to.Ptr("A rule for critical recommendations"), - // ConditionSets: []any{ - // map[string]any{ - // "conditions":[]any{ - // map[string]any{ - // "operator": "Equals", - // "property": "$.Metadata.Severity", - // "value": "Low", - // }, - // }, - // }}, - // DisplayName: to.Ptr("Admin's rule"), - // ExcludedScopes: []*string{ - // }, - // GovernanceEmailNotification: &armsecurity.GovernanceRuleEmailNotification{ - // DisableManagerEmailNotification: to.Ptr(true), - // DisableOwnerEmailNotification: to.Ptr(true), - // }, - // IncludeMemberScopes: to.Ptr(false), - // IsDisabled: to.Ptr(false), - // IsGracePeriod: to.Ptr(true), - // Metadata: &armsecurity.GovernanceRuleMetadata{ - // CreatedBy: to.Ptr("c23b5354-ff0a-4b2a-9f92-6f144effd936"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-10T08:31:26.799Z"); return t}()), - // UpdatedBy: to.Ptr("c23b5354-ff0a-4b2a-9f92-6f144effd936"), - // UpdatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-10T08:31:26.799Z"); return t}()), - // }, - // OwnerSource: &armsecurity.GovernanceRuleOwnerSource{ - // Type: to.Ptr(armsecurity.GovernanceRuleOwnerSourceTypeManually), - // Value: to.Ptr("user@contoso.com"), - // }, - // RemediationTimeframe: to.Ptr("7.00:00:00"), - // RulePriority: to.Ptr[int32](200), - // RuleType: to.Ptr(armsecurity.GovernanceRuleTypeIntegrated), - // SourceResourceType: to.Ptr(armsecurity.GovernanceRuleSourceResourceTypeAssessments), - // TenantID: to.Ptr("f0b6d37b-e4bc-4719-9291-c066c3194f23"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/GetManagementGroupGovernanceRule_example.json -func ExampleGovernanceRulesClient_Get_getAGovernanceRuleOverManagementGroupScope() { - 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.NewGovernanceRulesClient().Get(ctx, "providers/Microsoft.Management/managementGroups/contoso", "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", 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.GovernanceRule = armsecurity.GovernanceRule{ - // Name: to.Ptr("ad9a8e26-29d9-4829-bb30-e597a58cdbb8"), - // Type: to.Ptr("Microsoft.Security/governanceRules"), - // ID: to.Ptr("providers/Microsoft.Management/managementGroups/contoso/providers/Microsoft.Security/governanceRules/ad9a8e26-29d9-4829-bb30-e597a58cdbb8"), - // Properties: &armsecurity.GovernanceRuleProperties{ - // Description: to.Ptr("A rule for a management group"), - // ConditionSets: []any{ - // map[string]any{ - // "conditions":[]any{ - // map[string]any{ - // "operator": "In", - // "property": "$.AssessmentKey", - // "value": "[\"b1cd27e0-4ecc-4246-939f-49c426d9d72f\", \"fe83f80b-073d-4ccf-93d9-6797eb870201\"]", - // }, - // }, - // }}, - // DisplayName: to.Ptr("Management group rule"), - // ExcludedScopes: []*string{ - // to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23")}, - // GovernanceEmailNotification: &armsecurity.GovernanceRuleEmailNotification{ - // DisableManagerEmailNotification: to.Ptr(false), - // DisableOwnerEmailNotification: to.Ptr(false), - // }, - // IncludeMemberScopes: to.Ptr(false), - // IsDisabled: to.Ptr(false), - // IsGracePeriod: to.Ptr(true), - // Metadata: &armsecurity.GovernanceRuleMetadata{ - // CreatedBy: to.Ptr("c23b5354-ff0a-4b2a-9f92-6f144effd936"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-10T08:31:26.799Z"); return t}()), - // UpdatedBy: to.Ptr("c23b5354-ff0a-4b2a-9f92-6f144effd936"), - // UpdatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-10T08:31:26.799Z"); return t}()), - // }, - // OwnerSource: &armsecurity.GovernanceRuleOwnerSource{ - // Type: to.Ptr(armsecurity.GovernanceRuleOwnerSourceTypeManually), - // Value: to.Ptr("user@contoso.com"), - // }, - // RemediationTimeframe: to.Ptr("7.00:00:00"), - // RulePriority: to.Ptr[int32](200), - // RuleType: to.Ptr(armsecurity.GovernanceRuleTypeIntegrated), - // SourceResourceType: to.Ptr(armsecurity.GovernanceRuleSourceResourceTypeAssessments), - // TenantID: to.Ptr("f0b6d37b-e4bc-4719-9291-c066c3194f23"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/GetSecurityConnectorGovernanceRule_example.json -func ExampleGovernanceRulesClient_Get_getAGovernanceRuleOverSecurityConnectorScope() { - 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.NewGovernanceRulesClient().Get(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", 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.GovernanceRule = armsecurity.GovernanceRule{ - // Name: to.Ptr("ad9a8e26-29d9-4829-bb30-e597a58cdbb8"), - // Type: to.Ptr("Microsoft.Security/governanceRules"), - // ID: to.Ptr("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector/providers/Microsoft.Security/governanceRules/ad9a8e26-29d9-4829-bb30-e597a58cdbb8"), - // Properties: &armsecurity.GovernanceRuleProperties{ - // Description: to.Ptr("A rule on critical GCP recommendations"), - // ConditionSets: []any{ - // map[string]any{ - // "conditions":[]any{ - // map[string]any{ - // "operator": "In", - // "property": "$.AssessmentKey", - // "value": "[\"b1cd27e0-4ecc-4246-939f-49c426d9d72f\", \"fe83f80b-073d-4ccf-93d9-6797eb870201\"]", - // }, - // }, - // }}, - // DisplayName: to.Ptr("GCP Admin's rule"), - // ExcludedScopes: []*string{ - // }, - // GovernanceEmailNotification: &armsecurity.GovernanceRuleEmailNotification{ - // DisableManagerEmailNotification: to.Ptr(false), - // DisableOwnerEmailNotification: to.Ptr(false), - // }, - // IncludeMemberScopes: to.Ptr(false), - // IsDisabled: to.Ptr(false), - // IsGracePeriod: to.Ptr(true), - // Metadata: &armsecurity.GovernanceRuleMetadata{ - // CreatedBy: to.Ptr("c23b5354-ff0a-4b2a-9f92-6f144effd936"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-10T08:31:26.799Z"); return t}()), - // UpdatedBy: to.Ptr("c23b5354-ff0a-4b2a-9f92-6f144effd936"), - // UpdatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-10T08:31:26.799Z"); return t}()), - // }, - // OwnerSource: &armsecurity.GovernanceRuleOwnerSource{ - // Type: to.Ptr(armsecurity.GovernanceRuleOwnerSourceTypeManually), - // Value: to.Ptr("user@contoso.com"), - // }, - // RemediationTimeframe: to.Ptr("7.00:00:00"), - // RulePriority: to.Ptr[int32](200), - // RuleType: to.Ptr(armsecurity.GovernanceRuleTypeIntegrated), - // SourceResourceType: to.Ptr(armsecurity.GovernanceRuleSourceResourceTypeAssessments), - // TenantID: to.Ptr("f0b6d37b-e4bc-4719-9291-c066c3194f23"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/GetGovernanceRule_example.json -func ExampleGovernanceRulesClient_Get_getAGovernanceRuleOverSubscriptionScope() { - 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.NewGovernanceRulesClient().Get(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", 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.GovernanceRule = armsecurity.GovernanceRule{ - // Name: to.Ptr("ad9a8e26-29d9-4829-bb30-e597a58cdbb8"), - // Type: to.Ptr("Microsoft.Security/governanceRules"), - // ID: to.Ptr("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/governanceRules/ad9a8e26-29d9-4829-bb30-e597a58cdbb8"), - // Properties: &armsecurity.GovernanceRuleProperties{ - // Description: to.Ptr("A rule for critical recommendations"), - // ConditionSets: []any{ - // map[string]any{ - // "conditions":[]any{ - // map[string]any{ - // "operator": "In", - // "property": "$.AssessmentKey", - // "value": "[\"b1cd27e0-4ecc-4246-939f-49c426d9d72f\", \"fe83f80b-073d-4ccf-93d9-6797eb870201\"]", - // }, - // }, - // }}, - // DisplayName: to.Ptr("Admin's rule"), - // ExcludedScopes: []*string{ - // }, - // GovernanceEmailNotification: &armsecurity.GovernanceRuleEmailNotification{ - // DisableManagerEmailNotification: to.Ptr(false), - // DisableOwnerEmailNotification: to.Ptr(false), - // }, - // IncludeMemberScopes: to.Ptr(false), - // IsDisabled: to.Ptr(false), - // IsGracePeriod: to.Ptr(true), - // Metadata: &armsecurity.GovernanceRuleMetadata{ - // CreatedBy: to.Ptr("c23b5354-ff0a-4b2a-9f92-6f144effd936"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-10T08:31:26.799Z"); return t}()), - // UpdatedBy: to.Ptr("c23b5354-ff0a-4b2a-9f92-6f144effd936"), - // UpdatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-10T08:31:26.799Z"); return t}()), - // }, - // OwnerSource: &armsecurity.GovernanceRuleOwnerSource{ - // Type: to.Ptr(armsecurity.GovernanceRuleOwnerSourceTypeManually), - // Value: to.Ptr("user@contoso.com"), - // }, - // RemediationTimeframe: to.Ptr("7.00:00:00"), - // RulePriority: to.Ptr[int32](200), - // RuleType: to.Ptr(armsecurity.GovernanceRuleTypeIntegrated), - // SourceResourceType: to.Ptr(armsecurity.GovernanceRuleSourceResourceTypeAssessments), - // TenantID: to.Ptr("f0b6d37b-e4bc-4719-9291-c066c3194f23"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/PutManagementGroupGovernanceRule_example.json -func ExampleGovernanceRulesClient_CreateOrUpdate_createOrUpdateGovernanceRuleOverManagementGroupScope() { - 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.NewGovernanceRulesClient().CreateOrUpdate(ctx, "providers/Microsoft.Management/managementGroups/contoso", "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", armsecurity.GovernanceRule{ - Properties: &armsecurity.GovernanceRuleProperties{ - Description: to.Ptr("A rule for a management group"), - ConditionSets: []any{ - map[string]any{ - "conditions": []any{ - map[string]any{ - "operator": "In", - "property": "$.AssessmentKey", - "value": "[\"b1cd27e0-4ecc-4246-939f-49c426d9d72f\", \"fe83f80b-073d-4ccf-93d9-6797eb870201\"]", - }, - }, - }}, - DisplayName: to.Ptr("Management group rule"), - ExcludedScopes: []*string{ - to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23")}, - GovernanceEmailNotification: &armsecurity.GovernanceRuleEmailNotification{ - DisableManagerEmailNotification: to.Ptr(true), - DisableOwnerEmailNotification: to.Ptr(false), - }, - IsDisabled: to.Ptr(false), - IsGracePeriod: to.Ptr(true), - OwnerSource: &armsecurity.GovernanceRuleOwnerSource{ - Type: to.Ptr(armsecurity.GovernanceRuleOwnerSourceTypeManually), - Value: to.Ptr("user@contoso.com"), - }, - RemediationTimeframe: to.Ptr("7.00:00:00"), - RulePriority: to.Ptr[int32](200), - RuleType: to.Ptr(armsecurity.GovernanceRuleTypeIntegrated), - SourceResourceType: to.Ptr(armsecurity.GovernanceRuleSourceResourceTypeAssessments), - }, - }, 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.GovernanceRule = armsecurity.GovernanceRule{ - // Name: to.Ptr("ad9a8e26-29d9-4829-bb30-e597a58cdbb8"), - // Type: to.Ptr("Microsoft.Security/governanceRules"), - // ID: to.Ptr("providers/Microsoft.Management/managementGroups/contoso/providers/Microsoft.Security/governanceRules/ad9a8e26-29d9-4829-bb30-e597a58cdbb8"), - // Properties: &armsecurity.GovernanceRuleProperties{ - // Description: to.Ptr("A rule for a management group"), - // ConditionSets: []any{ - // map[string]any{ - // "conditions":[]any{ - // map[string]any{ - // "operator": "In", - // "property": "$.AssessmentKey", - // "value": "[\"b1cd27e0-4ecc-4246-939f-49c426d9d72f\", \"fe83f80b-073d-4ccf-93d9-6797eb870201\"]", - // }, - // }, - // }}, - // DisplayName: to.Ptr("Management group rule"), - // ExcludedScopes: []*string{ - // to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23")}, - // GovernanceEmailNotification: &armsecurity.GovernanceRuleEmailNotification{ - // DisableManagerEmailNotification: to.Ptr(true), - // DisableOwnerEmailNotification: to.Ptr(false), - // }, - // IncludeMemberScopes: to.Ptr(false), - // IsDisabled: to.Ptr(false), - // IsGracePeriod: to.Ptr(true), - // Metadata: &armsecurity.GovernanceRuleMetadata{ - // CreatedBy: to.Ptr("c23b5354-ff0a-4b2a-9f92-6f144effd936"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-10T08:31:26.799Z"); return t}()), - // UpdatedBy: to.Ptr("c23b5354-ff0a-4b2a-9f92-6f144effd936"), - // UpdatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-10T08:31:26.799Z"); return t}()), - // }, - // OwnerSource: &armsecurity.GovernanceRuleOwnerSource{ - // Type: to.Ptr(armsecurity.GovernanceRuleOwnerSourceTypeManually), - // Value: to.Ptr("user@contoso.com"), - // }, - // RemediationTimeframe: to.Ptr("7.00:00:00"), - // RulePriority: to.Ptr[int32](200), - // RuleType: to.Ptr(armsecurity.GovernanceRuleTypeIntegrated), - // SourceResourceType: to.Ptr(armsecurity.GovernanceRuleSourceResourceTypeAssessments), - // TenantID: to.Ptr("f0b6d37b-e4bc-4719-9291-c066c3194f23"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/PutSecurityConnectorGovernanceRule_example.json -func ExampleGovernanceRulesClient_CreateOrUpdate_createOrUpdateGovernanceRuleOverSecurityConnectorScope() { - 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.NewGovernanceRulesClient().CreateOrUpdate(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", armsecurity.GovernanceRule{ - Properties: &armsecurity.GovernanceRuleProperties{ - Description: to.Ptr("A rule on critical GCP recommendations"), - ConditionSets: []any{ - map[string]any{ - "conditions": []any{ - map[string]any{ - "operator": "In", - "property": "$.AssessmentKey", - "value": "[\"b1cd27e0-4ecc-4246-939f-49c426d9d72f\", \"fe83f80b-073d-4ccf-93d9-6797eb870201\"]", - }, - }, - }}, - DisplayName: to.Ptr("GCP Admin's rule"), - GovernanceEmailNotification: &armsecurity.GovernanceRuleEmailNotification{ - DisableManagerEmailNotification: to.Ptr(true), - DisableOwnerEmailNotification: to.Ptr(false), - }, - IsDisabled: to.Ptr(false), - IsGracePeriod: to.Ptr(true), - OwnerSource: &armsecurity.GovernanceRuleOwnerSource{ - Type: to.Ptr(armsecurity.GovernanceRuleOwnerSourceTypeManually), - Value: to.Ptr("user@contoso.com"), - }, - RemediationTimeframe: to.Ptr("7.00:00:00"), - RulePriority: to.Ptr[int32](200), - RuleType: to.Ptr(armsecurity.GovernanceRuleTypeIntegrated), - SourceResourceType: to.Ptr(armsecurity.GovernanceRuleSourceResourceTypeAssessments), - }, - }, 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.GovernanceRule = armsecurity.GovernanceRule{ - // Name: to.Ptr("ad9a8e26-29d9-4829-bb30-e597a58cdbb8"), - // Type: to.Ptr("Microsoft.Security/governanceRules"), - // ID: to.Ptr("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector/providers/Microsoft.Security/governanceRules/ad9a8e26-29d9-4829-bb30-e597a58cdbb8"), - // Properties: &armsecurity.GovernanceRuleProperties{ - // Description: to.Ptr("A rule on critical GCP recommendations"), - // ConditionSets: []any{ - // map[string]any{ - // "conditions":[]any{ - // map[string]any{ - // "operator": "In", - // "property": "$.AssessmentKey", - // "value": "[\"b1cd27e0-4ecc-4246-939f-49c426d9d72f\", \"fe83f80b-073d-4ccf-93d9-6797eb870201\"]", - // }, - // }, - // }}, - // DisplayName: to.Ptr("GCP Admin's rule"), - // ExcludedScopes: []*string{ - // }, - // GovernanceEmailNotification: &armsecurity.GovernanceRuleEmailNotification{ - // DisableManagerEmailNotification: to.Ptr(true), - // DisableOwnerEmailNotification: to.Ptr(false), - // }, - // IncludeMemberScopes: to.Ptr(false), - // IsDisabled: to.Ptr(false), - // IsGracePeriod: to.Ptr(true), - // Metadata: &armsecurity.GovernanceRuleMetadata{ - // CreatedBy: to.Ptr("c23b5354-ff0a-4b2a-9f92-6f144effd936"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-10T08:31:26.799Z"); return t}()), - // UpdatedBy: to.Ptr("c23b5354-ff0a-4b2a-9f92-6f144effd936"), - // UpdatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-10T08:31:26.799Z"); return t}()), - // }, - // OwnerSource: &armsecurity.GovernanceRuleOwnerSource{ - // Type: to.Ptr(armsecurity.GovernanceRuleOwnerSourceTypeManually), - // Value: to.Ptr("user@contoso.com"), - // }, - // RemediationTimeframe: to.Ptr("7.00:00:00"), - // RulePriority: to.Ptr[int32](200), - // RuleType: to.Ptr(armsecurity.GovernanceRuleTypeIntegrated), - // SourceResourceType: to.Ptr(armsecurity.GovernanceRuleSourceResourceTypeAssessments), - // TenantID: to.Ptr("f0b6d37b-e4bc-4719-9291-c066c3194f23"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/PutGovernanceRule_example.json -func ExampleGovernanceRulesClient_CreateOrUpdate_createOrUpdateGovernanceRuleOverSubscriptionScope() { - 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.NewGovernanceRulesClient().CreateOrUpdate(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", armsecurity.GovernanceRule{ - Properties: &armsecurity.GovernanceRuleProperties{ - Description: to.Ptr("A rule for critical recommendations"), - ConditionSets: []any{ - map[string]any{ - "conditions": []any{ - map[string]any{ - "operator": "In", - "property": "$.AssessmentKey", - "value": "[\"b1cd27e0-4ecc-4246-939f-49c426d9d72f\", \"fe83f80b-073d-4ccf-93d9-6797eb870201\"]", - }, - }, - }}, - DisplayName: to.Ptr("Admin's rule"), - GovernanceEmailNotification: &armsecurity.GovernanceRuleEmailNotification{ - DisableManagerEmailNotification: to.Ptr(false), - DisableOwnerEmailNotification: to.Ptr(false), - }, - IsDisabled: to.Ptr(false), - IsGracePeriod: to.Ptr(true), - OwnerSource: &armsecurity.GovernanceRuleOwnerSource{ - Type: to.Ptr(armsecurity.GovernanceRuleOwnerSourceTypeManually), - Value: to.Ptr("user@contoso.com"), - }, - RemediationTimeframe: to.Ptr("7.00:00:00"), - RulePriority: to.Ptr[int32](200), - RuleType: to.Ptr(armsecurity.GovernanceRuleTypeIntegrated), - SourceResourceType: to.Ptr(armsecurity.GovernanceRuleSourceResourceTypeAssessments), - }, - }, 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.GovernanceRule = armsecurity.GovernanceRule{ - // Name: to.Ptr("ad9a8e26-29d9-4829-bb30-e597a58cdbb8"), - // Type: to.Ptr("Microsoft.Security/governanceRules"), - // ID: to.Ptr("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/governanceRules/ad9a8e26-29d9-4829-bb30-e597a58cdbb8"), - // Properties: &armsecurity.GovernanceRuleProperties{ - // Description: to.Ptr("A rule for critical recommendations"), - // ConditionSets: []any{ - // map[string]any{ - // "conditions":[]any{ - // map[string]any{ - // "operator": "In", - // "property": "$.AssessmentKey", - // "value": "[\"b1cd27e0-4ecc-4246-939f-49c426d9d72f\", \"fe83f80b-073d-4ccf-93d9-6797eb870201\"]", - // }, - // }, - // }}, - // DisplayName: to.Ptr("Admin's rule"), - // ExcludedScopes: []*string{ - // }, - // GovernanceEmailNotification: &armsecurity.GovernanceRuleEmailNotification{ - // DisableManagerEmailNotification: to.Ptr(false), - // DisableOwnerEmailNotification: to.Ptr(false), - // }, - // IncludeMemberScopes: to.Ptr(false), - // IsDisabled: to.Ptr(false), - // IsGracePeriod: to.Ptr(true), - // Metadata: &armsecurity.GovernanceRuleMetadata{ - // CreatedBy: to.Ptr("c23b5354-ff0a-4b2a-9f92-6f144effd936"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-10T08:31:26.799Z"); return t}()), - // UpdatedBy: to.Ptr("c23b5354-ff0a-4b2a-9f92-6f144effd936"), - // UpdatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-10T08:31:26.799Z"); return t}()), - // }, - // OwnerSource: &armsecurity.GovernanceRuleOwnerSource{ - // Type: to.Ptr(armsecurity.GovernanceRuleOwnerSourceTypeManually), - // Value: to.Ptr("user@contoso.com"), - // }, - // RemediationTimeframe: to.Ptr("7.00:00:00"), - // RulePriority: to.Ptr[int32](200), - // RuleType: to.Ptr(armsecurity.GovernanceRuleTypeIntegrated), - // SourceResourceType: to.Ptr(armsecurity.GovernanceRuleSourceResourceTypeAssessments), - // TenantID: to.Ptr("f0b6d37b-e4bc-4719-9291-c066c3194f23"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/DeleteManagementGroupGovernanceRule_example.json -func ExampleGovernanceRulesClient_BeginDelete_deleteAGovernanceRuleOverManagementGroupScope() { - 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.NewGovernanceRulesClient().BeginDelete(ctx, "providers/Microsoft.Management/managementGroups/contoso", "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", 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) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/DeleteSecurityConnectorGovernanceRule_example.json -func ExampleGovernanceRulesClient_BeginDelete_deleteAGovernanceRuleOverSecurityConnectorScope() { - 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.NewGovernanceRulesClient().BeginDelete(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", 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) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/DeleteGovernanceRule_example.json -func ExampleGovernanceRulesClient_BeginDelete_deleteAGovernanceRuleOverSubscriptionScope() { - 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.NewGovernanceRulesClient().BeginDelete(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", 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) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/PostGovernanceRule_example.json -func ExampleGovernanceRulesClient_BeginExecute_executeGovernanceRuleOverSubscriptionScope() { - 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.NewGovernanceRulesClient().BeginExecute(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", &armsecurity.GovernanceRulesClientBeginExecuteOptions{ExecuteGovernanceRuleParams: 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) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/PostManagementGroupGovernanceRule_example.json -func ExampleGovernanceRulesClient_BeginExecute_executeGovernanceRuleOverManagementGroupScope() { - 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.NewGovernanceRulesClient().BeginExecute(ctx, "providers/Microsoft.Management/managementGroups/contoso", "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", &armsecurity.GovernanceRulesClientBeginExecuteOptions{ExecuteGovernanceRuleParams: 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) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/PostSecurityConnectorGovernanceRule_example.json -func ExampleGovernanceRulesClient_BeginExecute_executeGovernanceRuleOverSecurityConnectorScope() { - 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.NewGovernanceRulesClient().BeginExecute(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", &armsecurity.GovernanceRulesClientBeginExecuteOptions{ExecuteGovernanceRuleParams: 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) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/GetManagementGroupGovernanceRuleExecuteStatus_example.json -func ExampleGovernanceRulesClient_OperationResults_getGovernanceRulesLongRunOperationResultOverManagementGroup() { - 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.NewGovernanceRulesClient().OperationResults(ctx, "providers/Microsoft.Management/managementGroups/contoso", "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", "58b33f4f-c8c7-4b01-99cc-d437db4d40dd", 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.OperationResultAutoGenerated = armsecurity.OperationResultAutoGenerated{ - // Status: to.Ptr(armsecurity.OperationResultSucceeded), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/GetSecurityConnectorGovernanceRuleExecuteStatus_example.json -func ExampleGovernanceRulesClient_OperationResults_getGovernanceRulesLongRunOperationResultOverSecurityConnector() { - 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.NewGovernanceRulesClient().OperationResults(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", "58b33f4f-c8c7-4b01-99cc-d437db4d40dd", 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.OperationResultAutoGenerated = armsecurity.OperationResultAutoGenerated{ - // Status: to.Ptr(armsecurity.OperationResultSucceeded), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/GetGovernanceRuleExecuteStatus_example.json -func ExampleGovernanceRulesClient_OperationResults_getGovernanceRulesLongRunOperationResultOverSubscription() { - 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.NewGovernanceRulesClient().OperationResults(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", "58b33f4f-c8c7-4b01-99cc-d437db4d40dd", 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.OperationResultAutoGenerated = armsecurity.OperationResultAutoGenerated{ - // Status: to.Ptr(armsecurity.OperationResultSucceeded), - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/healthreports_client.go b/sdk/resourcemanager/security/armsecurity/healthreports_client.go deleted file mode 100644 index 53fac9ea1cb3..000000000000 --- a/sdk/resourcemanager/security/armsecurity/healthreports_client.go +++ /dev/null @@ -1,152 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// HealthReportsClient contains the methods for the HealthReports group. -// Don't use this type directly, use NewHealthReportsClient() instead. -type HealthReportsClient struct { - internal *arm.Client -} - -// 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. -func NewHealthReportsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*HealthReportsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &HealthReportsClient{ - internal: cl, - } - return client, nil -} - -// Get - Get health report of resource -// 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 -// - 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 - const operationName = "HealthReportsClient.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, healthReportName, options) - if err != nil { - return HealthReportsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return HealthReportsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return HealthReportsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *HealthReportsClient) getCreateRequest(ctx context.Context, resourceID string, healthReportName string, options *HealthReportsClientGetOptions) (*policy.Request, error) { - urlPath := "/{resourceId}/providers/Microsoft.Security/healthReports/{healthReportName}" - urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) - if healthReportName == "" { - return nil, errors.New("parameter healthReportName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{healthReportName}", url.PathEscape(healthReportName)) - 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-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 *HealthReportsClient) getHandleResponse(resp *http.Response) (HealthReportsClientGetResponse, error) { - result := HealthReportsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.HealthReport); err != nil { - return HealthReportsClientGetResponse{}, err - } - return result, nil -} - -// 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})' -// -// Generated from API version 2023-05-01-preview -// - scope - The scope at which the operation is performed. -// - 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]{ - More: func(page HealthReportsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *HealthReportsClientListResponse) (HealthReportsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "HealthReportsClient.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 HealthReportsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *HealthReportsClient) listCreateRequest(ctx context.Context, scope string, options *HealthReportsClientListOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Security/healthReports" - 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", "2023-05-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 *HealthReportsClient) listHandleResponse(resp *http.Response) (HealthReportsClientListResponse, error) { - result := HealthReportsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.HealthReportsList); err != nil { - return HealthReportsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/healthreports_client_example_test.go b/sdk/resourcemanager/security/armsecurity/healthreports_client_example_test.go deleted file mode 100644 index 2c9c814253f9..000000000000 --- a/sdk/resourcemanager/security/armsecurity/healthreports_client_example_test.go +++ /dev/null @@ -1,143 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-05-01-preview/examples/HealthReports/ListHealthReports_example.json -func ExampleHealthReportsClient_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.NewHealthReportsClient().NewListPager("subscriptions/a1efb6ca-fbc5-4782-9aaa-5c7daded1ce2", 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.HealthReportsList = armsecurity.HealthReportsList{ - // Value: []*armsecurity.HealthReport{ - // { - // Name: to.Ptr("2351eaac-f8e6-43d8-87c0-a7e2c3d197c0"), - // Type: to.Ptr("Microsoft.Security/healthReports"), - // ID: to.Ptr("/subscriptions/a1efb6ca-fbc5-4782-9aaa-5c7daded1ce2/resourcegroups/ascdemorg/providers/microsoft.compute/virtualmachines/vm3/providers/Microsoft.Security/healthReports/2351eaac-f8e6-43d8-87c0-a7e2c3d197c0"), - // Properties: &armsecurity.HealthReportProperties{ - // AffectedDefendersPlans: []*string{ - // to.Ptr("DefenderForServers")}, - // EnvironmentDetails: &armsecurity.EnvironmentDetails{ - // EnvironmentHierarchyID: to.Ptr("a1efb6ca-fbc5-4782-9aaa-5c7daded1ce2"), - // NativeResourceID: to.Ptr("/subscriptions/a1efb6ca-fbc5-4782-9aaa-5c7daded1ce2/resourcegroups/ascdemorg/providers/microsoft.compute/virtualmachines/vm3"), - // OrganizationalHierarchyID: to.Ptr("200d73cf-ba70-4b93-8fa2-25e05e6aa1f6"), - // SubscriptionID: to.Ptr("a1efb6ca-fbc5-4782-9aaa-5c7daded1ce2"), - // TenantID: to.Ptr("200d73cf-ba70-4b93-8fa2-25e05e6aa1f6"), - // }, - // HealthDataClassification: &armsecurity.HealthDataClassification{ - // Component: to.Ptr("MDE"), - // Scenario: to.Ptr("Reporting"), - // Scope: to.Ptr("VirtualMachines"), - // }, - // Issues: []*armsecurity.Issue{ - // }, - // ResourceDetails: &armsecurity.ResourceDetailsAutoGenerated{ - // ID: to.Ptr("/subscriptions/a1efb6ca-fbc5-4782-9aaa-5c7daded1ce2/resourcegroups/ascdemorg/providers/microsoft.compute/virtualmachines/vm3"), - // Source: to.Ptr(armsecurity.SourceAzure), - // }, - // Status: &armsecurity.StatusAutoGenerated{ - // Code: to.Ptr(armsecurity.StatusNameHealthy), - // FirstEvaluationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-12T09:07:18.675Z"); return t}()), - // LastScannedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-04-25T09:02:20.134Z"); return t}()), - // StatusChangeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-12T09:07:18.675Z"); return t}()), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-05-01-preview/examples/HealthReports/GetHealthReports_example.json -func ExampleHealthReportsClient_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.NewHealthReportsClient().Get(ctx, "subscriptions/a1efb6ca-fbc5-4782-9aaa-5c7daded1ce2/resourcegroups/E2E-IBB0WX/providers/Microsoft.Security/securityconnectors/AwsConnectorAllOfferings", "909c629a-bf39-4521-8e4f-10b443a0bc02", 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.HealthReport = armsecurity.HealthReport{ - // Name: to.Ptr("909c629a-bf39-4521-8e4f-10b443a0bc02"), - // Type: to.Ptr("Microsoft.Security/healthReports"), - // ID: to.Ptr("/subscriptions/a1efb6ca-fbc5-4782-9aaa-5c7daded1ce2/resourcegroups/E2E-IBB0WX/providers/Microsoft.Security/securityconnectors/AwsConnectorAllOfferings/providers/Microsoft.Security/healthReports/909c629a-bf39-4521-8e4f-10b443a0bc02"), - // Properties: &armsecurity.HealthReportProperties{ - // AffectedDefendersPlans: []*string{ - // }, - // EnvironmentDetails: &armsecurity.EnvironmentDetails{ - // EnvironmentHierarchyID: to.Ptr("a1efb6ca-fbc5-4782-9aaa-5c7daded1ce2"), - // NativeResourceID: to.Ptr("arn:aws:iam::827098768879"), - // OrganizationalHierarchyID: to.Ptr("e81b978c-11be-449f-a392-42c0ed96bb91"), - // SubscriptionID: to.Ptr("a1efb6ca-fbc5-4782-9aaa-5c7daded1ce2"), - // TenantID: to.Ptr("a1efb6ca-fbc5-4782-9aaa-5c7daded1ce2"), - // }, - // HealthDataClassification: &armsecurity.HealthDataClassification{ - // Component: to.Ptr("Connectivity"), - // Scope: to.Ptr("Connectors"), - // }, - // Issues: []*armsecurity.Issue{ - // { - // IssueAdditionalData: map[string]*string{ - // "StacksetName": to.Ptr("ProdStackSet"), - // }, - // IssueDescription: to.Ptr("A problem was identified with the AWS CloudFormation StackSet. The StackSet is used to create stacks across multiple accounts. To grant Defender for Cloud access to your member accounts, there is a need to run the StackSet on the member accounts."), - // IssueKey: to.Ptr("414af15d-207e-4c63-b8eb-624d1b652e45"), - // IssueName: to.Ptr("AWS CloudFormation StackSet name invalid or does not exist"), - // RemediationScript: to.Ptr(""), - // RemediationSteps: to.Ptr("Validate that the StackSet name in AWS matches the name provided in the onboarding set up: StackSet name can be found in AWS Management Console -> CloudFormation -> StackSets -> StackSet name In case the names do not match, update the StackSet name to match the StackSet name provided in the onboarding set up. In case the StackSet does not exist, re-run the CloudFormation template only for StackSet. Navigate to CloudFormation 'StackSets' in AWS Management Console -> Click 'Create StackSet' -> Choose 'Upload a template file', `Choose file` and select the downloaded template. Make sure to enter the exact StackSet name as it was provided in the onboarding set up. Download template link "), - // SecurityValues: []*string{ - // to.Ptr("Connectivity to AWS member accounts")}, - // }}, - // ResourceDetails: &armsecurity.ResourceDetailsAutoGenerated{ - // ConnectorID: to.Ptr("bb7ad9cc-26b6-48ec-a5b4-23fc23be2733"), - // ID: to.Ptr("/subscriptions/a1efb6ca-fbc5-4782-9aaa-5c7daded1ce2/resourcegroups/E2E-IBB0WX/providers/Microsoft.Security/securityconnectors/AwsConnectorAllOfferings"), - // Source: to.Ptr(armsecurity.Source("Aws")), - // }, - // Status: &armsecurity.StatusAutoGenerated{ - // Code: to.Ptr(armsecurity.StatusNameNotHealthy), - // FirstEvaluationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-12T09:07:18.675Z"); return t}()), - // LastScannedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-04-25T09:02:20.134Z"); return t}()), - // StatusChangeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-12T09:07:18.675Z"); return t}()), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/informationprotectionpolicies_client.go b/sdk/resourcemanager/security/armsecurity/informationprotectionpolicies_client.go deleted file mode 100644 index 077b5740e34e..000000000000 --- a/sdk/resourcemanager/security/armsecurity/informationprotectionpolicies_client.go +++ /dev/null @@ -1,217 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// InformationProtectionPoliciesClient contains the methods for the InformationProtectionPolicies group. -// Don't use this type directly, use NewInformationProtectionPoliciesClient() instead. -type InformationProtectionPoliciesClient struct { - internal *arm.Client -} - -// 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. -func NewInformationProtectionPoliciesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*InformationProtectionPoliciesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &InformationProtectionPoliciesClient{ - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Details of the information protection policy. -// 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). -// - informationProtectionPolicyName - Name of the information protection policy. -// - informationProtectionPolicy - Information protection policy. -// - options - InformationProtectionPoliciesClientCreateOrUpdateOptions contains the optional parameters for the InformationProtectionPoliciesClient.CreateOrUpdate -// method. -func (client *InformationProtectionPoliciesClient) CreateOrUpdate(ctx context.Context, scope string, informationProtectionPolicyName InformationProtectionPolicyName, informationProtectionPolicy InformationProtectionPolicy, options *InformationProtectionPoliciesClientCreateOrUpdateOptions) (InformationProtectionPoliciesClientCreateOrUpdateResponse, error) { - var err error - const operationName = "InformationProtectionPoliciesClient.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, informationProtectionPolicyName, informationProtectionPolicy, options) - if err != nil { - return InformationProtectionPoliciesClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return InformationProtectionPoliciesClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return InformationProtectionPoliciesClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *InformationProtectionPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, scope string, informationProtectionPolicyName InformationProtectionPolicyName, informationProtectionPolicy InformationProtectionPolicy, options *InformationProtectionPoliciesClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if informationProtectionPolicyName == "" { - return nil, errors.New("parameter informationProtectionPolicyName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{informationProtectionPolicyName}", url.PathEscape(string(informationProtectionPolicyName))) - 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", "2017-08-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, informationProtectionPolicy); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *InformationProtectionPoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (InformationProtectionPoliciesClientCreateOrUpdateResponse, error) { - result := InformationProtectionPoliciesClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.InformationProtectionPolicy); err != nil { - return InformationProtectionPoliciesClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Get - Details of the information protection policy. -// 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). -// - informationProtectionPolicyName - Name of the information protection policy. -// - options - InformationProtectionPoliciesClientGetOptions contains the optional parameters for the InformationProtectionPoliciesClient.Get -// method. -func (client *InformationProtectionPoliciesClient) Get(ctx context.Context, scope string, informationProtectionPolicyName InformationProtectionPolicyName, options *InformationProtectionPoliciesClientGetOptions) (InformationProtectionPoliciesClientGetResponse, error) { - var err error - const operationName = "InformationProtectionPoliciesClient.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, informationProtectionPolicyName, options) - if err != nil { - return InformationProtectionPoliciesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return InformationProtectionPoliciesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return InformationProtectionPoliciesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *InformationProtectionPoliciesClient) getCreateRequest(ctx context.Context, scope string, informationProtectionPolicyName InformationProtectionPolicyName, options *InformationProtectionPoliciesClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if informationProtectionPolicyName == "" { - return nil, errors.New("parameter informationProtectionPolicyName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{informationProtectionPolicyName}", url.PathEscape(string(informationProtectionPolicyName))) - 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", "2017-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 *InformationProtectionPoliciesClient) getHandleResponse(resp *http.Response) (InformationProtectionPoliciesClientGetResponse, error) { - result := InformationProtectionPoliciesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.InformationProtectionPolicy); err != nil { - return InformationProtectionPoliciesClientGetResponse{}, err - } - return result, nil -} - -// 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). -// - options - InformationProtectionPoliciesClientListOptions contains the optional parameters for the InformationProtectionPoliciesClient.NewListPager -// method. -func (client *InformationProtectionPoliciesClient) NewListPager(scope string, options *InformationProtectionPoliciesClientListOptions) *runtime.Pager[InformationProtectionPoliciesClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[InformationProtectionPoliciesClientListResponse]{ - More: func(page InformationProtectionPoliciesClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *InformationProtectionPoliciesClientListResponse) (InformationProtectionPoliciesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "InformationProtectionPoliciesClient.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 InformationProtectionPoliciesClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *InformationProtectionPoliciesClient) listCreateRequest(ctx context.Context, scope string, options *InformationProtectionPoliciesClientListOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Security/informationProtectionPolicies" - 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", "2017-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 *InformationProtectionPoliciesClient) listHandleResponse(resp *http.Response) (InformationProtectionPoliciesClientListResponse, error) { - result := InformationProtectionPoliciesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.InformationProtectionPolicyList); err != nil { - return InformationProtectionPoliciesClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/informationprotectionpolicies_client_example_test.go b/sdk/resourcemanager/security/armsecurity/informationprotectionpolicies_client_example_test.go deleted file mode 100644 index c467e431b0e9..000000000000 --- a/sdk/resourcemanager/security/armsecurity/informationprotectionpolicies_client_example_test.go +++ /dev/null @@ -1,512 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/2017-08-01-preview/examples/InformationProtectionPolicies/GetCustomInformationProtectionPolicy_example.json -func ExampleInformationProtectionPoliciesClient_Get_getTheCustomizedInformationProtectionPolicyForAManagementGroup() { - 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.NewInformationProtectionPoliciesClient().Get(ctx, "providers/Microsoft.Management/managementGroups/148059f7-faf3-49a6-ba35-85122112291e", armsecurity.InformationProtectionPolicyNameCustom, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.InformationProtectionPolicy = armsecurity.InformationProtectionPolicy{ - // Name: to.Ptr("custom"), - // Type: to.Ptr("Microsoft.Security/informationProtectionPolicies"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/148059f7-faf3-49a6-ba35-85122112291e/providers/Microsoft.Security/informationProtectionPolicies/custom"), - // Properties: &armsecurity.InformationProtectionPolicyProperties{ - // InformationTypes: map[string]*armsecurity.InformationType{ - // "3bf35491-99b8-41f2-86d5-c1200a7df658": &armsecurity.InformationType{ - // Custom: to.Ptr(true), - // DisplayName: to.Ptr("Custom"), - // Enabled: to.Ptr(true), - // Keywords: []*armsecurity.InformationProtectionKeyword{ - // { - // CanBeNumeric: to.Ptr(true), - // Custom: to.Ptr(true), - // Pattern: to.Ptr("%custom%"), - // }}, - // Order: to.Ptr[int32](1400), - // RecommendedLabelID: to.Ptr("7aa516c7-5a53-4857-bc6e-6808c6acd542"), - // }, - // "7fb9419d-2473-4ad8-8e11-b25cc8cf6a07": &armsecurity.InformationType{ - // Custom: to.Ptr(false), - // DisplayName: to.Ptr("Networking"), - // Enabled: to.Ptr(true), - // Keywords: []*armsecurity.InformationProtectionKeyword{ - // { - // CanBeNumeric: to.Ptr(false), - // Custom: to.Ptr(true), - // Pattern: to.Ptr("%networking%"), - // }}, - // Order: to.Ptr[int32](100), - // RecommendedLabelID: to.Ptr("575739d2-3d53-4df0-9042-4c7772d5c7b1"), - // }, - // }, - // Labels: map[string]*armsecurity.SensitivityLabel{ - // "1345da73-bc5a-4a8f-b7dd-3820eb713da8": &armsecurity.SensitivityLabel{ - // DisplayName: to.Ptr("Public"), - // Enabled: to.Ptr(true), - // Order: to.Ptr[int32](100), - // }, - // "575739d2-3d53-4df0-9042-4c7772d5c7b1": &armsecurity.SensitivityLabel{ - // DisplayName: to.Ptr("Confidential"), - // Enabled: to.Ptr(true), - // Order: to.Ptr[int32](300), - // }, - // "7aa516c7-5a53-4857-bc6e-6808c6acd542": &armsecurity.SensitivityLabel{ - // DisplayName: to.Ptr("General"), - // Enabled: to.Ptr(true), - // Order: to.Ptr[int32](200), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/InformationProtectionPolicies/GetEffectiveInformationProtectionPolicy_example.json -func ExampleInformationProtectionPoliciesClient_Get_getTheEffectiveInformationProtectionPolicyForAManagementGroup() { - 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.NewInformationProtectionPoliciesClient().Get(ctx, "providers/Microsoft.Management/managementGroups/148059f7-faf3-49a6-ba35-85122112291e", armsecurity.InformationProtectionPolicyNameEffective, 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.InformationProtectionPolicy = armsecurity.InformationProtectionPolicy{ - // Name: to.Ptr("effective"), - // Type: to.Ptr("Microsoft.Security/informationProtectionPolicies"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/148059f7-faf3-49a6-ba35-85122112291e/providers/Microsoft.Security/informationProtectionPolicies/effective"), - // Properties: &armsecurity.InformationProtectionPolicyProperties{ - // InformationTypes: map[string]*armsecurity.InformationType{ - // "3bf35491-99b8-41f2-86d5-c1200a7df658": &armsecurity.InformationType{ - // Custom: to.Ptr(true), - // DisplayName: to.Ptr("Custom"), - // Enabled: to.Ptr(true), - // Keywords: []*armsecurity.InformationProtectionKeyword{ - // { - // CanBeNumeric: to.Ptr(false), - // Custom: to.Ptr(true), - // Pattern: to.Ptr("%networking%"), - // }}, - // Order: to.Ptr[int32](1400), - // RecommendedLabelID: to.Ptr("7aa516c7-5a53-4857-bc6e-6808c6acd542"), - // }, - // "5856f35c-8e08-4d08-9bf7-87a146150569": &armsecurity.InformationType{ - // Custom: to.Ptr(false), - // DisplayName: to.Ptr("Contact Info"), - // Enabled: to.Ptr(true), - // Keywords: []*armsecurity.InformationProtectionKeyword{ - // { - // CanBeNumeric: to.Ptr(false), - // Custom: to.Ptr(false), - // Pattern: to.Ptr("%email%"), - // }, - // { - // CanBeNumeric: to.Ptr(false), - // Custom: to.Ptr(false), - // Pattern: to.Ptr("%e-mail%"), - // }, - // { - // CanBeNumeric: to.Ptr(false), - // Custom: to.Ptr(false), - // Pattern: to.Ptr("%addr%"), - // }, - // { - // CanBeNumeric: to.Ptr(true), - // Custom: to.Ptr(false), - // Pattern: to.Ptr("%street%"), - // }, - // { - // CanBeNumeric: to.Ptr(false), - // Custom: to.Ptr(false), - // Pattern: to.Ptr("%city%"), - // }}, - // Order: to.Ptr[int32](200), - // RecommendedLabelID: to.Ptr("575739d2-3d53-4df0-9042-4c7772d5c7b1"), - // }, - // "7fb9419d-2473-4ad8-8e11-b25cc8cf6a07": &armsecurity.InformationType{ - // Custom: to.Ptr(false), - // DisplayName: to.Ptr("Networking"), - // Enabled: to.Ptr(true), - // Keywords: []*armsecurity.InformationProtectionKeyword{ - // { - // CanBeNumeric: to.Ptr(false), - // Custom: to.Ptr(false), - // Pattern: to.Ptr("%ip%"), - // }, - // { - // CanBeNumeric: to.Ptr(false), - // Custom: to.Ptr(false), - // Pattern: to.Ptr("ip%address%"), - // }, - // { - // CanBeNumeric: to.Ptr(false), - // Custom: to.Ptr(false), - // Pattern: to.Ptr("%mac%address%"), - // }, - // { - // CanBeNumeric: to.Ptr(true), - // Custom: to.Ptr(true), - // Excluded: to.Ptr(true), - // Pattern: to.Ptr("%networking%"), - // }}, - // Order: to.Ptr[int32](100), - // RecommendedLabelID: to.Ptr("575739d2-3d53-4df0-9042-4c7772d5c7b1"), - // }, - // }, - // Labels: map[string]*armsecurity.SensitivityLabel{ - // "1345da73-bc5a-4a8f-b7dd-3820eb713da8": &armsecurity.SensitivityLabel{ - // DisplayName: to.Ptr("Public"), - // Enabled: to.Ptr(true), - // Order: to.Ptr[int32](100), - // }, - // "575739d2-3d53-4df0-9042-4c7772d5c7b1": &armsecurity.SensitivityLabel{ - // DisplayName: to.Ptr("Confidential"), - // Enabled: to.Ptr(true), - // Order: to.Ptr[int32](300), - // }, - // "7aa516c7-5a53-4857-bc6e-6808c6acd542": &armsecurity.SensitivityLabel{ - // DisplayName: to.Ptr("General"), - // Enabled: to.Ptr(true), - // Order: to.Ptr[int32](200), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/InformationProtectionPolicies/CreateOrUpdateInformationProtectionPolicy_example.json -func ExampleInformationProtectionPoliciesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewInformationProtectionPoliciesClient().CreateOrUpdate(ctx, "providers/Microsoft.Management/managementGroups/148059f7-faf3-49a6-ba35-85122112291e", armsecurity.InformationProtectionPolicyNameCustom, armsecurity.InformationProtectionPolicy{ - Properties: &armsecurity.InformationProtectionPolicyProperties{ - InformationTypes: map[string]*armsecurity.InformationType{ - "3bf35491-99b8-41f2-86d5-c1200a7df658": { - Custom: to.Ptr(true), - DisplayName: to.Ptr("Custom"), - Enabled: to.Ptr(true), - Keywords: []*armsecurity.InformationProtectionKeyword{ - { - CanBeNumeric: to.Ptr(true), - Custom: to.Ptr(true), - Pattern: to.Ptr("%custom%"), - }}, - Order: to.Ptr[int32](1400), - RecommendedLabelID: to.Ptr("7aa516c7-5a53-4857-bc6e-6808c6acd542"), - }, - "7fb9419d-2473-4ad8-8e11-b25cc8cf6a07": { - Custom: to.Ptr(false), - DisplayName: to.Ptr("Networking"), - Enabled: to.Ptr(true), - Keywords: []*armsecurity.InformationProtectionKeyword{ - { - CanBeNumeric: to.Ptr(false), - Custom: to.Ptr(true), - Pattern: to.Ptr("%networking%"), - }}, - Order: to.Ptr[int32](100), - RecommendedLabelID: to.Ptr("575739d2-3d53-4df0-9042-4c7772d5c7b1"), - }, - }, - Labels: map[string]*armsecurity.SensitivityLabel{ - "1345da73-bc5a-4a8f-b7dd-3820eb713da8": { - DisplayName: to.Ptr("Public"), - Enabled: to.Ptr(true), - Order: to.Ptr[int32](100), - }, - "575739d2-3d53-4df0-9042-4c7772d5c7b1": { - DisplayName: to.Ptr("Confidential"), - Enabled: to.Ptr(true), - Order: to.Ptr[int32](300), - }, - "7aa516c7-5a53-4857-bc6e-6808c6acd542": { - DisplayName: to.Ptr("General"), - Enabled: to.Ptr(true), - Order: to.Ptr[int32](200), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.InformationProtectionPolicy = armsecurity.InformationProtectionPolicy{ - // Name: to.Ptr("custom"), - // Type: to.Ptr("Microsoft.Security/informationProtectionPolicies"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/148059f7-faf3-49a6-ba35-85122112291e/providers/Microsoft.Security/informationProtectionPolicies/custom"), - // Properties: &armsecurity.InformationProtectionPolicyProperties{ - // InformationTypes: map[string]*armsecurity.InformationType{ - // "3bf35491-99b8-41f2-86d5-c1200a7df658": &armsecurity.InformationType{ - // Custom: to.Ptr(true), - // DisplayName: to.Ptr("Custom"), - // Enabled: to.Ptr(true), - // Keywords: []*armsecurity.InformationProtectionKeyword{ - // { - // CanBeNumeric: to.Ptr(true), - // Custom: to.Ptr(true), - // Pattern: to.Ptr("%custom%"), - // }}, - // Order: to.Ptr[int32](1400), - // RecommendedLabelID: to.Ptr("7aa516c7-5a53-4857-bc6e-6808c6acd542"), - // }, - // "7fb9419d-2473-4ad8-8e11-b25cc8cf6a07": &armsecurity.InformationType{ - // Custom: to.Ptr(false), - // DisplayName: to.Ptr("Networking"), - // Enabled: to.Ptr(true), - // Keywords: []*armsecurity.InformationProtectionKeyword{ - // { - // CanBeNumeric: to.Ptr(false), - // Custom: to.Ptr(true), - // Pattern: to.Ptr("%networking%"), - // }}, - // Order: to.Ptr[int32](100), - // RecommendedLabelID: to.Ptr("575739d2-3d53-4df0-9042-4c7772d5c7b1"), - // }, - // }, - // Labels: map[string]*armsecurity.SensitivityLabel{ - // "1345da73-bc5a-4a8f-b7dd-3820eb713da8": &armsecurity.SensitivityLabel{ - // DisplayName: to.Ptr("Public"), - // Enabled: to.Ptr(true), - // Order: to.Ptr[int32](100), - // }, - // "575739d2-3d53-4df0-9042-4c7772d5c7b1": &armsecurity.SensitivityLabel{ - // DisplayName: to.Ptr("Confidential"), - // Enabled: to.Ptr(true), - // Order: to.Ptr[int32](300), - // }, - // "7aa516c7-5a53-4857-bc6e-6808c6acd542": &armsecurity.SensitivityLabel{ - // DisplayName: to.Ptr("General"), - // Enabled: to.Ptr(true), - // Order: to.Ptr[int32](200), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/InformationProtectionPolicies/ListInformationProtectionPolicies_example.json -func ExampleInformationProtectionPoliciesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewInformationProtectionPoliciesClient().NewListPager("providers/Microsoft.Management/managementGroups/148059f7-faf3-49a6-ba35-85122112291e", 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.InformationProtectionPolicyList = armsecurity.InformationProtectionPolicyList{ - // Value: []*armsecurity.InformationProtectionPolicy{ - // { - // Name: to.Ptr("effective"), - // Type: to.Ptr("Microsoft.Security/informationProtectionPolicies"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/148059f7-faf3-49a6-ba35-85122112291e/providers/Microsoft.Security/informationProtectionPolicies/effective"), - // Properties: &armsecurity.InformationProtectionPolicyProperties{ - // InformationTypes: map[string]*armsecurity.InformationType{ - // "3bf35491-99b8-41f2-86d5-c1200a7df658": &armsecurity.InformationType{ - // Custom: to.Ptr(true), - // DisplayName: to.Ptr("Custom"), - // Enabled: to.Ptr(true), - // Keywords: []*armsecurity.InformationProtectionKeyword{ - // { - // CanBeNumeric: to.Ptr(false), - // Custom: to.Ptr(true), - // Pattern: to.Ptr("%networking%"), - // }}, - // Order: to.Ptr[int32](1400), - // RecommendedLabelID: to.Ptr("7aa516c7-5a53-4857-bc6e-6808c6acd542"), - // }, - // "5856f35c-8e08-4d08-9bf7-87a146150569": &armsecurity.InformationType{ - // Custom: to.Ptr(false), - // DisplayName: to.Ptr("Contact Info"), - // Enabled: to.Ptr(true), - // Keywords: []*armsecurity.InformationProtectionKeyword{ - // { - // CanBeNumeric: to.Ptr(false), - // Custom: to.Ptr(false), - // Pattern: to.Ptr("%email%"), - // }, - // { - // CanBeNumeric: to.Ptr(false), - // Custom: to.Ptr(false), - // Pattern: to.Ptr("%e-mail%"), - // }, - // { - // CanBeNumeric: to.Ptr(false), - // Custom: to.Ptr(false), - // Pattern: to.Ptr("%addr%"), - // }, - // { - // CanBeNumeric: to.Ptr(true), - // Custom: to.Ptr(false), - // Pattern: to.Ptr("%street%"), - // }, - // { - // CanBeNumeric: to.Ptr(false), - // Custom: to.Ptr(false), - // Pattern: to.Ptr("%city%"), - // }}, - // Order: to.Ptr[int32](200), - // RecommendedLabelID: to.Ptr("575739d2-3d53-4df0-9042-4c7772d5c7b1"), - // }, - // "7fb9419d-2473-4ad8-8e11-b25cc8cf6a07": &armsecurity.InformationType{ - // Custom: to.Ptr(false), - // DisplayName: to.Ptr("Networking"), - // Enabled: to.Ptr(true), - // Keywords: []*armsecurity.InformationProtectionKeyword{ - // { - // CanBeNumeric: to.Ptr(false), - // Custom: to.Ptr(false), - // Pattern: to.Ptr("%ip%"), - // }, - // { - // CanBeNumeric: to.Ptr(false), - // Custom: to.Ptr(false), - // Pattern: to.Ptr("ip%address%"), - // }, - // { - // CanBeNumeric: to.Ptr(false), - // Custom: to.Ptr(false), - // Pattern: to.Ptr("%mac%address%"), - // }, - // { - // CanBeNumeric: to.Ptr(true), - // Custom: to.Ptr(true), - // Pattern: to.Ptr("%networking%"), - // }}, - // Order: to.Ptr[int32](100), - // RecommendedLabelID: to.Ptr("575739d2-3d53-4df0-9042-4c7772d5c7b1"), - // }, - // }, - // Labels: map[string]*armsecurity.SensitivityLabel{ - // "1345da73-bc5a-4a8f-b7dd-3820eb713da8": &armsecurity.SensitivityLabel{ - // DisplayName: to.Ptr("Public"), - // Enabled: to.Ptr(true), - // Order: to.Ptr[int32](100), - // }, - // "575739d2-3d53-4df0-9042-4c7772d5c7b1": &armsecurity.SensitivityLabel{ - // DisplayName: to.Ptr("Confidential"), - // Enabled: to.Ptr(true), - // Order: to.Ptr[int32](300), - // }, - // "7aa516c7-5a53-4857-bc6e-6808c6acd542": &armsecurity.SensitivityLabel{ - // DisplayName: to.Ptr("General"), - // Enabled: to.Ptr(true), - // Order: to.Ptr[int32](200), - // }, - // }, - // }, - // }, - // { - // Name: to.Ptr("custom"), - // Type: to.Ptr("Microsoft.Security/informationProtectionPolicies"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/148059f7-faf3-49a6-ba35-85122112291e/providers/Microsoft.Security/informationProtectionPolicies/custom"), - // Properties: &armsecurity.InformationProtectionPolicyProperties{ - // InformationTypes: map[string]*armsecurity.InformationType{ - // "3bf35491-99b8-41f2-86d5-c1200a7df658": &armsecurity.InformationType{ - // Custom: to.Ptr(true), - // DisplayName: to.Ptr("Custom"), - // Enabled: to.Ptr(true), - // Keywords: []*armsecurity.InformationProtectionKeyword{ - // { - // CanBeNumeric: to.Ptr(true), - // Custom: to.Ptr(true), - // Pattern: to.Ptr("%custom%"), - // }}, - // Order: to.Ptr[int32](1400), - // RecommendedLabelID: to.Ptr("7aa516c7-5a53-4857-bc6e-6808c6acd542"), - // }, - // "7fb9419d-2473-4ad8-8e11-b25cc8cf6a07": &armsecurity.InformationType{ - // Custom: to.Ptr(false), - // DisplayName: to.Ptr("Networking"), - // Enabled: to.Ptr(true), - // Keywords: []*armsecurity.InformationProtectionKeyword{ - // { - // CanBeNumeric: to.Ptr(false), - // Custom: to.Ptr(true), - // Pattern: to.Ptr("%networking%"), - // }}, - // Order: to.Ptr[int32](100), - // RecommendedLabelID: to.Ptr("575739d2-3d53-4df0-9042-4c7772d5c7b1"), - // }, - // }, - // Labels: map[string]*armsecurity.SensitivityLabel{ - // "1345da73-bc5a-4a8f-b7dd-3820eb713da8": &armsecurity.SensitivityLabel{ - // DisplayName: to.Ptr("Public"), - // Enabled: to.Ptr(true), - // Order: to.Ptr[int32](100), - // }, - // "575739d2-3d53-4df0-9042-4c7772d5c7b1": &armsecurity.SensitivityLabel{ - // DisplayName: to.Ptr("Confidential"), - // Enabled: to.Ptr(true), - // Order: to.Ptr[int32](300), - // }, - // "7aa516c7-5a53-4857-bc6e-6808c6acd542": &armsecurity.SensitivityLabel{ - // DisplayName: to.Ptr("General"), - // Enabled: to.Ptr(true), - // Order: to.Ptr[int32](200), - // }, - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/security/armsecurity/interfaces.go b/sdk/resourcemanager/security/armsecurity/interfaces.go deleted file mode 100644 index 64b6b9daf958..000000000000 --- a/sdk/resourcemanager/security/armsecurity/interfaces.go +++ /dev/null @@ -1,213 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armsecurity - -// AdditionalDataClassification provides polymorphic access to related types. -// Call the interface's GetAdditionalData() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AdditionalData, *ContainerRegistryVulnerabilityProperties, *SQLServerVulnerabilityProperties, *ServerVulnerabilityProperties -type AdditionalDataClassification interface { - // GetAdditionalData returns the AdditionalData content of the underlying type. - GetAdditionalData() *AdditionalData -} - -// AlertSimulatorRequestPropertiesClassification provides polymorphic access to related types. -// Call the interface's GetAlertSimulatorRequestProperties() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AlertSimulatorBundlesRequestProperties, *AlertSimulatorRequestProperties -type AlertSimulatorRequestPropertiesClassification interface { - // GetAlertSimulatorRequestProperties returns the AlertSimulatorRequestProperties content of the underlying type. - GetAlertSimulatorRequestProperties() *AlertSimulatorRequestProperties -} - -// AllowlistCustomAlertRuleClassification provides polymorphic access to related types. -// Call the interface's GetAllowlistCustomAlertRule() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AllowlistCustomAlertRule, *ConnectionFromIPNotAllowed, *ConnectionToIPNotAllowed, *LocalUserNotAllowed, *ProcessNotAllowed -type AllowlistCustomAlertRuleClassification interface { - ListCustomAlertRuleClassification - // GetAllowlistCustomAlertRule returns the AllowlistCustomAlertRule content of the underlying type. - GetAllowlistCustomAlertRule() *AllowlistCustomAlertRule -} - -// AuthenticationDetailsPropertiesClassification provides polymorphic access to related types. -// Call the interface's GetAuthenticationDetailsProperties() 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 -} - -// AutomationActionClassification provides polymorphic access to related types. -// Call the interface's GetAutomationAction() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AutomationAction, *AutomationActionEventHub, *AutomationActionLogicApp, *AutomationActionWorkspace -type AutomationActionClassification interface { - // GetAutomationAction returns the AutomationAction content of the underlying type. - GetAutomationAction() *AutomationAction -} - -// AwsOrganizationalDataClassification provides polymorphic access to related types. -// Call the interface's GetAwsOrganizationalData() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AwsOrganizationalData, *AwsOrganizationalDataMaster, *AwsOrganizationalDataMember -type AwsOrganizationalDataClassification interface { - // GetAwsOrganizationalData returns the AwsOrganizationalData content of the underlying type. - GetAwsOrganizationalData() *AwsOrganizationalData -} - -// 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 -type CloudOfferingClassification interface { - // GetCloudOffering returns the CloudOffering content of the underlying type. - GetCloudOffering() *CloudOffering -} - -// 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: -// - *ActiveConnectionsNotInAllowedRange, *AllowlistCustomAlertRule, *AmqpC2DMessagesNotInAllowedRange, *AmqpC2DRejectedMessagesNotInAllowedRange, -// - *AmqpD2CMessagesNotInAllowedRange, *ConnectionFromIPNotAllowed, *ConnectionToIPNotAllowed, *CustomAlertRule, *DenylistCustomAlertRule, -// - *DirectMethodInvokesNotInAllowedRange, *FailedLocalLoginsNotInAllowedRange, *FileUploadsNotInAllowedRange, *HTTPC2DMessagesNotInAllowedRange, -// - *HTTPC2DRejectedMessagesNotInAllowedRange, *HTTPD2CMessagesNotInAllowedRange, *ListCustomAlertRule, *LocalUserNotAllowed, -// - *MqttC2DMessagesNotInAllowedRange, *MqttC2DRejectedMessagesNotInAllowedRange, *MqttD2CMessagesNotInAllowedRange, *ProcessNotAllowed, -// - *QueuePurgesNotInAllowedRange, *ThresholdCustomAlertRule, *TimeWindowCustomAlertRule, *TwinUpdatesNotInAllowedRange, -// - *UnauthorizedOperationsNotInAllowedRange -type CustomAlertRuleClassification interface { - // GetCustomAlertRule returns the CustomAlertRule content of the underlying type. - GetCustomAlertRule() *CustomAlertRule -} - -// 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 -type EnvironmentDataClassification interface { - // GetEnvironmentData returns the EnvironmentData content of the underlying type. - GetEnvironmentData() *EnvironmentData -} - -// ExternalSecuritySolutionClassification provides polymorphic access to related types. -// Call the interface's GetExternalSecuritySolution() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AADExternalSecuritySolution, *AtaExternalSecuritySolution, *CefExternalSecuritySolution, *ExternalSecuritySolution -type ExternalSecuritySolutionClassification interface { - // GetExternalSecuritySolution returns the ExternalSecuritySolution content of the underlying type. - GetExternalSecuritySolution() *ExternalSecuritySolution -} - -// GcpOrganizationalDataClassification provides polymorphic access to related types. -// Call the interface's GetGcpOrganizationalData() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *GcpOrganizationalData, *GcpOrganizationalDataMember, *GcpOrganizationalDataOrganization -type GcpOrganizationalDataClassification interface { - // GetGcpOrganizationalData returns the GcpOrganizationalData content of the underlying type. - GetGcpOrganizationalData() *GcpOrganizationalData -} - -// ListCustomAlertRuleClassification provides polymorphic access to related types. -// Call the interface's GetListCustomAlertRule() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AllowlistCustomAlertRule, *ConnectionFromIPNotAllowed, *ConnectionToIPNotAllowed, *DenylistCustomAlertRule, *ListCustomAlertRule, -// - *LocalUserNotAllowed, *ProcessNotAllowed -type ListCustomAlertRuleClassification interface { - CustomAlertRuleClassification - // GetListCustomAlertRule returns the ListCustomAlertRule content of the underlying type. - GetListCustomAlertRule() *ListCustomAlertRule -} - -// NotificationsSourceClassification provides polymorphic access to related types. -// Call the interface's GetNotificationsSource() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *NotificationsSource, *NotificationsSourceAlert, *NotificationsSourceAttackPath -type NotificationsSourceClassification interface { - // GetNotificationsSource returns the NotificationsSource content of the underlying type. - GetNotificationsSource() *NotificationsSource -} - -// OnPremiseResourceDetailsClassification provides polymorphic access to related types. -// Call the interface's GetOnPremiseResourceDetails() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *OnPremiseResourceDetails, *OnPremiseSQLResourceDetails -type OnPremiseResourceDetailsClassification interface { - ResourceDetailsClassification - // 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: -// - *AzureResourceIdentifier, *LogAnalyticsIdentifier, *ResourceIdentifier -type ResourceIdentifierClassification interface { - // GetResourceIdentifier returns the ResourceIdentifier content of the underlying type. - GetResourceIdentifier() *ResourceIdentifier -} - -// ServerVulnerabilityAssessmentsSettingClassification provides polymorphic access to related types. -// Call the interface's GetServerVulnerabilityAssessmentsSetting() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AzureServersSetting, *ServerVulnerabilityAssessmentsSetting -type ServerVulnerabilityAssessmentsSettingClassification interface { - // GetServerVulnerabilityAssessmentsSetting returns the ServerVulnerabilityAssessmentsSetting content of the underlying type. - GetServerVulnerabilityAssessmentsSetting() *ServerVulnerabilityAssessmentsSetting -} - -// SettingClassification provides polymorphic access to related types. -// Call the interface's GetSetting() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AlertSyncSettings, *DataExportSettings, *Setting -type SettingClassification interface { - // GetSetting returns the Setting content of the underlying type. - GetSetting() *Setting -} - -// ThresholdCustomAlertRuleClassification provides polymorphic access to related types. -// Call the interface's GetThresholdCustomAlertRule() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *ActiveConnectionsNotInAllowedRange, *AmqpC2DMessagesNotInAllowedRange, *AmqpC2DRejectedMessagesNotInAllowedRange, *AmqpD2CMessagesNotInAllowedRange, -// - *DirectMethodInvokesNotInAllowedRange, *FailedLocalLoginsNotInAllowedRange, *FileUploadsNotInAllowedRange, *HTTPC2DMessagesNotInAllowedRange, -// - *HTTPC2DRejectedMessagesNotInAllowedRange, *HTTPD2CMessagesNotInAllowedRange, *MqttC2DMessagesNotInAllowedRange, *MqttC2DRejectedMessagesNotInAllowedRange, -// - *MqttD2CMessagesNotInAllowedRange, *QueuePurgesNotInAllowedRange, *ThresholdCustomAlertRule, *TimeWindowCustomAlertRule, -// - *TwinUpdatesNotInAllowedRange, *UnauthorizedOperationsNotInAllowedRange -type ThresholdCustomAlertRuleClassification interface { - CustomAlertRuleClassification - // GetThresholdCustomAlertRule returns the ThresholdCustomAlertRule content of the underlying type. - GetThresholdCustomAlertRule() *ThresholdCustomAlertRule -} - -// TimeWindowCustomAlertRuleClassification provides polymorphic access to related types. -// Call the interface's GetTimeWindowCustomAlertRule() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *ActiveConnectionsNotInAllowedRange, *AmqpC2DMessagesNotInAllowedRange, *AmqpC2DRejectedMessagesNotInAllowedRange, *AmqpD2CMessagesNotInAllowedRange, -// - *DirectMethodInvokesNotInAllowedRange, *FailedLocalLoginsNotInAllowedRange, *FileUploadsNotInAllowedRange, *HTTPC2DMessagesNotInAllowedRange, -// - *HTTPC2DRejectedMessagesNotInAllowedRange, *HTTPD2CMessagesNotInAllowedRange, *MqttC2DMessagesNotInAllowedRange, *MqttC2DRejectedMessagesNotInAllowedRange, -// - *MqttD2CMessagesNotInAllowedRange, *QueuePurgesNotInAllowedRange, *TimeWindowCustomAlertRule, *TwinUpdatesNotInAllowedRange, -// - *UnauthorizedOperationsNotInAllowedRange -type TimeWindowCustomAlertRuleClassification interface { - ThresholdCustomAlertRuleClassification - // GetTimeWindowCustomAlertRule returns the TimeWindowCustomAlertRule content of the underlying type. - GetTimeWindowCustomAlertRule() *TimeWindowCustomAlertRule -} diff --git a/sdk/resourcemanager/security/armsecurity/iotsecuritysolution_client.go b/sdk/resourcemanager/security/armsecurity/iotsecuritysolution_client.go deleted file mode 100644 index ee1428fe0c5a..000000000000 --- a/sdk/resourcemanager/security/armsecurity/iotsecuritysolution_client.go +++ /dev/null @@ -1,423 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// IotSecuritySolutionClient contains the methods for the IotSecuritySolution group. -// Don't use this type directly, use NewIotSecuritySolutionClient() instead. -type IotSecuritySolutionClient struct { - internal *arm.Client - subscriptionID string -} - -// NewIotSecuritySolutionClient creates a new instance of IotSecuritySolutionClient 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 NewIotSecuritySolutionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*IotSecuritySolutionClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &IotSecuritySolutionClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Use this method to create or update yours IoT Security solution -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-08-01 -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - solutionName - The name of the IoT Security solution. -// - iotSecuritySolutionData - The security solution data -// - options - IotSecuritySolutionClientCreateOrUpdateOptions contains the optional parameters for the IotSecuritySolutionClient.CreateOrUpdate -// method. -func (client *IotSecuritySolutionClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, solutionName string, iotSecuritySolutionData IoTSecuritySolutionModel, options *IotSecuritySolutionClientCreateOrUpdateOptions) (IotSecuritySolutionClientCreateOrUpdateResponse, error) { - var err error - const operationName = "IotSecuritySolutionClient.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, solutionName, iotSecuritySolutionData, options) - if err != nil { - return IotSecuritySolutionClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return IotSecuritySolutionClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return IotSecuritySolutionClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *IotSecuritySolutionClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, iotSecuritySolutionData IoTSecuritySolutionModel, options *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") - } - 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 solutionName == "" { - return nil, errors.New("parameter solutionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{solutionName}", url.PathEscape(solutionName)) - 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", "2019-08-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, iotSecuritySolutionData); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *IotSecuritySolutionClient) createOrUpdateHandleResponse(resp *http.Response) (IotSecuritySolutionClientCreateOrUpdateResponse, error) { - result := IotSecuritySolutionClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.IoTSecuritySolutionModel); err != nil { - return IotSecuritySolutionClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Use this method to delete yours IoT Security solution -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-08-01 -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - solutionName - The name of the IoT Security solution. -// - options - IotSecuritySolutionClientDeleteOptions contains the optional parameters for the IotSecuritySolutionClient.Delete -// method. -func (client *IotSecuritySolutionClient) Delete(ctx context.Context, resourceGroupName string, solutionName string, options *IotSecuritySolutionClientDeleteOptions) (IotSecuritySolutionClientDeleteResponse, error) { - var err error - const operationName = "IotSecuritySolutionClient.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, solutionName, options) - if err != nil { - return IotSecuritySolutionClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return IotSecuritySolutionClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return IotSecuritySolutionClientDeleteResponse{}, err - } - return IotSecuritySolutionClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *IotSecuritySolutionClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, options *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") - } - 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 solutionName == "" { - return nil, errors.New("parameter solutionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{solutionName}", url.PathEscape(solutionName)) - 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", "2019-08-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - User this method to get details of a specific IoT Security solution based on solution name -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-08-01 -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - solutionName - The name of the IoT Security solution. -// - 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) { - var err error - const operationName = "IotSecuritySolutionClient.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, solutionName, options) - if err != nil { - return IotSecuritySolutionClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return IotSecuritySolutionClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return IotSecuritySolutionClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *IotSecuritySolutionClient) getCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, options *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") - } - 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 solutionName == "" { - return nil, errors.New("parameter solutionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{solutionName}", url.PathEscape(solutionName)) - 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", "2019-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 *IotSecuritySolutionClient) getHandleResponse(resp *http.Response) (IotSecuritySolutionClientGetResponse, error) { - result := IotSecuritySolutionClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.IoTSecuritySolutionModel); err != nil { - return IotSecuritySolutionClientGetResponse{}, err - } - return result, nil -} - -// 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. -// - options - IotSecuritySolutionClientListByResourceGroupOptions contains the optional parameters for the IotSecuritySolutionClient.NewListByResourceGroupPager -// method. -func (client *IotSecuritySolutionClient) NewListByResourceGroupPager(resourceGroupName string, options *IotSecuritySolutionClientListByResourceGroupOptions) *runtime.Pager[IotSecuritySolutionClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[IotSecuritySolutionClientListByResourceGroupResponse]{ - More: func(page IotSecuritySolutionClientListByResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *IotSecuritySolutionClientListByResourceGroupResponse) (IotSecuritySolutionClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "IotSecuritySolutionClient.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 IotSecuritySolutionClientListByResourceGroupResponse{}, err - } - return client.listByResourceGroupHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *IotSecuritySolutionClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *IotSecuritySolutionClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions" - 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() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2019-08-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *IotSecuritySolutionClient) listByResourceGroupHandleResponse(resp *http.Response) (IotSecuritySolutionClientListByResourceGroupResponse, error) { - result := IotSecuritySolutionClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.IoTSecuritySolutionsList); err != nil { - return IotSecuritySolutionClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionPager - Use this method to get the list of IoT Security solutions by subscription. -// -// Generated from API version 2019-08-01 -// - options - IotSecuritySolutionClientListBySubscriptionOptions contains the optional parameters for the IotSecuritySolutionClient.NewListBySubscriptionPager -// method. -func (client *IotSecuritySolutionClient) NewListBySubscriptionPager(options *IotSecuritySolutionClientListBySubscriptionOptions) *runtime.Pager[IotSecuritySolutionClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[IotSecuritySolutionClientListBySubscriptionResponse]{ - More: func(page IotSecuritySolutionClientListBySubscriptionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *IotSecuritySolutionClientListBySubscriptionResponse) (IotSecuritySolutionClientListBySubscriptionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "IotSecuritySolutionClient.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 IotSecuritySolutionClientListBySubscriptionResponse{}, err - } - return client.listBySubscriptionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *IotSecuritySolutionClient) listBySubscriptionCreateRequest(ctx context.Context, options *IotSecuritySolutionClientListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotSecuritySolutions" - 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() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2019-08-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *IotSecuritySolutionClient) listBySubscriptionHandleResponse(resp *http.Response) (IotSecuritySolutionClientListBySubscriptionResponse, error) { - result := IotSecuritySolutionClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.IoTSecuritySolutionsList); err != nil { - return IotSecuritySolutionClientListBySubscriptionResponse{}, err - } - return result, nil -} - -// Update - Use this method to update existing IoT Security solution tags or user defined resources. To update other fields -// use the CreateOrUpdate method. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-08-01 -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - solutionName - The name of the IoT Security solution. -// - updateIotSecuritySolutionData - The security solution data -// - options - IotSecuritySolutionClientUpdateOptions contains the optional parameters for the IotSecuritySolutionClient.Update -// method. -func (client *IotSecuritySolutionClient) Update(ctx context.Context, resourceGroupName string, solutionName string, updateIotSecuritySolutionData UpdateIotSecuritySolutionData, options *IotSecuritySolutionClientUpdateOptions) (IotSecuritySolutionClientUpdateResponse, error) { - var err error - const operationName = "IotSecuritySolutionClient.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, solutionName, updateIotSecuritySolutionData, options) - if err != nil { - return IotSecuritySolutionClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return IotSecuritySolutionClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return IotSecuritySolutionClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *IotSecuritySolutionClient) updateCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, updateIotSecuritySolutionData UpdateIotSecuritySolutionData, options *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") - } - 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 solutionName == "" { - return nil, errors.New("parameter solutionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{solutionName}", url.PathEscape(solutionName)) - 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", "2019-08-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, updateIotSecuritySolutionData); err != nil { - return nil, err - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *IotSecuritySolutionClient) updateHandleResponse(resp *http.Response) (IotSecuritySolutionClientUpdateResponse, error) { - result := IotSecuritySolutionClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.IoTSecuritySolutionModel); err != nil { - return IotSecuritySolutionClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/iotsecuritysolution_client_example_test.go b/sdk/resourcemanager/security/armsecurity/iotsecuritysolution_client_example_test.go deleted file mode 100644 index eb13b94f3fd7..000000000000 --- a/sdk/resourcemanager/security/armsecurity/iotsecuritysolution_client_example_test.go +++ /dev/null @@ -1,1192 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/2019-08-01/examples/IoTSecuritySolutions/GetIoTSecuritySolutionsListByIotHub.json -func ExampleIotSecuritySolutionClient_NewListBySubscriptionPager_listIoTSecuritySolutionsByIoTHub() { - 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.NewIotSecuritySolutionClient().NewListBySubscriptionPager(&armsecurity.IotSecuritySolutionClientListBySubscriptionOptions{Filter: to.Ptr("properties.iotHubs/any(i eq \"/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/FirstIotHub\")")}) - for pager.More() { - 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.IoTSecuritySolutionsList = armsecurity.IoTSecuritySolutionsList{ - // Value: []*armsecurity.IoTSecuritySolutionModel{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/IoTSecuritySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/MyGroup/providers/Microsoft.Security/IoTSecuritySolutions/Locations/eastus/default"), - // Tags: map[string]*string{ - // }, - // Location: to.Ptr("East Us"), - // Properties: &armsecurity.IoTSecuritySolutionProperties{ - // AutoDiscoveredResources: []*string{ - // to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735"), - // to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/FirstIotHub")}, - // DisabledDataSources: []*armsecurity.DataSource{ - // }, - // DisplayName: to.Ptr("Solution Default"), - // Export: []*armsecurity.ExportData{ - // to.Ptr(armsecurity.ExportDataRawEvents)}, - // IotHubs: []*string{ - // to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/FirstIotHub")}, - // RecommendationsConfiguration: []*armsecurity.RecommendationConfigurationProperties{ - // { - // Name: to.Ptr("Service Principal Not Used with ACR"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTAcrauthentication), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Agent sending underutilized messages"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTAgentSendsUnutilizedMessages), - // Status: to.Ptr(armsecurity.RecommendationConfigStatus("TurnedOn")), - // }, - // { - // Name: to.Ptr("Operating system (OS) baseline validation failure"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTBaseline), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Edge Hub memory can be optimized"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTEdgeHubMemOptimize), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("No Logging Configured for Edge Module"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTEdgeLoggingOptions), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Module Settings Inconsistent in SecurityGroup"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTInconsistentModuleSettings), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Install the Azure Security of Things Agent"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTInstallAgent), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Default IP Filter Policy should be Deny"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTIpfilterDenyAll), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("IP Filter rule includes large IP range"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTIpfilterPermissiveRule), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Open Ports On Device"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTOpenPorts), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusDisabled), - // }, - // { - // Name: to.Ptr("Permissive firewall policy in one of the chains was found"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPermissiveFirewallPolicy), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Permissive firewall rule in the input chain was found"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPermissiveInputFirewallRules), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Permissive firewall rule in the output chain was found"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPermissiveOutputFirewallRules), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("High level permissions configured in Edge model twin for Edge module"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPrivilegedDockerOptions), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Same Authentication Credentials used by multiple devices"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTSharedCredentials), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusDisabled), - // }, - // { - // Name: to.Ptr("TLS cipher suite upgrade"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTVulnerableTLSCipherSuite), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }}, - // Status: to.Ptr(armsecurity.SecuritySolutionStatusEnabled), - // UnmaskedIPLoggingStatus: to.Ptr(armsecurity.UnmaskedIPLoggingStatusEnabled), - // UserDefinedResources: &armsecurity.UserDefinedResourcesProperties{ - // Query: to.Ptr("where type != \"microsoft.devices/iothubs\" | where name contains \"iot\""), - // QuerySubscriptions: []*string{ - // to.Ptr("075423e9-7d33-4166-8bdf-3920b04e3735")}, - // }, - // Workspace: to.Ptr("/subscriptions/c4930e90-cd72-4aa5-93e9-2d081d129569/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace1"), - // }, - // SystemData: &armsecurity.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.092Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.092Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // 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/stable/2019-08-01/examples/IoTSecuritySolutions/GetIoTSecuritySolutionsList.json -func ExampleIotSecuritySolutionClient_NewListBySubscriptionPager_listIoTSecuritySolutionsBySubscription() { - 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.NewIotSecuritySolutionClient().NewListBySubscriptionPager(&armsecurity.IotSecuritySolutionClientListBySubscriptionOptions{Filter: 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.IoTSecuritySolutionsList = armsecurity.IoTSecuritySolutionsList{ - // Value: []*armsecurity.IoTSecuritySolutionModel{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/IoTSecuritySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/MyGroup/providers/Microsoft.Security/IoTSecuritySolutions/Locations/eastus/default"), - // Tags: map[string]*string{ - // }, - // Location: to.Ptr("East Us"), - // Properties: &armsecurity.IoTSecuritySolutionProperties{ - // AutoDiscoveredResources: []*string{ - // to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735"), - // to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/FirstIotHub")}, - // DisabledDataSources: []*armsecurity.DataSource{ - // }, - // DisplayName: to.Ptr("Solution Default"), - // Export: []*armsecurity.ExportData{ - // }, - // IotHubs: []*string{ - // to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/FirstIotHub")}, - // RecommendationsConfiguration: []*armsecurity.RecommendationConfigurationProperties{ - // { - // Name: to.Ptr("Service Principal Not Used with ACR"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTAcrauthentication), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Agent sending underutilized messages"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTAgentSendsUnutilizedMessages), - // Status: to.Ptr(armsecurity.RecommendationConfigStatus("TurnedOn")), - // }, - // { - // Name: to.Ptr("Operating system (OS) baseline validation failure"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTBaseline), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Edge Hub memory can be optimized"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTEdgeHubMemOptimize), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("No Logging Configured for Edge Module"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTEdgeLoggingOptions), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Module Settings Inconsistent in SecurityGroup"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTInconsistentModuleSettings), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Install the Azure Security of Things Agent"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTInstallAgent), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Default IP Filter Policy should be Deny"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTIpfilterDenyAll), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("IP Filter rule includes large IP range"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTIpfilterPermissiveRule), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Open Ports On Device"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTOpenPorts), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusDisabled), - // }, - // { - // Name: to.Ptr("Permissive firewall policy in one of the chains was found"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPermissiveFirewallPolicy), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Permissive firewall rule in the input chain was found"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPermissiveInputFirewallRules), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Permissive firewall rule in the output chain was found"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPermissiveOutputFirewallRules), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("High level permissions configured in Edge model twin for Edge module"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPrivilegedDockerOptions), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Same Authentication Credentials used by multiple devices"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTSharedCredentials), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusDisabled), - // }, - // { - // Name: to.Ptr("TLS cipher suite upgrade"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTVulnerableTLSCipherSuite), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }}, - // Status: to.Ptr(armsecurity.SecuritySolutionStatusEnabled), - // UnmaskedIPLoggingStatus: to.Ptr(armsecurity.UnmaskedIPLoggingStatusEnabled), - // UserDefinedResources: &armsecurity.UserDefinedResourcesProperties{ - // Query: to.Ptr("where type != \"microsoft.devices/iothubs\" | where name contains \"iot\""), - // QuerySubscriptions: []*string{ - // to.Ptr("075423e9-7d33-4166-8bdf-3920b04e3735")}, - // }, - // Workspace: to.Ptr("/subscriptions/c4930e90-cd72-4aa5-93e9-2d081d129569/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace1"), - // }, - // SystemData: &armsecurity.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.092Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.092Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("sec-solution"), - // Type: to.Ptr("Microsoft.Security/IoTSecuritySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SecondGroup/providers/Microsoft.Security/IoTSecuritySolutions/Locations/eastus/sec-solution"), - // Tags: map[string]*string{ - // }, - // Location: to.Ptr("East Us"), - // Properties: &armsecurity.IoTSecuritySolutionProperties{ - // AutoDiscoveredResources: []*string{ - // to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735"), - // to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/IotHubSecond")}, - // DisabledDataSources: []*armsecurity.DataSource{ - // }, - // DisplayName: to.Ptr("Second Solution"), - // Export: []*armsecurity.ExportData{ - // to.Ptr(armsecurity.ExportDataRawEvents)}, - // IotHubs: []*string{ - // to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/IotHubSecond")}, - // RecommendationsConfiguration: []*armsecurity.RecommendationConfigurationProperties{ - // { - // Name: to.Ptr("Service Principal Not Used with ACR"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTAcrauthentication), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Agent sending underutilized messages"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTAgentSendsUnutilizedMessages), - // Status: to.Ptr(armsecurity.RecommendationConfigStatus("TurnedOn")), - // }, - // { - // Name: to.Ptr("Operating system (OS) baseline validation failure"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTBaseline), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Edge Hub memory can be optimized"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTEdgeHubMemOptimize), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("No Logging Configured for Edge Module"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTEdgeLoggingOptions), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Module Settings Inconsistent in SecurityGroup"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTInconsistentModuleSettings), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Install the Azure Security of Things Agent"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTInstallAgent), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Default IP Filter Policy should be Deny"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTIpfilterDenyAll), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("IP Filter rule includes large IP range"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTIpfilterPermissiveRule), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Open Ports On Device"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTOpenPorts), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusDisabled), - // }, - // { - // Name: to.Ptr("Permissive firewall policy in one of the chains was found"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPermissiveFirewallPolicy), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Permissive firewall rule in the input chain was found"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPermissiveInputFirewallRules), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Permissive firewall rule in the output chain was found"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPermissiveOutputFirewallRules), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("High level permissions configured in Edge model twin for Edge module"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPrivilegedDockerOptions), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Same Authentication Credentials used by multiple devices"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTSharedCredentials), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusDisabled), - // }, - // { - // Name: to.Ptr("TLS cipher suite upgrade"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTVulnerableTLSCipherSuite), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }}, - // Status: to.Ptr(armsecurity.SecuritySolutionStatusEnabled), - // UnmaskedIPLoggingStatus: to.Ptr(armsecurity.UnmaskedIPLoggingStatusEnabled), - // UserDefinedResources: &armsecurity.UserDefinedResourcesProperties{ - // Query: to.Ptr("where type != \"microsoft.devices/iothubs\" | where name contains \"iot\""), - // QuerySubscriptions: []*string{ - // to.Ptr("075423e9-7d33-4166-8bdf-3920b04e3735")}, - // }, - // Workspace: to.Ptr("/subscriptions/c4930e90-cd72-4aa5-93e9-2d081d129569/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace1"), - // }, - // SystemData: &armsecurity.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.092Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.092Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // 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/stable/2019-08-01/examples/IoTSecuritySolutions/GetIoTSecuritySolutionsListByRg.json -func ExampleIotSecuritySolutionClient_NewListByResourceGroupPager_listIoTSecuritySolutionsByResourceGroup() { - 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.NewIotSecuritySolutionClient().NewListByResourceGroupPager("MyGroup", &armsecurity.IotSecuritySolutionClientListByResourceGroupOptions{Filter: 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.IoTSecuritySolutionsList = armsecurity.IoTSecuritySolutionsList{ - // Value: []*armsecurity.IoTSecuritySolutionModel{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/IoTSecuritySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/MyGroup/providers/Microsoft.Security/IoTSecuritySolutions/Locations/eastus/default"), - // Tags: map[string]*string{ - // }, - // Location: to.Ptr("East Us"), - // Properties: &armsecurity.IoTSecuritySolutionProperties{ - // AutoDiscoveredResources: []*string{ - // to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735"), - // to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/FirstIotHub")}, - // DisabledDataSources: []*armsecurity.DataSource{ - // }, - // DisplayName: to.Ptr("Solution Default"), - // Export: []*armsecurity.ExportData{ - // }, - // IotHubs: []*string{ - // to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/FirstIotHub")}, - // RecommendationsConfiguration: []*armsecurity.RecommendationConfigurationProperties{ - // { - // Name: to.Ptr("Service Principal Not Used with ACR"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTAcrauthentication), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Agent sending underutilized messages"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTAgentSendsUnutilizedMessages), - // Status: to.Ptr(armsecurity.RecommendationConfigStatus("TurnedOn")), - // }, - // { - // Name: to.Ptr("Operating system (OS) baseline validation failure"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTBaseline), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Edge Hub memory can be optimized"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTEdgeHubMemOptimize), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("No Logging Configured for Edge Module"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTEdgeLoggingOptions), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Module Settings Inconsistent in SecurityGroup"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTInconsistentModuleSettings), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Install the Azure Security of Things Agent"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTInstallAgent), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Default IP Filter Policy should be Deny"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTIpfilterDenyAll), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("IP Filter rule includes large IP range"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTIpfilterPermissiveRule), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Open Ports On Device"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTOpenPorts), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusDisabled), - // }, - // { - // Name: to.Ptr("Permissive firewall policy in one of the chains was found"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPermissiveFirewallPolicy), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Permissive firewall rule in the input chain was found"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPermissiveInputFirewallRules), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Permissive firewall rule in the output chain was found"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPermissiveOutputFirewallRules), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("High level permissions configured in Edge model twin for Edge module"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPrivilegedDockerOptions), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Same Authentication Credentials used by multiple devices"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTSharedCredentials), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusDisabled), - // }, - // { - // Name: to.Ptr("TLS cipher suite upgrade"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTVulnerableTLSCipherSuite), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }}, - // Status: to.Ptr(armsecurity.SecuritySolutionStatusEnabled), - // UnmaskedIPLoggingStatus: to.Ptr(armsecurity.UnmaskedIPLoggingStatusEnabled), - // UserDefinedResources: &armsecurity.UserDefinedResourcesProperties{ - // Query: to.Ptr("where type != \"microsoft.devices/iothubs\" | where name contains \"iot\""), - // QuerySubscriptions: []*string{ - // to.Ptr("075423e9-7d33-4166-8bdf-3920b04e3735")}, - // }, - // Workspace: to.Ptr("/subscriptions/c4930e90-cd72-4aa5-93e9-2d081d129569/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace1"), - // }, - // SystemData: &armsecurity.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.092Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.092Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // 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/stable/2019-08-01/examples/IoTSecuritySolutions/GetIoTSecuritySolutionsListByIotHubAndRg.json -func ExampleIotSecuritySolutionClient_NewListByResourceGroupPager_listIoTSecuritySolutionsByResourceGroupAndIoTHub() { - 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.NewIotSecuritySolutionClient().NewListByResourceGroupPager("MyRg", &armsecurity.IotSecuritySolutionClientListByResourceGroupOptions{Filter: to.Ptr("properties.iotHubs/any(i eq \"/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/FirstIotHub\")")}) - 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.IoTSecuritySolutionsList = armsecurity.IoTSecuritySolutionsList{ - // Value: []*armsecurity.IoTSecuritySolutionModel{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/IoTSecuritySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/MyRg/providers/Microsoft.Security/IoTSecuritySolutions/Locations/eastus/default"), - // Tags: map[string]*string{ - // }, - // Location: to.Ptr("East Us"), - // Properties: &armsecurity.IoTSecuritySolutionProperties{ - // AutoDiscoveredResources: []*string{ - // to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735"), - // to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/FirstIotHub")}, - // DisabledDataSources: []*armsecurity.DataSource{ - // }, - // DisplayName: to.Ptr("Solution Default"), - // Export: []*armsecurity.ExportData{ - // to.Ptr(armsecurity.ExportDataRawEvents)}, - // IotHubs: []*string{ - // to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/FirstIotHub")}, - // RecommendationsConfiguration: []*armsecurity.RecommendationConfigurationProperties{ - // { - // Name: to.Ptr("Service Principal Not Used with ACR"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTAcrauthentication), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Agent sending underutilized messages"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTAgentSendsUnutilizedMessages), - // Status: to.Ptr(armsecurity.RecommendationConfigStatus("TurnedOn")), - // }, - // { - // Name: to.Ptr("Operating system (OS) baseline validation failure"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTBaseline), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Edge Hub memory can be optimized"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTEdgeHubMemOptimize), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("No Logging Configured for Edge Module"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTEdgeLoggingOptions), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Module Settings Inconsistent in SecurityGroup"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTInconsistentModuleSettings), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Install the Azure Security of Things Agent"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTInstallAgent), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Default IP Filter Policy should be Deny"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTIpfilterDenyAll), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("IP Filter rule includes large IP range"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTIpfilterPermissiveRule), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Open Ports On Device"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTOpenPorts), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusDisabled), - // }, - // { - // Name: to.Ptr("Permissive firewall policy in one of the chains was found"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPermissiveFirewallPolicy), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Permissive firewall rule in the input chain was found"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPermissiveInputFirewallRules), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Permissive firewall rule in the output chain was found"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPermissiveOutputFirewallRules), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("High level permissions configured in Edge model twin for Edge module"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPrivilegedDockerOptions), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Same Authentication Credentials used by multiple devices"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTSharedCredentials), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusDisabled), - // }, - // { - // Name: to.Ptr("TLS cipher suite upgrade"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTVulnerableTLSCipherSuite), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }}, - // Status: to.Ptr(armsecurity.SecuritySolutionStatusEnabled), - // UnmaskedIPLoggingStatus: to.Ptr(armsecurity.UnmaskedIPLoggingStatusEnabled), - // UserDefinedResources: &armsecurity.UserDefinedResourcesProperties{ - // Query: to.Ptr("where type != \"microsoft.devices/iothubs\" | where name contains \"iot\""), - // QuerySubscriptions: []*string{ - // to.Ptr("075423e9-7d33-4166-8bdf-3920b04e3735")}, - // }, - // Workspace: to.Ptr("/subscriptions/c4930e90-cd72-4aa5-93e9-2d081d129569/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace1"), - // }, - // SystemData: &armsecurity.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.092Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.092Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // 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/stable/2019-08-01/examples/IoTSecuritySolutions/GetIoTSecuritySolution.json -func ExampleIotSecuritySolutionClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIotSecuritySolutionClient().Get(ctx, "MyGroup", "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.IoTSecuritySolutionModel = armsecurity.IoTSecuritySolutionModel{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/IoTSecuritySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/MyGroup/providers/Microsoft.Security/IoTSecuritySolutions/Locations/eastus/default"), - // Tags: map[string]*string{ - // }, - // Location: to.Ptr("East Us"), - // Properties: &armsecurity.IoTSecuritySolutionProperties{ - // AutoDiscoveredResources: []*string{ - // to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735"), - // to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/FirstIotHub")}, - // DisabledDataSources: []*armsecurity.DataSource{ - // }, - // DisplayName: to.Ptr("Solution Default"), - // Export: []*armsecurity.ExportData{ - // }, - // IotHubs: []*string{ - // to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/FirstIotHub")}, - // RecommendationsConfiguration: []*armsecurity.RecommendationConfigurationProperties{ - // { - // Name: to.Ptr("Service Principal Not Used with ACR"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTAcrauthentication), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Agent sending underutilized messages"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTAgentSendsUnutilizedMessages), - // Status: to.Ptr(armsecurity.RecommendationConfigStatus("TurnedOn")), - // }, - // { - // Name: to.Ptr("Operating system (OS) baseline validation failure"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTBaseline), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Edge Hub memory can be optimized"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTEdgeHubMemOptimize), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("No Logging Configured for Edge Module"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTEdgeLoggingOptions), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Module Settings Inconsistent in SecurityGroup"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTInconsistentModuleSettings), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Install the Azure Security of Things Agent"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTInstallAgent), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Default IP Filter Policy should be Deny"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTIpfilterDenyAll), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("IP Filter rule includes large IP range"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTIpfilterPermissiveRule), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Open Ports On Device"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTOpenPorts), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusDisabled), - // }, - // { - // Name: to.Ptr("Permissive firewall policy in one of the chains was found"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPermissiveFirewallPolicy), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Permissive firewall rule in the input chain was found"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPermissiveInputFirewallRules), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Permissive firewall rule in the output chain was found"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPermissiveOutputFirewallRules), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("High level permissions configured in Edge model twin for Edge module"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPrivilegedDockerOptions), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Same Authentication Credentials used by multiple devices"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTSharedCredentials), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusDisabled), - // }, - // { - // Name: to.Ptr("TLS cipher suite upgrade"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTVulnerableTLSCipherSuite), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }}, - // Status: to.Ptr(armsecurity.SecuritySolutionStatusEnabled), - // UnmaskedIPLoggingStatus: to.Ptr(armsecurity.UnmaskedIPLoggingStatusEnabled), - // UserDefinedResources: &armsecurity.UserDefinedResourcesProperties{ - // Query: to.Ptr("where type != \"microsoft.devices/iothubs\" | where name contains \"iot\""), - // QuerySubscriptions: []*string{ - // to.Ptr("075423e9-7d33-4166-8bdf-3920b04e3735")}, - // }, - // Workspace: to.Ptr("/subscriptions/c4930e90-cd72-4aa5-93e9-2d081d129569/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace1"), - // }, - // SystemData: &armsecurity.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.092Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.092Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // 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/stable/2019-08-01/examples/IoTSecuritySolutions/CreateIoTSecuritySolution.json -func ExampleIotSecuritySolutionClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIotSecuritySolutionClient().CreateOrUpdate(ctx, "MyGroup", "default", armsecurity.IoTSecuritySolutionModel{ - Tags: map[string]*string{}, - Location: to.Ptr("East Us"), - Properties: &armsecurity.IoTSecuritySolutionProperties{ - DisabledDataSources: []*armsecurity.DataSource{}, - DisplayName: to.Ptr("Solution Default"), - Export: []*armsecurity.ExportData{}, - IotHubs: []*string{ - to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/FirstIotHub")}, - RecommendationsConfiguration: []*armsecurity.RecommendationConfigurationProperties{ - { - RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTOpenPorts), - Status: to.Ptr(armsecurity.RecommendationConfigStatusDisabled), - }, - { - RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTSharedCredentials), - Status: to.Ptr(armsecurity.RecommendationConfigStatusDisabled), - }}, - Status: to.Ptr(armsecurity.SecuritySolutionStatusEnabled), - UnmaskedIPLoggingStatus: to.Ptr(armsecurity.UnmaskedIPLoggingStatusEnabled), - UserDefinedResources: &armsecurity.UserDefinedResourcesProperties{ - Query: to.Ptr("where type != \"microsoft.devices/iothubs\" | where name contains \"iot\""), - QuerySubscriptions: []*string{ - to.Ptr("075423e9-7d33-4166-8bdf-3920b04e3735")}, - }, - Workspace: to.Ptr("/subscriptions/c4930e90-cd72-4aa5-93e9-2d081d129569/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.IoTSecuritySolutionModel = armsecurity.IoTSecuritySolutionModel{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/IoTSecuritySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/MyGroup/providers/Microsoft.Security/Locations/eastus/IoTSecuritySolutions/default"), - // Tags: map[string]*string{ - // }, - // Location: to.Ptr("East Us"), - // Properties: &armsecurity.IoTSecuritySolutionProperties{ - // AutoDiscoveredResources: []*string{ - // to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735"), - // to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/FirstIotHub")}, - // DisabledDataSources: []*armsecurity.DataSource{ - // }, - // DisplayName: to.Ptr("Solution Default"), - // Export: []*armsecurity.ExportData{ - // }, - // IotHubs: []*string{ - // to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/FirstIotHub")}, - // RecommendationsConfiguration: []*armsecurity.RecommendationConfigurationProperties{ - // { - // Name: to.Ptr("Service Principal Not Used with ACR"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTAcrauthentication), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Agent sending underutilized messages"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTAgentSendsUnutilizedMessages), - // Status: to.Ptr(armsecurity.RecommendationConfigStatus("TurnedOn")), - // }, - // { - // Name: to.Ptr("Operating system (OS) baseline validation failure"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTBaseline), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Edge Hub memory can be optimized"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTEdgeHubMemOptimize), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("No Logging Configured for Edge Module"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTEdgeLoggingOptions), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Module Settings Inconsistent in SecurityGroup"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTInconsistentModuleSettings), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Install the Azure Security of Things Agent"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTInstallAgent), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Default IP Filter Policy should be Deny"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTIpfilterDenyAll), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("IP Filter rule includes large IP range"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTIpfilterPermissiveRule), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Open Ports On Device"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTOpenPorts), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusDisabled), - // }, - // { - // Name: to.Ptr("Permissive firewall policy in one of the chains was found"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPermissiveFirewallPolicy), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Permissive firewall rule in the input chain was found"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPermissiveInputFirewallRules), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Permissive firewall rule in the output chain was found"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPermissiveOutputFirewallRules), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("High level permissions configured in Edge model twin for Edge module"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPrivilegedDockerOptions), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Same Authentication Credentials used by multiple devices"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTSharedCredentials), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusDisabled), - // }, - // { - // Name: to.Ptr("TLS cipher suite upgrade"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTVulnerableTLSCipherSuite), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }}, - // Status: to.Ptr(armsecurity.SecuritySolutionStatusEnabled), - // UnmaskedIPLoggingStatus: to.Ptr(armsecurity.UnmaskedIPLoggingStatusEnabled), - // UserDefinedResources: &armsecurity.UserDefinedResourcesProperties{ - // Query: to.Ptr("where type != \"microsoft.devices/iothubs\" | where name contains \"iot\""), - // QuerySubscriptions: []*string{ - // to.Ptr("075423e9-7d33-4166-8bdf-3920b04e3735")}, - // }, - // Workspace: to.Ptr("/subscriptions/c4930e90-cd72-4aa5-93e9-2d081d129569/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace1"), - // }, - // SystemData: &armsecurity.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.092Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.092Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // 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/stable/2019-08-01/examples/IoTSecuritySolutions/UpdateIoTSecuritySolution.json -func ExampleIotSecuritySolutionClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIotSecuritySolutionClient().Update(ctx, "myRg", "default", armsecurity.UpdateIotSecuritySolutionData{ - Tags: map[string]*string{ - "foo": to.Ptr("bar"), - }, - Properties: &armsecurity.UpdateIoTSecuritySolutionProperties{ - RecommendationsConfiguration: []*armsecurity.RecommendationConfigurationProperties{ - { - RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTOpenPorts), - Status: to.Ptr(armsecurity.RecommendationConfigStatusDisabled), - }, - { - RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTSharedCredentials), - Status: to.Ptr(armsecurity.RecommendationConfigStatusDisabled), - }}, - UserDefinedResources: &armsecurity.UserDefinedResourcesProperties{ - Query: to.Ptr("where type != \"microsoft.devices/iothubs\" | where name contains \"v2\""), - QuerySubscriptions: []*string{ - to.Ptr("075423e9-7d33-4166-8bdf-3920b04e3735")}, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.IoTSecuritySolutionModel = armsecurity.IoTSecuritySolutionModel{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/IoTSecuritySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/MyGroup/providers/Microsoft.Security/Locations/eastus/IoTSecuritySolutions/default"), - // Tags: map[string]*string{ - // "foo": to.Ptr("bar"), - // }, - // Location: to.Ptr("East Us"), - // Properties: &armsecurity.IoTSecuritySolutionProperties{ - // AutoDiscoveredResources: []*string{ - // to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735"), - // to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/FirstIotHub")}, - // DisabledDataSources: []*armsecurity.DataSource{ - // }, - // DisplayName: to.Ptr("Solution Default"), - // Export: []*armsecurity.ExportData{ - // to.Ptr(armsecurity.ExportDataRawEvents)}, - // IotHubs: []*string{ - // to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/FirstIotHub")}, - // RecommendationsConfiguration: []*armsecurity.RecommendationConfigurationProperties{ - // { - // Name: to.Ptr("Service Principal Not Used with ACR"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTAcrauthentication), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Agent sending underutilized messages"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTAgentSendsUnutilizedMessages), - // Status: to.Ptr(armsecurity.RecommendationConfigStatus("TurnedOn")), - // }, - // { - // Name: to.Ptr("Operating system (OS) baseline validation failure"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTBaseline), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Edge Hub memory can be optimized"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTEdgeHubMemOptimize), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("No Logging Configured for Edge Module"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTEdgeLoggingOptions), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Module Settings Inconsistent in SecurityGroup"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTInconsistentModuleSettings), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Install the Azure Security of Things Agent"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTInstallAgent), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Default IP Filter Policy should be Deny"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTIpfilterDenyAll), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("IP Filter rule includes large IP range"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTIpfilterPermissiveRule), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Open Ports On Device"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTOpenPorts), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusDisabled), - // }, - // { - // Name: to.Ptr("Permissive firewall policy in one of the chains was found"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPermissiveFirewallPolicy), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Permissive firewall rule in the input chain was found"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPermissiveInputFirewallRules), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Permissive firewall rule in the output chain was found"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPermissiveOutputFirewallRules), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("High level permissions configured in Edge model twin for Edge module"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTPrivilegedDockerOptions), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }, - // { - // Name: to.Ptr("Same Authentication Credentials used by multiple devices"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTSharedCredentials), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusDisabled), - // }, - // { - // Name: to.Ptr("TLS cipher suite upgrade"), - // RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTVulnerableTLSCipherSuite), - // Status: to.Ptr(armsecurity.RecommendationConfigStatusEnabled), - // }}, - // Status: to.Ptr(armsecurity.SecuritySolutionStatusEnabled), - // UnmaskedIPLoggingStatus: to.Ptr(armsecurity.UnmaskedIPLoggingStatusEnabled), - // UserDefinedResources: &armsecurity.UserDefinedResourcesProperties{ - // Query: to.Ptr("where type != \"microsoft.devices/iothubs\" | where name contains \"v2\""), - // QuerySubscriptions: []*string{ - // to.Ptr("075423e9-7d33-4166-8bdf-3920b04e3735")}, - // }, - // Workspace: to.Ptr("/subscriptions/c4930e90-cd72-4aa5-93e9-2d081d129569/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace1"), - // }, - // SystemData: &armsecurity.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.092Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.092Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // 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/stable/2019-08-01/examples/IoTSecuritySolutions/DeleteIoTSecuritySolution.json -func ExampleIotSecuritySolutionClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewIotSecuritySolutionClient().Delete(ctx, "MyGroup", "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionanalytics_client.go b/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionanalytics_client.go deleted file mode 100644 index ef0ddaa3c931..000000000000 --- a/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionanalytics_client.go +++ /dev/null @@ -1,174 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// IotSecuritySolutionAnalyticsClient contains the methods for the IotSecuritySolutionAnalytics group. -// Don't use this type directly, use NewIotSecuritySolutionAnalyticsClient() instead. -type IotSecuritySolutionAnalyticsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewIotSecuritySolutionAnalyticsClient creates a new instance of IotSecuritySolutionAnalyticsClient 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 NewIotSecuritySolutionAnalyticsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*IotSecuritySolutionAnalyticsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &IotSecuritySolutionAnalyticsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Use this method to get IoT Security Analytics metrics. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-08-01 -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - solutionName - The name of the IoT Security solution. -// - options - IotSecuritySolutionAnalyticsClientGetOptions contains the optional parameters for the IotSecuritySolutionAnalyticsClient.Get -// method. -func (client *IotSecuritySolutionAnalyticsClient) Get(ctx context.Context, resourceGroupName string, solutionName string, options *IotSecuritySolutionAnalyticsClientGetOptions) (IotSecuritySolutionAnalyticsClientGetResponse, error) { - var err error - const operationName = "IotSecuritySolutionAnalyticsClient.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, solutionName, options) - if err != nil { - return IotSecuritySolutionAnalyticsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return IotSecuritySolutionAnalyticsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return IotSecuritySolutionAnalyticsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *IotSecuritySolutionAnalyticsClient) getCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, options *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") - } - 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 solutionName == "" { - return nil, errors.New("parameter solutionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{solutionName}", url.PathEscape(solutionName)) - 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", "2019-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 *IotSecuritySolutionAnalyticsClient) getHandleResponse(resp *http.Response) (IotSecuritySolutionAnalyticsClientGetResponse, error) { - result := IotSecuritySolutionAnalyticsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.IoTSecuritySolutionAnalyticsModel); err != nil { - return IotSecuritySolutionAnalyticsClientGetResponse{}, err - } - return result, nil -} - -// List - Use this method to get IoT security Analytics metrics in an array. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-08-01 -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - solutionName - The name of the IoT Security solution. -// - options - IotSecuritySolutionAnalyticsClientListOptions contains the optional parameters for the IotSecuritySolutionAnalyticsClient.List -// method. -func (client *IotSecuritySolutionAnalyticsClient) List(ctx context.Context, resourceGroupName string, solutionName string, options *IotSecuritySolutionAnalyticsClientListOptions) (IotSecuritySolutionAnalyticsClientListResponse, error) { - var err error - const operationName = "IotSecuritySolutionAnalyticsClient.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, resourceGroupName, solutionName, options) - if err != nil { - return IotSecuritySolutionAnalyticsClientListResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return IotSecuritySolutionAnalyticsClientListResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return IotSecuritySolutionAnalyticsClientListResponse{}, err - } - resp, err := client.listHandleResponse(httpResp) - return resp, err -} - -// listCreateRequest creates the List request. -func (client *IotSecuritySolutionAnalyticsClient) listCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, options *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") - } - 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 solutionName == "" { - return nil, errors.New("parameter solutionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{solutionName}", url.PathEscape(solutionName)) - 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", "2019-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 *IotSecuritySolutionAnalyticsClient) listHandleResponse(resp *http.Response) (IotSecuritySolutionAnalyticsClientListResponse, error) { - result := IotSecuritySolutionAnalyticsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.IoTSecuritySolutionAnalyticsModelList); err != nil { - return IotSecuritySolutionAnalyticsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionanalytics_client_example_test.go b/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionanalytics_client_example_test.go deleted file mode 100644 index 4c9682a27add..000000000000 --- a/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionanalytics_client_example_test.go +++ /dev/null @@ -1,211 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityAnalyticsList.json -func ExampleIotSecuritySolutionAnalyticsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIotSecuritySolutionAnalyticsClient().List(ctx, "MyGroup", "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.IoTSecuritySolutionAnalyticsModelList = armsecurity.IoTSecuritySolutionAnalyticsModelList{ - // Value: []*armsecurity.IoTSecuritySolutionAnalyticsModel{ - // { - // Name: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/MyGroup/providers/Microsoft.Security/IoTSecuritySolutions/Locations/eastus/default"), - // Type: to.Ptr("Microsoft.Security/iotSecuritySolutions/analyticsModels"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/MyGroup/providers/Microsoft.Security/IoTSecuritySolutions/Locations/eastus/default"), - // Properties: &armsecurity.IoTSecuritySolutionAnalyticsModelProperties{ - // DevicesMetrics: []*armsecurity.IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem{ - // { - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-02-01T00:00:00.000Z"); return t}()), - // DevicesMetrics: &armsecurity.IoTSeverityMetrics{ - // High: to.Ptr[int64](3), - // Low: to.Ptr[int64](70), - // Medium: to.Ptr[int64](15), - // }, - // }, - // { - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-02-02T00:00:00.000Z"); return t}()), - // DevicesMetrics: &armsecurity.IoTSeverityMetrics{ - // High: to.Ptr[int64](3), - // Low: to.Ptr[int64](65), - // Medium: to.Ptr[int64](45), - // }, - // }}, - // Metrics: &armsecurity.IoTSeverityMetrics{ - // High: to.Ptr[int64](5), - // Low: to.Ptr[int64](102), - // Medium: to.Ptr[int64](200), - // }, - // MostPrevalentDeviceAlerts: []*armsecurity.IoTSecurityDeviceAlert{ - // { - // AlertDisplayName: to.Ptr("Custom Alert - number of device to cloud messages in AMQP protocol is not in the allowed range"), - // AlertsCount: to.Ptr[int64](200), - // ReportedSeverity: to.Ptr(armsecurity.ReportedSeverityLow), - // }, - // { - // AlertDisplayName: to.Ptr("Custom Alert - execution of a process that is not allowed"), - // AlertsCount: to.Ptr[int64](170), - // ReportedSeverity: to.Ptr(armsecurity.ReportedSeverityMedium), - // }, - // { - // AlertDisplayName: to.Ptr("Successful Bruteforce"), - // AlertsCount: to.Ptr[int64](150), - // ReportedSeverity: to.Ptr(armsecurity.ReportedSeverityLow), - // }}, - // MostPrevalentDeviceRecommendations: []*armsecurity.IoTSecurityDeviceRecommendation{ - // { - // DevicesCount: to.Ptr[int64](200), - // RecommendationDisplayName: to.Ptr("Install the Azure Security of Things Agent"), - // ReportedSeverity: to.Ptr(armsecurity.ReportedSeverityLow), - // }, - // { - // DevicesCount: to.Ptr[int64](170), - // RecommendationDisplayName: to.Ptr("High level permissions configured in Edge model twin for Edge module"), - // ReportedSeverity: to.Ptr(armsecurity.ReportedSeverityLow), - // }, - // { - // DevicesCount: to.Ptr[int64](150), - // RecommendationDisplayName: to.Ptr("Same Authentication Credentials used by multiple devices"), - // ReportedSeverity: to.Ptr(armsecurity.ReportedSeverityMedium), - // }}, - // TopAlertedDevices: []*armsecurity.IoTSecurityAlertedDevice{ - // { - // AlertsCount: to.Ptr[int64](200), - // DeviceID: to.Ptr("id1"), - // }, - // { - // AlertsCount: to.Ptr[int64](170), - // DeviceID: to.Ptr("id2"), - // }, - // { - // AlertsCount: to.Ptr[int64](150), - // DeviceID: to.Ptr("id3"), - // }}, - // UnhealthyDeviceCount: to.Ptr[int64](1200), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityAnalytics.json -func ExampleIotSecuritySolutionAnalyticsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIotSecuritySolutionAnalyticsClient().Get(ctx, "MyGroup", "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.IoTSecuritySolutionAnalyticsModel = armsecurity.IoTSecuritySolutionAnalyticsModel{ - // Name: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/MyGroup/providers/Microsoft.Security/IoTSecuritySolutions/Locations/eastus/default"), - // Type: to.Ptr("Microsoft.Security/iotSecuritySolutions/analyticsModels"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/MyGroup/providers/Microsoft.Security/IoTSecuritySolutions/Locations/eastus/default"), - // Properties: &armsecurity.IoTSecuritySolutionAnalyticsModelProperties{ - // DevicesMetrics: []*armsecurity.IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem{ - // { - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-02-01T00:00:00.000Z"); return t}()), - // DevicesMetrics: &armsecurity.IoTSeverityMetrics{ - // High: to.Ptr[int64](3), - // Low: to.Ptr[int64](70), - // Medium: to.Ptr[int64](15), - // }, - // }, - // { - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-02-02T00:00:00.000Z"); return t}()), - // DevicesMetrics: &armsecurity.IoTSeverityMetrics{ - // High: to.Ptr[int64](3), - // Low: to.Ptr[int64](65), - // Medium: to.Ptr[int64](45), - // }, - // }}, - // Metrics: &armsecurity.IoTSeverityMetrics{ - // High: to.Ptr[int64](5), - // Low: to.Ptr[int64](102), - // Medium: to.Ptr[int64](200), - // }, - // MostPrevalentDeviceAlerts: []*armsecurity.IoTSecurityDeviceAlert{ - // { - // AlertDisplayName: to.Ptr("Custom Alert - number of device to cloud messages in AMQP protocol is not in the allowed range"), - // AlertsCount: to.Ptr[int64](200), - // ReportedSeverity: to.Ptr(armsecurity.ReportedSeverityLow), - // }, - // { - // AlertDisplayName: to.Ptr("Custom Alert - execution of a process that is not allowed"), - // AlertsCount: to.Ptr[int64](170), - // ReportedSeverity: to.Ptr(armsecurity.ReportedSeverityMedium), - // }, - // { - // AlertDisplayName: to.Ptr("Successful Bruteforce"), - // AlertsCount: to.Ptr[int64](150), - // ReportedSeverity: to.Ptr(armsecurity.ReportedSeverityLow), - // }}, - // MostPrevalentDeviceRecommendations: []*armsecurity.IoTSecurityDeviceRecommendation{ - // { - // DevicesCount: to.Ptr[int64](200), - // RecommendationDisplayName: to.Ptr("Install the Azure Security of Things Agent"), - // ReportedSeverity: to.Ptr(armsecurity.ReportedSeverityLow), - // }, - // { - // DevicesCount: to.Ptr[int64](170), - // RecommendationDisplayName: to.Ptr("High level permissions configured in Edge model twin for Edge module"), - // ReportedSeverity: to.Ptr(armsecurity.ReportedSeverityLow), - // }, - // { - // DevicesCount: to.Ptr[int64](150), - // RecommendationDisplayName: to.Ptr("Same Authentication Credentials used by multiple devices"), - // ReportedSeverity: to.Ptr(armsecurity.ReportedSeverityMedium), - // }}, - // TopAlertedDevices: []*armsecurity.IoTSecurityAlertedDevice{ - // { - // AlertsCount: to.Ptr[int64](200), - // DeviceID: to.Ptr("id1"), - // }, - // { - // AlertsCount: to.Ptr[int64](170), - // DeviceID: to.Ptr("id2"), - // }, - // { - // AlertsCount: to.Ptr[int64](150), - // DeviceID: to.Ptr("id3"), - // }}, - // UnhealthyDeviceCount: to.Ptr[int64](1200), - // }, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionsanalyticsaggregatedalert_client.go b/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionsanalyticsaggregatedalert_client.go deleted file mode 100644 index 0d6a74abd132..000000000000 --- a/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionsanalyticsaggregatedalert_client.go +++ /dev/null @@ -1,244 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// IotSecuritySolutionsAnalyticsAggregatedAlertClient contains the methods for the IotSecuritySolutionsAnalyticsAggregatedAlert group. -// Don't use this type directly, use NewIotSecuritySolutionsAnalyticsAggregatedAlertClient() instead. -type IotSecuritySolutionsAnalyticsAggregatedAlertClient struct { - internal *arm.Client - subscriptionID string -} - -// NewIotSecuritySolutionsAnalyticsAggregatedAlertClient creates a new instance of IotSecuritySolutionsAnalyticsAggregatedAlertClient 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 NewIotSecuritySolutionsAnalyticsAggregatedAlertClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*IotSecuritySolutionsAnalyticsAggregatedAlertClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &IotSecuritySolutionsAnalyticsAggregatedAlertClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Dismiss - Use this method to dismiss an aggregated IoT Security Solution Alert. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-08-01 -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - solutionName - The name of the IoT Security solution. -// - aggregatedAlertName - Identifier of the aggregated alert. -// - options - IotSecuritySolutionsAnalyticsAggregatedAlertClientDismissOptions contains the optional parameters for the IotSecuritySolutionsAnalyticsAggregatedAlertClient.Dismiss -// method. -func (client *IotSecuritySolutionsAnalyticsAggregatedAlertClient) Dismiss(ctx context.Context, resourceGroupName string, solutionName string, aggregatedAlertName string, options *IotSecuritySolutionsAnalyticsAggregatedAlertClientDismissOptions) (IotSecuritySolutionsAnalyticsAggregatedAlertClientDismissResponse, error) { - var err error - const operationName = "IotSecuritySolutionsAnalyticsAggregatedAlertClient.Dismiss" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.dismissCreateRequest(ctx, resourceGroupName, solutionName, aggregatedAlertName, options) - if err != nil { - return IotSecuritySolutionsAnalyticsAggregatedAlertClientDismissResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return IotSecuritySolutionsAnalyticsAggregatedAlertClientDismissResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return IotSecuritySolutionsAnalyticsAggregatedAlertClientDismissResponse{}, err - } - return IotSecuritySolutionsAnalyticsAggregatedAlertClientDismissResponse{}, nil -} - -// dismissCreateRequest creates the Dismiss request. -func (client *IotSecuritySolutionsAnalyticsAggregatedAlertClient) dismissCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, aggregatedAlertName string, options *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") - } - 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 solutionName == "" { - return nil, errors.New("parameter solutionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{solutionName}", url.PathEscape(solutionName)) - if aggregatedAlertName == "" { - return nil, errors.New("parameter aggregatedAlertName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{aggregatedAlertName}", url.PathEscape(aggregatedAlertName)) - 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", "2019-08-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Use this method to get a single the aggregated alert of yours IoT Security solution. This aggregation is performed -// by alert name. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-08-01 -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - solutionName - The name of the IoT Security solution. -// - aggregatedAlertName - Identifier of the aggregated alert. -// - options - IotSecuritySolutionsAnalyticsAggregatedAlertClientGetOptions contains the optional parameters for the IotSecuritySolutionsAnalyticsAggregatedAlertClient.Get -// method. -func (client *IotSecuritySolutionsAnalyticsAggregatedAlertClient) Get(ctx context.Context, resourceGroupName string, solutionName string, aggregatedAlertName string, options *IotSecuritySolutionsAnalyticsAggregatedAlertClientGetOptions) (IotSecuritySolutionsAnalyticsAggregatedAlertClientGetResponse, error) { - var err error - const operationName = "IotSecuritySolutionsAnalyticsAggregatedAlertClient.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, solutionName, aggregatedAlertName, options) - if err != nil { - return IotSecuritySolutionsAnalyticsAggregatedAlertClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return IotSecuritySolutionsAnalyticsAggregatedAlertClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return IotSecuritySolutionsAnalyticsAggregatedAlertClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *IotSecuritySolutionsAnalyticsAggregatedAlertClient) getCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, aggregatedAlertName string, options *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") - } - 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 solutionName == "" { - return nil, errors.New("parameter solutionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{solutionName}", url.PathEscape(solutionName)) - if aggregatedAlertName == "" { - return nil, errors.New("parameter aggregatedAlertName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{aggregatedAlertName}", url.PathEscape(aggregatedAlertName)) - 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", "2019-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 *IotSecuritySolutionsAnalyticsAggregatedAlertClient) getHandleResponse(resp *http.Response) (IotSecuritySolutionsAnalyticsAggregatedAlertClientGetResponse, error) { - result := IotSecuritySolutionsAnalyticsAggregatedAlertClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.IoTSecurityAggregatedAlert); err != nil { - return IotSecuritySolutionsAnalyticsAggregatedAlertClientGetResponse{}, err - } - return result, nil -} - -// 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. -// - solutionName - The name of the IoT Security solution. -// - options - IotSecuritySolutionsAnalyticsAggregatedAlertClientListOptions contains the optional parameters for the IotSecuritySolutionsAnalyticsAggregatedAlertClient.NewListPager -// method. -func (client *IotSecuritySolutionsAnalyticsAggregatedAlertClient) NewListPager(resourceGroupName string, solutionName string, options *IotSecuritySolutionsAnalyticsAggregatedAlertClientListOptions) *runtime.Pager[IotSecuritySolutionsAnalyticsAggregatedAlertClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[IotSecuritySolutionsAnalyticsAggregatedAlertClientListResponse]{ - More: func(page IotSecuritySolutionsAnalyticsAggregatedAlertClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *IotSecuritySolutionsAnalyticsAggregatedAlertClientListResponse) (IotSecuritySolutionsAnalyticsAggregatedAlertClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "IotSecuritySolutionsAnalyticsAggregatedAlertClient.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, solutionName, options) - }, nil) - if err != nil { - return IotSecuritySolutionsAnalyticsAggregatedAlertClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *IotSecuritySolutionsAnalyticsAggregatedAlertClient) listCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, options *IotSecuritySolutionsAnalyticsAggregatedAlertClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts" - 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 solutionName == "" { - return nil, errors.New("parameter solutionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{solutionName}", url.PathEscape(solutionName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) - } - reqQP.Set("api-version", "2019-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 *IotSecuritySolutionsAnalyticsAggregatedAlertClient) listHandleResponse(resp *http.Response) (IotSecuritySolutionsAnalyticsAggregatedAlertClientListResponse, error) { - result := IotSecuritySolutionsAnalyticsAggregatedAlertClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.IoTSecurityAggregatedAlertList); err != nil { - return IotSecuritySolutionsAnalyticsAggregatedAlertClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionsanalyticsaggregatedalert_client_example_test.go b/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionsanalyticsaggregatedalert_client_example_test.go deleted file mode 100644 index 19fc112d0a8b..000000000000 --- a/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionsanalyticsaggregatedalert_client_example_test.go +++ /dev/null @@ -1,173 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityAggregatedAlertList.json -func ExampleIotSecuritySolutionsAnalyticsAggregatedAlertClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewIotSecuritySolutionsAnalyticsAggregatedAlertClient().NewListPager("MyGroup", "default", &armsecurity.IotSecuritySolutionsAnalyticsAggregatedAlertClientListOptions{Top: 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.IoTSecurityAggregatedAlertList = armsecurity.IoTSecurityAggregatedAlertList{ - // Value: []*armsecurity.IoTSecurityAggregatedAlert{ - // { - // Name: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/MyGroup/providers/Microsoft.Security/IoTSecuritySolutions/Locations/eastus/default/IoT_Bruteforce_Fail/2019-02-02"), - // Type: to.Ptr("Microsoft.Security/iotSecuritySolutions/analyticsModels/aggregatedAlerts"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/MyGroup/providers/Microsoft.Security/IoTSecuritySolutions/Locations/eastus/default/IoT_Bruteforce_Fail/2019-02-02"), - // Properties: &armsecurity.IoTSecurityAggregatedAlertProperties{ - // Description: to.Ptr("Multiple unsuccsseful login attempts identified. A Bruteforce attack on the device failed."), - // ActionTaken: to.Ptr("Detected"), - // AggregatedDateUTC: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2019-02-02"); return t}()), - // AlertDisplayName: to.Ptr("Failed Bruteforce"), - // AlertType: to.Ptr("IoT_Bruteforce_Fail"), - // Count: to.Ptr[int64](50), - // EffectedResourceType: to.Ptr("IoT Device"), - // LogAnalyticsQuery: to.Ptr("SecurityAlert | where tolower(ResourceId) == tolower('/subscriptions/b77ec8a9-04ed-48d2-a87a-e5887b978ba6/resourceGroups/IoT-Solution-DemoEnv/providers/Microsoft.Devices/IotHubs/rtogm-hub') and tolower(AlertName) == tolower('Custom Alert - number of device to cloud messages in MQTT protocol is not in the allowed range') | extend DeviceId=parse_json(ExtendedProperties)['DeviceId'] | project DeviceId, TimeGenerated, DisplayName, AlertSeverity, Description, RemediationSteps, ExtendedProperties"), - // RemediationSteps: to.Ptr(""), - // ReportedSeverity: to.Ptr(armsecurity.ReportedSeverityLow), - // SystemSource: to.Ptr("Devices"), - // TopDevicesList: []*armsecurity.IoTSecurityAggregatedAlertPropertiesTopDevicesListItem{ - // { - // AlertsCount: to.Ptr[int64](45), - // DeviceID: to.Ptr("testDevice1"), - // LastOccurrence: to.Ptr("10:42"), - // }, - // { - // AlertsCount: to.Ptr[int64](30), - // DeviceID: to.Ptr("testDevice2"), - // LastOccurrence: to.Ptr("15:42"), - // }}, - // VendorName: to.Ptr("Microsoft"), - // }, - // }, - // { - // Name: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/MyGroup/providers/Microsoft.Security/IoTSecuritySolutions/Locations/eastus/default/IoT_Bruteforce_Success/2019-02-02"), - // Type: to.Ptr("Microsoft.Security/iotSecuritySolutions/analyticsModels/aggregatedAlerts"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/MyGroup/providers/Microsoft.Security/IoTSecuritySolutions/Locations/eastus/default/IoT_Bruteforce_Success/2019-02-02"), - // Properties: &armsecurity.IoTSecurityAggregatedAlertProperties{ - // Description: to.Ptr("Multiple unsuccsseful login attempts identified followed by a succssful login. A Bruteforce attack on the device was Successfule"), - // ActionTaken: to.Ptr("Detected"), - // AggregatedDateUTC: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2019-02-02"); return t}()), - // AlertDisplayName: to.Ptr("Successful Bruteforce"), - // AlertType: to.Ptr("IoT_Bruteforce_Success"), - // Count: to.Ptr[int64](600000), - // EffectedResourceType: to.Ptr("IoT Device"), - // LogAnalyticsQuery: to.Ptr("SecurityAlert | where tolower(ResourceId) == tolower('/subscriptions/b77ec8a9-04ed-48d2-a87a-e5887b978ba6/resourceGroups/IoT-Solution-DemoEnv/providers/Microsoft.Devices/IotHubs/rtogm-hub') and tolower(AlertName) == tolower('Custom Alert - number of device to cloud messages in MQTT protocol is not in the allowed range') | extend DeviceId=parse_json(ExtendedProperties)['DeviceId'] | project DeviceId, TimeGenerated, DisplayName, AlertSeverity, Description, RemediationSteps, ExtendedProperties"), - // RemediationSteps: to.Ptr(""), - // ReportedSeverity: to.Ptr(armsecurity.ReportedSeverityLow), - // SystemSource: to.Ptr("Devices"), - // TopDevicesList: []*armsecurity.IoTSecurityAggregatedAlertPropertiesTopDevicesListItem{ - // { - // AlertsCount: to.Ptr[int64](12321), - // DeviceID: to.Ptr("testDevice1"), - // LastOccurrence: to.Ptr("10:42"), - // }, - // { - // AlertsCount: to.Ptr[int64](455), - // DeviceID: to.Ptr("testDevice2"), - // LastOccurrence: to.Ptr("15:42"), - // }}, - // VendorName: to.Ptr("Microsoft"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityAggregatedAlert.json -func ExampleIotSecuritySolutionsAnalyticsAggregatedAlertClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIotSecuritySolutionsAnalyticsAggregatedAlertClient().Get(ctx, "MyGroup", "default", "IoT_Bruteforce_Fail/2019-02-02", 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.IoTSecurityAggregatedAlert = armsecurity.IoTSecurityAggregatedAlert{ - // Name: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/MyGroup/providers/Microsoft.Security/IoTSecuritySolutions/Locations/eastus/default/IoT_Bruteforce_Fail/2019-02-02"), - // Type: to.Ptr("Microsoft.Security/iotSecuritySolutions/analyticsModels/aggregatedAlerts"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/MyGroup/providers/Microsoft.Security/IoTSecuritySolutions/Locations/eastus/default/IoT_Bruteforce_Fail/2019-02-02"), - // Properties: &armsecurity.IoTSecurityAggregatedAlertProperties{ - // Description: to.Ptr("Multiple unsuccsseful login attempts identified. A Bruteforce attack on the device failed."), - // ActionTaken: to.Ptr("Detected"), - // AggregatedDateUTC: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2019-02-02"); return t}()), - // AlertDisplayName: to.Ptr("Failed Bruteforce"), - // AlertType: to.Ptr("IoT_Bruteforce_Fail"), - // Count: to.Ptr[int64](50), - // EffectedResourceType: to.Ptr("IoT Device"), - // LogAnalyticsQuery: to.Ptr("SecurityAlert | where tolower(ResourceId) == tolower('/subscriptions/b77ec8a9-04ed-48d2-a87a-e5887b978ba6/resourceGroups/IoT-Solution-DemoEnv/providers/Microsoft.Devices/IotHubs/rtogm-hub') and tolower(AlertName) == tolower('Custom Alert - number of device to cloud messages in MQTT protocol is not in the allowed range') | extend DeviceId=parse_json(ExtendedProperties)['DeviceId'] | project DeviceId, TimeGenerated, DisplayName, AlertSeverity, Description, RemediationSteps, ExtendedProperties"), - // RemediationSteps: to.Ptr(""), - // ReportedSeverity: to.Ptr(armsecurity.ReportedSeverityLow), - // SystemSource: to.Ptr("Devices"), - // TopDevicesList: []*armsecurity.IoTSecurityAggregatedAlertPropertiesTopDevicesListItem{ - // { - // AlertsCount: to.Ptr[int64](100), - // DeviceID: to.Ptr("testDevice1"), - // LastOccurrence: to.Ptr("10:42"), - // }, - // { - // AlertsCount: to.Ptr[int64](80), - // DeviceID: to.Ptr("testDevice2"), - // LastOccurrence: to.Ptr("15:42"), - // }}, - // VendorName: to.Ptr("Microsoft"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutionsAnalytics/PostIoTSecuritySolutionsSecurityAggregatedAlertDismiss.json -func ExampleIotSecuritySolutionsAnalyticsAggregatedAlertClient_Dismiss() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewIotSecuritySolutionsAnalyticsAggregatedAlertClient().Dismiss(ctx, "IoTEdgeResources", "default", "IoT_Bruteforce_Fail/2019-02-02/dismiss", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionsanalyticsrecommendation_client.go b/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionsanalyticsrecommendation_client.go deleted file mode 100644 index 1a2d3fe1289e..000000000000 --- a/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionsanalyticsrecommendation_client.go +++ /dev/null @@ -1,184 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// IotSecuritySolutionsAnalyticsRecommendationClient contains the methods for the IotSecuritySolutionsAnalyticsRecommendation group. -// Don't use this type directly, use NewIotSecuritySolutionsAnalyticsRecommendationClient() instead. -type IotSecuritySolutionsAnalyticsRecommendationClient struct { - internal *arm.Client - subscriptionID string -} - -// NewIotSecuritySolutionsAnalyticsRecommendationClient creates a new instance of IotSecuritySolutionsAnalyticsRecommendationClient 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 NewIotSecuritySolutionsAnalyticsRecommendationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*IotSecuritySolutionsAnalyticsRecommendationClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &IotSecuritySolutionsAnalyticsRecommendationClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Use this method to get the aggregated security analytics recommendation of yours IoT Security solution. This aggregation -// is performed by recommendation name. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-08-01 -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - solutionName - The name of the IoT Security solution. -// - aggregatedRecommendationName - Name of the recommendation aggregated for this query. -// - options - IotSecuritySolutionsAnalyticsRecommendationClientGetOptions contains the optional parameters for the IotSecuritySolutionsAnalyticsRecommendationClient.Get -// method. -func (client *IotSecuritySolutionsAnalyticsRecommendationClient) Get(ctx context.Context, resourceGroupName string, solutionName string, aggregatedRecommendationName string, options *IotSecuritySolutionsAnalyticsRecommendationClientGetOptions) (IotSecuritySolutionsAnalyticsRecommendationClientGetResponse, error) { - var err error - const operationName = "IotSecuritySolutionsAnalyticsRecommendationClient.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, solutionName, aggregatedRecommendationName, options) - if err != nil { - return IotSecuritySolutionsAnalyticsRecommendationClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return IotSecuritySolutionsAnalyticsRecommendationClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return IotSecuritySolutionsAnalyticsRecommendationClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *IotSecuritySolutionsAnalyticsRecommendationClient) getCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, aggregatedRecommendationName string, options *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") - } - 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 solutionName == "" { - return nil, errors.New("parameter solutionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{solutionName}", url.PathEscape(solutionName)) - if aggregatedRecommendationName == "" { - return nil, errors.New("parameter aggregatedRecommendationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{aggregatedRecommendationName}", url.PathEscape(aggregatedRecommendationName)) - 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", "2019-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 *IotSecuritySolutionsAnalyticsRecommendationClient) getHandleResponse(resp *http.Response) (IotSecuritySolutionsAnalyticsRecommendationClientGetResponse, error) { - result := IotSecuritySolutionsAnalyticsRecommendationClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.IoTSecurityAggregatedRecommendation); err != nil { - return IotSecuritySolutionsAnalyticsRecommendationClientGetResponse{}, err - } - return result, nil -} - -// 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. -// - solutionName - The name of the IoT Security solution. -// - options - IotSecuritySolutionsAnalyticsRecommendationClientListOptions contains the optional parameters for the IotSecuritySolutionsAnalyticsRecommendationClient.NewListPager -// method. -func (client *IotSecuritySolutionsAnalyticsRecommendationClient) NewListPager(resourceGroupName string, solutionName string, options *IotSecuritySolutionsAnalyticsRecommendationClientListOptions) *runtime.Pager[IotSecuritySolutionsAnalyticsRecommendationClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[IotSecuritySolutionsAnalyticsRecommendationClientListResponse]{ - More: func(page IotSecuritySolutionsAnalyticsRecommendationClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *IotSecuritySolutionsAnalyticsRecommendationClientListResponse) (IotSecuritySolutionsAnalyticsRecommendationClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "IotSecuritySolutionsAnalyticsRecommendationClient.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, solutionName, options) - }, nil) - if err != nil { - return IotSecuritySolutionsAnalyticsRecommendationClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *IotSecuritySolutionsAnalyticsRecommendationClient) listCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, options *IotSecuritySolutionsAnalyticsRecommendationClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations" - 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 solutionName == "" { - return nil, errors.New("parameter solutionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{solutionName}", url.PathEscape(solutionName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) - } - reqQP.Set("api-version", "2019-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 *IotSecuritySolutionsAnalyticsRecommendationClient) listHandleResponse(resp *http.Response) (IotSecuritySolutionsAnalyticsRecommendationClientListResponse, error) { - result := IotSecuritySolutionsAnalyticsRecommendationClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.IoTSecurityAggregatedRecommendationList); err != nil { - return IotSecuritySolutionsAnalyticsRecommendationClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionsanalyticsrecommendation_client_example_test.go b/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionsanalyticsrecommendation_client_example_test.go deleted file mode 100644 index c455bca7631f..000000000000 --- a/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionsanalyticsrecommendation_client_example_test.go +++ /dev/null @@ -1,117 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityRecommendation.json -func ExampleIotSecuritySolutionsAnalyticsRecommendationClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIotSecuritySolutionsAnalyticsRecommendationClient().Get(ctx, "IoTEdgeResources", "default", "OpenPortsOnDevice", 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.IoTSecurityAggregatedRecommendation = armsecurity.IoTSecurityAggregatedRecommendation{ - // Name: to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/IoTEdgeResources/providers/Microsoft.Security/IoTSecuritySolutions/Locations/eastus/default/OpenPortsOnDevice"), - // Type: to.Ptr("Microsoft.Security/iotSecuritySolutions/analyticsModels/aggregatedRecommendations"), - // ID: to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/IoTEdgeResources/providers/Microsoft.Security/IoTSecuritySolutions/Locations/eastus/default/OpenPortsOnDevice"), - // Properties: &armsecurity.IoTSecurityAggregatedRecommendationProperties{ - // Description: to.Ptr("An allowed firewall policy was found in main firewall Chains (INPUT/OUTPUT). The policy should Deny all traffic by default define rules to allow necessary communication to/from the device"), - // DetectedBy: to.Ptr("Microsoft"), - // HealthyDevices: to.Ptr[int64](10000), - // LogAnalyticsQuery: to.Ptr("SecurityRecommendation | where tolower(AssessedResourceId) == tolower('/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/IoTEdgeResources/providers/Microsoft.Devices/IotHubs/t-ofdadu-hub') and tolower(RecommendationName) == tolower('OpenPortsOnDevice')"), - // RecommendationDisplayName: to.Ptr("Permissive firewall policy in one of the chains was found"), - // RecommendationName: to.Ptr("OpenPortsOnDevice"), - // RecommendationTypeID: to.Ptr("{20ff7fc3-e762-44dd-bd96-b71116dcdc23}"), - // RemediationSteps: to.Ptr(""), - // ReportedSeverity: to.Ptr(armsecurity.ReportedSeverityLow), - // UnhealthyDeviceCount: to.Ptr[int64](200), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityRecommendationList.json -func ExampleIotSecuritySolutionsAnalyticsRecommendationClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewIotSecuritySolutionsAnalyticsRecommendationClient().NewListPager("IoTEdgeResources", "default", &armsecurity.IotSecuritySolutionsAnalyticsRecommendationClientListOptions{Top: 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.IoTSecurityAggregatedRecommendationList = armsecurity.IoTSecurityAggregatedRecommendationList{ - // Value: []*armsecurity.IoTSecurityAggregatedRecommendation{ - // { - // Name: to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/IoTEdgeResources/providers/Microsoft.Security/IoTSecuritySolutions/Locations/eastus/default/OpenPortsOnDevice"), - // Type: to.Ptr("Microsoft.Security/iotSecuritySolutions/analyticsModels/aggregatedRecommendations"), - // ID: to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/IoTEdgeResources/providers/Microsoft.Security/IoTSecuritySolutions/Locations/eastus/default/OpenPortsOnDevice"), - // Properties: &armsecurity.IoTSecurityAggregatedRecommendationProperties{ - // Description: to.Ptr("An allowed firewall policy was found in main firewall Chains (INPUT/OUTPUT). The policy should Deny all traffic by default define rules to allow necessary communication to/from the device"), - // DetectedBy: to.Ptr("Microsoft"), - // HealthyDevices: to.Ptr[int64](10000), - // LogAnalyticsQuery: to.Ptr("SecurityRecommendation | where tolower(AssessedResourceId) == tolower('/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/IoTEdgeResources/providers/Microsoft.Devices/IotHubs/t-ofdadu-hub') and tolower(RecommendationName) == tolower('OpenPortsOnDevice')"), - // RecommendationDisplayName: to.Ptr("Permissive firewall policy in one of the chains was found"), - // RecommendationName: to.Ptr("OpenPortsOnDevice"), - // RecommendationTypeID: to.Ptr("{20ff7fc3-e762-44dd-bd96-b71116dcdc23}"), - // RemediationSteps: to.Ptr(""), - // ReportedSeverity: to.Ptr(armsecurity.ReportedSeverityLow), - // UnhealthyDeviceCount: to.Ptr[int64](200), - // }, - // }, - // { - // Name: to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/IoTEdgeResources/providers/Microsoft.Security/IoTSecuritySolutions/Locations/eastus/default/IoT_InstallAgent"), - // Type: to.Ptr("Microsoft.Security/iotSecuritySolutions/analyticsModels/aggregatedRecommendations"), - // ID: to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/IoTEdgeResources/providers/Microsoft.Security/IoTSecuritySolutions/Locations/eastus/default/TooLargeIPRange"), - // Properties: &armsecurity.IoTSecurityAggregatedRecommendationProperties{ - // Description: to.Ptr("An allow IP filter rule source IP range is too large. Overly permissive rules can expose your IoT hub to malicious actors."), - // DetectedBy: to.Ptr("Microsoft"), - // HealthyDevices: to.Ptr[int64](130000), - // LogAnalyticsQuery: to.Ptr("SecurityRecommendation | where tolower(AssessedResourceId) == tolower('/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/IoTEdgeResources/providers/Microsoft.Devices/IotHubs/t-ofdadu-hub') and tolower(RecommendationName) == tolower('TooLargeIPRange')"), - // RecommendationDisplayName: to.Ptr("Permissive firewall policy in one of the chains was found"), - // RecommendationName: to.Ptr("TooLargeIPRange"), - // RecommendationTypeID: to.Ptr("{20ff7fc3-e762-44dd-bd96-b71116dcdc23}"), - // RemediationSteps: to.Ptr(""), - // ReportedSeverity: to.Ptr(armsecurity.ReportedSeverityHigh), - // UnhealthyDeviceCount: to.Ptr[int64](1), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/security/armsecurity/jitnetworkaccesspolicies_client.go b/sdk/resourcemanager/security/armsecurity/jitnetworkaccesspolicies_client.go deleted file mode 100644 index a965aa8c4c33..000000000000 --- a/sdk/resourcemanager/security/armsecurity/jitnetworkaccesspolicies_client.go +++ /dev/null @@ -1,563 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// JitNetworkAccessPoliciesClient contains the methods for the JitNetworkAccessPolicies group. -// Don't use this type directly, use NewJitNetworkAccessPoliciesClient() instead. -type JitNetworkAccessPoliciesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewJitNetworkAccessPoliciesClient creates a new instance of JitNetworkAccessPoliciesClient 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 NewJitNetworkAccessPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*JitNetworkAccessPoliciesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &JitNetworkAccessPoliciesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Create a policy for protecting resources using Just-in-Time access control -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-01-01 -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - jitNetworkAccessPolicyName - Name of a Just-in-Time access configuration policy. -// - options - JitNetworkAccessPoliciesClientCreateOrUpdateOptions contains the optional parameters for the JitNetworkAccessPoliciesClient.CreateOrUpdate -// method. -func (client *JitNetworkAccessPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ascLocation string, jitNetworkAccessPolicyName string, body JitNetworkAccessPolicy, options *JitNetworkAccessPoliciesClientCreateOrUpdateOptions) (JitNetworkAccessPoliciesClientCreateOrUpdateResponse, error) { - var err error - const operationName = "JitNetworkAccessPoliciesClient.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, ascLocation, jitNetworkAccessPolicyName, body, options) - if err != nil { - return JitNetworkAccessPoliciesClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return JitNetworkAccessPoliciesClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return JitNetworkAccessPoliciesClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// 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) { - 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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ascLocation == "" { - return nil, errors.New("parameter ascLocation cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ascLocation}", url.PathEscape(ascLocation)) - if jitNetworkAccessPolicyName == "" { - return nil, errors.New("parameter jitNetworkAccessPolicyName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{jitNetworkAccessPolicyName}", url.PathEscape(jitNetworkAccessPolicyName)) - 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 -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *JitNetworkAccessPoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (JitNetworkAccessPoliciesClientCreateOrUpdateResponse, error) { - result := JitNetworkAccessPoliciesClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.JitNetworkAccessPolicy); err != nil { - return JitNetworkAccessPoliciesClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Delete a Just-in-Time access control policy. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-01-01 -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - jitNetworkAccessPolicyName - Name of a Just-in-Time access configuration policy. -// - options - JitNetworkAccessPoliciesClientDeleteOptions contains the optional parameters for the JitNetworkAccessPoliciesClient.Delete -// method. -func (client *JitNetworkAccessPoliciesClient) Delete(ctx context.Context, resourceGroupName string, ascLocation string, jitNetworkAccessPolicyName string, options *JitNetworkAccessPoliciesClientDeleteOptions) (JitNetworkAccessPoliciesClientDeleteResponse, error) { - var err error - const operationName = "JitNetworkAccessPoliciesClient.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, ascLocation, jitNetworkAccessPolicyName, options) - if err != nil { - return JitNetworkAccessPoliciesClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return JitNetworkAccessPoliciesClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return JitNetworkAccessPoliciesClientDeleteResponse{}, err - } - return JitNetworkAccessPoliciesClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *JitNetworkAccessPoliciesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, jitNetworkAccessPolicyName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ascLocation == "" { - return nil, errors.New("parameter ascLocation cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ascLocation}", url.PathEscape(ascLocation)) - if jitNetworkAccessPolicyName == "" { - return nil, errors.New("parameter jitNetworkAccessPolicyName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{jitNetworkAccessPolicyName}", url.PathEscape(jitNetworkAccessPolicyName)) - 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 - Policies for protecting resources using Just-in-Time access control for the subscription, location -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-01-01 -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - jitNetworkAccessPolicyName - Name of a Just-in-Time access configuration policy. -// - options - JitNetworkAccessPoliciesClientGetOptions contains the optional parameters for the JitNetworkAccessPoliciesClient.Get -// method. -func (client *JitNetworkAccessPoliciesClient) Get(ctx context.Context, resourceGroupName string, ascLocation string, jitNetworkAccessPolicyName string, options *JitNetworkAccessPoliciesClientGetOptions) (JitNetworkAccessPoliciesClientGetResponse, error) { - var err error - const operationName = "JitNetworkAccessPoliciesClient.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, ascLocation, jitNetworkAccessPolicyName, options) - if err != nil { - return JitNetworkAccessPoliciesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return JitNetworkAccessPoliciesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return JitNetworkAccessPoliciesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *JitNetworkAccessPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, jitNetworkAccessPolicyName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ascLocation == "" { - return nil, errors.New("parameter ascLocation cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ascLocation}", url.PathEscape(ascLocation)) - if jitNetworkAccessPolicyName == "" { - return nil, errors.New("parameter jitNetworkAccessPolicyName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{jitNetworkAccessPolicyName}", url.PathEscape(jitNetworkAccessPolicyName)) - 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 *JitNetworkAccessPoliciesClient) getHandleResponse(resp *http.Response) (JitNetworkAccessPoliciesClientGetResponse, error) { - result := JitNetworkAccessPoliciesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.JitNetworkAccessPolicy); err != nil { - return JitNetworkAccessPoliciesClientGetResponse{}, err - } - return result, nil -} - -// Initiate - Initiate a JIT access from a specific Just-in-Time policy configuration. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-01-01 -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - jitNetworkAccessPolicyName - Name of a Just-in-Time access configuration policy. -// - options - JitNetworkAccessPoliciesClientInitiateOptions contains the optional parameters for the JitNetworkAccessPoliciesClient.Initiate -// method. -func (client *JitNetworkAccessPoliciesClient) Initiate(ctx context.Context, resourceGroupName string, ascLocation string, jitNetworkAccessPolicyName string, body JitNetworkAccessPolicyInitiateRequest, options *JitNetworkAccessPoliciesClientInitiateOptions) (JitNetworkAccessPoliciesClientInitiateResponse, error) { - var err error - const operationName = "JitNetworkAccessPoliciesClient.Initiate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.initiateCreateRequest(ctx, resourceGroupName, ascLocation, jitNetworkAccessPolicyName, body, options) - if err != nil { - return JitNetworkAccessPoliciesClientInitiateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return JitNetworkAccessPoliciesClientInitiateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return JitNetworkAccessPoliciesClientInitiateResponse{}, err - } - resp, err := client.initiateHandleResponse(httpResp) - return resp, err -} - -// 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) { - 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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ascLocation == "" { - return nil, errors.New("parameter ascLocation cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ascLocation}", url.PathEscape(ascLocation)) - if jitNetworkAccessPolicyName == "" { - return nil, errors.New("parameter jitNetworkAccessPolicyName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{jitNetworkAccessPolicyName}", url.PathEscape(jitNetworkAccessPolicyName)) - urlPath = strings.ReplaceAll(urlPath, "{jitNetworkAccessPolicyInitiateType}", url.PathEscape("initiate")) - 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 -} - -// initiateHandleResponse handles the Initiate response. -func (client *JitNetworkAccessPoliciesClient) initiateHandleResponse(resp *http.Response) (JitNetworkAccessPoliciesClientInitiateResponse, error) { - result := JitNetworkAccessPoliciesClientInitiateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.JitNetworkAccessRequest); err != nil { - return JitNetworkAccessPoliciesClientInitiateResponse{}, err - } - return result, nil -} - -// NewListPager - Policies for protecting resources using Just-in-Time access control. -// -// Generated from API version 2020-01-01 -// - options - JitNetworkAccessPoliciesClientListOptions contains the optional parameters for the JitNetworkAccessPoliciesClient.NewListPager -// method. -func (client *JitNetworkAccessPoliciesClient) NewListPager(options *JitNetworkAccessPoliciesClientListOptions) *runtime.Pager[JitNetworkAccessPoliciesClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[JitNetworkAccessPoliciesClientListResponse]{ - More: func(page JitNetworkAccessPoliciesClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *JitNetworkAccessPoliciesClientListResponse) (JitNetworkAccessPoliciesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "JitNetworkAccessPoliciesClient.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 JitNetworkAccessPoliciesClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *JitNetworkAccessPoliciesClient) listCreateRequest(ctx context.Context, options *JitNetworkAccessPoliciesClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/jitNetworkAccessPolicies" - 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") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *JitNetworkAccessPoliciesClient) listHandleResponse(resp *http.Response) (JitNetworkAccessPoliciesClientListResponse, error) { - result := JitNetworkAccessPoliciesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.JitNetworkAccessPoliciesList); err != nil { - return JitNetworkAccessPoliciesClientListResponse{}, err - } - return result, nil -} - -// NewListByRegionPager - Policies for protecting resources using Just-in-Time access control for the subscription, location -// -// Generated from API version 2020-01-01 -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - options - JitNetworkAccessPoliciesClientListByRegionOptions contains the optional parameters for the JitNetworkAccessPoliciesClient.NewListByRegionPager -// method. -func (client *JitNetworkAccessPoliciesClient) NewListByRegionPager(ascLocation string, options *JitNetworkAccessPoliciesClientListByRegionOptions) *runtime.Pager[JitNetworkAccessPoliciesClientListByRegionResponse] { - return runtime.NewPager(runtime.PagingHandler[JitNetworkAccessPoliciesClientListByRegionResponse]{ - More: func(page JitNetworkAccessPoliciesClientListByRegionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *JitNetworkAccessPoliciesClientListByRegionResponse) (JitNetworkAccessPoliciesClientListByRegionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "JitNetworkAccessPoliciesClient.NewListByRegionPager") - 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.listByRegionCreateRequest(ctx, ascLocation, options) - }, nil) - if err != nil { - return JitNetworkAccessPoliciesClientListByRegionResponse{}, err - } - return client.listByRegionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByRegionCreateRequest creates the ListByRegion request. -func (client *JitNetworkAccessPoliciesClient) listByRegionCreateRequest(ctx context.Context, ascLocation string, options *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") - } - 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)) - 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 -} - -// listByRegionHandleResponse handles the ListByRegion response. -func (client *JitNetworkAccessPoliciesClient) listByRegionHandleResponse(resp *http.Response) (JitNetworkAccessPoliciesClientListByRegionResponse, error) { - result := JitNetworkAccessPoliciesClientListByRegionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.JitNetworkAccessPoliciesList); err != nil { - return JitNetworkAccessPoliciesClientListByRegionResponse{}, err - } - return result, nil -} - -// NewListByResourceGroupPager - Policies for protecting resources using Just-in-Time access control for the subscription, -// 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. -// - options - JitNetworkAccessPoliciesClientListByResourceGroupOptions contains the optional parameters for the JitNetworkAccessPoliciesClient.NewListByResourceGroupPager -// method. -func (client *JitNetworkAccessPoliciesClient) NewListByResourceGroupPager(resourceGroupName string, options *JitNetworkAccessPoliciesClientListByResourceGroupOptions) *runtime.Pager[JitNetworkAccessPoliciesClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[JitNetworkAccessPoliciesClientListByResourceGroupResponse]{ - More: func(page JitNetworkAccessPoliciesClientListByResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *JitNetworkAccessPoliciesClientListByResourceGroupResponse) (JitNetworkAccessPoliciesClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "JitNetworkAccessPoliciesClient.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 JitNetworkAccessPoliciesClientListByResourceGroupResponse{}, err - } - return client.listByResourceGroupHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *JitNetworkAccessPoliciesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *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") - } - 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", "2020-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *JitNetworkAccessPoliciesClient) listByResourceGroupHandleResponse(resp *http.Response) (JitNetworkAccessPoliciesClientListByResourceGroupResponse, error) { - result := JitNetworkAccessPoliciesClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.JitNetworkAccessPoliciesList); err != nil { - return JitNetworkAccessPoliciesClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// NewListByResourceGroupAndRegionPager - Policies for protecting resources using Just-in-Time access control for the subscription, -// 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. -// - 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. -func (client *JitNetworkAccessPoliciesClient) NewListByResourceGroupAndRegionPager(resourceGroupName string, ascLocation string, options *JitNetworkAccessPoliciesClientListByResourceGroupAndRegionOptions) *runtime.Pager[JitNetworkAccessPoliciesClientListByResourceGroupAndRegionResponse] { - return runtime.NewPager(runtime.PagingHandler[JitNetworkAccessPoliciesClientListByResourceGroupAndRegionResponse]{ - More: func(page JitNetworkAccessPoliciesClientListByResourceGroupAndRegionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *JitNetworkAccessPoliciesClientListByResourceGroupAndRegionResponse) (JitNetworkAccessPoliciesClientListByResourceGroupAndRegionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "JitNetworkAccessPoliciesClient.NewListByResourceGroupAndRegionPager") - 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.listByResourceGroupAndRegionCreateRequest(ctx, resourceGroupName, ascLocation, options) - }, nil) - if err != nil { - return JitNetworkAccessPoliciesClientListByResourceGroupAndRegionResponse{}, err - } - return client.listByResourceGroupAndRegionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByResourceGroupAndRegionCreateRequest creates the ListByResourceGroupAndRegion request. -func (client *JitNetworkAccessPoliciesClient) listByResourceGroupAndRegionCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ascLocation == "" { - return nil, errors.New("parameter ascLocation cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ascLocation}", url.PathEscape(ascLocation)) - 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 -} - -// listByResourceGroupAndRegionHandleResponse handles the ListByResourceGroupAndRegion response. -func (client *JitNetworkAccessPoliciesClient) listByResourceGroupAndRegionHandleResponse(resp *http.Response) (JitNetworkAccessPoliciesClientListByResourceGroupAndRegionResponse, error) { - result := JitNetworkAccessPoliciesClientListByResourceGroupAndRegionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.JitNetworkAccessPoliciesList); err != nil { - return JitNetworkAccessPoliciesClientListByResourceGroupAndRegionResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/jitnetworkaccesspolicies_client_example_test.go b/sdk/resourcemanager/security/armsecurity/jitnetworkaccesspolicies_client_example_test.go deleted file mode 100644 index ce1d0ffe20e1..000000000000 --- a/sdk/resourcemanager/security/armsecurity/jitnetworkaccesspolicies_client_example_test.go +++ /dev/null @@ -1,530 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/GetJitNetworkAccessPoliciesSubscription_example.json -func ExampleJitNetworkAccessPoliciesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewJitNetworkAccessPoliciesClient().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.JitNetworkAccessPoliciesList = armsecurity.JitNetworkAccessPoliciesList{ - // Value: []*armsecurity.JitNetworkAccessPolicy{ - // { - // Kind: to.Ptr("Basic"), - // Location: to.Ptr("westeurope"), - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/locations/jitNetworkAccessPolicies"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Security/locations/westeurope/jitNetworkAccessPolicies/default"), - // Properties: &armsecurity.JitNetworkAccessPolicyProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // Requests: []*armsecurity.JitNetworkAccessRequest{ - // { - // Justification: to.Ptr("testing a new version of the product"), - // Requestor: to.Ptr("barbara@contoso.com"), - // StartTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-17T08:06:45.569Z"); return t}()), - // VirtualMachines: []*armsecurity.JitNetworkAccessRequestVirtualMachine{ - // { - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1"), - // Ports: []*armsecurity.JitNetworkAccessRequestPort{ - // { - // AllowedSourceAddressPrefix: to.Ptr("192.127.0.2"), - // EndTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-17T09:06:45.569Z"); return t}()), - // Number: to.Ptr[int32](3389), - // Status: to.Ptr(armsecurity.StatusInitiated), - // StatusReason: to.Ptr(armsecurity.StatusReasonUserRequested), - // }}, - // }}, - // }}, - // VirtualMachines: []*armsecurity.JitNetworkAccessPolicyVirtualMachine{ - // { - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1"), - // Ports: []*armsecurity.JitNetworkAccessPortRule{ - // { - // AllowedSourceAddressPrefix: to.Ptr("*"), - // MaxRequestAccessDuration: to.Ptr("PT3H"), - // Number: to.Ptr[int32](22), - // Protocol: to.Ptr(armsecurity.ProtocolAll), - // }, - // { - // AllowedSourceAddressPrefix: to.Ptr("*"), - // MaxRequestAccessDuration: to.Ptr("PT3H"), - // Number: to.Ptr[int32](3389), - // Protocol: to.Ptr(armsecurity.ProtocolAll), - // }}, - // }}, - // }, - // }}, - // } - } -} - -// 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/JitNetworkAccessPolicies/GetJitNetworkAccessPoliciesSubscriptionLocation_example.json -func ExampleJitNetworkAccessPoliciesClient_NewListByRegionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewJitNetworkAccessPoliciesClient().NewListByRegionPager("westeurope", 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.JitNetworkAccessPoliciesList = armsecurity.JitNetworkAccessPoliciesList{ - // Value: []*armsecurity.JitNetworkAccessPolicy{ - // { - // Kind: to.Ptr("Basic"), - // Location: to.Ptr("westeurope"), - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/locations/jitNetworkAccessPolicies"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Security/locations/westeurope/jitNetworkAccessPolicies/default"), - // Properties: &armsecurity.JitNetworkAccessPolicyProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // Requests: []*armsecurity.JitNetworkAccessRequest{ - // { - // Justification: to.Ptr("testing a new version of the product"), - // Requestor: to.Ptr("barbara@contoso.com"), - // StartTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-17T08:06:45.569Z"); return t}()), - // VirtualMachines: []*armsecurity.JitNetworkAccessRequestVirtualMachine{ - // { - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1"), - // Ports: []*armsecurity.JitNetworkAccessRequestPort{ - // { - // AllowedSourceAddressPrefix: to.Ptr("192.127.0.2"), - // EndTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-17T09:06:45.569Z"); return t}()), - // Number: to.Ptr[int32](3389), - // Status: to.Ptr(armsecurity.StatusInitiated), - // StatusReason: to.Ptr(armsecurity.StatusReasonUserRequested), - // }}, - // }}, - // }}, - // VirtualMachines: []*armsecurity.JitNetworkAccessPolicyVirtualMachine{ - // { - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1"), - // Ports: []*armsecurity.JitNetworkAccessPortRule{ - // { - // AllowedSourceAddressPrefix: to.Ptr("*"), - // MaxRequestAccessDuration: to.Ptr("PT3H"), - // Number: to.Ptr[int32](22), - // Protocol: to.Ptr(armsecurity.ProtocolAll), - // }, - // { - // AllowedSourceAddressPrefix: to.Ptr("*"), - // MaxRequestAccessDuration: to.Ptr("PT3H"), - // Number: to.Ptr[int32](3389), - // Protocol: to.Ptr(armsecurity.ProtocolAll), - // }}, - // }}, - // }, - // }}, - // } - } -} - -// 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/JitNetworkAccessPolicies/GetJitNetworkAccessPoliciesResourceGroup_example.json -func ExampleJitNetworkAccessPoliciesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewJitNetworkAccessPoliciesClient().NewListByResourceGroupPager("myRg1", 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.JitNetworkAccessPoliciesList = armsecurity.JitNetworkAccessPoliciesList{ - // Value: []*armsecurity.JitNetworkAccessPolicy{ - // { - // Kind: to.Ptr("Basic"), - // Location: to.Ptr("westeurope"), - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/locations/jitNetworkAccessPolicies"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Security/locations/westeurope/jitNetworkAccessPolicies/default"), - // Properties: &armsecurity.JitNetworkAccessPolicyProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // Requests: []*armsecurity.JitNetworkAccessRequest{ - // { - // Justification: to.Ptr("testing a new version of the product"), - // Requestor: to.Ptr("barbara@contoso.com"), - // StartTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-17T08:06:45.569Z"); return t}()), - // VirtualMachines: []*armsecurity.JitNetworkAccessRequestVirtualMachine{ - // { - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1"), - // Ports: []*armsecurity.JitNetworkAccessRequestPort{ - // { - // AllowedSourceAddressPrefix: to.Ptr("192.127.0.2"), - // EndTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-17T09:06:45.569Z"); return t}()), - // Number: to.Ptr[int32](3389), - // Status: to.Ptr(armsecurity.StatusInitiated), - // StatusReason: to.Ptr(armsecurity.StatusReasonUserRequested), - // }}, - // }}, - // }}, - // VirtualMachines: []*armsecurity.JitNetworkAccessPolicyVirtualMachine{ - // { - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1"), - // Ports: []*armsecurity.JitNetworkAccessPortRule{ - // { - // AllowedSourceAddressPrefix: to.Ptr("*"), - // MaxRequestAccessDuration: to.Ptr("PT3H"), - // Number: to.Ptr[int32](22), - // Protocol: to.Ptr(armsecurity.ProtocolAll), - // }, - // { - // AllowedSourceAddressPrefix: to.Ptr("*"), - // MaxRequestAccessDuration: to.Ptr("PT3H"), - // Number: to.Ptr[int32](3389), - // Protocol: to.Ptr(armsecurity.ProtocolAll), - // }}, - // }}, - // }, - // }}, - // } - } -} - -// 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/JitNetworkAccessPolicies/GetJitNetworkAccessPoliciesResourceGroupLocation_example.json -func ExampleJitNetworkAccessPoliciesClient_NewListByResourceGroupAndRegionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewJitNetworkAccessPoliciesClient().NewListByResourceGroupAndRegionPager("myRg1", "westeurope", 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.JitNetworkAccessPoliciesList = armsecurity.JitNetworkAccessPoliciesList{ - // Value: []*armsecurity.JitNetworkAccessPolicy{ - // { - // Kind: to.Ptr("Basic"), - // Location: to.Ptr("westeurope"), - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/locations/jitNetworkAccessPolicies"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Security/locations/westeurope/jitNetworkAccessPolicies/default"), - // Properties: &armsecurity.JitNetworkAccessPolicyProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // Requests: []*armsecurity.JitNetworkAccessRequest{ - // { - // Justification: to.Ptr("testing a new version of the product"), - // Requestor: to.Ptr("barbara@contoso.com"), - // StartTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-17T08:06:45.569Z"); return t}()), - // VirtualMachines: []*armsecurity.JitNetworkAccessRequestVirtualMachine{ - // { - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1"), - // Ports: []*armsecurity.JitNetworkAccessRequestPort{ - // { - // AllowedSourceAddressPrefix: to.Ptr("192.127.0.2"), - // EndTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-17T09:06:45.569Z"); return t}()), - // Number: to.Ptr[int32](3389), - // Status: to.Ptr(armsecurity.StatusInitiated), - // StatusReason: to.Ptr(armsecurity.StatusReasonUserRequested), - // }}, - // }}, - // }}, - // VirtualMachines: []*armsecurity.JitNetworkAccessPolicyVirtualMachine{ - // { - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1"), - // Ports: []*armsecurity.JitNetworkAccessPortRule{ - // { - // AllowedSourceAddressPrefix: to.Ptr("*"), - // MaxRequestAccessDuration: to.Ptr("PT3H"), - // Number: to.Ptr[int32](22), - // Protocol: to.Ptr(armsecurity.ProtocolAll), - // }, - // { - // AllowedSourceAddressPrefix: to.Ptr("*"), - // MaxRequestAccessDuration: to.Ptr("PT3H"), - // Number: to.Ptr[int32](3389), - // Protocol: to.Ptr(armsecurity.ProtocolAll), - // }}, - // }}, - // }, - // }}, - // } - } -} - -// 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/JitNetworkAccessPolicies/GetJitNetworkAccessPolicy_example.json -func ExampleJitNetworkAccessPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewJitNetworkAccessPoliciesClient().Get(ctx, "myRg1", "westeurope", "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.JitNetworkAccessPolicy = armsecurity.JitNetworkAccessPolicy{ - // Kind: to.Ptr("Basic"), - // Location: to.Ptr("westeurope"), - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/locations/jitNetworkAccessPolicies"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Security/locations/westeurope/jitNetworkAccessPolicies/default"), - // Properties: &armsecurity.JitNetworkAccessPolicyProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // Requests: []*armsecurity.JitNetworkAccessRequest{ - // { - // Justification: to.Ptr("testing a new version of the product"), - // Requestor: to.Ptr("barbara@contoso.com"), - // StartTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-17T08:06:45.569Z"); return t}()), - // VirtualMachines: []*armsecurity.JitNetworkAccessRequestVirtualMachine{ - // { - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1"), - // Ports: []*armsecurity.JitNetworkAccessRequestPort{ - // { - // AllowedSourceAddressPrefix: to.Ptr("192.127.0.2"), - // EndTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-17T09:06:45.569Z"); return t}()), - // Number: to.Ptr[int32](3389), - // Status: to.Ptr(armsecurity.StatusInitiated), - // StatusReason: to.Ptr(armsecurity.StatusReasonUserRequested), - // }}, - // }}, - // }}, - // VirtualMachines: []*armsecurity.JitNetworkAccessPolicyVirtualMachine{ - // { - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1"), - // Ports: []*armsecurity.JitNetworkAccessPortRule{ - // { - // AllowedSourceAddressPrefix: to.Ptr("*"), - // MaxRequestAccessDuration: to.Ptr("PT3H"), - // Number: to.Ptr[int32](22), - // Protocol: to.Ptr(armsecurity.ProtocolAll), - // }, - // { - // AllowedSourceAddressPrefix: to.Ptr("*"), - // MaxRequestAccessDuration: to.Ptr("PT3H"), - // Number: to.Ptr[int32](3389), - // Protocol: to.Ptr(armsecurity.ProtocolAll), - // }}, - // }}, - // }, - // } -} - -// 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/JitNetworkAccessPolicies/CreateJitNetworkAccessPolicy_example.json -func ExampleJitNetworkAccessPoliciesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewJitNetworkAccessPoliciesClient().CreateOrUpdate(ctx, "myRg1", "westeurope", "default", armsecurity.JitNetworkAccessPolicy{ - Kind: to.Ptr("Basic"), - Location: to.Ptr("westeurope"), - Name: to.Ptr("default"), - Type: to.Ptr("Microsoft.Security/locations/jitNetworkAccessPolicies"), - ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Security/locations/westeurope/jitNetworkAccessPolicies/default"), - Properties: &armsecurity.JitNetworkAccessPolicyProperties{ - ProvisioningState: to.Ptr("Succeeded"), - Requests: []*armsecurity.JitNetworkAccessRequest{ - { - Requestor: to.Ptr("barbara@contoso.com"), - StartTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-17T08:06:45.569Z"); return t }()), - VirtualMachines: []*armsecurity.JitNetworkAccessRequestVirtualMachine{ - { - ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1"), - Ports: []*armsecurity.JitNetworkAccessRequestPort{ - { - AllowedSourceAddressPrefix: to.Ptr("192.127.0.2"), - EndTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-17T09:06:45.569Z"); return t }()), - Number: to.Ptr[int32](3389), - Status: to.Ptr(armsecurity.StatusInitiated), - StatusReason: to.Ptr(armsecurity.StatusReasonUserRequested), - }}, - }}, - }}, - VirtualMachines: []*armsecurity.JitNetworkAccessPolicyVirtualMachine{ - { - ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1"), - Ports: []*armsecurity.JitNetworkAccessPortRule{ - { - AllowedSourceAddressPrefix: to.Ptr("*"), - MaxRequestAccessDuration: to.Ptr("PT3H"), - Number: to.Ptr[int32](22), - Protocol: to.Ptr(armsecurity.ProtocolAll), - }, - { - AllowedSourceAddressPrefix: to.Ptr("*"), - MaxRequestAccessDuration: to.Ptr("PT3H"), - Number: to.Ptr[int32](3389), - Protocol: to.Ptr(armsecurity.ProtocolAll), - }}, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.JitNetworkAccessPolicy = armsecurity.JitNetworkAccessPolicy{ - // Kind: to.Ptr("Basic"), - // Location: to.Ptr("westeurope"), - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/locations/jitNetworkAccessPolicies"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Security/locations/westeurope/jitNetworkAccessPolicies/default"), - // Properties: &armsecurity.JitNetworkAccessPolicyProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // Requests: []*armsecurity.JitNetworkAccessRequest{ - // { - // Requestor: to.Ptr("barbara@contoso.com"), - // StartTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-17T08:06:45.569Z"); return t}()), - // VirtualMachines: []*armsecurity.JitNetworkAccessRequestVirtualMachine{ - // { - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1"), - // Ports: []*armsecurity.JitNetworkAccessRequestPort{ - // { - // AllowedSourceAddressPrefix: to.Ptr("192.127.0.2"), - // EndTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-17T09:06:45.569Z"); return t}()), - // Number: to.Ptr[int32](3389), - // Status: to.Ptr(armsecurity.StatusInitiated), - // StatusReason: to.Ptr(armsecurity.StatusReasonUserRequested), - // }}, - // }}, - // }}, - // VirtualMachines: []*armsecurity.JitNetworkAccessPolicyVirtualMachine{ - // { - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1"), - // Ports: []*armsecurity.JitNetworkAccessPortRule{ - // { - // AllowedSourceAddressPrefix: to.Ptr("*"), - // MaxRequestAccessDuration: to.Ptr("PT3H"), - // Number: to.Ptr[int32](22), - // Protocol: to.Ptr(armsecurity.ProtocolAll), - // }, - // { - // AllowedSourceAddressPrefix: to.Ptr("*"), - // MaxRequestAccessDuration: to.Ptr("PT3H"), - // Number: to.Ptr[int32](3389), - // Protocol: to.Ptr(armsecurity.ProtocolAll), - // }}, - // }}, - // }, - // } -} - -// 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/JitNetworkAccessPolicies/DeleteJitNetworkAccessPolicy_example.json -func ExampleJitNetworkAccessPoliciesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewJitNetworkAccessPoliciesClient().Delete(ctx, "myRg1", "westeurope", "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/InitiateJitNetworkAccessPolicy_example.json -func ExampleJitNetworkAccessPoliciesClient_Initiate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewJitNetworkAccessPoliciesClient().Initiate(ctx, "myRg1", "westeurope", "default", armsecurity.JitNetworkAccessPolicyInitiateRequest{ - Justification: to.Ptr("testing a new version of the product"), - VirtualMachines: []*armsecurity.JitNetworkAccessPolicyInitiateVirtualMachine{ - { - ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1"), - Ports: []*armsecurity.JitNetworkAccessPolicyInitiatePort{ - { - AllowedSourceAddressPrefix: to.Ptr("192.127.0.2"), - Number: to.Ptr[int32](3389), - }}, - }}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/locations_client.go b/sdk/resourcemanager/security/armsecurity/locations_client.go deleted file mode 100644 index e40a0382b534..000000000000 --- a/sdk/resourcemanager/security/armsecurity/locations_client.go +++ /dev/null @@ -1,159 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// LocationsClient contains the methods for the Locations group. -// Don't use this type directly, use NewLocationsClient() instead. -type LocationsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewLocationsClient creates a new instance of LocationsClient 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 NewLocationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LocationsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &LocationsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Details of a specific location -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2015-06-01-preview -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - options - LocationsClientGetOptions contains the optional parameters for the LocationsClient.Get method. -func (client *LocationsClient) Get(ctx context.Context, ascLocation string, options *LocationsClientGetOptions) (LocationsClientGetResponse, error) { - var err error - const operationName = "LocationsClient.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, options) - if err != nil { - return LocationsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return LocationsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return LocationsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *LocationsClient) getCreateRequest(ctx context.Context, ascLocation string, options *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") - } - 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)) - 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") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *LocationsClient) getHandleResponse(resp *http.Response) (LocationsClientGetResponse, error) { - result := LocationsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AscLocation); err != nil { - return LocationsClientGetResponse{}, err - } - return result, nil -} - -// 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. -// -// Generated from API version 2015-06-01-preview -// - options - LocationsClientListOptions contains the optional parameters for the LocationsClient.NewListPager method. -func (client *LocationsClient) NewListPager(options *LocationsClientListOptions) *runtime.Pager[LocationsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[LocationsClientListResponse]{ - More: func(page LocationsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *LocationsClientListResponse) (LocationsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "LocationsClient.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 LocationsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *LocationsClient) listCreateRequest(ctx context.Context, options *LocationsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations" - 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", "2015-06-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 *LocationsClient) listHandleResponse(resp *http.Response) (LocationsClientListResponse, error) { - result := LocationsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AscLocationList); err != nil { - return LocationsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/locations_client_example_test.go b/sdk/resourcemanager/security/armsecurity/locations_client_example_test.go deleted file mode 100644 index 2f6af02d21b2..000000000000 --- a/sdk/resourcemanager/security/armsecurity/locations_client_example_test.go +++ /dev/null @@ -1,82 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Locations/GetLocations_example.json -func ExampleLocationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLocationsClient().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.AscLocationList = armsecurity.AscLocationList{ - // Value: []*armsecurity.AscLocation{ - // { - // Name: to.Ptr("centralus"), - // Type: to.Ptr("Microsoft.Security/locations"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/locations/centralus"), - // Properties: map[string]any{ - // "homeRegionName": "centralus", - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Locations/GetLocation_example.json -func ExampleLocationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLocationsClient().Get(ctx, "centralus", 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.AscLocation = armsecurity.AscLocation{ - // Name: to.Ptr("centralus"), - // Type: to.Ptr("Microsoft.Security/locations"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/locations/centralus"), - // Properties: map[string]any{ - // "homeRegionName": "centralus", - // }, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/mdeonboardings_client.go b/sdk/resourcemanager/security/armsecurity/mdeonboardings_client.go deleted file mode 100644 index fb8963b4566d..000000000000 --- a/sdk/resourcemanager/security/armsecurity/mdeonboardings_client.go +++ /dev/null @@ -1,152 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// MdeOnboardingsClient contains the methods for the MdeOnboardings group. -// Don't use this type directly, use NewMdeOnboardingsClient() instead. -type MdeOnboardingsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewMdeOnboardingsClient creates a new instance of MdeOnboardingsClient 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 NewMdeOnboardingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MdeOnboardingsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &MdeOnboardingsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - The default configuration or data needed to onboard the machine to MDE -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-10-01-preview -// - options - MdeOnboardingsClientGetOptions contains the optional parameters for the MdeOnboardingsClient.Get method. -func (client *MdeOnboardingsClient) Get(ctx context.Context, options *MdeOnboardingsClientGetOptions) (MdeOnboardingsClientGetResponse, error) { - var err error - const operationName = "MdeOnboardingsClient.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, options) - if err != nil { - return MdeOnboardingsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MdeOnboardingsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return MdeOnboardingsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *MdeOnboardingsClient) getCreateRequest(ctx context.Context, options *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") - } - 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-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 *MdeOnboardingsClient) getHandleResponse(resp *http.Response) (MdeOnboardingsClientGetResponse, error) { - result := MdeOnboardingsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MdeOnboardingData); err != nil { - return MdeOnboardingsClientGetResponse{}, err - } - return result, nil -} - -// List - The configuration or data needed to onboard the machine to MDE -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-10-01-preview -// - options - MdeOnboardingsClientListOptions contains the optional parameters for the MdeOnboardingsClient.List method. -func (client *MdeOnboardingsClient) List(ctx context.Context, options *MdeOnboardingsClientListOptions) (MdeOnboardingsClientListResponse, error) { - var err error - const operationName = "MdeOnboardingsClient.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 MdeOnboardingsClientListResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MdeOnboardingsClientListResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return MdeOnboardingsClientListResponse{}, err - } - resp, err := client.listHandleResponse(httpResp) - return resp, err -} - -// listCreateRequest creates the List request. -func (client *MdeOnboardingsClient) listCreateRequest(ctx context.Context, options *MdeOnboardingsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings" - 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-10-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 *MdeOnboardingsClient) listHandleResponse(resp *http.Response) (MdeOnboardingsClientListResponse, error) { - result := MdeOnboardingsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MdeOnboardingDataList); err != nil { - return MdeOnboardingsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/mdeonboardings_client_example_test.go b/sdk/resourcemanager/security/armsecurity/mdeonboardings_client_example_test.go deleted file mode 100644 index 65d37bb5393f..000000000000 --- a/sdk/resourcemanager/security/armsecurity/mdeonboardings_client_example_test.go +++ /dev/null @@ -1,79 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2021-10-01-preview/examples/MdeOnboardings/ListMdeOnboardings_example.json -func ExampleMdeOnboardingsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMdeOnboardingsClient().List(ctx, 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.MdeOnboardingDataList = armsecurity.MdeOnboardingDataList{ - // Value: []*armsecurity.MdeOnboardingData{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/mdeOnboarding"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/mdeOnboarding/default"), - // Properties: &armsecurity.MdeOnboardingDataProperties{ - // OnboardingPackageLinux: []byte("QGVjaG8gb2ZmCgplY2hvLiA+TlVMIDI+JjEKZWNobyBTdGFydGluZyBXaW5kb3dzIERlZmVuZGVyIEFkdmFuY2VkIFRocmVhdCBQcm90ZWN0aW9uIG9uYm9hcmRpbmcgcHJvY2Vzcy4uLiA+TlVMIDI+JjEKZWNoby4gPk5VTCAyPiYxCgpzZXQgZXJyb3JDb2RlPTAKc2V0IGxhc3RFcnJvcj0wCnNldCAidHJvdWJsZXNob290SW5mbz1Gb3IgbW9yZSBpbmZvcm1hdGlvbiwgdmlzaXQ6IGh0dHBzOi8vZ28ubWljcm9zb2Z0LmNvbS9md2xpbmsvcC8/bGlua2lkPTgyMjgwNyIKc2V0ICJlcnJvckRlc2NyaXB0aW9uPSIKCmVjaG8gVGVzdGluZyBhZG1pbmlzdHJhdG9yIHByaXZpbGVnZXMgPk5VTCAyPiYxCgpuZXQgc2Vzc2lvbiA+TlVMIDI+JjEKaWYgJUVSUk9STEVWRUwlIE5FUSAwICgKCUBlY2hvIFNjcmlwdCBpcyBydW5uaW5nIHdpdGggaW5zdWZmaWNpZW50IHByaXZpbGVnZXMuIFBsZWFzZSBydW4gd2l0aCBhZG1pbmlzdHJhdG9yIHByaXZpbGVnZXM+ICVUTVAlXHNlbnNlVG1wLnR4dAoJc2V0IGVycm9yQ29kZT02NQogc2V0IGxhc3RFcnJvcj0lRVJST1JMRVZFTCUKCUdPVE8gRVJST1IKKQoKZWNobyBTY3JpcHQgaXMgcnVubmluZyB3aXRoIHN1ZmZpY2llbnQgcHJpdmlsZWdlcyA+TlVMIDI+JjEKZWNoby4gPk5VTCAyPiYxCmVjaG8gUGVyZm9ybWluZyBvbmJvYXJkaW5nIG9wZXJhdGlvbnMgPk5VTCAyPiYxCmVjaG8uID5OVUwgMj4mMQoKSUYgWyVQUk9DRVNTT1JfQVJDSElURVc2NDMyJV0gRVFVIFtdICgKICBzZXQgcG93ZXJzaGVsbFBhdGg9JXdpbmRpciVcU3lzdGVtMzJcV2luZG93c1Bvd2VyU2hlbGxcdjEuMFxwb3dlcnNoZWxsLmV4ZQopIEVMU0UgKAogIHNldCBwb3dlcnNoZWxsUGF0aD0ld2luZGlyJVxTeXNOYXRpdmVcV2luZG93c1Bvd2VyU2hlbGxcdjEuMFxwb3dlcnNoZWxsLmV4ZQopCgpzZXQgc2RiaW49MDEwMDA0ODA0NDAwMDAwMDU0MDAwMDAwMDAwMDAwMDAxNDAwMDAwMDAyMDAzMDAwMDIwMDAwMDAwMDAwMTQwMEZGMEYxMjAwMDEwMTAwMDAwMDAwMDAwNTEyMDAwMDAwMDAwMDE0MDBFMTA0MTIwMDAxMDEwMDAwMDAwMDAwMDUwQjAwMDAwMDAxMDIwMDAwMDAwMDAwMDUyMDAwMDAwMDIwMDIwMDAwMDEwMjAwMDAwMDAwMDAwNTIwMDAwMDAwMjAwMjAwMDAgPk5VTCAyPiYxCnJlZyBhZGQgSEtMTVxTWVNURU1cQ3VycmVudENvbnRyb2xTZXRcQ29udHJvbFxXTUlcU2VjdXJpdHkgL3YgMTRmODEzOGUtM2I2MS01ODBiLTU0NGItMjYwOTM3OGFlNDYwIC90IFJFR19CSU5BUlkgL2QgJXNkYmluJSAvZiA+TlVMIDI+JjEKcmVnIGFkZCBIS0xNXFNZU1RFTVxDdXJyZW50Q29udHJvbFNldFxDb250cm9sXFdNSVxTZWN1cml0eSAvdiBjYjJmZjcyZC1kNGU0LTU4NWQtMzNmOS1mM2EzOTVjNDBiZTcgL3QgUkVHX0JJTkFSWSAvZCAlc2RiaW4lIC9mID5OVUwgMj4mMQoKUkVHIGFkZCAiSEtMTVxTT0ZUV0FSRVxQb2xpY2llc1xNaWNyb3NvZnRcV2luZG93c1xEYXRhQ29sbGVjdGlvbiIgL3YgRGlzYWJsZUVudGVycHJpc2VBdXRoUHJveHkgL3QgUkVHX0RXT1JEIC9mIC9kIDEgPk5VTCAyPiYxCgolcG93ZXJzaGVsbFBhdGglIC1FeGVjdXRpb25Qb2xpY3kgQnlwYXNzIC1Ob1Byb2ZpbGUgLUNvbW1hbmQgIkFkZC1UeXBlICcgdXNpbmcgU3lzdGVtOyB1c2luZyBTeXN0ZW0uSU87IHVzaW5nIFN5c3RlbS5SdW50aW1lLkludGVyb3BTZXJ2aWNlczsgdXNpbmcgTWljcm9zb2Z0LldpbjMyLlNhZmVIYW5kbGVzOyB1c2luZyBTeXN0ZW0uQ29tcG9uZW50TW9kZWw7IHB1YmxpYyBzdGF0aWMgY2xhc3MgRWxhbXsgW0RsbEltcG9ydChcIktlcm5lbDMyXCIsIENoYXJTZXQ9Q2hhclNldC5BdXRvLCBTZXRMYXN0RXJyb3I9dHJ1ZSldIHB1YmxpYyBzdGF0aWMgZXh0ZXJuIGJvb2wgSW5zdGFsbEVMQU1DZXJ0aWZpY2F0ZUluZm8oU2FmZUZpbGVIYW5kbGUgaGFuZGxlKTsgcHVibGljIHN0YXRpYyB2b2lkIEluc3RhbGxXZEJvb3Qoc3RyaW5nIHBhdGgpIHsgQ29uc29sZS5PdXQuV3JpdGVMaW5lKFwiQWJvdXQgdG8gY2FsbCBjcmVhdGUgZmlsZSBvbiB7MH1cIiwgcGF0aCk7IHZhciBzdHJlYW0gPSBGaWxlLk9wZW4ocGF0aCwgRmlsZU1vZGUuT3BlbiwgRmlsZUFjY2Vzcy5SZWFkLCBGaWxlU2hhcmUuUmVhZCk7IHZhciBoYW5kbGUgPSBzdHJlYW0uU2FmZUZpbGVIYW5kbGU7IENvbnNvbGUuT3V0LldyaXRlTGluZShcIkFib3V0IHRvIGNhbGwgSW5zdGFsbEVMQU1DZXJ0aWZpY2F0ZUluZm8gb24gaGFuZGxlIHswfVwiLCBoYW5kbGUuRGFuZ2Vyb3VzR2V0SGFuZGxlKCkpOyBpZiAoIUluc3RhbGxFTEFNQ2VydGlmaWNhdGVJbmZvKGhhbmRsZSkpIHsgQ29uc29sZS5PdXQuV3JpdGVMaW5lKFwiQ2FsbCBmYWlsZWQuXCIpOyB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oTWFyc2hhbC5HZXRMYXN0V2luMzJFcnJvcigpKTsgfSBDb25zb2xlLk91dC5Xcml0ZUxpbmUoXCJDYWxsIHN1Y2Nlc3NmdWwuXCIpOyB9IH0gJzsgJGRyaXZlclBhdGggPSAkZW52OlN5c3RlbVJvb3QgKyAnXFN5c3RlbTMyXERyaXZlcnNcV2RCb290LnN5cyc7IFtFbGFtXTo6SW5zdGFsbFdkQm9vdCgkZHJpdmVyUGF0aCkgIiA+TlVMIDI+JjEKClJFRyBxdWVyeSAiSEtMTVxTT0ZUV0FSRVxQb2xpY2llc1xNaWNyb3NvZnRcV2luZG93cyBBZHZhbmNlZCBUaHJlYXQgUHJvdGVjdGlvbiIgL3YgNjk2QzFGQTEtNDAzMC00RkE0LTg3MTMtRkFGOUIyRUE3QzBBIC9yZWc6NjQgPiAlVE1QJVxzZW5zZVRtcC50eHQgMj4mMQppZiAlRVJST1JMRVZFTCUgRVFVIDAgKCAgCiAgICBSRUcgZGVsZXRlICJIS0xNXFNPRlRXQVJFXFBvbGljaWVzXE1pY3Jvc29mdFxXaW5kb3dzIEFkdmFuY2VkIFRocmVhdCBQcm90ZWN0aW9uIiAvdiA2OTZDMUZBMS00MDMwLTRGQTQtODcxMy1GQUY5QjJFQTdDMEEgL2YgPiAlVE1QJVxzZW5zZVRtcC50eHQgMj4mMQogICAgaWYgJUVSUk9STEVWRUwlIE5FUSAwICgKICAgICAgICBzZXQgImVycm9yRGVzY3JpcHRpb249VW5hYmxlIHRvIGRlbGV0ZSBwcmV2aW91cyBvZmZib2FyZGluZyBpbmZvcm1hdGlvbiBmcm9tIHJlZ2lzdHJ5LiIKICAgICAgICBzZXQgZXJyb3JDb2RlPTUKICAgICAgICBzZXQgbGFzdEVycm9yPSVFUlJPUkxFVkVMJQogICAgICAgIEdPVE8gRVJST1IKICAgICkKKQoKUkVHIGFkZCAiSEtMTVxTT0ZUV0FSRVxQb2xpY2llc1xNaWNyb3NvZnRcV2luZG93cyBBZHZhbmNlZCBUaHJlYXQgUHJvdGVjdGlvbiIgL3YgT25ib2FyZGluZ0luZm8gL3QgUkVHX1NaIC9mIC9kICJ7XCJib2R5XCI6XCJ7XFxcInByZXZpb3VzT3JnSWRzXFxcIjpbXSxcXFwib3JnSWRcXFwiOlxcXCIwMDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMGRlYWRcXFwiLFxcXCJnZW9Mb2NhdGlvblVybFxcXCI6XFxcImh0dHBzOi8vc2V2aWxsZWNsb3VkZ2F0ZXdheS1zdGcubWljcm9zb2Z0LmNvbS9cXFwiLFxcXCJkYXRhY2VudGVyXFxcIjpcXFwiRWFzdFVzMlxcXCIsXFxcInZvcnRleEdlb0xvY2F0aW9uXFxcIjpcXFwiU2FuZGJveFxcXCIsXFxcInZlcnNpb25cXFwiOlxcXCIxLjNcXFwifVwiLFwic2lnXCI6XCJKc0dGR2o3UCtIL1cvUEExcW9LTml3RXROZkU4YkhGblhxeks1SDhsQ09wc0RnRGNWTWpoT3BmQTZJTTJ3RFZadk5kWGhvZ0dEQ1FDWjNYdFJCbHRkcGFWc3pZNGtINVpHVkdnRUQxVE80ZCtCTjk2VDFSa3pOZ2NjZ2ZCWDNNQUw1bllUWXdiMGlUQUtFMGIxb3BmQmZrMzJQN3Q3b3A5dkhPeXZNMW5qdlZybVdWWWVSNk4rZFFrLzM4UDNUY2V3b2FkRmFUb3pidjBZK3dZOHgrbFcxeWN6bk1KMitQWTlxRHpabXoybE1rd0FlaDJwRTI4VW5MT0lhNjg0Y3U5RitHUlAveGhhR3dQWmpoc1JCSW51cHV5U1E2Y09YdE9kSERCQlRaZzVKSEhHMDBkNk9tUk5ONmxBelJWeFJURUVmaFFUVnN0U1poKzNMSjJTMGhmZGc9PVwiLFwic2hhMjU2c2lnXCI6XCJsVGI4ZittdkFveDRCckxPS0lqejFnTTNrRHREbG9wL21uNmZodmVEWjMvblVqb1lhNk81V2p4R0x2Z3lqZ0RtdThETkdPNUtqWWlxTVZ6Z0QzcHdqOVYwOXVOeUdYNGJUaXN0d1BnQTFLbGMrMUFLcmtWQTRGWGlQTHlST2tXdlhLM2dydFFJWU9nYjdSRlh6dzhnQlB5YlV0Z0FWbmNaMVFpdTAzblFLdGh5MFU3aXBlZUxaVE9oYVlhN001cTJxUTcya1BaSTZWUWlqSE42NVg3UTEvcm5rdUlSUkFmUEErZElIeE4wN0tpSlY2MGZsbDFZUUtOUlpSYUhKeGQ1UDd0RmdaaytEZE5mNVNXcHVaSTZTZE9MdExDN3VnbmdnK0krU2pUeUtvcVFKZElkWGRRaE5JK3I3WEM1L1M0ZlhnRVNtWmZKTUYxL0JtVlVFZUJDZlE9PVwiLFwiY2VydFwiOlwiTUlJRjVqQ0NBODZnQXdJQkFnSVRNd0FBQVkwdmh1VTl6R2x5b1FBQUFBQUJqVEFOQmdrcWhraUc5dzBCQVFzRkFEQitNUXN3Q1FZRFZRUUdFd0pWVXpFVE1CRUdBMVVFQ0JNS1YyRnphR2x1WjNSdmJqRVFNQTRHQTFVRUJ4TUhVbVZrYlc5dVpERWVNQndHQTFVRUNoTVZUV2xqY205emIyWjBJRU52Y25CdmNtRjBhVzl1TVNnd0pnWURWUVFERXg5TmFXTnliM052Wm5RZ1UyVmpkWEpsSUZObGNuWmxjaUJEUVNBeU1ERXhNQjRYRFRJd01EZ3dOakl3TlRBMU9Gb1hEVEl4TURnd05qSXdOVEExT0Zvd2dZb3hDekFKQmdOVkJBWVRBbFZUTVFzd0NRWURWUVFJRXdKWFFURVFNQTRHQTFVRUJ4TUhVbVZrYlc5dVpERWVNQndHQTFVRUNoTVZUV2xqY205emIyWjBJRU52Y25CdmNtRjBhVzl1TVI0d0hBWURWUVFMRXhWTmFXTnliM052Wm5RZ1EyOXljRzl5WVhScGIyNHhIREFhQmdOVkJBTVRFMU5sZG1sc2JHVXVWMmx1Wkc5M2N5NWpiMjB3Z2dFaU1BMEdDU3FHU0liM0RRRUJBUVVBQTRJQkR3QXdnZ0VLQW9JQkFRRENmcWtCcmV1Um1qdm90bDFFdURQWVplaVc1dUVERmV6MXhsYmh6cjVaa1BjSUJYT3RIMVZWRjRaUmVrdTFpK3ZMbTNON2xkVGl4c2RSZW0yU09iVkFGb1dDbjZ2cEYwL1ZYcWpmUTJHbyt2dk9UU1Q0Si9pQWxocXhialVVbkRyWFpXYUMvS2xtU0lYMjlHUng5bG1pT0IrWVBhRzlOTEE1U3F3emNad2hjTThzS3F0VDhHaWQ3Q3JFNGs1WldES0gyL1dPVTVsQ01iZTY2MWtrbWxKZDB2TlBDTXpyMUgzVmNmRG1qVVo4Q25WQzBFODlhVVA3VHhhME1uS0FzVFArQkpCNXJMenhkVlJRbGRNbmhHVXNXRU0ydUNOWXFOdWc4QWYrTGp3RytySXZrSVR3NVlDMUZDZy9qVHBvdHJnSFhmSGRqaURqa0F3ZWY1TlVkTmx0QWdNQkFBR2pnZ0ZPTUlJQlNqQU9CZ05WSFE4QkFmOEVCQU1DQjRBd0V3WURWUjBsQkF3d0NnWUlLd1lCQlFVSEF3RXdIUVlEVlIwT0JCWUVGT0U1NVFoeno5bEhuWTl2aDVTWmtyMTdjbEtzTUI0R0ExVWRFUVFYTUJXQ0UxTmxkbWxzYkdVdVYybHVaRzkzY3k1amIyMHdId1lEVlIwakJCZ3dGb0FVTmxhSlpVbkxXNXN2UEt4Q0ZsQk5rYmt6MTVFd1V3WURWUjBmQkV3d1NqQklvRWFnUklaQ2FIUjBjRG92TDNkM2R5NXRhV055YjNOdlpuUXVZMjl0TDNCcmFXOXdjeTlqY213dlRXbGpVMlZqVTJWeVEwRXlNREV4WHpJd01URXRNVEF0TVRndVkzSnNNR0FHQ0NzR0FRVUZCd0VCQkZRd1VqQlFCZ2dyQmdFRkJRY3dBb1pFYUhSMGNEb3ZMM2QzZHk1dGFXTnliM052Wm5RdVkyOXRMM0JyYVc5d2N5OWpaWEowY3k5TmFXTlRaV05UWlhKRFFUSXdNVEZmTWpBeE1TMHhNQzB4T0M1amNuUXdEQVlEVlIwVEFRSC9CQUl3QURBTkJna3Foa2lHOXcwQkFRc0ZBQU9DQWdFQVp3ZGxhWjg4U3BURFdUUjc5NWRHV2N0dUxUWmc2UDBqYmh4Q0dhOXBnb3AzSXZ1Qi9QYzJXT2Ruc1ZCYUpUZG5WN3NvcFZHa3V4Vjc1eWk2Q0NQM2sxNG0xQ1FhNk01cmNodmJuVEY0TFdjWld4U1g4Z0hjRWhObFdYV3hxU3FKMzNnSHVGNEc5SCs3VDM3UlNMb2Jqb1MyeVRhc21SRWtCNTI4b1gwWVU0cVpjeVdyK0xEMVovQk10dEhMUlZUZUtHdnpMaVpCNmhqWURybW9qUUxKZXZwSEdoTVdOTU9oR2RLd2pOS0crZGhVRHV6dTdsVXgwZzdhaUR3c1l4NzFTaU9ucDJWOSt5UEhET2R5OXlBRUNPb0N3bUprbW5qLzlDMmVNMDFDQjFZMUxTWHNiQUJtQVd3Si9iczhRNnhTWlJtSnkyRXJSQ3VTakl0MUQydzRTUFVMRFNNVTdIaDk3TWJpQVJDV25TMVRRMGg5azZFWVVmbW1ZaFNHQ0p3MXFlekFqZ2FmTngyYWcrRDhzRFFkQzRjVHhUSTk5aGthUm1DakFmeW1qcVdscUx5V0pCUmdvaXdTd21MVDFUbzRJNUVjZHFoQ1FNdEpoRVVRR2dpenk2ZUE2RlhtNHhmeExua08xSkNKSGJUejlqL2c4OW5zZ0hVN2V4SDVnZHhZQ0FDMGJkUlZLN1YrVlBDcExnLy9SemtlNm9mc1Y3WkxyQUpvN0EyQTZka0dVL09XeGhpVjJiY0VlUEpmSWsrVjM3UHp3c25yZ1JFV2RpM1pic3dBOU5aTTVzZGVSMFlFRm11bit0b2JCRGMzMlRidlVyTUpTb2tjcG9XNnRZczlkR0tUcE1GV01EZ09UeEZjSHljbHZrMjRVQVV2dXk2WVcvSVN2VlY4a3BRPVwiLFwiY2hhaW5cIjpbXCJNSUlHMkRDQ0JNQ2dBd0lCQWdJS1lUKzNHQUFBQUFBQUJEQU5CZ2txaGtpRzl3MEJBUXNGQURDQmlERUxNQWtHQTFVRUJoTUNWVk14RXpBUkJnTlZCQWdUQ2xkaGMyaHBibWQwYjI0eEVEQU9CZ05WQkFjVEIxSmxaRzF2Ym1ReEhqQWNCZ05WQkFvVEZVMXBZM0p2YzI5bWRDQkRiM0p3YjNKaGRHbHZiakV5TURBR0ExVUVBeE1wVFdsamNtOXpiMlowSUZKdmIzUWdRMlZ5ZEdsbWFXTmhkR1VnUVhWMGFHOXlhWFI1SURJd01URXdIaGNOTVRFeE1ERTRNakkxTlRFNVdoY05Nall4TURFNE1qTXdOVEU1V2pCK01Rc3dDUVlEVlFRR0V3SlZVekVUTUJFR0ExVUVDQk1LVjJGemFHbHVaM1J2YmpFUU1BNEdBMVVFQnhNSFVtVmtiVzl1WkRFZU1Cd0dBMVVFQ2hNVlRXbGpjbTl6YjJaMElFTnZjbkJ2Y21GMGFXOXVNU2d3SmdZRFZRUURFeDlOYVdOeWIzTnZablFnVTJWamRYSmxJRk5sY25abGNpQkRRU0F5TURFeE1JSUNJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBZzhBTUlJQ0NnS0NBZ0VBMEF2QXBLZ1pnZUkyNWVLcTVmT3lGVmgxdnJUbFNmSGdoUG03RFdUdmhjR0JWYmp6NS9GdFFGVTl6b3RxMFlTVDlYVjhXNlRVZEJES012TWowNjd1ejU0RVdNTFpSOHZSZkFCQlNIRWJBV2NYR0svRy9uTURmdVR2UTV6dkFYRXFINEVtUTNlWVZGZHpuVlVyOEo2T2ZRWU9yQnRVOHliMytDTUlJb3VlQmgwM09QMXkwc3JsWThHYVduMnliYk5TcVc3cHJyWDhpemI1bnZyMkhGZ2JsMWFsRWVXM1V0dTc2ZkJVdjdUL0xHeTRYU2JPb0FyWDM1UHRmOTJzOFN4ekd0a1pOMVc2M1NKNGpxSFVtd240QnlJeGNiQ1VydUN3NXlaRVY1Q0JseFhPWWV4bDRrdnhoVklXTXZpMWVLcCt6VTNzZ3lHa3FKdSttbW9FNEtNY3pWWVliUDFyTDBJKzRqZnljcXZRZUhOeWU5N3NBRmpsSVRDakNEcVo3NS9EOTNvV2xtVzF3NEd2OURsd1NhLzJxZlpxQURqNXRBZ1o0Qm8xcFZaMklsOXE4bW11UHExWVJrMjRWUGFKUVVRZWNyRzhFaWRUMHNIL3NzMVFtQjYxOUx1MndvSTUyYXdiOGpzbmhHcXd4aVlMMXpvUTU3UGJmTk5XckZOTUMvbzdNVGQwMkZrcitRQjVHUVo3L1J3ZFF0UkJEUzhGRHRWclNTUC96ODM0ZW9MUDJqd3QzK2pZRWdRWXVoNklkN2lZSHhBSHU4Z0ZmZ3NKdjJ2ZDQwNWJzUG5IaEtZN3lreWZXMklwOThlaXFKV0ljQ3psd1Q4OFVpTlBRSnJETVlXREw3OHA4UjFRanlHV0I4N3Y4b0RDUkgyYll1OHZ3M2VKcTBWTlV6NENlZE1DQXdFQUFhT0NBVXN3Z2dGSE1CQUdDU3NHQVFRQmdqY1ZBUVFEQWdFQU1CMEdBMVVkRGdRV0JCUTJWb2xsU2N0Ym15ODhyRUlXVUUyUnVUUFhrVEFaQmdrckJnRUVBWUkzRkFJRURCNEtBRk1BZFFCaUFFTUFRVEFMQmdOVkhROEVCQU1DQVlZd0R3WURWUjBUQVFIL0JBVXdBd0VCL3pBZkJnTlZIU01FR0RBV2dCUnlMVG9DTVpCRHVSUUZUdUhxcDhjeDBTT0pOREJhQmdOVkhSOEVVekJSTUUrZ1RhQkxoa2xvZEhSd09pOHZZM0pzTG0xcFkzSnZjMjltZEM1amIyMHZjR3RwTDJOeWJDOXdjbTlrZFdOMGN5OU5hV05TYjI5RFpYSkJkWFF5TURFeFh6SXdNVEZmTUROZk1qSXVZM0pzTUY0R0NDc0dBUVVGQndFQkJGSXdVREJPQmdnckJnRUZCUWN3QW9aQ2FIUjBjRG92TDNkM2R5NXRhV055YjNOdlpuUXVZMjl0TDNCcmFTOWpaWEowY3k5TmFXTlNiMjlEWlhKQmRYUXlNREV4WHpJd01URmZNRE5mTWpJdVkzSjBNQTBHQ1NxR1NJYjNEUUVCQ3dVQUE0SUNBUUJCeUdIQjlWdWVQcEV4OGJER3Z3a0J0SjIya0hUWENkdW1MZzJmeU9kMk5FYXZCMkNKVElHelBOWDBFalYxd25PbDlVMkVqTXVrWGErL2t2WVhDRmRDbFhKbEJYWjVyZTdSdXJndVZLTlJCNnhvNnlFTTR5V0J3czBxOHNQL3o4SzlTUmlheC9DRXhma1V2R3VWNVpidnMwTFNVOVZLb0JMRXJoSjJVd2xXRHAzMzA2WkppRkR5aWl5WElLSytUbmp2QldXM1M2RVdpTjR4eHdoQ0pIeWtlNTZkdkdBQVhtS1g0NVA4cC81YmV5WGY1Rk4vUzc3bVB2RGJBWGxDSEc2RmJIMjJSREQ3cFRlU2s3S2w3aUN0UDFQVnlmUW9hMWZCK0IxcXQxWXF0aWVCSEtZdG4rZjAwREdEbDZncXRxeStHMEgxNUlsZlZ2dmFXdE5lZlZXVUVINVRWL1JLUFVBcXlMMW5uNFRoRU83OTJtc1Zna244UmgzL1JRWjBuRUlVN2NVNTA3UE5DNE1ua0VOUmt2SkVncTV1bWhVWHNobjZ4MFZzbUFGN3Z6ZXBzSWlra3J3NE9PQWQ1SHlYbUJvdVgrODRaYmMxTDcxL1R5SDZ4SXpTYndiNVNUWHEzeUFQSmFycVlLc3NIMHVKL0xmNlhGU1FTejZpS0U5czVGSmx3ZjJRSElXQ2lHN3BwbFhkSVNoNVJiQVU1UXJNNWwvRXU5dGhOR21mckNZNDk4RXBRUWdWTGt5Zzkva01QdDVmcXdnSkxZT3NyRFNEWXZUSlNVS0pKYlZ1c2tmRnN6bWdzU0FiTExHT0JHK2xNRWtjMEVicFFGdjByVzY2MjRKS2h4SktnQWxOMjk5MnVRVmJHK0M3SUhCZkFDWEgwdzc2RnExN0lwNXhDQT09XCIsXCJNSUlGN1RDQ0E5V2dBd0lCQWdJUVA0dkl0Znlmc3BaRHRXbldiRUxoUkRBTkJna3Foa2lHOXcwQkFRc0ZBRENCaURFTE1Ba0dBMVVFQmhNQ1ZWTXhFekFSQmdOVkJBZ1RDbGRoYzJocGJtZDBiMjR4RURBT0JnTlZCQWNUQjFKbFpHMXZibVF4SGpBY0JnTlZCQW9URlUxcFkzSnZjMjltZENCRGIzSndiM0poZEdsdmJqRXlNREFHQTFVRUF4TXBUV2xqY205emIyWjBJRkp2YjNRZ1EyVnlkR2xtYVdOaGRHVWdRWFYwYUc5eWFYUjVJREl3TVRFd0hoY05NVEV3TXpJeU1qSXdOVEk0V2hjTk16WXdNekl5TWpJeE16QTBXakNCaURFTE1Ba0dBMVVFQmhNQ1ZWTXhFekFSQmdOVkJBZ1RDbGRoYzJocGJtZDBiMjR4RURBT0JnTlZCQWNUQjFKbFpHMXZibVF4SGpBY0JnTlZCQW9URlUxcFkzSnZjMjltZENCRGIzSndiM0poZEdsdmJqRXlNREFHQTFVRUF4TXBUV2xqY205emIyWjBJRkp2YjNRZ1EyVnlkR2xtYVdOaGRHVWdRWFYwYUc5eWFYUjVJREl3TVRFd2dnSWlNQTBHQ1NxR1NJYjNEUUVCQVFVQUE0SUNEd0F3Z2dJS0FvSUNBUUN5Z0VHcU5UaE5FM0l5YUNKTnVMTHgvOVZTdkd6SDlkSktqRGJ1MGNKY2ZveUtycThUS0cvQWMrTTZ6dEFscUZvNmJlK291Rm1yRXlOb3pRd3BoOUZ2Z0Z5UFJIOWRrQUZTV0t4UnhWOHFoOXpjMkFvZHdRTzVlN0JXNktQZVpHSENudmp6Zkxuc0RiVlUva3kyWlUrSThKeEltUXhDQ3dsOE1Wa1hlUVo0S0kySk9rd0RKYjV4YWx3TDU0UmdwSmtpNDlLdmhLU24rOUdZN1F5cDNwU0o0UTZnM01ET21UM3FDRks3Vm5ua0g0UzZIcmkweEVsY1R6RkxoOTNkQldjbW1ZRGdjUkdqdUtWQjRxUlR1ZmN5S1lNTUU3ODJYZ1N6UzBOSEwydmlrUjdUbUUvZFFnZkk2QjBTL0ptcGF6NlNmc2pXYVRyOFpMMjJDWjNLL1F3TG9wdDNZRXNEbEtRd2FSTFdRaTNCUVV6SzNLcjlqMXVEUnByWi9MSFI0N1BKZjBoNnpTVHdRWTljZE5Dc3NCQWdCa20zeHkwaHlGZmowSWJ6QTJqNzBNNXh3WW1aU21RQmJQM3NNSkhQUVR5U3grVzZoaDFoaE1kZmd6bGlyclNTTDBmekMvaFY2NkFmV2RDN2RKc2UwSGJtOHVrRzF4RG8rbVRlYWNZMWxvZ0M4RWE0UHllWmI4dHhpU2sxOTBnV0FqV1AxWGw4VFFMUFgrdUtnMDlGY1lqNXFRMU9jdW5DbkFmUFNSdE9CQTVqVVl4ZTJBREJWU3kyeHVEQ1pVN0pORG4xbkxQRWZ1aGhiaE5mRmNSZjJYN3RIYzd1Uk96TExvYXg3RGoyY08yclhCUEIyUThOeDRDeVZlMDA5NnliNU1QYTUwYzhwcldQTWQvRlM2L3I4UUlEQVFBQm8xRXdUekFMQmdOVkhROEVCQU1DQVlZd0R3WURWUjBUQVFIL0JBVXdBd0VCL3pBZEJnTlZIUTRFRmdRVWNpMDZBakdRUTdrVUJVN2g2cWZITWRFamlUUXdFQVlKS3dZQkJBR0NOeFVCQkFNQ0FRQXdEUVlKS29aSWh2Y05BUUVMQlFBRGdnSUJBSDl5encrM3hSWGJtOEJKeWlaYi9wNFQ1dFB3MHR1WFgvSkxQMDJ6cmhtdTdkZVhvS3p2cVRxandrR3c1YmlSbmhPQkpBUG1DZjAvVjBBNUlTUlcwUkF2UzBDcE5vWkx0Rk5YbXZ2eGZvbVBFZjRZYkZHcTZPMEpsYlhsY2NtaDZZZDFwaFYveVg0M1ZGNTBrOFhEWjh3TlQydW9Gd3h0Q0pKK2k5MkJxaTF3SWNNOUJoUzd2eVJlcDRUWFB3OGhJcjFMQUFiYmx4ellYdFRGQzF5SGJsQ2s2TU00cFB2TExNV1NacHVGWHN0NmJKTjhnQ2xZVzFlMVFHbTZDSG1tWkdJVm5ZZVdSYlZtSXlBRGl4eHpvTk9pZVRQZ1VGbUcyeS9sQWlYcWN5cWZBQlRJTnNlU08rbE9BT3pZVmdtNU0wa1MwbFFMQWF1c1I3YVJLWDFNdEhXQVVnSG95b0wybjh5c25JOFg2aThtc0t0eXJBditubEVleDBOVlowOVJzMWZXdHV6dVVyYzY2VTdoMTRHSXZFK09kYnRMcVBBMXFpYlVaMmRKc25CTU81UGNIZDk0a0laeXNqaWswZHlTVGNsWTZ5c1NYTlE3cm94cnNJUGxBVC80Q1RMMmt6VTBJcS9kTncxM0NZQXJ6VWdBOFl5WkdVY0ZBZW5SdjlGTzBPWW9RemVacEFwS0NObWFjWFBTcXMweEUyTjJvVGR2a2pnZWZSSThaakxueTIzaC9GS0ozY3JXWmdXYWxtRytvaWpISEtPbk5sQThPcVRmU203bWh6dk82L0RnZ1RlZEV6eFNqcjI1SFRUR0hkVUthajJZS1hDTWlTclJxNElRU0IvYzlPK2x4YnRWR2poamhFNjNiSzJWVk94bEloQkpGN2pBSHNjUHJGUkhcIl19IiA+ICVUTVAlXHNlbnNlVG1wLnR4dCAyPiYxCmlmICVFUlJPUkxFVkVMJSBORVEgMCAoCiAgIHNldCAiZXJyb3JEZXNjcmlwdGlvbj1VbmFibGUgdG8gd3JpdGUgb25ib2FyZGluZyBpbmZvcm1hdGlvbiB0byByZWdpc3RyeS4iCiAgIHNldCBlcnJvckNvZGU9MTAKICAgc2V0IGxhc3RFcnJvcj0lRVJST1JMRVZFTCUKICAgR09UTyBFUlJPUgopCgplY2hvIFN0YXJ0aW5nIHRoZSBzZXJ2aWNlLCBpZiBub3QgYWxyZWFkeSBydW5uaW5nID5OVUwgMj4mMQplY2hvLiA+TlVMIDI+JjEKc2MgcXVlcnkgIlNFTlNFIiB8IGZpbmQgL2kgIlJVTk5JTkciID5OVUwgMj4mMQppZiAlRVJST1JMRVZFTCUgRVFVIDAgR09UTyBSVU5OSU5HCgpuZXQgc3RhcnQgc2Vuc2UgPiAlVE1QJVxzZW5zZVRtcC50eHQgMj4mMQppZiAlRVJST1JMRVZFTCUgTkVRIDAgKAogICBlY2hvIFdpbmRvd3MgRGVmZW5kZXIgQWR2YW5jZWQgVGhyZWF0IFByb3RlY3Rpb24gU2VydmljZSBoYXMgbm90IHN0YXJ0ZWQgeWV0ID5OVUwgMj4mMQogICBHT1RPIFdBSVRfRk9SX1RIRV9TRVJWSUNFX1RPX1NUQVJUCikKZ290byBTVUNDRUVERUQKCjpSVU5OSU5HCnNldCAicnVubmluZ091dHB1dD1UaGUgV2luZG93cyBEZWZlbmRlciBBZHZhbmNlZCBUaHJlYXQgUHJvdGVjdGlvbiBTZXJ2aWNlIGlzIGFscmVhZHkgcnVubmluZyEiCmVjaG8gJXJ1bm5pbmdPdXRwdXQlID5OVUwgMj4mMQplY2hvLiA+TlVMIDI+JjEKZXZlbnRjcmVhdGUgL2wgQXBwbGljYXRpb24gL3NvIFdEQVRQT25ib2FyZGluZyAvdCBJbmZvcm1hdGlvbiAvaWQgMTAgL2QgIiVydW5uaW5nT3V0cHV0JSIgPk5VTCAyPiYxCkdPVE8gV0FJVF9GT1JfVEhFX1NFUlZJQ0VfVE9fU1RBUlQKCjpFUlJPUgpTZXQgL1AgZXJyb3JNc2c9PCVUTVAlXHNlbnNlVG1wLnR4dApzZXQgImVycm9yT3V0cHV0PVtFcnJvciBJZDogJWVycm9yQ29kZSUsIEVycm9yIExldmVsOiAlbGFzdEVycm9yJV0gJWVycm9yRGVzY3JpcHRpb24lIEVycm9yIG1lc3NhZ2U6ICVlcnJvck1zZyUiCiVwb3dlcnNoZWxsUGF0aCUgLUV4ZWN1dGlvblBvbGljeSBCeXBhc3MgLU5vUHJvZmlsZSAtQ29tbWFuZCAiQWRkLVR5cGUgJ3VzaW5nIFN5c3RlbTsgdXNpbmcgU3lzdGVtLkRpYWdub3N0aWNzOyB1c2luZyBTeXN0ZW0uRGlhZ25vc3RpY3MuVHJhY2luZzsgbmFtZXNwYWNlIFNlbnNlIHsgW0V2ZW50RGF0YShOYW1lID0gXCJPbmJvYXJkaW5nXCIpXXB1YmxpYyBzdHJ1Y3QgT25ib2FyZGluZ3twdWJsaWMgc3RyaW5nIE1lc3NhZ2UgeyBnZXQ7IHNldDsgfX0gcHVibGljIGNsYXNzIFRyYWNlIHtwdWJsaWMgc3RhdGljIEV2ZW50U291cmNlT3B0aW9ucyBUZWxlbWV0cnlDcml0aWNhbE9wdGlvbiA9IG5ldyBFdmVudFNvdXJjZU9wdGlvbnMoKXtMZXZlbCA9IEV2ZW50TGV2ZWwuRXJyb3IsIEtleXdvcmRzID0gKEV2ZW50S2V5d29yZHMpMHgwMDAwMjAwMDAwMDAwMDAwLCBUYWdzID0gKEV2ZW50VGFncykweDAyMDAwMDB9OyBwdWJsaWMgdm9pZCBXcml0ZU9uYm9hcmRpbmdNZXNzYWdlKHN0cmluZyBtZXNzYWdlKXtlcy5Xcml0ZShcIk9uYm9hcmRpbmdTY3JpcHRcIiwgVGVsZW1ldHJ5Q3JpdGljYWxPcHRpb24sIG5ldyBPbmJvYXJkaW5nIHtNZXNzYWdlID0gbWVzc2FnZX0pO30gcHJpdmF0ZSBzdGF0aWMgcmVhZG9ubHkgc3RyaW5nW10gdGVsZW1ldHJ5VHJhaXRzID0geyBcIkVUV19HUk9VUFwiLCBcIns1RUNCMEJBQy1COTMwLTQ3RjUtQThBNC1FODI1MzUyOUVEQjd9XCIgfTsgcHJpdmF0ZSBFdmVudFNvdXJjZSBlcyA9IG5ldyBFdmVudFNvdXJjZShcIk1pY3Jvc29mdC5XaW5kb3dzLlNlbnNlLkNsaWVudC5NYW5hZ2VtZW50XCIsRXZlbnRTb3VyY2VTZXR0aW5ncy5FdHdTZWxmRGVzY3JpYmluZ0V2ZW50Rm9ybWF0LHRlbGVtZXRyeVRyYWl0cyk7fX0nOyAkbG9nZ2VyID0gTmV3LU9iamVjdCAtVHlwZU5hbWUgU2Vuc2UuVHJhY2U7ICRsb2dnZXIuV3JpdGVPbmJvYXJkaW5nTWVzc2FnZSgnJWVycm9yT3V0cHV0JScpIiA+TlVMIDI+JjEKZWNobyAlZXJyb3JPdXRwdXQlID5OVUwgMj4mMQplY2hvLiA+TlVMIDI+JjEKZXZlbnRjcmVhdGUgL2wgQXBwbGljYXRpb24gL3NvIFdEQVRQT25ib2FyZGluZyAvdCBFcnJvciAvaWQgJWVycm9yQ29kZSUgL2QgIiVlcnJvck91dHB1dCUiID5OVUwgMj4mMQpHT1RPIENMRUFOVVAKCjpTVUNDRUVERUQKZWNobyBGaW5pc2hlZCBwZXJmb3JtaW5nIG9uYm9hcmRpbmcgb3BlcmF0aW9ucyA+TlVMIDI+JjEKZWNoby4gPk5VTCAyPiYxCkdPVE8gV0FJVF9GT1JfVEhFX1NFUlZJQ0VfVE9fU1RBUlQKCjpXQUlUX0ZPUl9USEVfU0VSVklDRV9UT19TVEFSVAplY2hvIFdhaXRpbmcgZm9yIHRoZSBzZXJ2aWNlIHRvIHN0YXJ0ID5OVUwgMj4mMQplY2hvLiA+TlVMIDI+JjEKCnNldCAvYSBjb3VudGVyPTAKCjpTRU5TRV9SVU5OSU5HX1dBSVQKc2MgcXVlcnkgIlNFTlNFIiB8IGZpbmQgL2kgIlJVTk5JTkciID5OVUwgMj4mMQppZiAlRVJST1JMRVZFTCUgTkVRIDAgKAoJSUYgJWNvdW50ZXIlIEVRVSA0ICgKCQlzZXQgImVycm9yRGVzY3JpcHRpb249VW5hYmxlIHRvIHN0YXJ0IFdpbmRvd3MgRGVmZW5kZXIgQWR2YW5jZWQgVGhyZWF0IFByb3RlY3Rpb24gU2VydmljZS4iCgkJc2V0IGVycm9yQ29kZT0xNQoJCXNldCBsYXN0RXJyb3I9JUVSUk9STEVWRUwlCgkJR09UTyBFUlJPUgoJKQoKCXNldCAvYSBjb3VudGVyPSVjb3VudGVyJSsxCgoJdGltZW91dCA1ID5OVUwgMj4mMQoJR09UTyA6U0VOU0VfUlVOTklOR19XQUlUCikKCnNldCAvYSBjb3VudGVyPTAKCjpTRU5TRV9PTkJPQVJERURfU1RBVFVTX1dBSVQKUkVHIHF1ZXJ5ICJIS0xNXFNPRlRXQVJFXE1pY3Jvc29mdFxXaW5kb3dzIEFkdmFuY2VkIFRocmVhdCBQcm90ZWN0aW9uXFN0YXR1cyIgL3YgT25ib2FyZGluZ1N0YXRlIC9yZWc6NjQgPk5VTCAyPiYxCmlmICVFUlJPUkxFVkVMJSBORVEgMCAoCglJRiAlY291bnRlciUgRVFVIDQgKAoJCUBlY2hvIFdpbmRvd3MgRGVmZW5kZXIgQWR2YW5jZWQgVGhyZWF0IFByb3RlY3Rpb24gU2VydmljZSBpcyBub3QgcnVubmluZyBhcyBleHBlY3RlZD4gJVRNUCVcc2Vuc2VUbXAudHh0CgkJc2V0IGVycm9yQ29kZT0zNQogICAgIHNldCBsYXN0RXJyb3I9JUVSUk9STEVWRUwlCgkJR09UTyBFUlJPUgoJKQoKCXNldCAvYSBjb3VudGVyPSVjb3VudGVyJSsxCgoJdGltZW91dCA1ID5OVUwgMj4mMQoJR09UTyA6U0VOU0VfT05CT0FSREVEX1NUQVRVU19XQUlUCikKCnNldCAvYSBjb3VudGVyPTAKCjpTRU5TRV9PTkJPQVJERURfV0FJVApSRUcgcXVlcnkgIkhLTE1cU09GVFdBUkVcTWljcm9zb2Z0XFdpbmRvd3MgQWR2YW5jZWQgVGhyZWF0IFByb3RlY3Rpb25cU3RhdHVzIiAvdiBPbmJvYXJkaW5nU3RhdGUgL3JlZzo2NCB8IGZpbmQgL2kgIjB4MSIgPk5VTCAyPiYxCmlmICVFUlJPUkxFVkVMJSBORVEgMCAoCglJRiAlY291bnRlciUgRVFVIDQgKAoJCUBlY2hvIFdpbmRvd3MgRGVmZW5kZXIgQWR2YW5jZWQgVGhyZWF0IFByb3RlY3Rpb24gU2VydmljZSBpcyBub3QgcnVubmluZyBhcyBleHBlY3RlZD4gJVRNUCVcc2Vuc2VUbXAudHh0CgkJc2V0IGVycm9yQ29kZT00MAogICAgIHNldCBsYXN0RXJyb3I9JUVSUk9STEVWRUwlCgkJR09UTyBFUlJPUgoJKQoKCXNldCAvYSBjb3VudGVyPSVjb3VudGVyJSsxCgoJdGltZW91dCA1ID5OVUwgMj4mMQoJR09UTyA6U0VOU0VfT05CT0FSREVEX1dBSVQKKQoKc2V0ICJzdWNjZXNzT3V0cHV0PVN1Y2Nlc3NmdWxseSBvbmJvYXJkZWQgbWFjaGluZSB0byBXaW5kb3dzIERlZmVuZGVyIEFkdmFuY2VkIFRocmVhdCBQcm90ZWN0aW9uIgplY2hvICVzdWNjZXNzT3V0cHV0JSA+TlVMIDI+JjEKZWNoby4KZXZlbnRjcmVhdGUgL2wgQXBwbGljYXRpb24gL3NvIFdEQVRQT25ib2FyZGluZyAvdCBJbmZvcm1hdGlvbiAvaWQgMjAgL2QgIiVzdWNjZXNzT3V0cHV0JSIgPk5VTCAyPiYxCiVwb3dlcnNoZWxsUGF0aCUgLUV4ZWN1dGlvblBvbGljeSBCeXBhc3MgLU5vUHJvZmlsZSAtQ29tbWFuZCAiQWRkLVR5cGUgJ3VzaW5nIFN5c3RlbTsgdXNpbmcgU3lzdGVtLkRpYWdub3N0aWNzOyB1c2luZyBTeXN0ZW0uRGlhZ25vc3RpY3MuVHJhY2luZzsgbmFtZXNwYWNlIFNlbnNlIHsgW0V2ZW50RGF0YShOYW1lID0gXCJPbmJvYXJkaW5nXCIpXXB1YmxpYyBzdHJ1Y3QgT25ib2FyZGluZ3twdWJsaWMgc3RyaW5nIE1lc3NhZ2UgeyBnZXQ7IHNldDsgfX0gcHVibGljIGNsYXNzIFRyYWNlIHtwdWJsaWMgc3RhdGljIEV2ZW50U291cmNlT3B0aW9ucyBUZWxlbWV0cnlDcml0aWNhbE9wdGlvbiA9IG5ldyBFdmVudFNvdXJjZU9wdGlvbnMoKXtMZXZlbCA9IEV2ZW50TGV2ZWwuSW5mb3JtYXRpb25hbCwgS2V5d29yZHMgPSAoRXZlbnRLZXl3b3JkcykweDAwMDAyMDAwMDAwMDAwMDAsIFRhZ3MgPSAoRXZlbnRUYWdzKTB4MDIwMDAwMH07IHB1YmxpYyB2b2lkIFdyaXRlT25ib2FyZGluZ01lc3NhZ2Uoc3RyaW5nIG1lc3NhZ2Upe2VzLldyaXRlKFwiT25ib2FyZGluZ1NjcmlwdFwiLCBUZWxlbWV0cnlDcml0aWNhbE9wdGlvbiwgbmV3IE9uYm9hcmRpbmcge01lc3NhZ2UgPSBtZXNzYWdlfSk7fSBwcml2YXRlIHN0YXRpYyByZWFkb25seSBzdHJpbmdbXSB0ZWxlbWV0cnlUcmFpdHMgPSB7IFwiRVRXX0dST1VQXCIsIFwiezVFQ0IwQkFDLUI5MzAtNDdGNS1BOEE0LUU4MjUzNTI5RURCN31cIiB9OyBwcml2YXRlIEV2ZW50U291cmNlIGVzID0gbmV3IEV2ZW50U291cmNlKFwiTWljcm9zb2Z0LldpbmRvd3MuU2Vuc2UuQ2xpZW50Lk1hbmFnZW1lbnRcIixFdmVudFNvdXJjZVNldHRpbmdzLkV0d1NlbGZEZXNjcmliaW5nRXZlbnRGb3JtYXQsdGVsZW1ldHJ5VHJhaXRzKTt9fSc7ICRsb2dnZXIgPSBOZXctT2JqZWN0IC1UeXBlTmFtZSBTZW5zZS5UcmFjZTsgJGxvZ2dlci5Xcml0ZU9uYm9hcmRpbmdNZXNzYWdlKCclc3VjY2Vzc091dHB1dCUnKSIgPk5VTCAyPiYxCiIlUFJPR1JBTUZJTEVTJVxXaW5kb3dzIERlZmVuZGVyXE1wQ21kUnVuLmV4ZSIgLVJlbG9hZEVuZ2luZSA+TlVMIDI+JjEKCkdPVE8gQ0xFQU5VUAoKOkNMRUFOVVAKaWYgZXhpc3QgJVRNUCVcc2Vuc2VUbXAudHh0IGRlbCAlVE1QJVxzZW5zZVRtcC50eHQKRVhJVCAvQiAlZXJyb3JDb2RlJQo=="), - // OnboardingPackageWindows: []byte("QGVjaG8gb2ZmCgplY2hvLiA+TlVMIDI+JjEKZWNobyBTdGFydGluZyBXaW5kb3dzIERlZmVuZGVyIEFkdmFuY2VkIFRocmVhdCBQcm90ZWN0aW9uIG9uYm9hcmRpbmcgcHJvY2Vzcy4uLiA+TlVMIDI+JjEKZWNoby4gPk5VTCAyPiYxCgpzZXQgZXJyb3JDb2RlPTAKc2V0IGxhc3RFcnJvcj0wCnNldCAidHJvdWJsZXNob290SW5mbz1Gb3IgbW9yZSBpbmZvcm1hdGlvbiwgdmlzaXQ6IGh0dHBzOi8vZ28ubWljcm9zb2Z0LmNvbS9md2xpbmsvcC8/bGlua2lkPTgyMjgwNyIKc2V0ICJlcnJvckRlc2NyaXB0aW9uPSIKCmVjaG8gVGVzdGluZyBhZG1pbmlzdHJhdG9yIHByaXZpbGVnZXMgPk5VTCAyPiYxCgpuZXQgc2Vzc2lvbiA+TlVMIDI+JjEKaWYgJUVSUk9STEVWRUwlIE5FUSAwICgKCUBlY2hvIFNjcmlwdCBpcyBydW5uaW5nIHdpdGggaW5zdWZmaWNpZW50IHByaXZpbGVnZXMuIFBsZWFzZSBydW4gd2l0aCBhZG1pbmlzdHJhdG9yIHByaXZpbGVnZXM+ICVUTVAlXHNlbnNlVG1wLnR4dAoJc2V0IGVycm9yQ29kZT02NQogc2V0IGxhc3RFcnJvcj0lRVJST1JMRVZFTCUKCUdPVE8gRVJST1IKKQoKZWNobyBTY3JpcHQgaXMgcnVubmluZyB3aXRoIHN1ZmZpY2llbnQgcHJpdmlsZWdlcyA+TlVMIDI+JjEKZWNoby4gPk5VTCAyPiYxCmVjaG8gUGVyZm9ybWluZyBvbmJvYXJkaW5nIG9wZXJhdGlvbnMgPk5VTCAyPiYxCmVjaG8uID5OVUwgMj4mMQoKSUYgWyVQUk9DRVNTT1JfQVJDSElURVc2NDMyJV0gRVFVIFtdICgKICBzZXQgcG93ZXJzaGVsbFBhdGg9JXdpbmRpciVcU3lzdGVtMzJcV2luZG93c1Bvd2VyU2hlbGxcdjEuMFxwb3dlcnNoZWxsLmV4ZQopIEVMU0UgKAogIHNldCBwb3dlcnNoZWxsUGF0aD0ld2luZGlyJVxTeXNOYXRpdmVcV2luZG93c1Bvd2VyU2hlbGxcdjEuMFxwb3dlcnNoZWxsLmV4ZQopCgpzZXQgc2RiaW49MDEwMDA0ODA0NDAwMDAwMDU0MDAwMDAwMDAwMDAwMDAxNDAwMDAwMDAyMDAzMDAwMDIwMDAwMDAwMDAwMTQwMEZGMEYxMjAwMDEwMTAwMDAwMDAwMDAwNTEyMDAwMDAwMDAwMDE0MDBFMTA0MTIwMDAxMDEwMDAwMDAwMDAwMDUwQjAwMDAwMDAxMDIwMDAwMDAwMDAwMDUyMDAwMDAwMDIwMDIwMDAwMDEwMjAwMDAwMDAwMDAwNTIwMDAwMDAwMjAwMjAwMDAgPk5VTCAyPiYxCnJlZyBhZGQgSEtMTVxTWVNURU1cQ3VycmVudENvbnRyb2xTZXRcQ29udHJvbFxXTUlcU2VjdXJpdHkgL3YgMTRmODEzOGUtM2I2MS01ODBiLTU0NGItMjYwOTM3OGFlNDYwIC90IFJFR19CSU5BUlkgL2QgJXNkYmluJSAvZiA+TlVMIDI+JjEKcmVnIGFkZCBIS0xNXFNZU1RFTVxDdXJyZW50Q29udHJvbFNldFxDb250cm9sXFdNSVxTZWN1cml0eSAvdiBjYjJmZjcyZC1kNGU0LTU4NWQtMzNmOS1mM2EzOTVjNDBiZTcgL3QgUkVHX0JJTkFSWSAvZCAlc2RiaW4lIC9mID5OVUwgMj4mMQoKUkVHIGFkZCAiSEtMTVxTT0ZUV0FSRVxQb2xpY2llc1xNaWNyb3NvZnRcV2luZG93c1xEYXRhQ29sbGVjdGlvbiIgL3YgRGlzYWJsZUVudGVycHJpc2VBdXRoUHJveHkgL3QgUkVHX0RXT1JEIC9mIC9kIDEgPk5VTCAyPiYxCgolcG93ZXJzaGVsbFBhdGglIC1FeGVjdXRpb25Qb2xpY3kgQnlwYXNzIC1Ob1Byb2ZpbGUgLUNvbW1hbmQgIkFkZC1UeXBlICcgdXNpbmcgU3lzdGVtOyB1c2luZyBTeXN0ZW0uSU87IHVzaW5nIFN5c3RlbS5SdW50aW1lLkludGVyb3BTZXJ2aWNlczsgdXNpbmcgTWljcm9zb2Z0LldpbjMyLlNhZmVIYW5kbGVzOyB1c2luZyBTeXN0ZW0uQ29tcG9uZW50TW9kZWw7IHB1YmxpYyBzdGF0aWMgY2xhc3MgRWxhbXsgW0RsbEltcG9ydChcIktlcm5lbDMyXCIsIENoYXJTZXQ9Q2hhclNldC5BdXRvLCBTZXRMYXN0RXJyb3I9dHJ1ZSldIHB1YmxpYyBzdGF0aWMgZXh0ZXJuIGJvb2wgSW5zdGFsbEVMQU1DZXJ0aWZpY2F0ZUluZm8oU2FmZUZpbGVIYW5kbGUgaGFuZGxlKTsgcHVibGljIHN0YXRpYyB2b2lkIEluc3RhbGxXZEJvb3Qoc3RyaW5nIHBhdGgpIHsgQ29uc29sZS5PdXQuV3JpdGVMaW5lKFwiQWJvdXQgdG8gY2FsbCBjcmVhdGUgZmlsZSBvbiB7MH1cIiwgcGF0aCk7IHZhciBzdHJlYW0gPSBGaWxlLk9wZW4ocGF0aCwgRmlsZU1vZGUuT3BlbiwgRmlsZUFjY2Vzcy5SZWFkLCBGaWxlU2hhcmUuUmVhZCk7IHZhciBoYW5kbGUgPSBzdHJlYW0uU2FmZUZpbGVIYW5kbGU7IENvbnNvbGUuT3V0LldyaXRlTGluZShcIkFib3V0IHRvIGNhbGwgSW5zdGFsbEVMQU1DZXJ0aWZpY2F0ZUluZm8gb24gaGFuZGxlIHswfVwiLCBoYW5kbGUuRGFuZ2Vyb3VzR2V0SGFuZGxlKCkpOyBpZiAoIUluc3RhbGxFTEFNQ2VydGlmaWNhdGVJbmZvKGhhbmRsZSkpIHsgQ29uc29sZS5PdXQuV3JpdGVMaW5lKFwiQ2FsbCBmYWlsZWQuXCIpOyB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oTWFyc2hhbC5HZXRMYXN0V2luMzJFcnJvcigpKTsgfSBDb25zb2xlLk91dC5Xcml0ZUxpbmUoXCJDYWxsIHN1Y2Nlc3NmdWwuXCIpOyB9IH0gJzsgJGRyaXZlclBhdGggPSAkZW52OlN5c3RlbVJvb3QgKyAnXFN5c3RlbTMyXERyaXZlcnNcV2RCb290LnN5cyc7IFtFbGFtXTo6SW5zdGFsbFdkQm9vdCgkZHJpdmVyUGF0aCkgIiA+TlVMIDI+JjEKClJFRyBxdWVyeSAiSEtMTVxTT0ZUV0FSRVxQb2xpY2llc1xNaWNyb3NvZnRcV2luZG93cyBBZHZhbmNlZCBUaHJlYXQgUHJvdGVjdGlvbiIgL3YgNjk2QzFGQTEtNDAzMC00RkE0LTg3MTMtRkFGOUIyRUE3QzBBIC9yZWc6NjQgPiAlVE1QJVxzZW5zZVRtcC50eHQgMj4mMQppZiAlRVJST1JMRVZFTCUgRVFVIDAgKCAgCiAgICBSRUcgZGVsZXRlICJIS0xNXFNPRlRXQVJFXFBvbGljaWVzXE1pY3Jvc29mdFxXaW5kb3dzIEFkdmFuY2VkIFRocmVhdCBQcm90ZWN0aW9uIiAvdiA2OTZDMUZBMS00MDMwLTRGQTQtODcxMy1GQUY5QjJFQTdDMEEgL2YgPiAlVE1QJVxzZW5zZVRtcC50eHQgMj4mMQogICAgaWYgJUVSUk9STEVWRUwlIE5FUSAwICgKICAgICAgICBzZXQgImVycm9yRGVzY3JpcHRpb249VW5hYmxlIHRvIGRlbGV0ZSBwcmV2aW91cyBvZmZib2FyZGluZyBpbmZvcm1hdGlvbiBmcm9tIHJlZ2lzdHJ5LiIKICAgICAgICBzZXQgZXJyb3JDb2RlPTUKICAgICAgICBzZXQgbGFzdEVycm9yPSVFUlJPUkxFVkVMJQogICAgICAgIEdPVE8gRVJST1IKICAgICkKKQoKUkVHIGFkZCAiSEtMTVxTT0ZUV0FSRVxQb2xpY2llc1xNaWNyb3NvZnRcV2luZG93cyBBZHZhbmNlZCBUaHJlYXQgUHJvdGVjdGlvbiIgL3YgT25ib2FyZGluZ0luZm8gL3QgUkVHX1NaIC9mIC9kICJ7XCJib2R5XCI6XCJ7XFxcInByZXZpb3VzT3JnSWRzXFxcIjpbXSxcXFwib3JnSWRcXFwiOlxcXCIwMDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMGRlYWRcXFwiLFxcXCJnZW9Mb2NhdGlvblVybFxcXCI6XFxcImh0dHBzOi8vc2V2aWxsZWNsb3VkZ2F0ZXdheS1zdGcubWljcm9zb2Z0LmNvbS9cXFwiLFxcXCJkYXRhY2VudGVyXFxcIjpcXFwiRWFzdFVzMlxcXCIsXFxcInZvcnRleEdlb0xvY2F0aW9uXFxcIjpcXFwiU2FuZGJveFxcXCIsXFxcInZlcnNpb25cXFwiOlxcXCIxLjNcXFwifVwiLFwic2lnXCI6XCJKc0dGR2o3UCtIL1cvUEExcW9LTml3RXROZkU4YkhGblhxeks1SDhsQ09wc0RnRGNWTWpoT3BmQTZJTTJ3RFZadk5kWGhvZ0dEQ1FDWjNYdFJCbHRkcGFWc3pZNGtINVpHVkdnRUQxVE80ZCtCTjk2VDFSa3pOZ2NjZ2ZCWDNNQUw1bllUWXdiMGlUQUtFMGIxb3BmQmZrMzJQN3Q3b3A5dkhPeXZNMW5qdlZybVdWWWVSNk4rZFFrLzM4UDNUY2V3b2FkRmFUb3pidjBZK3dZOHgrbFcxeWN6bk1KMitQWTlxRHpabXoybE1rd0FlaDJwRTI4VW5MT0lhNjg0Y3U5RitHUlAveGhhR3dQWmpoc1JCSW51cHV5U1E2Y09YdE9kSERCQlRaZzVKSEhHMDBkNk9tUk5ONmxBelJWeFJURUVmaFFUVnN0U1poKzNMSjJTMGhmZGc9PVwiLFwic2hhMjU2c2lnXCI6XCJsVGI4ZittdkFveDRCckxPS0lqejFnTTNrRHREbG9wL21uNmZodmVEWjMvblVqb1lhNk81V2p4R0x2Z3lqZ0RtdThETkdPNUtqWWlxTVZ6Z0QzcHdqOVYwOXVOeUdYNGJUaXN0d1BnQTFLbGMrMUFLcmtWQTRGWGlQTHlST2tXdlhLM2dydFFJWU9nYjdSRlh6dzhnQlB5YlV0Z0FWbmNaMVFpdTAzblFLdGh5MFU3aXBlZUxaVE9oYVlhN001cTJxUTcya1BaSTZWUWlqSE42NVg3UTEvcm5rdUlSUkFmUEErZElIeE4wN0tpSlY2MGZsbDFZUUtOUlpSYUhKeGQ1UDd0RmdaaytEZE5mNVNXcHVaSTZTZE9MdExDN3VnbmdnK0krU2pUeUtvcVFKZElkWGRRaE5JK3I3WEM1L1M0ZlhnRVNtWmZKTUYxL0JtVlVFZUJDZlE9PVwiLFwiY2VydFwiOlwiTUlJRjVqQ0NBODZnQXdJQkFnSVRNd0FBQVkwdmh1VTl6R2x5b1FBQUFBQUJqVEFOQmdrcWhraUc5dzBCQVFzRkFEQitNUXN3Q1FZRFZRUUdFd0pWVXpFVE1CRUdBMVVFQ0JNS1YyRnphR2x1WjNSdmJqRVFNQTRHQTFVRUJ4TUhVbVZrYlc5dVpERWVNQndHQTFVRUNoTVZUV2xqY205emIyWjBJRU52Y25CdmNtRjBhVzl1TVNnd0pnWURWUVFERXg5TmFXTnliM052Wm5RZ1UyVmpkWEpsSUZObGNuWmxjaUJEUVNBeU1ERXhNQjRYRFRJd01EZ3dOakl3TlRBMU9Gb1hEVEl4TURnd05qSXdOVEExT0Zvd2dZb3hDekFKQmdOVkJBWVRBbFZUTVFzd0NRWURWUVFJRXdKWFFURVFNQTRHQTFVRUJ4TUhVbVZrYlc5dVpERWVNQndHQTFVRUNoTVZUV2xqY205emIyWjBJRU52Y25CdmNtRjBhVzl1TVI0d0hBWURWUVFMRXhWTmFXTnliM052Wm5RZ1EyOXljRzl5WVhScGIyNHhIREFhQmdOVkJBTVRFMU5sZG1sc2JHVXVWMmx1Wkc5M2N5NWpiMjB3Z2dFaU1BMEdDU3FHU0liM0RRRUJBUVVBQTRJQkR3QXdnZ0VLQW9JQkFRRENmcWtCcmV1Um1qdm90bDFFdURQWVplaVc1dUVERmV6MXhsYmh6cjVaa1BjSUJYT3RIMVZWRjRaUmVrdTFpK3ZMbTNON2xkVGl4c2RSZW0yU09iVkFGb1dDbjZ2cEYwL1ZYcWpmUTJHbyt2dk9UU1Q0Si9pQWxocXhialVVbkRyWFpXYUMvS2xtU0lYMjlHUng5bG1pT0IrWVBhRzlOTEE1U3F3emNad2hjTThzS3F0VDhHaWQ3Q3JFNGs1WldES0gyL1dPVTVsQ01iZTY2MWtrbWxKZDB2TlBDTXpyMUgzVmNmRG1qVVo4Q25WQzBFODlhVVA3VHhhME1uS0FzVFArQkpCNXJMenhkVlJRbGRNbmhHVXNXRU0ydUNOWXFOdWc4QWYrTGp3RytySXZrSVR3NVlDMUZDZy9qVHBvdHJnSFhmSGRqaURqa0F3ZWY1TlVkTmx0QWdNQkFBR2pnZ0ZPTUlJQlNqQU9CZ05WSFE4QkFmOEVCQU1DQjRBd0V3WURWUjBsQkF3d0NnWUlLd1lCQlFVSEF3RXdIUVlEVlIwT0JCWUVGT0U1NVFoeno5bEhuWTl2aDVTWmtyMTdjbEtzTUI0R0ExVWRFUVFYTUJXQ0UxTmxkbWxzYkdVdVYybHVaRzkzY3k1amIyMHdId1lEVlIwakJCZ3dGb0FVTmxhSlpVbkxXNXN2UEt4Q0ZsQk5rYmt6MTVFd1V3WURWUjBmQkV3d1NqQklvRWFnUklaQ2FIUjBjRG92TDNkM2R5NXRhV055YjNOdlpuUXVZMjl0TDNCcmFXOXdjeTlqY213dlRXbGpVMlZqVTJWeVEwRXlNREV4WHpJd01URXRNVEF0TVRndVkzSnNNR0FHQ0NzR0FRVUZCd0VCQkZRd1VqQlFCZ2dyQmdFRkJRY3dBb1pFYUhSMGNEb3ZMM2QzZHk1dGFXTnliM052Wm5RdVkyOXRMM0JyYVc5d2N5OWpaWEowY3k5TmFXTlRaV05UWlhKRFFUSXdNVEZmTWpBeE1TMHhNQzB4T0M1amNuUXdEQVlEVlIwVEFRSC9CQUl3QURBTkJna3Foa2lHOXcwQkFRc0ZBQU9DQWdFQVp3ZGxhWjg4U3BURFdUUjc5NWRHV2N0dUxUWmc2UDBqYmh4Q0dhOXBnb3AzSXZ1Qi9QYzJXT2Ruc1ZCYUpUZG5WN3NvcFZHa3V4Vjc1eWk2Q0NQM2sxNG0xQ1FhNk01cmNodmJuVEY0TFdjWld4U1g4Z0hjRWhObFdYV3hxU3FKMzNnSHVGNEc5SCs3VDM3UlNMb2Jqb1MyeVRhc21SRWtCNTI4b1gwWVU0cVpjeVdyK0xEMVovQk10dEhMUlZUZUtHdnpMaVpCNmhqWURybW9qUUxKZXZwSEdoTVdOTU9oR2RLd2pOS0crZGhVRHV6dTdsVXgwZzdhaUR3c1l4NzFTaU9ucDJWOSt5UEhET2R5OXlBRUNPb0N3bUprbW5qLzlDMmVNMDFDQjFZMUxTWHNiQUJtQVd3Si9iczhRNnhTWlJtSnkyRXJSQ3VTakl0MUQydzRTUFVMRFNNVTdIaDk3TWJpQVJDV25TMVRRMGg5azZFWVVmbW1ZaFNHQ0p3MXFlekFqZ2FmTngyYWcrRDhzRFFkQzRjVHhUSTk5aGthUm1DakFmeW1qcVdscUx5V0pCUmdvaXdTd21MVDFUbzRJNUVjZHFoQ1FNdEpoRVVRR2dpenk2ZUE2RlhtNHhmeExua08xSkNKSGJUejlqL2c4OW5zZ0hVN2V4SDVnZHhZQ0FDMGJkUlZLN1YrVlBDcExnLy9SemtlNm9mc1Y3WkxyQUpvN0EyQTZka0dVL09XeGhpVjJiY0VlUEpmSWsrVjM3UHp3c25yZ1JFV2RpM1pic3dBOU5aTTVzZGVSMFlFRm11bit0b2JCRGMzMlRidlVyTUpTb2tjcG9XNnRZczlkR0tUcE1GV01EZ09UeEZjSHljbHZrMjRVQVV2dXk2WVcvSVN2VlY4a3BRPVwiLFwiY2hhaW5cIjpbXCJNSUlHMkRDQ0JNQ2dBd0lCQWdJS1lUKzNHQUFBQUFBQUJEQU5CZ2txaGtpRzl3MEJBUXNGQURDQmlERUxNQWtHQTFVRUJoTUNWVk14RXpBUkJnTlZCQWdUQ2xkaGMyaHBibWQwYjI0eEVEQU9CZ05WQkFjVEIxSmxaRzF2Ym1ReEhqQWNCZ05WQkFvVEZVMXBZM0p2YzI5bWRDQkRiM0p3YjNKaGRHbHZiakV5TURBR0ExVUVBeE1wVFdsamNtOXpiMlowSUZKdmIzUWdRMlZ5ZEdsbWFXTmhkR1VnUVhWMGFHOXlhWFI1SURJd01URXdIaGNOTVRFeE1ERTRNakkxTlRFNVdoY05Nall4TURFNE1qTXdOVEU1V2pCK01Rc3dDUVlEVlFRR0V3SlZVekVUTUJFR0ExVUVDQk1LVjJGemFHbHVaM1J2YmpFUU1BNEdBMVVFQnhNSFVtVmtiVzl1WkRFZU1Cd0dBMVVFQ2hNVlRXbGpjbTl6YjJaMElFTnZjbkJ2Y21GMGFXOXVNU2d3SmdZRFZRUURFeDlOYVdOeWIzTnZablFnVTJWamRYSmxJRk5sY25abGNpQkRRU0F5TURFeE1JSUNJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBZzhBTUlJQ0NnS0NBZ0VBMEF2QXBLZ1pnZUkyNWVLcTVmT3lGVmgxdnJUbFNmSGdoUG03RFdUdmhjR0JWYmp6NS9GdFFGVTl6b3RxMFlTVDlYVjhXNlRVZEJES012TWowNjd1ejU0RVdNTFpSOHZSZkFCQlNIRWJBV2NYR0svRy9uTURmdVR2UTV6dkFYRXFINEVtUTNlWVZGZHpuVlVyOEo2T2ZRWU9yQnRVOHliMytDTUlJb3VlQmgwM09QMXkwc3JsWThHYVduMnliYk5TcVc3cHJyWDhpemI1bnZyMkhGZ2JsMWFsRWVXM1V0dTc2ZkJVdjdUL0xHeTRYU2JPb0FyWDM1UHRmOTJzOFN4ekd0a1pOMVc2M1NKNGpxSFVtd240QnlJeGNiQ1VydUN3NXlaRVY1Q0JseFhPWWV4bDRrdnhoVklXTXZpMWVLcCt6VTNzZ3lHa3FKdSttbW9FNEtNY3pWWVliUDFyTDBJKzRqZnljcXZRZUhOeWU5N3NBRmpsSVRDakNEcVo3NS9EOTNvV2xtVzF3NEd2OURsd1NhLzJxZlpxQURqNXRBZ1o0Qm8xcFZaMklsOXE4bW11UHExWVJrMjRWUGFKUVVRZWNyRzhFaWRUMHNIL3NzMVFtQjYxOUx1MndvSTUyYXdiOGpzbmhHcXd4aVlMMXpvUTU3UGJmTk5XckZOTUMvbzdNVGQwMkZrcitRQjVHUVo3L1J3ZFF0UkJEUzhGRHRWclNTUC96ODM0ZW9MUDJqd3QzK2pZRWdRWXVoNklkN2lZSHhBSHU4Z0ZmZ3NKdjJ2ZDQwNWJzUG5IaEtZN3lreWZXMklwOThlaXFKV0ljQ3psd1Q4OFVpTlBRSnJETVlXREw3OHA4UjFRanlHV0I4N3Y4b0RDUkgyYll1OHZ3M2VKcTBWTlV6NENlZE1DQXdFQUFhT0NBVXN3Z2dGSE1CQUdDU3NHQVFRQmdqY1ZBUVFEQWdFQU1CMEdBMVVkRGdRV0JCUTJWb2xsU2N0Ym15ODhyRUlXVUUyUnVUUFhrVEFaQmdrckJnRUVBWUkzRkFJRURCNEtBRk1BZFFCaUFFTUFRVEFMQmdOVkhROEVCQU1DQVlZd0R3WURWUjBUQVFIL0JBVXdBd0VCL3pBZkJnTlZIU01FR0RBV2dCUnlMVG9DTVpCRHVSUUZUdUhxcDhjeDBTT0pOREJhQmdOVkhSOEVVekJSTUUrZ1RhQkxoa2xvZEhSd09pOHZZM0pzTG0xcFkzSnZjMjltZEM1amIyMHZjR3RwTDJOeWJDOXdjbTlrZFdOMGN5OU5hV05TYjI5RFpYSkJkWFF5TURFeFh6SXdNVEZmTUROZk1qSXVZM0pzTUY0R0NDc0dBUVVGQndFQkJGSXdVREJPQmdnckJnRUZCUWN3QW9aQ2FIUjBjRG92TDNkM2R5NXRhV055YjNOdlpuUXVZMjl0TDNCcmFTOWpaWEowY3k5TmFXTlNiMjlEWlhKQmRYUXlNREV4WHpJd01URmZNRE5mTWpJdVkzSjBNQTBHQ1NxR1NJYjNEUUVCQ3dVQUE0SUNBUUJCeUdIQjlWdWVQcEV4OGJER3Z3a0J0SjIya0hUWENkdW1MZzJmeU9kMk5FYXZCMkNKVElHelBOWDBFalYxd25PbDlVMkVqTXVrWGErL2t2WVhDRmRDbFhKbEJYWjVyZTdSdXJndVZLTlJCNnhvNnlFTTR5V0J3czBxOHNQL3o4SzlTUmlheC9DRXhma1V2R3VWNVpidnMwTFNVOVZLb0JMRXJoSjJVd2xXRHAzMzA2WkppRkR5aWl5WElLSytUbmp2QldXM1M2RVdpTjR4eHdoQ0pIeWtlNTZkdkdBQVhtS1g0NVA4cC81YmV5WGY1Rk4vUzc3bVB2RGJBWGxDSEc2RmJIMjJSREQ3cFRlU2s3S2w3aUN0UDFQVnlmUW9hMWZCK0IxcXQxWXF0aWVCSEtZdG4rZjAwREdEbDZncXRxeStHMEgxNUlsZlZ2dmFXdE5lZlZXVUVINVRWL1JLUFVBcXlMMW5uNFRoRU83OTJtc1Zna244UmgzL1JRWjBuRUlVN2NVNTA3UE5DNE1ua0VOUmt2SkVncTV1bWhVWHNobjZ4MFZzbUFGN3Z6ZXBzSWlra3J3NE9PQWQ1SHlYbUJvdVgrODRaYmMxTDcxL1R5SDZ4SXpTYndiNVNUWHEzeUFQSmFycVlLc3NIMHVKL0xmNlhGU1FTejZpS0U5czVGSmx3ZjJRSElXQ2lHN3BwbFhkSVNoNVJiQVU1UXJNNWwvRXU5dGhOR21mckNZNDk4RXBRUWdWTGt5Zzkva01QdDVmcXdnSkxZT3NyRFNEWXZUSlNVS0pKYlZ1c2tmRnN6bWdzU0FiTExHT0JHK2xNRWtjMEVicFFGdjByVzY2MjRKS2h4SktnQWxOMjk5MnVRVmJHK0M3SUhCZkFDWEgwdzc2RnExN0lwNXhDQT09XCIsXCJNSUlGN1RDQ0E5V2dBd0lCQWdJUVA0dkl0Znlmc3BaRHRXbldiRUxoUkRBTkJna3Foa2lHOXcwQkFRc0ZBRENCaURFTE1Ba0dBMVVFQmhNQ1ZWTXhFekFSQmdOVkJBZ1RDbGRoYzJocGJtZDBiMjR4RURBT0JnTlZCQWNUQjFKbFpHMXZibVF4SGpBY0JnTlZCQW9URlUxcFkzSnZjMjltZENCRGIzSndiM0poZEdsdmJqRXlNREFHQTFVRUF4TXBUV2xqY205emIyWjBJRkp2YjNRZ1EyVnlkR2xtYVdOaGRHVWdRWFYwYUc5eWFYUjVJREl3TVRFd0hoY05NVEV3TXpJeU1qSXdOVEk0V2hjTk16WXdNekl5TWpJeE16QTBXakNCaURFTE1Ba0dBMVVFQmhNQ1ZWTXhFekFSQmdOVkJBZ1RDbGRoYzJocGJtZDBiMjR4RURBT0JnTlZCQWNUQjFKbFpHMXZibVF4SGpBY0JnTlZCQW9URlUxcFkzSnZjMjltZENCRGIzSndiM0poZEdsdmJqRXlNREFHQTFVRUF4TXBUV2xqY205emIyWjBJRkp2YjNRZ1EyVnlkR2xtYVdOaGRHVWdRWFYwYUc5eWFYUjVJREl3TVRFd2dnSWlNQTBHQ1NxR1NJYjNEUUVCQVFVQUE0SUNEd0F3Z2dJS0FvSUNBUUN5Z0VHcU5UaE5FM0l5YUNKTnVMTHgvOVZTdkd6SDlkSktqRGJ1MGNKY2ZveUtycThUS0cvQWMrTTZ6dEFscUZvNmJlK291Rm1yRXlOb3pRd3BoOUZ2Z0Z5UFJIOWRrQUZTV0t4UnhWOHFoOXpjMkFvZHdRTzVlN0JXNktQZVpHSENudmp6Zkxuc0RiVlUva3kyWlUrSThKeEltUXhDQ3dsOE1Wa1hlUVo0S0kySk9rd0RKYjV4YWx3TDU0UmdwSmtpNDlLdmhLU24rOUdZN1F5cDNwU0o0UTZnM01ET21UM3FDRks3Vm5ua0g0UzZIcmkweEVsY1R6RkxoOTNkQldjbW1ZRGdjUkdqdUtWQjRxUlR1ZmN5S1lNTUU3ODJYZ1N6UzBOSEwydmlrUjdUbUUvZFFnZkk2QjBTL0ptcGF6NlNmc2pXYVRyOFpMMjJDWjNLL1F3TG9wdDNZRXNEbEtRd2FSTFdRaTNCUVV6SzNLcjlqMXVEUnByWi9MSFI0N1BKZjBoNnpTVHdRWTljZE5Dc3NCQWdCa20zeHkwaHlGZmowSWJ6QTJqNzBNNXh3WW1aU21RQmJQM3NNSkhQUVR5U3grVzZoaDFoaE1kZmd6bGlyclNTTDBmekMvaFY2NkFmV2RDN2RKc2UwSGJtOHVrRzF4RG8rbVRlYWNZMWxvZ0M4RWE0UHllWmI4dHhpU2sxOTBnV0FqV1AxWGw4VFFMUFgrdUtnMDlGY1lqNXFRMU9jdW5DbkFmUFNSdE9CQTVqVVl4ZTJBREJWU3kyeHVEQ1pVN0pORG4xbkxQRWZ1aGhiaE5mRmNSZjJYN3RIYzd1Uk96TExvYXg3RGoyY08yclhCUEIyUThOeDRDeVZlMDA5NnliNU1QYTUwYzhwcldQTWQvRlM2L3I4UUlEQVFBQm8xRXdUekFMQmdOVkhROEVCQU1DQVlZd0R3WURWUjBUQVFIL0JBVXdBd0VCL3pBZEJnTlZIUTRFRmdRVWNpMDZBakdRUTdrVUJVN2g2cWZITWRFamlUUXdFQVlKS3dZQkJBR0NOeFVCQkFNQ0FRQXdEUVlKS29aSWh2Y05BUUVMQlFBRGdnSUJBSDl5encrM3hSWGJtOEJKeWlaYi9wNFQ1dFB3MHR1WFgvSkxQMDJ6cmhtdTdkZVhvS3p2cVRxandrR3c1YmlSbmhPQkpBUG1DZjAvVjBBNUlTUlcwUkF2UzBDcE5vWkx0Rk5YbXZ2eGZvbVBFZjRZYkZHcTZPMEpsYlhsY2NtaDZZZDFwaFYveVg0M1ZGNTBrOFhEWjh3TlQydW9Gd3h0Q0pKK2k5MkJxaTF3SWNNOUJoUzd2eVJlcDRUWFB3OGhJcjFMQUFiYmx4ellYdFRGQzF5SGJsQ2s2TU00cFB2TExNV1NacHVGWHN0NmJKTjhnQ2xZVzFlMVFHbTZDSG1tWkdJVm5ZZVdSYlZtSXlBRGl4eHpvTk9pZVRQZ1VGbUcyeS9sQWlYcWN5cWZBQlRJTnNlU08rbE9BT3pZVmdtNU0wa1MwbFFMQWF1c1I3YVJLWDFNdEhXQVVnSG95b0wybjh5c25JOFg2aThtc0t0eXJBditubEVleDBOVlowOVJzMWZXdHV6dVVyYzY2VTdoMTRHSXZFK09kYnRMcVBBMXFpYlVaMmRKc25CTU81UGNIZDk0a0laeXNqaWswZHlTVGNsWTZ5c1NYTlE3cm94cnNJUGxBVC80Q1RMMmt6VTBJcS9kTncxM0NZQXJ6VWdBOFl5WkdVY0ZBZW5SdjlGTzBPWW9RemVacEFwS0NObWFjWFBTcXMweEUyTjJvVGR2a2pnZWZSSThaakxueTIzaC9GS0ozY3JXWmdXYWxtRytvaWpISEtPbk5sQThPcVRmU203bWh6dk82L0RnZ1RlZEV6eFNqcjI1SFRUR0hkVUthajJZS1hDTWlTclJxNElRU0IvYzlPK2x4YnRWR2poamhFNjNiSzJWVk94bEloQkpGN2pBSHNjUHJGUkhcIl19IiA+ICVUTVAlXHNlbnNlVG1wLnR4dCAyPiYxCmlmICVFUlJPUkxFVkVMJSBORVEgMCAoCiAgIHNldCAiZXJyb3JEZXNjcmlwdGlvbj1VbmFibGUgdG8gd3JpdGUgb25ib2FyZGluZyBpbmZvcm1hdGlvbiB0byByZWdpc3RyeS4iCiAgIHNldCBlcnJvckNvZGU9MTAKICAgc2V0IGxhc3RFcnJvcj0lRVJST1JMRVZFTCUKICAgR09UTyBFUlJPUgopCgplY2hvIFN0YXJ0aW5nIHRoZSBzZXJ2aWNlLCBpZiBub3QgYWxyZWFkeSBydW5uaW5nID5OVUwgMj4mMQplY2hvLiA+TlVMIDI+JjEKc2MgcXVlcnkgIlNFTlNFIiB8IGZpbmQgL2kgIlJVTk5JTkciID5OVUwgMj4mMQppZiAlRVJST1JMRVZFTCUgRVFVIDAgR09UTyBSVU5OSU5HCgpuZXQgc3RhcnQgc2Vuc2UgPiAlVE1QJVxzZW5zZVRtcC50eHQgMj4mMQppZiAlRVJST1JMRVZFTCUgTkVRIDAgKAogICBlY2hvIFdpbmRvd3MgRGVmZW5kZXIgQWR2YW5jZWQgVGhyZWF0IFByb3RlY3Rpb24gU2VydmljZSBoYXMgbm90IHN0YXJ0ZWQgeWV0ID5OVUwgMj4mMQogICBHT1RPIFdBSVRfRk9SX1RIRV9TRVJWSUNFX1RPX1NUQVJUCikKZ290byBTVUNDRUVERUQKCjpSVU5OSU5HCnNldCAicnVubmluZ091dHB1dD1UaGUgV2luZG93cyBEZWZlbmRlciBBZHZhbmNlZCBUaHJlYXQgUHJvdGVjdGlvbiBTZXJ2aWNlIGlzIGFscmVhZHkgcnVubmluZyEiCmVjaG8gJXJ1bm5pbmdPdXRwdXQlID5OVUwgMj4mMQplY2hvLiA+TlVMIDI+JjEKZXZlbnRjcmVhdGUgL2wgQXBwbGljYXRpb24gL3NvIFdEQVRQT25ib2FyZGluZyAvdCBJbmZvcm1hdGlvbiAvaWQgMTAgL2QgIiVydW5uaW5nT3V0cHV0JSIgPk5VTCAyPiYxCkdPVE8gV0FJVF9GT1JfVEhFX1NFUlZJQ0VfVE9fU1RBUlQKCjpFUlJPUgpTZXQgL1AgZXJyb3JNc2c9PCVUTVAlXHNlbnNlVG1wLnR4dApzZXQgImVycm9yT3V0cHV0PVtFcnJvciBJZDogJWVycm9yQ29kZSUsIEVycm9yIExldmVsOiAlbGFzdEVycm9yJV0gJWVycm9yRGVzY3JpcHRpb24lIEVycm9yIG1lc3NhZ2U6ICVlcnJvck1zZyUiCiVwb3dlcnNoZWxsUGF0aCUgLUV4ZWN1dGlvblBvbGljeSBCeXBhc3MgLU5vUHJvZmlsZSAtQ29tbWFuZCAiQWRkLVR5cGUgJ3VzaW5nIFN5c3RlbTsgdXNpbmcgU3lzdGVtLkRpYWdub3N0aWNzOyB1c2luZyBTeXN0ZW0uRGlhZ25vc3RpY3MuVHJhY2luZzsgbmFtZXNwYWNlIFNlbnNlIHsgW0V2ZW50RGF0YShOYW1lID0gXCJPbmJvYXJkaW5nXCIpXXB1YmxpYyBzdHJ1Y3QgT25ib2FyZGluZ3twdWJsaWMgc3RyaW5nIE1lc3NhZ2UgeyBnZXQ7IHNldDsgfX0gcHVibGljIGNsYXNzIFRyYWNlIHtwdWJsaWMgc3RhdGljIEV2ZW50U291cmNlT3B0aW9ucyBUZWxlbWV0cnlDcml0aWNhbE9wdGlvbiA9IG5ldyBFdmVudFNvdXJjZU9wdGlvbnMoKXtMZXZlbCA9IEV2ZW50TGV2ZWwuRXJyb3IsIEtleXdvcmRzID0gKEV2ZW50S2V5d29yZHMpMHgwMDAwMjAwMDAwMDAwMDAwLCBUYWdzID0gKEV2ZW50VGFncykweDAyMDAwMDB9OyBwdWJsaWMgdm9pZCBXcml0ZU9uYm9hcmRpbmdNZXNzYWdlKHN0cmluZyBtZXNzYWdlKXtlcy5Xcml0ZShcIk9uYm9hcmRpbmdTY3JpcHRcIiwgVGVsZW1ldHJ5Q3JpdGljYWxPcHRpb24sIG5ldyBPbmJvYXJkaW5nIHtNZXNzYWdlID0gbWVzc2FnZX0pO30gcHJpdmF0ZSBzdGF0aWMgcmVhZG9ubHkgc3RyaW5nW10gdGVsZW1ldHJ5VHJhaXRzID0geyBcIkVUV19HUk9VUFwiLCBcIns1RUNCMEJBQy1COTMwLTQ3RjUtQThBNC1FODI1MzUyOUVEQjd9XCIgfTsgcHJpdmF0ZSBFdmVudFNvdXJjZSBlcyA9IG5ldyBFdmVudFNvdXJjZShcIk1pY3Jvc29mdC5XaW5kb3dzLlNlbnNlLkNsaWVudC5NYW5hZ2VtZW50XCIsRXZlbnRTb3VyY2VTZXR0aW5ncy5FdHdTZWxmRGVzY3JpYmluZ0V2ZW50Rm9ybWF0LHRlbGVtZXRyeVRyYWl0cyk7fX0nOyAkbG9nZ2VyID0gTmV3LU9iamVjdCAtVHlwZU5hbWUgU2Vuc2UuVHJhY2U7ICRsb2dnZXIuV3JpdGVPbmJvYXJkaW5nTWVzc2FnZSgnJWVycm9yT3V0cHV0JScpIiA+TlVMIDI+JjEKZWNobyAlZXJyb3JPdXRwdXQlID5OVUwgMj4mMQplY2hvLiA+TlVMIDI+JjEKZXZlbnRjcmVhdGUgL2wgQXBwbGljYXRpb24gL3NvIFdEQVRQT25ib2FyZGluZyAvdCBFcnJvciAvaWQgJWVycm9yQ29kZSUgL2QgIiVlcnJvck91dHB1dCUiID5OVUwgMj4mMQpHT1RPIENMRUFOVVAKCjpTVUNDRUVERUQKZWNobyBGaW5pc2hlZCBwZXJmb3JtaW5nIG9uYm9hcmRpbmcgb3BlcmF0aW9ucyA+TlVMIDI+JjEKZWNoby4gPk5VTCAyPiYxCkdPVE8gV0FJVF9GT1JfVEhFX1NFUlZJQ0VfVE9fU1RBUlQKCjpXQUlUX0ZPUl9USEVfU0VSVklDRV9UT19TVEFSVAplY2hvIFdhaXRpbmcgZm9yIHRoZSBzZXJ2aWNlIHRvIHN0YXJ0ID5OVUwgMj4mMQplY2hvLiA+TlVMIDI+JjEKCnNldCAvYSBjb3VudGVyPTAKCjpTRU5TRV9SVU5OSU5HX1dBSVQKc2MgcXVlcnkgIlNFTlNFIiB8IGZpbmQgL2kgIlJVTk5JTkciID5OVUwgMj4mMQppZiAlRVJST1JMRVZFTCUgTkVRIDAgKAoJSUYgJWNvdW50ZXIlIEVRVSA0ICgKCQlzZXQgImVycm9yRGVzY3JpcHRpb249VW5hYmxlIHRvIHN0YXJ0IFdpbmRvd3MgRGVmZW5kZXIgQWR2YW5jZWQgVGhyZWF0IFByb3RlY3Rpb24gU2VydmljZS4iCgkJc2V0IGVycm9yQ29kZT0xNQoJCXNldCBsYXN0RXJyb3I9JUVSUk9STEVWRUwlCgkJR09UTyBFUlJPUgoJKQoKCXNldCAvYSBjb3VudGVyPSVjb3VudGVyJSsxCgoJdGltZW91dCA1ID5OVUwgMj4mMQoJR09UTyA6U0VOU0VfUlVOTklOR19XQUlUCikKCnNldCAvYSBjb3VudGVyPTAKCjpTRU5TRV9PTkJPQVJERURfU1RBVFVTX1dBSVQKUkVHIHF1ZXJ5ICJIS0xNXFNPRlRXQVJFXE1pY3Jvc29mdFxXaW5kb3dzIEFkdmFuY2VkIFRocmVhdCBQcm90ZWN0aW9uXFN0YXR1cyIgL3YgT25ib2FyZGluZ1N0YXRlIC9yZWc6NjQgPk5VTCAyPiYxCmlmICVFUlJPUkxFVkVMJSBORVEgMCAoCglJRiAlY291bnRlciUgRVFVIDQgKAoJCUBlY2hvIFdpbmRvd3MgRGVmZW5kZXIgQWR2YW5jZWQgVGhyZWF0IFByb3RlY3Rpb24gU2VydmljZSBpcyBub3QgcnVubmluZyBhcyBleHBlY3RlZD4gJVRNUCVcc2Vuc2VUbXAudHh0CgkJc2V0IGVycm9yQ29kZT0zNQogICAgIHNldCBsYXN0RXJyb3I9JUVSUk9STEVWRUwlCgkJR09UTyBFUlJPUgoJKQoKCXNldCAvYSBjb3VudGVyPSVjb3VudGVyJSsxCgoJdGltZW91dCA1ID5OVUwgMj4mMQoJR09UTyA6U0VOU0VfT05CT0FSREVEX1NUQVRVU19XQUlUCikKCnNldCAvYSBjb3VudGVyPTAKCjpTRU5TRV9PTkJPQVJERURfV0FJVApSRUcgcXVlcnkgIkhLTE1cU09GVFdBUkVcTWljcm9zb2Z0XFdpbmRvd3MgQWR2YW5jZWQgVGhyZWF0IFByb3RlY3Rpb25cU3RhdHVzIiAvdiBPbmJvYXJkaW5nU3RhdGUgL3JlZzo2NCB8IGZpbmQgL2kgIjB4MSIgPk5VTCAyPiYxCmlmICVFUlJPUkxFVkVMJSBORVEgMCAoCglJRiAlY291bnRlciUgRVFVIDQgKAoJCUBlY2hvIFdpbmRvd3MgRGVmZW5kZXIgQWR2YW5jZWQgVGhyZWF0IFByb3RlY3Rpb24gU2VydmljZSBpcyBub3QgcnVubmluZyBhcyBleHBlY3RlZD4gJVRNUCVcc2Vuc2VUbXAudHh0CgkJc2V0IGVycm9yQ29kZT00MAogICAgIHNldCBsYXN0RXJyb3I9JUVSUk9STEVWRUwlCgkJR09UTyBFUlJPUgoJKQoKCXNldCAvYSBjb3VudGVyPSVjb3VudGVyJSsxCgoJdGltZW91dCA1ID5OVUwgMj4mMQoJR09UTyA6U0VOU0VfT05CT0FSREVEX1dBSVQKKQoKc2V0ICJzdWNjZXNzT3V0cHV0PVN1Y2Nlc3NmdWxseSBvbmJvYXJkZWQgbWFjaGluZSB0byBXaW5kb3dzIERlZmVuZGVyIEFkdmFuY2VkIFRocmVhdCBQcm90ZWN0aW9uIgplY2hvICVzdWNjZXNzT3V0cHV0JSA+TlVMIDI+JjEKZWNoby4KZXZlbnRjcmVhdGUgL2wgQXBwbGljYXRpb24gL3NvIFdEQVRQT25ib2FyZGluZyAvdCBJbmZvcm1hdGlvbiAvaWQgMjAgL2QgIiVzdWNjZXNzT3V0cHV0JSIgPk5VTCAyPiYxCiVwb3dlcnNoZWxsUGF0aCUgLUV4ZWN1dGlvblBvbGljeSBCeXBhc3MgLU5vUHJvZmlsZSAtQ29tbWFuZCAiQWRkLVR5cGUgJ3VzaW5nIFN5c3RlbTsgdXNpbmcgU3lzdGVtLkRpYWdub3N0aWNzOyB1c2luZyBTeXN0ZW0uRGlhZ25vc3RpY3MuVHJhY2luZzsgbmFtZXNwYWNlIFNlbnNlIHsgW0V2ZW50RGF0YShOYW1lID0gXCJPbmJvYXJkaW5nXCIpXXB1YmxpYyBzdHJ1Y3QgT25ib2FyZGluZ3twdWJsaWMgc3RyaW5nIE1lc3NhZ2UgeyBnZXQ7IHNldDsgfX0gcHVibGljIGNsYXNzIFRyYWNlIHtwdWJsaWMgc3RhdGljIEV2ZW50U291cmNlT3B0aW9ucyBUZWxlbWV0cnlDcml0aWNhbE9wdGlvbiA9IG5ldyBFdmVudFNvdXJjZU9wdGlvbnMoKXtMZXZlbCA9IEV2ZW50TGV2ZWwuSW5mb3JtYXRpb25hbCwgS2V5d29yZHMgPSAoRXZlbnRLZXl3b3JkcykweDAwMDAyMDAwMDAwMDAwMDAsIFRhZ3MgPSAoRXZlbnRUYWdzKTB4MDIwMDAwMH07IHB1YmxpYyB2b2lkIFdyaXRlT25ib2FyZGluZ01lc3NhZ2Uoc3RyaW5nIG1lc3NhZ2Upe2VzLldyaXRlKFwiT25ib2FyZGluZ1NjcmlwdFwiLCBUZWxlbWV0cnlDcml0aWNhbE9wdGlvbiwgbmV3IE9uYm9hcmRpbmcge01lc3NhZ2UgPSBtZXNzYWdlfSk7fSBwcml2YXRlIHN0YXRpYyByZWFkb25seSBzdHJpbmdbXSB0ZWxlbWV0cnlUcmFpdHMgPSB7IFwiRVRXX0dST1VQXCIsIFwiezVFQ0IwQkFDLUI5MzAtNDdGNS1BOEE0LUU4MjUzNTI5RURCN31cIiB9OyBwcml2YXRlIEV2ZW50U291cmNlIGVzID0gbmV3IEV2ZW50U291cmNlKFwiTWljcm9zb2Z0LldpbmRvd3MuU2Vuc2UuQ2xpZW50Lk1hbmFnZW1lbnRcIixFdmVudFNvdXJjZVNldHRpbmdzLkV0d1NlbGZEZXNjcmliaW5nRXZlbnRGb3JtYXQsdGVsZW1ldHJ5VHJhaXRzKTt9fSc7ICRsb2dnZXIgPSBOZXctT2JqZWN0IC1UeXBlTmFtZSBTZW5zZS5UcmFjZTsgJGxvZ2dlci5Xcml0ZU9uYm9hcmRpbmdNZXNzYWdlKCclc3VjY2Vzc091dHB1dCUnKSIgPk5VTCAyPiYxCiIlUFJPR1JBTUZJTEVTJVxXaW5kb3dzIERlZmVuZGVyXE1wQ21kUnVuLmV4ZSIgLVJlbG9hZEVuZ2luZSA+TlVMIDI+JjEKCkdPVE8gQ0xFQU5VUAoKOkNMRUFOVVAKaWYgZXhpc3QgJVRNUCVcc2Vuc2VUbXAudHh0IGRlbCAlVE1QJVxzZW5zZVRtcC50eHQKRVhJVCAvQiAlZXJyb3JDb2RlJQo=="), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2021-10-01-preview/examples/MdeOnboardings/GetMdeOnboardings_example.json -func ExampleMdeOnboardingsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMdeOnboardingsClient().Get(ctx, 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.MdeOnboardingData = armsecurity.MdeOnboardingData{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/mdeOnboardings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/mdeOnboardings/default"), - // Properties: &armsecurity.MdeOnboardingDataProperties{ - // OnboardingPackageLinux: []byte("QGVjaG8gb2ZmCgplY2hvLiA+TlVMIDI+JjEKZWNobyBTdGFydGluZyBXaW5kb3dzIERlZmVuZGVyIEFkdmFuY2VkIFRocmVhdCBQcm90ZWN0aW9uIG9uYm9hcmRpbmcgcHJvY2Vzcy4uLiA+TlVMIDI+JjEKZWNoby4gPk5VTCAyPiYxCgpzZXQgZXJyb3JDb2RlPTAKc2V0IGxhc3RFcnJvcj0wCnNldCAidHJvdWJsZXNob290SW5mbz1Gb3IgbW9yZSBpbmZvcm1hdGlvbiwgdmlzaXQ6IGh0dHBzOi8vZ28ubWljcm9zb2Z0LmNvbS9md2xpbmsvcC8/bGlua2lkPTgyMjgwNyIKc2V0ICJlcnJvckRlc2NyaXB0aW9uPSIKCmVjaG8gVGVzdGluZyBhZG1pbmlzdHJhdG9yIHByaXZpbGVnZXMgPk5VTCAyPiYxCgpuZXQgc2Vzc2lvbiA+TlVMIDI+JjEKaWYgJUVSUk9STEVWRUwlIE5FUSAwICgKCUBlY2hvIFNjcmlwdCBpcyBydW5uaW5nIHdpdGggaW5zdWZmaWNpZW50IHByaXZpbGVnZXMuIFBsZWFzZSBydW4gd2l0aCBhZG1pbmlzdHJhdG9yIHByaXZpbGVnZXM+ICVUTVAlXHNlbnNlVG1wLnR4dAoJc2V0IGVycm9yQ29kZT02NQogc2V0IGxhc3RFcnJvcj0lRVJST1JMRVZFTCUKCUdPVE8gRVJST1IKKQoKZWNobyBTY3JpcHQgaXMgcnVubmluZyB3aXRoIHN1ZmZpY2llbnQgcHJpdmlsZWdlcyA+TlVMIDI+JjEKZWNoby4gPk5VTCAyPiYxCmVjaG8gUGVyZm9ybWluZyBvbmJvYXJkaW5nIG9wZXJhdGlvbnMgPk5VTCAyPiYxCmVjaG8uID5OVUwgMj4mMQoKSUYgWyVQUk9DRVNTT1JfQVJDSElURVc2NDMyJV0gRVFVIFtdICgKICBzZXQgcG93ZXJzaGVsbFBhdGg9JXdpbmRpciVcU3lzdGVtMzJcV2luZG93c1Bvd2VyU2hlbGxcdjEuMFxwb3dlcnNoZWxsLmV4ZQopIEVMU0UgKAogIHNldCBwb3dlcnNoZWxsUGF0aD0ld2luZGlyJVxTeXNOYXRpdmVcV2luZG93c1Bvd2VyU2hlbGxcdjEuMFxwb3dlcnNoZWxsLmV4ZQopCgpzZXQgc2RiaW49MDEwMDA0ODA0NDAwMDAwMDU0MDAwMDAwMDAwMDAwMDAxNDAwMDAwMDAyMDAzMDAwMDIwMDAwMDAwMDAwMTQwMEZGMEYxMjAwMDEwMTAwMDAwMDAwMDAwNTEyMDAwMDAwMDAwMDE0MDBFMTA0MTIwMDAxMDEwMDAwMDAwMDAwMDUwQjAwMDAwMDAxMDIwMDAwMDAwMDAwMDUyMDAwMDAwMDIwMDIwMDAwMDEwMjAwMDAwMDAwMDAwNTIwMDAwMDAwMjAwMjAwMDAgPk5VTCAyPiYxCnJlZyBhZGQgSEtMTVxTWVNURU1cQ3VycmVudENvbnRyb2xTZXRcQ29udHJvbFxXTUlcU2VjdXJpdHkgL3YgMTRmODEzOGUtM2I2MS01ODBiLTU0NGItMjYwOTM3OGFlNDYwIC90IFJFR19CSU5BUlkgL2QgJXNkYmluJSAvZiA+TlVMIDI+JjEKcmVnIGFkZCBIS0xNXFNZU1RFTVxDdXJyZW50Q29udHJvbFNldFxDb250cm9sXFdNSVxTZWN1cml0eSAvdiBjYjJmZjcyZC1kNGU0LTU4NWQtMzNmOS1mM2EzOTVjNDBiZTcgL3QgUkVHX0JJTkFSWSAvZCAlc2RiaW4lIC9mID5OVUwgMj4mMQoKUkVHIGFkZCAiSEtMTVxTT0ZUV0FSRVxQb2xpY2llc1xNaWNyb3NvZnRcV2luZG93c1xEYXRhQ29sbGVjdGlvbiIgL3YgRGlzYWJsZUVudGVycHJpc2VBdXRoUHJveHkgL3QgUkVHX0RXT1JEIC9mIC9kIDEgPk5VTCAyPiYxCgolcG93ZXJzaGVsbFBhdGglIC1FeGVjdXRpb25Qb2xpY3kgQnlwYXNzIC1Ob1Byb2ZpbGUgLUNvbW1hbmQgIkFkZC1UeXBlICcgdXNpbmcgU3lzdGVtOyB1c2luZyBTeXN0ZW0uSU87IHVzaW5nIFN5c3RlbS5SdW50aW1lLkludGVyb3BTZXJ2aWNlczsgdXNpbmcgTWljcm9zb2Z0LldpbjMyLlNhZmVIYW5kbGVzOyB1c2luZyBTeXN0ZW0uQ29tcG9uZW50TW9kZWw7IHB1YmxpYyBzdGF0aWMgY2xhc3MgRWxhbXsgW0RsbEltcG9ydChcIktlcm5lbDMyXCIsIENoYXJTZXQ9Q2hhclNldC5BdXRvLCBTZXRMYXN0RXJyb3I9dHJ1ZSldIHB1YmxpYyBzdGF0aWMgZXh0ZXJuIGJvb2wgSW5zdGFsbEVMQU1DZXJ0aWZpY2F0ZUluZm8oU2FmZUZpbGVIYW5kbGUgaGFuZGxlKTsgcHVibGljIHN0YXRpYyB2b2lkIEluc3RhbGxXZEJvb3Qoc3RyaW5nIHBhdGgpIHsgQ29uc29sZS5PdXQuV3JpdGVMaW5lKFwiQWJvdXQgdG8gY2FsbCBjcmVhdGUgZmlsZSBvbiB7MH1cIiwgcGF0aCk7IHZhciBzdHJlYW0gPSBGaWxlLk9wZW4ocGF0aCwgRmlsZU1vZGUuT3BlbiwgRmlsZUFjY2Vzcy5SZWFkLCBGaWxlU2hhcmUuUmVhZCk7IHZhciBoYW5kbGUgPSBzdHJlYW0uU2FmZUZpbGVIYW5kbGU7IENvbnNvbGUuT3V0LldyaXRlTGluZShcIkFib3V0IHRvIGNhbGwgSW5zdGFsbEVMQU1DZXJ0aWZpY2F0ZUluZm8gb24gaGFuZGxlIHswfVwiLCBoYW5kbGUuRGFuZ2Vyb3VzR2V0SGFuZGxlKCkpOyBpZiAoIUluc3RhbGxFTEFNQ2VydGlmaWNhdGVJbmZvKGhhbmRsZSkpIHsgQ29uc29sZS5PdXQuV3JpdGVMaW5lKFwiQ2FsbCBmYWlsZWQuXCIpOyB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oTWFyc2hhbC5HZXRMYXN0V2luMzJFcnJvcigpKTsgfSBDb25zb2xlLk91dC5Xcml0ZUxpbmUoXCJDYWxsIHN1Y2Nlc3NmdWwuXCIpOyB9IH0gJzsgJGRyaXZlclBhdGggPSAkZW52OlN5c3RlbVJvb3QgKyAnXFN5c3RlbTMyXERyaXZlcnNcV2RCb290LnN5cyc7IFtFbGFtXTo6SW5zdGFsbFdkQm9vdCgkZHJpdmVyUGF0aCkgIiA+TlVMIDI+JjEKClJFRyBxdWVyeSAiSEtMTVxTT0ZUV0FSRVxQb2xpY2llc1xNaWNyb3NvZnRcV2luZG93cyBBZHZhbmNlZCBUaHJlYXQgUHJvdGVjdGlvbiIgL3YgNjk2QzFGQTEtNDAzMC00RkE0LTg3MTMtRkFGOUIyRUE3QzBBIC9yZWc6NjQgPiAlVE1QJVxzZW5zZVRtcC50eHQgMj4mMQppZiAlRVJST1JMRVZFTCUgRVFVIDAgKCAgCiAgICBSRUcgZGVsZXRlICJIS0xNXFNPRlRXQVJFXFBvbGljaWVzXE1pY3Jvc29mdFxXaW5kb3dzIEFkdmFuY2VkIFRocmVhdCBQcm90ZWN0aW9uIiAvdiA2OTZDMUZBMS00MDMwLTRGQTQtODcxMy1GQUY5QjJFQTdDMEEgL2YgPiAlVE1QJVxzZW5zZVRtcC50eHQgMj4mMQogICAgaWYgJUVSUk9STEVWRUwlIE5FUSAwICgKICAgICAgICBzZXQgImVycm9yRGVzY3JpcHRpb249VW5hYmxlIHRvIGRlbGV0ZSBwcmV2aW91cyBvZmZib2FyZGluZyBpbmZvcm1hdGlvbiBmcm9tIHJlZ2lzdHJ5LiIKICAgICAgICBzZXQgZXJyb3JDb2RlPTUKICAgICAgICBzZXQgbGFzdEVycm9yPSVFUlJPUkxFVkVMJQogICAgICAgIEdPVE8gRVJST1IKICAgICkKKQoKUkVHIGFkZCAiSEtMTVxTT0ZUV0FSRVxQb2xpY2llc1xNaWNyb3NvZnRcV2luZG93cyBBZHZhbmNlZCBUaHJlYXQgUHJvdGVjdGlvbiIgL3YgT25ib2FyZGluZ0luZm8gL3QgUkVHX1NaIC9mIC9kICJ7XCJib2R5XCI6XCJ7XFxcInByZXZpb3VzT3JnSWRzXFxcIjpbXSxcXFwib3JnSWRcXFwiOlxcXCIwMDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMGRlYWRcXFwiLFxcXCJnZW9Mb2NhdGlvblVybFxcXCI6XFxcImh0dHBzOi8vc2V2aWxsZWNsb3VkZ2F0ZXdheS1zdGcubWljcm9zb2Z0LmNvbS9cXFwiLFxcXCJkYXRhY2VudGVyXFxcIjpcXFwiRWFzdFVzMlxcXCIsXFxcInZvcnRleEdlb0xvY2F0aW9uXFxcIjpcXFwiU2FuZGJveFxcXCIsXFxcInZlcnNpb25cXFwiOlxcXCIxLjNcXFwifVwiLFwic2lnXCI6XCJKc0dGR2o3UCtIL1cvUEExcW9LTml3RXROZkU4YkhGblhxeks1SDhsQ09wc0RnRGNWTWpoT3BmQTZJTTJ3RFZadk5kWGhvZ0dEQ1FDWjNYdFJCbHRkcGFWc3pZNGtINVpHVkdnRUQxVE80ZCtCTjk2VDFSa3pOZ2NjZ2ZCWDNNQUw1bllUWXdiMGlUQUtFMGIxb3BmQmZrMzJQN3Q3b3A5dkhPeXZNMW5qdlZybVdWWWVSNk4rZFFrLzM4UDNUY2V3b2FkRmFUb3pidjBZK3dZOHgrbFcxeWN6bk1KMitQWTlxRHpabXoybE1rd0FlaDJwRTI4VW5MT0lhNjg0Y3U5RitHUlAveGhhR3dQWmpoc1JCSW51cHV5U1E2Y09YdE9kSERCQlRaZzVKSEhHMDBkNk9tUk5ONmxBelJWeFJURUVmaFFUVnN0U1poKzNMSjJTMGhmZGc9PVwiLFwic2hhMjU2c2lnXCI6XCJsVGI4ZittdkFveDRCckxPS0lqejFnTTNrRHREbG9wL21uNmZodmVEWjMvblVqb1lhNk81V2p4R0x2Z3lqZ0RtdThETkdPNUtqWWlxTVZ6Z0QzcHdqOVYwOXVOeUdYNGJUaXN0d1BnQTFLbGMrMUFLcmtWQTRGWGlQTHlST2tXdlhLM2dydFFJWU9nYjdSRlh6dzhnQlB5YlV0Z0FWbmNaMVFpdTAzblFLdGh5MFU3aXBlZUxaVE9oYVlhN001cTJxUTcya1BaSTZWUWlqSE42NVg3UTEvcm5rdUlSUkFmUEErZElIeE4wN0tpSlY2MGZsbDFZUUtOUlpSYUhKeGQ1UDd0RmdaaytEZE5mNVNXcHVaSTZTZE9MdExDN3VnbmdnK0krU2pUeUtvcVFKZElkWGRRaE5JK3I3WEM1L1M0ZlhnRVNtWmZKTUYxL0JtVlVFZUJDZlE9PVwiLFwiY2VydFwiOlwiTUlJRjVqQ0NBODZnQXdJQkFnSVRNd0FBQVkwdmh1VTl6R2x5b1FBQUFBQUJqVEFOQmdrcWhraUc5dzBCQVFzRkFEQitNUXN3Q1FZRFZRUUdFd0pWVXpFVE1CRUdBMVVFQ0JNS1YyRnphR2x1WjNSdmJqRVFNQTRHQTFVRUJ4TUhVbVZrYlc5dVpERWVNQndHQTFVRUNoTVZUV2xqY205emIyWjBJRU52Y25CdmNtRjBhVzl1TVNnd0pnWURWUVFERXg5TmFXTnliM052Wm5RZ1UyVmpkWEpsSUZObGNuWmxjaUJEUVNBeU1ERXhNQjRYRFRJd01EZ3dOakl3TlRBMU9Gb1hEVEl4TURnd05qSXdOVEExT0Zvd2dZb3hDekFKQmdOVkJBWVRBbFZUTVFzd0NRWURWUVFJRXdKWFFURVFNQTRHQTFVRUJ4TUhVbVZrYlc5dVpERWVNQndHQTFVRUNoTVZUV2xqY205emIyWjBJRU52Y25CdmNtRjBhVzl1TVI0d0hBWURWUVFMRXhWTmFXTnliM052Wm5RZ1EyOXljRzl5WVhScGIyNHhIREFhQmdOVkJBTVRFMU5sZG1sc2JHVXVWMmx1Wkc5M2N5NWpiMjB3Z2dFaU1BMEdDU3FHU0liM0RRRUJBUVVBQTRJQkR3QXdnZ0VLQW9JQkFRRENmcWtCcmV1Um1qdm90bDFFdURQWVplaVc1dUVERmV6MXhsYmh6cjVaa1BjSUJYT3RIMVZWRjRaUmVrdTFpK3ZMbTNON2xkVGl4c2RSZW0yU09iVkFGb1dDbjZ2cEYwL1ZYcWpmUTJHbyt2dk9UU1Q0Si9pQWxocXhialVVbkRyWFpXYUMvS2xtU0lYMjlHUng5bG1pT0IrWVBhRzlOTEE1U3F3emNad2hjTThzS3F0VDhHaWQ3Q3JFNGs1WldES0gyL1dPVTVsQ01iZTY2MWtrbWxKZDB2TlBDTXpyMUgzVmNmRG1qVVo4Q25WQzBFODlhVVA3VHhhME1uS0FzVFArQkpCNXJMenhkVlJRbGRNbmhHVXNXRU0ydUNOWXFOdWc4QWYrTGp3RytySXZrSVR3NVlDMUZDZy9qVHBvdHJnSFhmSGRqaURqa0F3ZWY1TlVkTmx0QWdNQkFBR2pnZ0ZPTUlJQlNqQU9CZ05WSFE4QkFmOEVCQU1DQjRBd0V3WURWUjBsQkF3d0NnWUlLd1lCQlFVSEF3RXdIUVlEVlIwT0JCWUVGT0U1NVFoeno5bEhuWTl2aDVTWmtyMTdjbEtzTUI0R0ExVWRFUVFYTUJXQ0UxTmxkbWxzYkdVdVYybHVaRzkzY3k1amIyMHdId1lEVlIwakJCZ3dGb0FVTmxhSlpVbkxXNXN2UEt4Q0ZsQk5rYmt6MTVFd1V3WURWUjBmQkV3d1NqQklvRWFnUklaQ2FIUjBjRG92TDNkM2R5NXRhV055YjNOdlpuUXVZMjl0TDNCcmFXOXdjeTlqY213dlRXbGpVMlZqVTJWeVEwRXlNREV4WHpJd01URXRNVEF0TVRndVkzSnNNR0FHQ0NzR0FRVUZCd0VCQkZRd1VqQlFCZ2dyQmdFRkJRY3dBb1pFYUhSMGNEb3ZMM2QzZHk1dGFXTnliM052Wm5RdVkyOXRMM0JyYVc5d2N5OWpaWEowY3k5TmFXTlRaV05UWlhKRFFUSXdNVEZmTWpBeE1TMHhNQzB4T0M1amNuUXdEQVlEVlIwVEFRSC9CQUl3QURBTkJna3Foa2lHOXcwQkFRc0ZBQU9DQWdFQVp3ZGxhWjg4U3BURFdUUjc5NWRHV2N0dUxUWmc2UDBqYmh4Q0dhOXBnb3AzSXZ1Qi9QYzJXT2Ruc1ZCYUpUZG5WN3NvcFZHa3V4Vjc1eWk2Q0NQM2sxNG0xQ1FhNk01cmNodmJuVEY0TFdjWld4U1g4Z0hjRWhObFdYV3hxU3FKMzNnSHVGNEc5SCs3VDM3UlNMb2Jqb1MyeVRhc21SRWtCNTI4b1gwWVU0cVpjeVdyK0xEMVovQk10dEhMUlZUZUtHdnpMaVpCNmhqWURybW9qUUxKZXZwSEdoTVdOTU9oR2RLd2pOS0crZGhVRHV6dTdsVXgwZzdhaUR3c1l4NzFTaU9ucDJWOSt5UEhET2R5OXlBRUNPb0N3bUprbW5qLzlDMmVNMDFDQjFZMUxTWHNiQUJtQVd3Si9iczhRNnhTWlJtSnkyRXJSQ3VTakl0MUQydzRTUFVMRFNNVTdIaDk3TWJpQVJDV25TMVRRMGg5azZFWVVmbW1ZaFNHQ0p3MXFlekFqZ2FmTngyYWcrRDhzRFFkQzRjVHhUSTk5aGthUm1DakFmeW1qcVdscUx5V0pCUmdvaXdTd21MVDFUbzRJNUVjZHFoQ1FNdEpoRVVRR2dpenk2ZUE2RlhtNHhmeExua08xSkNKSGJUejlqL2c4OW5zZ0hVN2V4SDVnZHhZQ0FDMGJkUlZLN1YrVlBDcExnLy9SemtlNm9mc1Y3WkxyQUpvN0EyQTZka0dVL09XeGhpVjJiY0VlUEpmSWsrVjM3UHp3c25yZ1JFV2RpM1pic3dBOU5aTTVzZGVSMFlFRm11bit0b2JCRGMzMlRidlVyTUpTb2tjcG9XNnRZczlkR0tUcE1GV01EZ09UeEZjSHljbHZrMjRVQVV2dXk2WVcvSVN2VlY4a3BRPVwiLFwiY2hhaW5cIjpbXCJNSUlHMkRDQ0JNQ2dBd0lCQWdJS1lUKzNHQUFBQUFBQUJEQU5CZ2txaGtpRzl3MEJBUXNGQURDQmlERUxNQWtHQTFVRUJoTUNWVk14RXpBUkJnTlZCQWdUQ2xkaGMyaHBibWQwYjI0eEVEQU9CZ05WQkFjVEIxSmxaRzF2Ym1ReEhqQWNCZ05WQkFvVEZVMXBZM0p2YzI5bWRDQkRiM0p3YjNKaGRHbHZiakV5TURBR0ExVUVBeE1wVFdsamNtOXpiMlowSUZKdmIzUWdRMlZ5ZEdsbWFXTmhkR1VnUVhWMGFHOXlhWFI1SURJd01URXdIaGNOTVRFeE1ERTRNakkxTlRFNVdoY05Nall4TURFNE1qTXdOVEU1V2pCK01Rc3dDUVlEVlFRR0V3SlZVekVUTUJFR0ExVUVDQk1LVjJGemFHbHVaM1J2YmpFUU1BNEdBMVVFQnhNSFVtVmtiVzl1WkRFZU1Cd0dBMVVFQ2hNVlRXbGpjbTl6YjJaMElFTnZjbkJ2Y21GMGFXOXVNU2d3SmdZRFZRUURFeDlOYVdOeWIzTnZablFnVTJWamRYSmxJRk5sY25abGNpQkRRU0F5TURFeE1JSUNJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBZzhBTUlJQ0NnS0NBZ0VBMEF2QXBLZ1pnZUkyNWVLcTVmT3lGVmgxdnJUbFNmSGdoUG03RFdUdmhjR0JWYmp6NS9GdFFGVTl6b3RxMFlTVDlYVjhXNlRVZEJES012TWowNjd1ejU0RVdNTFpSOHZSZkFCQlNIRWJBV2NYR0svRy9uTURmdVR2UTV6dkFYRXFINEVtUTNlWVZGZHpuVlVyOEo2T2ZRWU9yQnRVOHliMytDTUlJb3VlQmgwM09QMXkwc3JsWThHYVduMnliYk5TcVc3cHJyWDhpemI1bnZyMkhGZ2JsMWFsRWVXM1V0dTc2ZkJVdjdUL0xHeTRYU2JPb0FyWDM1UHRmOTJzOFN4ekd0a1pOMVc2M1NKNGpxSFVtd240QnlJeGNiQ1VydUN3NXlaRVY1Q0JseFhPWWV4bDRrdnhoVklXTXZpMWVLcCt6VTNzZ3lHa3FKdSttbW9FNEtNY3pWWVliUDFyTDBJKzRqZnljcXZRZUhOeWU5N3NBRmpsSVRDakNEcVo3NS9EOTNvV2xtVzF3NEd2OURsd1NhLzJxZlpxQURqNXRBZ1o0Qm8xcFZaMklsOXE4bW11UHExWVJrMjRWUGFKUVVRZWNyRzhFaWRUMHNIL3NzMVFtQjYxOUx1MndvSTUyYXdiOGpzbmhHcXd4aVlMMXpvUTU3UGJmTk5XckZOTUMvbzdNVGQwMkZrcitRQjVHUVo3L1J3ZFF0UkJEUzhGRHRWclNTUC96ODM0ZW9MUDJqd3QzK2pZRWdRWXVoNklkN2lZSHhBSHU4Z0ZmZ3NKdjJ2ZDQwNWJzUG5IaEtZN3lreWZXMklwOThlaXFKV0ljQ3psd1Q4OFVpTlBRSnJETVlXREw3OHA4UjFRanlHV0I4N3Y4b0RDUkgyYll1OHZ3M2VKcTBWTlV6NENlZE1DQXdFQUFhT0NBVXN3Z2dGSE1CQUdDU3NHQVFRQmdqY1ZBUVFEQWdFQU1CMEdBMVVkRGdRV0JCUTJWb2xsU2N0Ym15ODhyRUlXVUUyUnVUUFhrVEFaQmdrckJnRUVBWUkzRkFJRURCNEtBRk1BZFFCaUFFTUFRVEFMQmdOVkhROEVCQU1DQVlZd0R3WURWUjBUQVFIL0JBVXdBd0VCL3pBZkJnTlZIU01FR0RBV2dCUnlMVG9DTVpCRHVSUUZUdUhxcDhjeDBTT0pOREJhQmdOVkhSOEVVekJSTUUrZ1RhQkxoa2xvZEhSd09pOHZZM0pzTG0xcFkzSnZjMjltZEM1amIyMHZjR3RwTDJOeWJDOXdjbTlrZFdOMGN5OU5hV05TYjI5RFpYSkJkWFF5TURFeFh6SXdNVEZmTUROZk1qSXVZM0pzTUY0R0NDc0dBUVVGQndFQkJGSXdVREJPQmdnckJnRUZCUWN3QW9aQ2FIUjBjRG92TDNkM2R5NXRhV055YjNOdlpuUXVZMjl0TDNCcmFTOWpaWEowY3k5TmFXTlNiMjlEWlhKQmRYUXlNREV4WHpJd01URmZNRE5mTWpJdVkzSjBNQTBHQ1NxR1NJYjNEUUVCQ3dVQUE0SUNBUUJCeUdIQjlWdWVQcEV4OGJER3Z3a0J0SjIya0hUWENkdW1MZzJmeU9kMk5FYXZCMkNKVElHelBOWDBFalYxd25PbDlVMkVqTXVrWGErL2t2WVhDRmRDbFhKbEJYWjVyZTdSdXJndVZLTlJCNnhvNnlFTTR5V0J3czBxOHNQL3o4SzlTUmlheC9DRXhma1V2R3VWNVpidnMwTFNVOVZLb0JMRXJoSjJVd2xXRHAzMzA2WkppRkR5aWl5WElLSytUbmp2QldXM1M2RVdpTjR4eHdoQ0pIeWtlNTZkdkdBQVhtS1g0NVA4cC81YmV5WGY1Rk4vUzc3bVB2RGJBWGxDSEc2RmJIMjJSREQ3cFRlU2s3S2w3aUN0UDFQVnlmUW9hMWZCK0IxcXQxWXF0aWVCSEtZdG4rZjAwREdEbDZncXRxeStHMEgxNUlsZlZ2dmFXdE5lZlZXVUVINVRWL1JLUFVBcXlMMW5uNFRoRU83OTJtc1Zna244UmgzL1JRWjBuRUlVN2NVNTA3UE5DNE1ua0VOUmt2SkVncTV1bWhVWHNobjZ4MFZzbUFGN3Z6ZXBzSWlra3J3NE9PQWQ1SHlYbUJvdVgrODRaYmMxTDcxL1R5SDZ4SXpTYndiNVNUWHEzeUFQSmFycVlLc3NIMHVKL0xmNlhGU1FTejZpS0U5czVGSmx3ZjJRSElXQ2lHN3BwbFhkSVNoNVJiQVU1UXJNNWwvRXU5dGhOR21mckNZNDk4RXBRUWdWTGt5Zzkva01QdDVmcXdnSkxZT3NyRFNEWXZUSlNVS0pKYlZ1c2tmRnN6bWdzU0FiTExHT0JHK2xNRWtjMEVicFFGdjByVzY2MjRKS2h4SktnQWxOMjk5MnVRVmJHK0M3SUhCZkFDWEgwdzc2RnExN0lwNXhDQT09XCIsXCJNSUlGN1RDQ0E5V2dBd0lCQWdJUVA0dkl0Znlmc3BaRHRXbldiRUxoUkRBTkJna3Foa2lHOXcwQkFRc0ZBRENCaURFTE1Ba0dBMVVFQmhNQ1ZWTXhFekFSQmdOVkJBZ1RDbGRoYzJocGJtZDBiMjR4RURBT0JnTlZCQWNUQjFKbFpHMXZibVF4SGpBY0JnTlZCQW9URlUxcFkzSnZjMjltZENCRGIzSndiM0poZEdsdmJqRXlNREFHQTFVRUF4TXBUV2xqY205emIyWjBJRkp2YjNRZ1EyVnlkR2xtYVdOaGRHVWdRWFYwYUc5eWFYUjVJREl3TVRFd0hoY05NVEV3TXpJeU1qSXdOVEk0V2hjTk16WXdNekl5TWpJeE16QTBXakNCaURFTE1Ba0dBMVVFQmhNQ1ZWTXhFekFSQmdOVkJBZ1RDbGRoYzJocGJtZDBiMjR4RURBT0JnTlZCQWNUQjFKbFpHMXZibVF4SGpBY0JnTlZCQW9URlUxcFkzSnZjMjltZENCRGIzSndiM0poZEdsdmJqRXlNREFHQTFVRUF4TXBUV2xqY205emIyWjBJRkp2YjNRZ1EyVnlkR2xtYVdOaGRHVWdRWFYwYUc5eWFYUjVJREl3TVRFd2dnSWlNQTBHQ1NxR1NJYjNEUUVCQVFVQUE0SUNEd0F3Z2dJS0FvSUNBUUN5Z0VHcU5UaE5FM0l5YUNKTnVMTHgvOVZTdkd6SDlkSktqRGJ1MGNKY2ZveUtycThUS0cvQWMrTTZ6dEFscUZvNmJlK291Rm1yRXlOb3pRd3BoOUZ2Z0Z5UFJIOWRrQUZTV0t4UnhWOHFoOXpjMkFvZHdRTzVlN0JXNktQZVpHSENudmp6Zkxuc0RiVlUva3kyWlUrSThKeEltUXhDQ3dsOE1Wa1hlUVo0S0kySk9rd0RKYjV4YWx3TDU0UmdwSmtpNDlLdmhLU24rOUdZN1F5cDNwU0o0UTZnM01ET21UM3FDRks3Vm5ua0g0UzZIcmkweEVsY1R6RkxoOTNkQldjbW1ZRGdjUkdqdUtWQjRxUlR1ZmN5S1lNTUU3ODJYZ1N6UzBOSEwydmlrUjdUbUUvZFFnZkk2QjBTL0ptcGF6NlNmc2pXYVRyOFpMMjJDWjNLL1F3TG9wdDNZRXNEbEtRd2FSTFdRaTNCUVV6SzNLcjlqMXVEUnByWi9MSFI0N1BKZjBoNnpTVHdRWTljZE5Dc3NCQWdCa20zeHkwaHlGZmowSWJ6QTJqNzBNNXh3WW1aU21RQmJQM3NNSkhQUVR5U3grVzZoaDFoaE1kZmd6bGlyclNTTDBmekMvaFY2NkFmV2RDN2RKc2UwSGJtOHVrRzF4RG8rbVRlYWNZMWxvZ0M4RWE0UHllWmI4dHhpU2sxOTBnV0FqV1AxWGw4VFFMUFgrdUtnMDlGY1lqNXFRMU9jdW5DbkFmUFNSdE9CQTVqVVl4ZTJBREJWU3kyeHVEQ1pVN0pORG4xbkxQRWZ1aGhiaE5mRmNSZjJYN3RIYzd1Uk96TExvYXg3RGoyY08yclhCUEIyUThOeDRDeVZlMDA5NnliNU1QYTUwYzhwcldQTWQvRlM2L3I4UUlEQVFBQm8xRXdUekFMQmdOVkhROEVCQU1DQVlZd0R3WURWUjBUQVFIL0JBVXdBd0VCL3pBZEJnTlZIUTRFRmdRVWNpMDZBakdRUTdrVUJVN2g2cWZITWRFamlUUXdFQVlKS3dZQkJBR0NOeFVCQkFNQ0FRQXdEUVlKS29aSWh2Y05BUUVMQlFBRGdnSUJBSDl5encrM3hSWGJtOEJKeWlaYi9wNFQ1dFB3MHR1WFgvSkxQMDJ6cmhtdTdkZVhvS3p2cVRxandrR3c1YmlSbmhPQkpBUG1DZjAvVjBBNUlTUlcwUkF2UzBDcE5vWkx0Rk5YbXZ2eGZvbVBFZjRZYkZHcTZPMEpsYlhsY2NtaDZZZDFwaFYveVg0M1ZGNTBrOFhEWjh3TlQydW9Gd3h0Q0pKK2k5MkJxaTF3SWNNOUJoUzd2eVJlcDRUWFB3OGhJcjFMQUFiYmx4ellYdFRGQzF5SGJsQ2s2TU00cFB2TExNV1NacHVGWHN0NmJKTjhnQ2xZVzFlMVFHbTZDSG1tWkdJVm5ZZVdSYlZtSXlBRGl4eHpvTk9pZVRQZ1VGbUcyeS9sQWlYcWN5cWZBQlRJTnNlU08rbE9BT3pZVmdtNU0wa1MwbFFMQWF1c1I3YVJLWDFNdEhXQVVnSG95b0wybjh5c25JOFg2aThtc0t0eXJBditubEVleDBOVlowOVJzMWZXdHV6dVVyYzY2VTdoMTRHSXZFK09kYnRMcVBBMXFpYlVaMmRKc25CTU81UGNIZDk0a0laeXNqaWswZHlTVGNsWTZ5c1NYTlE3cm94cnNJUGxBVC80Q1RMMmt6VTBJcS9kTncxM0NZQXJ6VWdBOFl5WkdVY0ZBZW5SdjlGTzBPWW9RemVacEFwS0NObWFjWFBTcXMweEUyTjJvVGR2a2pnZWZSSThaakxueTIzaC9GS0ozY3JXWmdXYWxtRytvaWpISEtPbk5sQThPcVRmU203bWh6dk82L0RnZ1RlZEV6eFNqcjI1SFRUR0hkVUthajJZS1hDTWlTclJxNElRU0IvYzlPK2x4YnRWR2poamhFNjNiSzJWVk94bEloQkpGN2pBSHNjUHJGUkhcIl19IiA+ICVUTVAlXHNlbnNlVG1wLnR4dCAyPiYxCmlmICVFUlJPUkxFVkVMJSBORVEgMCAoCiAgIHNldCAiZXJyb3JEZXNjcmlwdGlvbj1VbmFibGUgdG8gd3JpdGUgb25ib2FyZGluZyBpbmZvcm1hdGlvbiB0byByZWdpc3RyeS4iCiAgIHNldCBlcnJvckNvZGU9MTAKICAgc2V0IGxhc3RFcnJvcj0lRVJST1JMRVZFTCUKICAgR09UTyBFUlJPUgopCgplY2hvIFN0YXJ0aW5nIHRoZSBzZXJ2aWNlLCBpZiBub3QgYWxyZWFkeSBydW5uaW5nID5OVUwgMj4mMQplY2hvLiA+TlVMIDI+JjEKc2MgcXVlcnkgIlNFTlNFIiB8IGZpbmQgL2kgIlJVTk5JTkciID5OVUwgMj4mMQppZiAlRVJST1JMRVZFTCUgRVFVIDAgR09UTyBSVU5OSU5HCgpuZXQgc3RhcnQgc2Vuc2UgPiAlVE1QJVxzZW5zZVRtcC50eHQgMj4mMQppZiAlRVJST1JMRVZFTCUgTkVRIDAgKAogICBlY2hvIFdpbmRvd3MgRGVmZW5kZXIgQWR2YW5jZWQgVGhyZWF0IFByb3RlY3Rpb24gU2VydmljZSBoYXMgbm90IHN0YXJ0ZWQgeWV0ID5OVUwgMj4mMQogICBHT1RPIFdBSVRfRk9SX1RIRV9TRVJWSUNFX1RPX1NUQVJUCikKZ290byBTVUNDRUVERUQKCjpSVU5OSU5HCnNldCAicnVubmluZ091dHB1dD1UaGUgV2luZG93cyBEZWZlbmRlciBBZHZhbmNlZCBUaHJlYXQgUHJvdGVjdGlvbiBTZXJ2aWNlIGlzIGFscmVhZHkgcnVubmluZyEiCmVjaG8gJXJ1bm5pbmdPdXRwdXQlID5OVUwgMj4mMQplY2hvLiA+TlVMIDI+JjEKZXZlbnRjcmVhdGUgL2wgQXBwbGljYXRpb24gL3NvIFdEQVRQT25ib2FyZGluZyAvdCBJbmZvcm1hdGlvbiAvaWQgMTAgL2QgIiVydW5uaW5nT3V0cHV0JSIgPk5VTCAyPiYxCkdPVE8gV0FJVF9GT1JfVEhFX1NFUlZJQ0VfVE9fU1RBUlQKCjpFUlJPUgpTZXQgL1AgZXJyb3JNc2c9PCVUTVAlXHNlbnNlVG1wLnR4dApzZXQgImVycm9yT3V0cHV0PVtFcnJvciBJZDogJWVycm9yQ29kZSUsIEVycm9yIExldmVsOiAlbGFzdEVycm9yJV0gJWVycm9yRGVzY3JpcHRpb24lIEVycm9yIG1lc3NhZ2U6ICVlcnJvck1zZyUiCiVwb3dlcnNoZWxsUGF0aCUgLUV4ZWN1dGlvblBvbGljeSBCeXBhc3MgLU5vUHJvZmlsZSAtQ29tbWFuZCAiQWRkLVR5cGUgJ3VzaW5nIFN5c3RlbTsgdXNpbmcgU3lzdGVtLkRpYWdub3N0aWNzOyB1c2luZyBTeXN0ZW0uRGlhZ25vc3RpY3MuVHJhY2luZzsgbmFtZXNwYWNlIFNlbnNlIHsgW0V2ZW50RGF0YShOYW1lID0gXCJPbmJvYXJkaW5nXCIpXXB1YmxpYyBzdHJ1Y3QgT25ib2FyZGluZ3twdWJsaWMgc3RyaW5nIE1lc3NhZ2UgeyBnZXQ7IHNldDsgfX0gcHVibGljIGNsYXNzIFRyYWNlIHtwdWJsaWMgc3RhdGljIEV2ZW50U291cmNlT3B0aW9ucyBUZWxlbWV0cnlDcml0aWNhbE9wdGlvbiA9IG5ldyBFdmVudFNvdXJjZU9wdGlvbnMoKXtMZXZlbCA9IEV2ZW50TGV2ZWwuRXJyb3IsIEtleXdvcmRzID0gKEV2ZW50S2V5d29yZHMpMHgwMDAwMjAwMDAwMDAwMDAwLCBUYWdzID0gKEV2ZW50VGFncykweDAyMDAwMDB9OyBwdWJsaWMgdm9pZCBXcml0ZU9uYm9hcmRpbmdNZXNzYWdlKHN0cmluZyBtZXNzYWdlKXtlcy5Xcml0ZShcIk9uYm9hcmRpbmdTY3JpcHRcIiwgVGVsZW1ldHJ5Q3JpdGljYWxPcHRpb24sIG5ldyBPbmJvYXJkaW5nIHtNZXNzYWdlID0gbWVzc2FnZX0pO30gcHJpdmF0ZSBzdGF0aWMgcmVhZG9ubHkgc3RyaW5nW10gdGVsZW1ldHJ5VHJhaXRzID0geyBcIkVUV19HUk9VUFwiLCBcIns1RUNCMEJBQy1COTMwLTQ3RjUtQThBNC1FODI1MzUyOUVEQjd9XCIgfTsgcHJpdmF0ZSBFdmVudFNvdXJjZSBlcyA9IG5ldyBFdmVudFNvdXJjZShcIk1pY3Jvc29mdC5XaW5kb3dzLlNlbnNlLkNsaWVudC5NYW5hZ2VtZW50XCIsRXZlbnRTb3VyY2VTZXR0aW5ncy5FdHdTZWxmRGVzY3JpYmluZ0V2ZW50Rm9ybWF0LHRlbGVtZXRyeVRyYWl0cyk7fX0nOyAkbG9nZ2VyID0gTmV3LU9iamVjdCAtVHlwZU5hbWUgU2Vuc2UuVHJhY2U7ICRsb2dnZXIuV3JpdGVPbmJvYXJkaW5nTWVzc2FnZSgnJWVycm9yT3V0cHV0JScpIiA+TlVMIDI+JjEKZWNobyAlZXJyb3JPdXRwdXQlID5OVUwgMj4mMQplY2hvLiA+TlVMIDI+JjEKZXZlbnRjcmVhdGUgL2wgQXBwbGljYXRpb24gL3NvIFdEQVRQT25ib2FyZGluZyAvdCBFcnJvciAvaWQgJWVycm9yQ29kZSUgL2QgIiVlcnJvck91dHB1dCUiID5OVUwgMj4mMQpHT1RPIENMRUFOVVAKCjpTVUNDRUVERUQKZWNobyBGaW5pc2hlZCBwZXJmb3JtaW5nIG9uYm9hcmRpbmcgb3BlcmF0aW9ucyA+TlVMIDI+JjEKZWNoby4gPk5VTCAyPiYxCkdPVE8gV0FJVF9GT1JfVEhFX1NFUlZJQ0VfVE9fU1RBUlQKCjpXQUlUX0ZPUl9USEVfU0VSVklDRV9UT19TVEFSVAplY2hvIFdhaXRpbmcgZm9yIHRoZSBzZXJ2aWNlIHRvIHN0YXJ0ID5OVUwgMj4mMQplY2hvLiA+TlVMIDI+JjEKCnNldCAvYSBjb3VudGVyPTAKCjpTRU5TRV9SVU5OSU5HX1dBSVQKc2MgcXVlcnkgIlNFTlNFIiB8IGZpbmQgL2kgIlJVTk5JTkciID5OVUwgMj4mMQppZiAlRVJST1JMRVZFTCUgTkVRIDAgKAoJSUYgJWNvdW50ZXIlIEVRVSA0ICgKCQlzZXQgImVycm9yRGVzY3JpcHRpb249VW5hYmxlIHRvIHN0YXJ0IFdpbmRvd3MgRGVmZW5kZXIgQWR2YW5jZWQgVGhyZWF0IFByb3RlY3Rpb24gU2VydmljZS4iCgkJc2V0IGVycm9yQ29kZT0xNQoJCXNldCBsYXN0RXJyb3I9JUVSUk9STEVWRUwlCgkJR09UTyBFUlJPUgoJKQoKCXNldCAvYSBjb3VudGVyPSVjb3VudGVyJSsxCgoJdGltZW91dCA1ID5OVUwgMj4mMQoJR09UTyA6U0VOU0VfUlVOTklOR19XQUlUCikKCnNldCAvYSBjb3VudGVyPTAKCjpTRU5TRV9PTkJPQVJERURfU1RBVFVTX1dBSVQKUkVHIHF1ZXJ5ICJIS0xNXFNPRlRXQVJFXE1pY3Jvc29mdFxXaW5kb3dzIEFkdmFuY2VkIFRocmVhdCBQcm90ZWN0aW9uXFN0YXR1cyIgL3YgT25ib2FyZGluZ1N0YXRlIC9yZWc6NjQgPk5VTCAyPiYxCmlmICVFUlJPUkxFVkVMJSBORVEgMCAoCglJRiAlY291bnRlciUgRVFVIDQgKAoJCUBlY2hvIFdpbmRvd3MgRGVmZW5kZXIgQWR2YW5jZWQgVGhyZWF0IFByb3RlY3Rpb24gU2VydmljZSBpcyBub3QgcnVubmluZyBhcyBleHBlY3RlZD4gJVRNUCVcc2Vuc2VUbXAudHh0CgkJc2V0IGVycm9yQ29kZT0zNQogICAgIHNldCBsYXN0RXJyb3I9JUVSUk9STEVWRUwlCgkJR09UTyBFUlJPUgoJKQoKCXNldCAvYSBjb3VudGVyPSVjb3VudGVyJSsxCgoJdGltZW91dCA1ID5OVUwgMj4mMQoJR09UTyA6U0VOU0VfT05CT0FSREVEX1NUQVRVU19XQUlUCikKCnNldCAvYSBjb3VudGVyPTAKCjpTRU5TRV9PTkJPQVJERURfV0FJVApSRUcgcXVlcnkgIkhLTE1cU09GVFdBUkVcTWljcm9zb2Z0XFdpbmRvd3MgQWR2YW5jZWQgVGhyZWF0IFByb3RlY3Rpb25cU3RhdHVzIiAvdiBPbmJvYXJkaW5nU3RhdGUgL3JlZzo2NCB8IGZpbmQgL2kgIjB4MSIgPk5VTCAyPiYxCmlmICVFUlJPUkxFVkVMJSBORVEgMCAoCglJRiAlY291bnRlciUgRVFVIDQgKAoJCUBlY2hvIFdpbmRvd3MgRGVmZW5kZXIgQWR2YW5jZWQgVGhyZWF0IFByb3RlY3Rpb24gU2VydmljZSBpcyBub3QgcnVubmluZyBhcyBleHBlY3RlZD4gJVRNUCVcc2Vuc2VUbXAudHh0CgkJc2V0IGVycm9yQ29kZT00MAogICAgIHNldCBsYXN0RXJyb3I9JUVSUk9STEVWRUwlCgkJR09UTyBFUlJPUgoJKQoKCXNldCAvYSBjb3VudGVyPSVjb3VudGVyJSsxCgoJdGltZW91dCA1ID5OVUwgMj4mMQoJR09UTyA6U0VOU0VfT05CT0FSREVEX1dBSVQKKQoKc2V0ICJzdWNjZXNzT3V0cHV0PVN1Y2Nlc3NmdWxseSBvbmJvYXJkZWQgbWFjaGluZSB0byBXaW5kb3dzIERlZmVuZGVyIEFkdmFuY2VkIFRocmVhdCBQcm90ZWN0aW9uIgplY2hvICVzdWNjZXNzT3V0cHV0JSA+TlVMIDI+JjEKZWNoby4KZXZlbnRjcmVhdGUgL2wgQXBwbGljYXRpb24gL3NvIFdEQVRQT25ib2FyZGluZyAvdCBJbmZvcm1hdGlvbiAvaWQgMjAgL2QgIiVzdWNjZXNzT3V0cHV0JSIgPk5VTCAyPiYxCiVwb3dlcnNoZWxsUGF0aCUgLUV4ZWN1dGlvblBvbGljeSBCeXBhc3MgLU5vUHJvZmlsZSAtQ29tbWFuZCAiQWRkLVR5cGUgJ3VzaW5nIFN5c3RlbTsgdXNpbmcgU3lzdGVtLkRpYWdub3N0aWNzOyB1c2luZyBTeXN0ZW0uRGlhZ25vc3RpY3MuVHJhY2luZzsgbmFtZXNwYWNlIFNlbnNlIHsgW0V2ZW50RGF0YShOYW1lID0gXCJPbmJvYXJkaW5nXCIpXXB1YmxpYyBzdHJ1Y3QgT25ib2FyZGluZ3twdWJsaWMgc3RyaW5nIE1lc3NhZ2UgeyBnZXQ7IHNldDsgfX0gcHVibGljIGNsYXNzIFRyYWNlIHtwdWJsaWMgc3RhdGljIEV2ZW50U291cmNlT3B0aW9ucyBUZWxlbWV0cnlDcml0aWNhbE9wdGlvbiA9IG5ldyBFdmVudFNvdXJjZU9wdGlvbnMoKXtMZXZlbCA9IEV2ZW50TGV2ZWwuSW5mb3JtYXRpb25hbCwgS2V5d29yZHMgPSAoRXZlbnRLZXl3b3JkcykweDAwMDAyMDAwMDAwMDAwMDAsIFRhZ3MgPSAoRXZlbnRUYWdzKTB4MDIwMDAwMH07IHB1YmxpYyB2b2lkIFdyaXRlT25ib2FyZGluZ01lc3NhZ2Uoc3RyaW5nIG1lc3NhZ2Upe2VzLldyaXRlKFwiT25ib2FyZGluZ1NjcmlwdFwiLCBUZWxlbWV0cnlDcml0aWNhbE9wdGlvbiwgbmV3IE9uYm9hcmRpbmcge01lc3NhZ2UgPSBtZXNzYWdlfSk7fSBwcml2YXRlIHN0YXRpYyByZWFkb25seSBzdHJpbmdbXSB0ZWxlbWV0cnlUcmFpdHMgPSB7IFwiRVRXX0dST1VQXCIsIFwiezVFQ0IwQkFDLUI5MzAtNDdGNS1BOEE0LUU4MjUzNTI5RURCN31cIiB9OyBwcml2YXRlIEV2ZW50U291cmNlIGVzID0gbmV3IEV2ZW50U291cmNlKFwiTWljcm9zb2Z0LldpbmRvd3MuU2Vuc2UuQ2xpZW50Lk1hbmFnZW1lbnRcIixFdmVudFNvdXJjZVNldHRpbmdzLkV0d1NlbGZEZXNjcmliaW5nRXZlbnRGb3JtYXQsdGVsZW1ldHJ5VHJhaXRzKTt9fSc7ICRsb2dnZXIgPSBOZXctT2JqZWN0IC1UeXBlTmFtZSBTZW5zZS5UcmFjZTsgJGxvZ2dlci5Xcml0ZU9uYm9hcmRpbmdNZXNzYWdlKCclc3VjY2Vzc091dHB1dCUnKSIgPk5VTCAyPiYxCiIlUFJPR1JBTUZJTEVTJVxXaW5kb3dzIERlZmVuZGVyXE1wQ21kUnVuLmV4ZSIgLVJlbG9hZEVuZ2luZSA+TlVMIDI+JjEKCkdPVE8gQ0xFQU5VUAoKOkNMRUFOVVAKaWYgZXhpc3QgJVRNUCVcc2Vuc2VUbXAudHh0IGRlbCAlVE1QJVxzZW5zZVRtcC50eHQKRVhJVCAvQiAlZXJyb3JDb2RlJQo=="), - // OnboardingPackageWindows: []byte("QGVjaG8gb2ZmCgplY2hvLiA+TlVMIDI+JjEKZWNobyBTdGFydGluZyBXaW5kb3dzIERlZmVuZGVyIEFkdmFuY2VkIFRocmVhdCBQcm90ZWN0aW9uIG9uYm9hcmRpbmcgcHJvY2Vzcy4uLiA+TlVMIDI+JjEKZWNoby4gPk5VTCAyPiYxCgpzZXQgZXJyb3JDb2RlPTAKc2V0IGxhc3RFcnJvcj0wCnNldCAidHJvdWJsZXNob290SW5mbz1Gb3IgbW9yZSBpbmZvcm1hdGlvbiwgdmlzaXQ6IGh0dHBzOi8vZ28ubWljcm9zb2Z0LmNvbS9md2xpbmsvcC8/bGlua2lkPTgyMjgwNyIKc2V0ICJlcnJvckRlc2NyaXB0aW9uPSIKCmVjaG8gVGVzdGluZyBhZG1pbmlzdHJhdG9yIHByaXZpbGVnZXMgPk5VTCAyPiYxCgpuZXQgc2Vzc2lvbiA+TlVMIDI+JjEKaWYgJUVSUk9STEVWRUwlIE5FUSAwICgKCUBlY2hvIFNjcmlwdCBpcyBydW5uaW5nIHdpdGggaW5zdWZmaWNpZW50IHByaXZpbGVnZXMuIFBsZWFzZSBydW4gd2l0aCBhZG1pbmlzdHJhdG9yIHByaXZpbGVnZXM+ICVUTVAlXHNlbnNlVG1wLnR4dAoJc2V0IGVycm9yQ29kZT02NQogc2V0IGxhc3RFcnJvcj0lRVJST1JMRVZFTCUKCUdPVE8gRVJST1IKKQoKZWNobyBTY3JpcHQgaXMgcnVubmluZyB3aXRoIHN1ZmZpY2llbnQgcHJpdmlsZWdlcyA+TlVMIDI+JjEKZWNoby4gPk5VTCAyPiYxCmVjaG8gUGVyZm9ybWluZyBvbmJvYXJkaW5nIG9wZXJhdGlvbnMgPk5VTCAyPiYxCmVjaG8uID5OVUwgMj4mMQoKSUYgWyVQUk9DRVNTT1JfQVJDSElURVc2NDMyJV0gRVFVIFtdICgKICBzZXQgcG93ZXJzaGVsbFBhdGg9JXdpbmRpciVcU3lzdGVtMzJcV2luZG93c1Bvd2VyU2hlbGxcdjEuMFxwb3dlcnNoZWxsLmV4ZQopIEVMU0UgKAogIHNldCBwb3dlcnNoZWxsUGF0aD0ld2luZGlyJVxTeXNOYXRpdmVcV2luZG93c1Bvd2VyU2hlbGxcdjEuMFxwb3dlcnNoZWxsLmV4ZQopCgpzZXQgc2RiaW49MDEwMDA0ODA0NDAwMDAwMDU0MDAwMDAwMDAwMDAwMDAxNDAwMDAwMDAyMDAzMDAwMDIwMDAwMDAwMDAwMTQwMEZGMEYxMjAwMDEwMTAwMDAwMDAwMDAwNTEyMDAwMDAwMDAwMDE0MDBFMTA0MTIwMDAxMDEwMDAwMDAwMDAwMDUwQjAwMDAwMDAxMDIwMDAwMDAwMDAwMDUyMDAwMDAwMDIwMDIwMDAwMDEwMjAwMDAwMDAwMDAwNTIwMDAwMDAwMjAwMjAwMDAgPk5VTCAyPiYxCnJlZyBhZGQgSEtMTVxTWVNURU1cQ3VycmVudENvbnRyb2xTZXRcQ29udHJvbFxXTUlcU2VjdXJpdHkgL3YgMTRmODEzOGUtM2I2MS01ODBiLTU0NGItMjYwOTM3OGFlNDYwIC90IFJFR19CSU5BUlkgL2QgJXNkYmluJSAvZiA+TlVMIDI+JjEKcmVnIGFkZCBIS0xNXFNZU1RFTVxDdXJyZW50Q29udHJvbFNldFxDb250cm9sXFdNSVxTZWN1cml0eSAvdiBjYjJmZjcyZC1kNGU0LTU4NWQtMzNmOS1mM2EzOTVjNDBiZTcgL3QgUkVHX0JJTkFSWSAvZCAlc2RiaW4lIC9mID5OVUwgMj4mMQoKUkVHIGFkZCAiSEtMTVxTT0ZUV0FSRVxQb2xpY2llc1xNaWNyb3NvZnRcV2luZG93c1xEYXRhQ29sbGVjdGlvbiIgL3YgRGlzYWJsZUVudGVycHJpc2VBdXRoUHJveHkgL3QgUkVHX0RXT1JEIC9mIC9kIDEgPk5VTCAyPiYxCgolcG93ZXJzaGVsbFBhdGglIC1FeGVjdXRpb25Qb2xpY3kgQnlwYXNzIC1Ob1Byb2ZpbGUgLUNvbW1hbmQgIkFkZC1UeXBlICcgdXNpbmcgU3lzdGVtOyB1c2luZyBTeXN0ZW0uSU87IHVzaW5nIFN5c3RlbS5SdW50aW1lLkludGVyb3BTZXJ2aWNlczsgdXNpbmcgTWljcm9zb2Z0LldpbjMyLlNhZmVIYW5kbGVzOyB1c2luZyBTeXN0ZW0uQ29tcG9uZW50TW9kZWw7IHB1YmxpYyBzdGF0aWMgY2xhc3MgRWxhbXsgW0RsbEltcG9ydChcIktlcm5lbDMyXCIsIENoYXJTZXQ9Q2hhclNldC5BdXRvLCBTZXRMYXN0RXJyb3I9dHJ1ZSldIHB1YmxpYyBzdGF0aWMgZXh0ZXJuIGJvb2wgSW5zdGFsbEVMQU1DZXJ0aWZpY2F0ZUluZm8oU2FmZUZpbGVIYW5kbGUgaGFuZGxlKTsgcHVibGljIHN0YXRpYyB2b2lkIEluc3RhbGxXZEJvb3Qoc3RyaW5nIHBhdGgpIHsgQ29uc29sZS5PdXQuV3JpdGVMaW5lKFwiQWJvdXQgdG8gY2FsbCBjcmVhdGUgZmlsZSBvbiB7MH1cIiwgcGF0aCk7IHZhciBzdHJlYW0gPSBGaWxlLk9wZW4ocGF0aCwgRmlsZU1vZGUuT3BlbiwgRmlsZUFjY2Vzcy5SZWFkLCBGaWxlU2hhcmUuUmVhZCk7IHZhciBoYW5kbGUgPSBzdHJlYW0uU2FmZUZpbGVIYW5kbGU7IENvbnNvbGUuT3V0LldyaXRlTGluZShcIkFib3V0IHRvIGNhbGwgSW5zdGFsbEVMQU1DZXJ0aWZpY2F0ZUluZm8gb24gaGFuZGxlIHswfVwiLCBoYW5kbGUuRGFuZ2Vyb3VzR2V0SGFuZGxlKCkpOyBpZiAoIUluc3RhbGxFTEFNQ2VydGlmaWNhdGVJbmZvKGhhbmRsZSkpIHsgQ29uc29sZS5PdXQuV3JpdGVMaW5lKFwiQ2FsbCBmYWlsZWQuXCIpOyB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oTWFyc2hhbC5HZXRMYXN0V2luMzJFcnJvcigpKTsgfSBDb25zb2xlLk91dC5Xcml0ZUxpbmUoXCJDYWxsIHN1Y2Nlc3NmdWwuXCIpOyB9IH0gJzsgJGRyaXZlclBhdGggPSAkZW52OlN5c3RlbVJvb3QgKyAnXFN5c3RlbTMyXERyaXZlcnNcV2RCb290LnN5cyc7IFtFbGFtXTo6SW5zdGFsbFdkQm9vdCgkZHJpdmVyUGF0aCkgIiA+TlVMIDI+JjEKClJFRyBxdWVyeSAiSEtMTVxTT0ZUV0FSRVxQb2xpY2llc1xNaWNyb3NvZnRcV2luZG93cyBBZHZhbmNlZCBUaHJlYXQgUHJvdGVjdGlvbiIgL3YgNjk2QzFGQTEtNDAzMC00RkE0LTg3MTMtRkFGOUIyRUE3QzBBIC9yZWc6NjQgPiAlVE1QJVxzZW5zZVRtcC50eHQgMj4mMQppZiAlRVJST1JMRVZFTCUgRVFVIDAgKCAgCiAgICBSRUcgZGVsZXRlICJIS0xNXFNPRlRXQVJFXFBvbGljaWVzXE1pY3Jvc29mdFxXaW5kb3dzIEFkdmFuY2VkIFRocmVhdCBQcm90ZWN0aW9uIiAvdiA2OTZDMUZBMS00MDMwLTRGQTQtODcxMy1GQUY5QjJFQTdDMEEgL2YgPiAlVE1QJVxzZW5zZVRtcC50eHQgMj4mMQogICAgaWYgJUVSUk9STEVWRUwlIE5FUSAwICgKICAgICAgICBzZXQgImVycm9yRGVzY3JpcHRpb249VW5hYmxlIHRvIGRlbGV0ZSBwcmV2aW91cyBvZmZib2FyZGluZyBpbmZvcm1hdGlvbiBmcm9tIHJlZ2lzdHJ5LiIKICAgICAgICBzZXQgZXJyb3JDb2RlPTUKICAgICAgICBzZXQgbGFzdEVycm9yPSVFUlJPUkxFVkVMJQogICAgICAgIEdPVE8gRVJST1IKICAgICkKKQoKUkVHIGFkZCAiSEtMTVxTT0ZUV0FSRVxQb2xpY2llc1xNaWNyb3NvZnRcV2luZG93cyBBZHZhbmNlZCBUaHJlYXQgUHJvdGVjdGlvbiIgL3YgT25ib2FyZGluZ0luZm8gL3QgUkVHX1NaIC9mIC9kICJ7XCJib2R5XCI6XCJ7XFxcInByZXZpb3VzT3JnSWRzXFxcIjpbXSxcXFwib3JnSWRcXFwiOlxcXCIwMDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMGRlYWRcXFwiLFxcXCJnZW9Mb2NhdGlvblVybFxcXCI6XFxcImh0dHBzOi8vc2V2aWxsZWNsb3VkZ2F0ZXdheS1zdGcubWljcm9zb2Z0LmNvbS9cXFwiLFxcXCJkYXRhY2VudGVyXFxcIjpcXFwiRWFzdFVzMlxcXCIsXFxcInZvcnRleEdlb0xvY2F0aW9uXFxcIjpcXFwiU2FuZGJveFxcXCIsXFxcInZlcnNpb25cXFwiOlxcXCIxLjNcXFwifVwiLFwic2lnXCI6XCJKc0dGR2o3UCtIL1cvUEExcW9LTml3RXROZkU4YkhGblhxeks1SDhsQ09wc0RnRGNWTWpoT3BmQTZJTTJ3RFZadk5kWGhvZ0dEQ1FDWjNYdFJCbHRkcGFWc3pZNGtINVpHVkdnRUQxVE80ZCtCTjk2VDFSa3pOZ2NjZ2ZCWDNNQUw1bllUWXdiMGlUQUtFMGIxb3BmQmZrMzJQN3Q3b3A5dkhPeXZNMW5qdlZybVdWWWVSNk4rZFFrLzM4UDNUY2V3b2FkRmFUb3pidjBZK3dZOHgrbFcxeWN6bk1KMitQWTlxRHpabXoybE1rd0FlaDJwRTI4VW5MT0lhNjg0Y3U5RitHUlAveGhhR3dQWmpoc1JCSW51cHV5U1E2Y09YdE9kSERCQlRaZzVKSEhHMDBkNk9tUk5ONmxBelJWeFJURUVmaFFUVnN0U1poKzNMSjJTMGhmZGc9PVwiLFwic2hhMjU2c2lnXCI6XCJsVGI4ZittdkFveDRCckxPS0lqejFnTTNrRHREbG9wL21uNmZodmVEWjMvblVqb1lhNk81V2p4R0x2Z3lqZ0RtdThETkdPNUtqWWlxTVZ6Z0QzcHdqOVYwOXVOeUdYNGJUaXN0d1BnQTFLbGMrMUFLcmtWQTRGWGlQTHlST2tXdlhLM2dydFFJWU9nYjdSRlh6dzhnQlB5YlV0Z0FWbmNaMVFpdTAzblFLdGh5MFU3aXBlZUxaVE9oYVlhN001cTJxUTcya1BaSTZWUWlqSE42NVg3UTEvcm5rdUlSUkFmUEErZElIeE4wN0tpSlY2MGZsbDFZUUtOUlpSYUhKeGQ1UDd0RmdaaytEZE5mNVNXcHVaSTZTZE9MdExDN3VnbmdnK0krU2pUeUtvcVFKZElkWGRRaE5JK3I3WEM1L1M0ZlhnRVNtWmZKTUYxL0JtVlVFZUJDZlE9PVwiLFwiY2VydFwiOlwiTUlJRjVqQ0NBODZnQXdJQkFnSVRNd0FBQVkwdmh1VTl6R2x5b1FBQUFBQUJqVEFOQmdrcWhraUc5dzBCQVFzRkFEQitNUXN3Q1FZRFZRUUdFd0pWVXpFVE1CRUdBMVVFQ0JNS1YyRnphR2x1WjNSdmJqRVFNQTRHQTFVRUJ4TUhVbVZrYlc5dVpERWVNQndHQTFVRUNoTVZUV2xqY205emIyWjBJRU52Y25CdmNtRjBhVzl1TVNnd0pnWURWUVFERXg5TmFXTnliM052Wm5RZ1UyVmpkWEpsSUZObGNuWmxjaUJEUVNBeU1ERXhNQjRYRFRJd01EZ3dOakl3TlRBMU9Gb1hEVEl4TURnd05qSXdOVEExT0Zvd2dZb3hDekFKQmdOVkJBWVRBbFZUTVFzd0NRWURWUVFJRXdKWFFURVFNQTRHQTFVRUJ4TUhVbVZrYlc5dVpERWVNQndHQTFVRUNoTVZUV2xqY205emIyWjBJRU52Y25CdmNtRjBhVzl1TVI0d0hBWURWUVFMRXhWTmFXTnliM052Wm5RZ1EyOXljRzl5WVhScGIyNHhIREFhQmdOVkJBTVRFMU5sZG1sc2JHVXVWMmx1Wkc5M2N5NWpiMjB3Z2dFaU1BMEdDU3FHU0liM0RRRUJBUVVBQTRJQkR3QXdnZ0VLQW9JQkFRRENmcWtCcmV1Um1qdm90bDFFdURQWVplaVc1dUVERmV6MXhsYmh6cjVaa1BjSUJYT3RIMVZWRjRaUmVrdTFpK3ZMbTNON2xkVGl4c2RSZW0yU09iVkFGb1dDbjZ2cEYwL1ZYcWpmUTJHbyt2dk9UU1Q0Si9pQWxocXhialVVbkRyWFpXYUMvS2xtU0lYMjlHUng5bG1pT0IrWVBhRzlOTEE1U3F3emNad2hjTThzS3F0VDhHaWQ3Q3JFNGs1WldES0gyL1dPVTVsQ01iZTY2MWtrbWxKZDB2TlBDTXpyMUgzVmNmRG1qVVo4Q25WQzBFODlhVVA3VHhhME1uS0FzVFArQkpCNXJMenhkVlJRbGRNbmhHVXNXRU0ydUNOWXFOdWc4QWYrTGp3RytySXZrSVR3NVlDMUZDZy9qVHBvdHJnSFhmSGRqaURqa0F3ZWY1TlVkTmx0QWdNQkFBR2pnZ0ZPTUlJQlNqQU9CZ05WSFE4QkFmOEVCQU1DQjRBd0V3WURWUjBsQkF3d0NnWUlLd1lCQlFVSEF3RXdIUVlEVlIwT0JCWUVGT0U1NVFoeno5bEhuWTl2aDVTWmtyMTdjbEtzTUI0R0ExVWRFUVFYTUJXQ0UxTmxkbWxzYkdVdVYybHVaRzkzY3k1amIyMHdId1lEVlIwakJCZ3dGb0FVTmxhSlpVbkxXNXN2UEt4Q0ZsQk5rYmt6MTVFd1V3WURWUjBmQkV3d1NqQklvRWFnUklaQ2FIUjBjRG92TDNkM2R5NXRhV055YjNOdlpuUXVZMjl0TDNCcmFXOXdjeTlqY213dlRXbGpVMlZqVTJWeVEwRXlNREV4WHpJd01URXRNVEF0TVRndVkzSnNNR0FHQ0NzR0FRVUZCd0VCQkZRd1VqQlFCZ2dyQmdFRkJRY3dBb1pFYUhSMGNEb3ZMM2QzZHk1dGFXTnliM052Wm5RdVkyOXRMM0JyYVc5d2N5OWpaWEowY3k5TmFXTlRaV05UWlhKRFFUSXdNVEZmTWpBeE1TMHhNQzB4T0M1amNuUXdEQVlEVlIwVEFRSC9CQUl3QURBTkJna3Foa2lHOXcwQkFRc0ZBQU9DQWdFQVp3ZGxhWjg4U3BURFdUUjc5NWRHV2N0dUxUWmc2UDBqYmh4Q0dhOXBnb3AzSXZ1Qi9QYzJXT2Ruc1ZCYUpUZG5WN3NvcFZHa3V4Vjc1eWk2Q0NQM2sxNG0xQ1FhNk01cmNodmJuVEY0TFdjWld4U1g4Z0hjRWhObFdYV3hxU3FKMzNnSHVGNEc5SCs3VDM3UlNMb2Jqb1MyeVRhc21SRWtCNTI4b1gwWVU0cVpjeVdyK0xEMVovQk10dEhMUlZUZUtHdnpMaVpCNmhqWURybW9qUUxKZXZwSEdoTVdOTU9oR2RLd2pOS0crZGhVRHV6dTdsVXgwZzdhaUR3c1l4NzFTaU9ucDJWOSt5UEhET2R5OXlBRUNPb0N3bUprbW5qLzlDMmVNMDFDQjFZMUxTWHNiQUJtQVd3Si9iczhRNnhTWlJtSnkyRXJSQ3VTakl0MUQydzRTUFVMRFNNVTdIaDk3TWJpQVJDV25TMVRRMGg5azZFWVVmbW1ZaFNHQ0p3MXFlekFqZ2FmTngyYWcrRDhzRFFkQzRjVHhUSTk5aGthUm1DakFmeW1qcVdscUx5V0pCUmdvaXdTd21MVDFUbzRJNUVjZHFoQ1FNdEpoRVVRR2dpenk2ZUE2RlhtNHhmeExua08xSkNKSGJUejlqL2c4OW5zZ0hVN2V4SDVnZHhZQ0FDMGJkUlZLN1YrVlBDcExnLy9SemtlNm9mc1Y3WkxyQUpvN0EyQTZka0dVL09XeGhpVjJiY0VlUEpmSWsrVjM3UHp3c25yZ1JFV2RpM1pic3dBOU5aTTVzZGVSMFlFRm11bit0b2JCRGMzMlRidlVyTUpTb2tjcG9XNnRZczlkR0tUcE1GV01EZ09UeEZjSHljbHZrMjRVQVV2dXk2WVcvSVN2VlY4a3BRPVwiLFwiY2hhaW5cIjpbXCJNSUlHMkRDQ0JNQ2dBd0lCQWdJS1lUKzNHQUFBQUFBQUJEQU5CZ2txaGtpRzl3MEJBUXNGQURDQmlERUxNQWtHQTFVRUJoTUNWVk14RXpBUkJnTlZCQWdUQ2xkaGMyaHBibWQwYjI0eEVEQU9CZ05WQkFjVEIxSmxaRzF2Ym1ReEhqQWNCZ05WQkFvVEZVMXBZM0p2YzI5bWRDQkRiM0p3YjNKaGRHbHZiakV5TURBR0ExVUVBeE1wVFdsamNtOXpiMlowSUZKdmIzUWdRMlZ5ZEdsbWFXTmhkR1VnUVhWMGFHOXlhWFI1SURJd01URXdIaGNOTVRFeE1ERTRNakkxTlRFNVdoY05Nall4TURFNE1qTXdOVEU1V2pCK01Rc3dDUVlEVlFRR0V3SlZVekVUTUJFR0ExVUVDQk1LVjJGemFHbHVaM1J2YmpFUU1BNEdBMVVFQnhNSFVtVmtiVzl1WkRFZU1Cd0dBMVVFQ2hNVlRXbGpjbTl6YjJaMElFTnZjbkJ2Y21GMGFXOXVNU2d3SmdZRFZRUURFeDlOYVdOeWIzTnZablFnVTJWamRYSmxJRk5sY25abGNpQkRRU0F5TURFeE1JSUNJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBZzhBTUlJQ0NnS0NBZ0VBMEF2QXBLZ1pnZUkyNWVLcTVmT3lGVmgxdnJUbFNmSGdoUG03RFdUdmhjR0JWYmp6NS9GdFFGVTl6b3RxMFlTVDlYVjhXNlRVZEJES012TWowNjd1ejU0RVdNTFpSOHZSZkFCQlNIRWJBV2NYR0svRy9uTURmdVR2UTV6dkFYRXFINEVtUTNlWVZGZHpuVlVyOEo2T2ZRWU9yQnRVOHliMytDTUlJb3VlQmgwM09QMXkwc3JsWThHYVduMnliYk5TcVc3cHJyWDhpemI1bnZyMkhGZ2JsMWFsRWVXM1V0dTc2ZkJVdjdUL0xHeTRYU2JPb0FyWDM1UHRmOTJzOFN4ekd0a1pOMVc2M1NKNGpxSFVtd240QnlJeGNiQ1VydUN3NXlaRVY1Q0JseFhPWWV4bDRrdnhoVklXTXZpMWVLcCt6VTNzZ3lHa3FKdSttbW9FNEtNY3pWWVliUDFyTDBJKzRqZnljcXZRZUhOeWU5N3NBRmpsSVRDakNEcVo3NS9EOTNvV2xtVzF3NEd2OURsd1NhLzJxZlpxQURqNXRBZ1o0Qm8xcFZaMklsOXE4bW11UHExWVJrMjRWUGFKUVVRZWNyRzhFaWRUMHNIL3NzMVFtQjYxOUx1MndvSTUyYXdiOGpzbmhHcXd4aVlMMXpvUTU3UGJmTk5XckZOTUMvbzdNVGQwMkZrcitRQjVHUVo3L1J3ZFF0UkJEUzhGRHRWclNTUC96ODM0ZW9MUDJqd3QzK2pZRWdRWXVoNklkN2lZSHhBSHU4Z0ZmZ3NKdjJ2ZDQwNWJzUG5IaEtZN3lreWZXMklwOThlaXFKV0ljQ3psd1Q4OFVpTlBRSnJETVlXREw3OHA4UjFRanlHV0I4N3Y4b0RDUkgyYll1OHZ3M2VKcTBWTlV6NENlZE1DQXdFQUFhT0NBVXN3Z2dGSE1CQUdDU3NHQVFRQmdqY1ZBUVFEQWdFQU1CMEdBMVVkRGdRV0JCUTJWb2xsU2N0Ym15ODhyRUlXVUUyUnVUUFhrVEFaQmdrckJnRUVBWUkzRkFJRURCNEtBRk1BZFFCaUFFTUFRVEFMQmdOVkhROEVCQU1DQVlZd0R3WURWUjBUQVFIL0JBVXdBd0VCL3pBZkJnTlZIU01FR0RBV2dCUnlMVG9DTVpCRHVSUUZUdUhxcDhjeDBTT0pOREJhQmdOVkhSOEVVekJSTUUrZ1RhQkxoa2xvZEhSd09pOHZZM0pzTG0xcFkzSnZjMjltZEM1amIyMHZjR3RwTDJOeWJDOXdjbTlrZFdOMGN5OU5hV05TYjI5RFpYSkJkWFF5TURFeFh6SXdNVEZmTUROZk1qSXVZM0pzTUY0R0NDc0dBUVVGQndFQkJGSXdVREJPQmdnckJnRUZCUWN3QW9aQ2FIUjBjRG92TDNkM2R5NXRhV055YjNOdlpuUXVZMjl0TDNCcmFTOWpaWEowY3k5TmFXTlNiMjlEWlhKQmRYUXlNREV4WHpJd01URmZNRE5mTWpJdVkzSjBNQTBHQ1NxR1NJYjNEUUVCQ3dVQUE0SUNBUUJCeUdIQjlWdWVQcEV4OGJER3Z3a0J0SjIya0hUWENkdW1MZzJmeU9kMk5FYXZCMkNKVElHelBOWDBFalYxd25PbDlVMkVqTXVrWGErL2t2WVhDRmRDbFhKbEJYWjVyZTdSdXJndVZLTlJCNnhvNnlFTTR5V0J3czBxOHNQL3o4SzlTUmlheC9DRXhma1V2R3VWNVpidnMwTFNVOVZLb0JMRXJoSjJVd2xXRHAzMzA2WkppRkR5aWl5WElLSytUbmp2QldXM1M2RVdpTjR4eHdoQ0pIeWtlNTZkdkdBQVhtS1g0NVA4cC81YmV5WGY1Rk4vUzc3bVB2RGJBWGxDSEc2RmJIMjJSREQ3cFRlU2s3S2w3aUN0UDFQVnlmUW9hMWZCK0IxcXQxWXF0aWVCSEtZdG4rZjAwREdEbDZncXRxeStHMEgxNUlsZlZ2dmFXdE5lZlZXVUVINVRWL1JLUFVBcXlMMW5uNFRoRU83OTJtc1Zna244UmgzL1JRWjBuRUlVN2NVNTA3UE5DNE1ua0VOUmt2SkVncTV1bWhVWHNobjZ4MFZzbUFGN3Z6ZXBzSWlra3J3NE9PQWQ1SHlYbUJvdVgrODRaYmMxTDcxL1R5SDZ4SXpTYndiNVNUWHEzeUFQSmFycVlLc3NIMHVKL0xmNlhGU1FTejZpS0U5czVGSmx3ZjJRSElXQ2lHN3BwbFhkSVNoNVJiQVU1UXJNNWwvRXU5dGhOR21mckNZNDk4RXBRUWdWTGt5Zzkva01QdDVmcXdnSkxZT3NyRFNEWXZUSlNVS0pKYlZ1c2tmRnN6bWdzU0FiTExHT0JHK2xNRWtjMEVicFFGdjByVzY2MjRKS2h4SktnQWxOMjk5MnVRVmJHK0M3SUhCZkFDWEgwdzc2RnExN0lwNXhDQT09XCIsXCJNSUlGN1RDQ0E5V2dBd0lCQWdJUVA0dkl0Znlmc3BaRHRXbldiRUxoUkRBTkJna3Foa2lHOXcwQkFRc0ZBRENCaURFTE1Ba0dBMVVFQmhNQ1ZWTXhFekFSQmdOVkJBZ1RDbGRoYzJocGJtZDBiMjR4RURBT0JnTlZCQWNUQjFKbFpHMXZibVF4SGpBY0JnTlZCQW9URlUxcFkzSnZjMjltZENCRGIzSndiM0poZEdsdmJqRXlNREFHQTFVRUF4TXBUV2xqY205emIyWjBJRkp2YjNRZ1EyVnlkR2xtYVdOaGRHVWdRWFYwYUc5eWFYUjVJREl3TVRFd0hoY05NVEV3TXpJeU1qSXdOVEk0V2hjTk16WXdNekl5TWpJeE16QTBXakNCaURFTE1Ba0dBMVVFQmhNQ1ZWTXhFekFSQmdOVkJBZ1RDbGRoYzJocGJtZDBiMjR4RURBT0JnTlZCQWNUQjFKbFpHMXZibVF4SGpBY0JnTlZCQW9URlUxcFkzSnZjMjltZENCRGIzSndiM0poZEdsdmJqRXlNREFHQTFVRUF4TXBUV2xqY205emIyWjBJRkp2YjNRZ1EyVnlkR2xtYVdOaGRHVWdRWFYwYUc5eWFYUjVJREl3TVRFd2dnSWlNQTBHQ1NxR1NJYjNEUUVCQVFVQUE0SUNEd0F3Z2dJS0FvSUNBUUN5Z0VHcU5UaE5FM0l5YUNKTnVMTHgvOVZTdkd6SDlkSktqRGJ1MGNKY2ZveUtycThUS0cvQWMrTTZ6dEFscUZvNmJlK291Rm1yRXlOb3pRd3BoOUZ2Z0Z5UFJIOWRrQUZTV0t4UnhWOHFoOXpjMkFvZHdRTzVlN0JXNktQZVpHSENudmp6Zkxuc0RiVlUva3kyWlUrSThKeEltUXhDQ3dsOE1Wa1hlUVo0S0kySk9rd0RKYjV4YWx3TDU0UmdwSmtpNDlLdmhLU24rOUdZN1F5cDNwU0o0UTZnM01ET21UM3FDRks3Vm5ua0g0UzZIcmkweEVsY1R6RkxoOTNkQldjbW1ZRGdjUkdqdUtWQjRxUlR1ZmN5S1lNTUU3ODJYZ1N6UzBOSEwydmlrUjdUbUUvZFFnZkk2QjBTL0ptcGF6NlNmc2pXYVRyOFpMMjJDWjNLL1F3TG9wdDNZRXNEbEtRd2FSTFdRaTNCUVV6SzNLcjlqMXVEUnByWi9MSFI0N1BKZjBoNnpTVHdRWTljZE5Dc3NCQWdCa20zeHkwaHlGZmowSWJ6QTJqNzBNNXh3WW1aU21RQmJQM3NNSkhQUVR5U3grVzZoaDFoaE1kZmd6bGlyclNTTDBmekMvaFY2NkFmV2RDN2RKc2UwSGJtOHVrRzF4RG8rbVRlYWNZMWxvZ0M4RWE0UHllWmI4dHhpU2sxOTBnV0FqV1AxWGw4VFFMUFgrdUtnMDlGY1lqNXFRMU9jdW5DbkFmUFNSdE9CQTVqVVl4ZTJBREJWU3kyeHVEQ1pVN0pORG4xbkxQRWZ1aGhiaE5mRmNSZjJYN3RIYzd1Uk96TExvYXg3RGoyY08yclhCUEIyUThOeDRDeVZlMDA5NnliNU1QYTUwYzhwcldQTWQvRlM2L3I4UUlEQVFBQm8xRXdUekFMQmdOVkhROEVCQU1DQVlZd0R3WURWUjBUQVFIL0JBVXdBd0VCL3pBZEJnTlZIUTRFRmdRVWNpMDZBakdRUTdrVUJVN2g2cWZITWRFamlUUXdFQVlKS3dZQkJBR0NOeFVCQkFNQ0FRQXdEUVlKS29aSWh2Y05BUUVMQlFBRGdnSUJBSDl5encrM3hSWGJtOEJKeWlaYi9wNFQ1dFB3MHR1WFgvSkxQMDJ6cmhtdTdkZVhvS3p2cVRxandrR3c1YmlSbmhPQkpBUG1DZjAvVjBBNUlTUlcwUkF2UzBDcE5vWkx0Rk5YbXZ2eGZvbVBFZjRZYkZHcTZPMEpsYlhsY2NtaDZZZDFwaFYveVg0M1ZGNTBrOFhEWjh3TlQydW9Gd3h0Q0pKK2k5MkJxaTF3SWNNOUJoUzd2eVJlcDRUWFB3OGhJcjFMQUFiYmx4ellYdFRGQzF5SGJsQ2s2TU00cFB2TExNV1NacHVGWHN0NmJKTjhnQ2xZVzFlMVFHbTZDSG1tWkdJVm5ZZVdSYlZtSXlBRGl4eHpvTk9pZVRQZ1VGbUcyeS9sQWlYcWN5cWZBQlRJTnNlU08rbE9BT3pZVmdtNU0wa1MwbFFMQWF1c1I3YVJLWDFNdEhXQVVnSG95b0wybjh5c25JOFg2aThtc0t0eXJBditubEVleDBOVlowOVJzMWZXdHV6dVVyYzY2VTdoMTRHSXZFK09kYnRMcVBBMXFpYlVaMmRKc25CTU81UGNIZDk0a0laeXNqaWswZHlTVGNsWTZ5c1NYTlE3cm94cnNJUGxBVC80Q1RMMmt6VTBJcS9kTncxM0NZQXJ6VWdBOFl5WkdVY0ZBZW5SdjlGTzBPWW9RemVacEFwS0NObWFjWFBTcXMweEUyTjJvVGR2a2pnZWZSSThaakxueTIzaC9GS0ozY3JXWmdXYWxtRytvaWpISEtPbk5sQThPcVRmU203bWh6dk82L0RnZ1RlZEV6eFNqcjI1SFRUR0hkVUthajJZS1hDTWlTclJxNElRU0IvYzlPK2x4YnRWR2poamhFNjNiSzJWVk94bEloQkpGN2pBSHNjUHJGUkhcIl19IiA+ICVUTVAlXHNlbnNlVG1wLnR4dCAyPiYxCmlmICVFUlJPUkxFVkVMJSBORVEgMCAoCiAgIHNldCAiZXJyb3JEZXNjcmlwdGlvbj1VbmFibGUgdG8gd3JpdGUgb25ib2FyZGluZyBpbmZvcm1hdGlvbiB0byByZWdpc3RyeS4iCiAgIHNldCBlcnJvckNvZGU9MTAKICAgc2V0IGxhc3RFcnJvcj0lRVJST1JMRVZFTCUKICAgR09UTyBFUlJPUgopCgplY2hvIFN0YXJ0aW5nIHRoZSBzZXJ2aWNlLCBpZiBub3QgYWxyZWFkeSBydW5uaW5nID5OVUwgMj4mMQplY2hvLiA+TlVMIDI+JjEKc2MgcXVlcnkgIlNFTlNFIiB8IGZpbmQgL2kgIlJVTk5JTkciID5OVUwgMj4mMQppZiAlRVJST1JMRVZFTCUgRVFVIDAgR09UTyBSVU5OSU5HCgpuZXQgc3RhcnQgc2Vuc2UgPiAlVE1QJVxzZW5zZVRtcC50eHQgMj4mMQppZiAlRVJST1JMRVZFTCUgTkVRIDAgKAogICBlY2hvIFdpbmRvd3MgRGVmZW5kZXIgQWR2YW5jZWQgVGhyZWF0IFByb3RlY3Rpb24gU2VydmljZSBoYXMgbm90IHN0YXJ0ZWQgeWV0ID5OVUwgMj4mMQogICBHT1RPIFdBSVRfRk9SX1RIRV9TRVJWSUNFX1RPX1NUQVJUCikKZ290byBTVUNDRUVERUQKCjpSVU5OSU5HCnNldCAicnVubmluZ091dHB1dD1UaGUgV2luZG93cyBEZWZlbmRlciBBZHZhbmNlZCBUaHJlYXQgUHJvdGVjdGlvbiBTZXJ2aWNlIGlzIGFscmVhZHkgcnVubmluZyEiCmVjaG8gJXJ1bm5pbmdPdXRwdXQlID5OVUwgMj4mMQplY2hvLiA+TlVMIDI+JjEKZXZlbnRjcmVhdGUgL2wgQXBwbGljYXRpb24gL3NvIFdEQVRQT25ib2FyZGluZyAvdCBJbmZvcm1hdGlvbiAvaWQgMTAgL2QgIiVydW5uaW5nT3V0cHV0JSIgPk5VTCAyPiYxCkdPVE8gV0FJVF9GT1JfVEhFX1NFUlZJQ0VfVE9fU1RBUlQKCjpFUlJPUgpTZXQgL1AgZXJyb3JNc2c9PCVUTVAlXHNlbnNlVG1wLnR4dApzZXQgImVycm9yT3V0cHV0PVtFcnJvciBJZDogJWVycm9yQ29kZSUsIEVycm9yIExldmVsOiAlbGFzdEVycm9yJV0gJWVycm9yRGVzY3JpcHRpb24lIEVycm9yIG1lc3NhZ2U6ICVlcnJvck1zZyUiCiVwb3dlcnNoZWxsUGF0aCUgLUV4ZWN1dGlvblBvbGljeSBCeXBhc3MgLU5vUHJvZmlsZSAtQ29tbWFuZCAiQWRkLVR5cGUgJ3VzaW5nIFN5c3RlbTsgdXNpbmcgU3lzdGVtLkRpYWdub3N0aWNzOyB1c2luZyBTeXN0ZW0uRGlhZ25vc3RpY3MuVHJhY2luZzsgbmFtZXNwYWNlIFNlbnNlIHsgW0V2ZW50RGF0YShOYW1lID0gXCJPbmJvYXJkaW5nXCIpXXB1YmxpYyBzdHJ1Y3QgT25ib2FyZGluZ3twdWJsaWMgc3RyaW5nIE1lc3NhZ2UgeyBnZXQ7IHNldDsgfX0gcHVibGljIGNsYXNzIFRyYWNlIHtwdWJsaWMgc3RhdGljIEV2ZW50U291cmNlT3B0aW9ucyBUZWxlbWV0cnlDcml0aWNhbE9wdGlvbiA9IG5ldyBFdmVudFNvdXJjZU9wdGlvbnMoKXtMZXZlbCA9IEV2ZW50TGV2ZWwuRXJyb3IsIEtleXdvcmRzID0gKEV2ZW50S2V5d29yZHMpMHgwMDAwMjAwMDAwMDAwMDAwLCBUYWdzID0gKEV2ZW50VGFncykweDAyMDAwMDB9OyBwdWJsaWMgdm9pZCBXcml0ZU9uYm9hcmRpbmdNZXNzYWdlKHN0cmluZyBtZXNzYWdlKXtlcy5Xcml0ZShcIk9uYm9hcmRpbmdTY3JpcHRcIiwgVGVsZW1ldHJ5Q3JpdGljYWxPcHRpb24sIG5ldyBPbmJvYXJkaW5nIHtNZXNzYWdlID0gbWVzc2FnZX0pO30gcHJpdmF0ZSBzdGF0aWMgcmVhZG9ubHkgc3RyaW5nW10gdGVsZW1ldHJ5VHJhaXRzID0geyBcIkVUV19HUk9VUFwiLCBcIns1RUNCMEJBQy1COTMwLTQ3RjUtQThBNC1FODI1MzUyOUVEQjd9XCIgfTsgcHJpdmF0ZSBFdmVudFNvdXJjZSBlcyA9IG5ldyBFdmVudFNvdXJjZShcIk1pY3Jvc29mdC5XaW5kb3dzLlNlbnNlLkNsaWVudC5NYW5hZ2VtZW50XCIsRXZlbnRTb3VyY2VTZXR0aW5ncy5FdHdTZWxmRGVzY3JpYmluZ0V2ZW50Rm9ybWF0LHRlbGVtZXRyeVRyYWl0cyk7fX0nOyAkbG9nZ2VyID0gTmV3LU9iamVjdCAtVHlwZU5hbWUgU2Vuc2UuVHJhY2U7ICRsb2dnZXIuV3JpdGVPbmJvYXJkaW5nTWVzc2FnZSgnJWVycm9yT3V0cHV0JScpIiA+TlVMIDI+JjEKZWNobyAlZXJyb3JPdXRwdXQlID5OVUwgMj4mMQplY2hvLiA+TlVMIDI+JjEKZXZlbnRjcmVhdGUgL2wgQXBwbGljYXRpb24gL3NvIFdEQVRQT25ib2FyZGluZyAvdCBFcnJvciAvaWQgJWVycm9yQ29kZSUgL2QgIiVlcnJvck91dHB1dCUiID5OVUwgMj4mMQpHT1RPIENMRUFOVVAKCjpTVUNDRUVERUQKZWNobyBGaW5pc2hlZCBwZXJmb3JtaW5nIG9uYm9hcmRpbmcgb3BlcmF0aW9ucyA+TlVMIDI+JjEKZWNoby4gPk5VTCAyPiYxCkdPVE8gV0FJVF9GT1JfVEhFX1NFUlZJQ0VfVE9fU1RBUlQKCjpXQUlUX0ZPUl9USEVfU0VSVklDRV9UT19TVEFSVAplY2hvIFdhaXRpbmcgZm9yIHRoZSBzZXJ2aWNlIHRvIHN0YXJ0ID5OVUwgMj4mMQplY2hvLiA+TlVMIDI+JjEKCnNldCAvYSBjb3VudGVyPTAKCjpTRU5TRV9SVU5OSU5HX1dBSVQKc2MgcXVlcnkgIlNFTlNFIiB8IGZpbmQgL2kgIlJVTk5JTkciID5OVUwgMj4mMQppZiAlRVJST1JMRVZFTCUgTkVRIDAgKAoJSUYgJWNvdW50ZXIlIEVRVSA0ICgKCQlzZXQgImVycm9yRGVzY3JpcHRpb249VW5hYmxlIHRvIHN0YXJ0IFdpbmRvd3MgRGVmZW5kZXIgQWR2YW5jZWQgVGhyZWF0IFByb3RlY3Rpb24gU2VydmljZS4iCgkJc2V0IGVycm9yQ29kZT0xNQoJCXNldCBsYXN0RXJyb3I9JUVSUk9STEVWRUwlCgkJR09UTyBFUlJPUgoJKQoKCXNldCAvYSBjb3VudGVyPSVjb3VudGVyJSsxCgoJdGltZW91dCA1ID5OVUwgMj4mMQoJR09UTyA6U0VOU0VfUlVOTklOR19XQUlUCikKCnNldCAvYSBjb3VudGVyPTAKCjpTRU5TRV9PTkJPQVJERURfU1RBVFVTX1dBSVQKUkVHIHF1ZXJ5ICJIS0xNXFNPRlRXQVJFXE1pY3Jvc29mdFxXaW5kb3dzIEFkdmFuY2VkIFRocmVhdCBQcm90ZWN0aW9uXFN0YXR1cyIgL3YgT25ib2FyZGluZ1N0YXRlIC9yZWc6NjQgPk5VTCAyPiYxCmlmICVFUlJPUkxFVkVMJSBORVEgMCAoCglJRiAlY291bnRlciUgRVFVIDQgKAoJCUBlY2hvIFdpbmRvd3MgRGVmZW5kZXIgQWR2YW5jZWQgVGhyZWF0IFByb3RlY3Rpb24gU2VydmljZSBpcyBub3QgcnVubmluZyBhcyBleHBlY3RlZD4gJVRNUCVcc2Vuc2VUbXAudHh0CgkJc2V0IGVycm9yQ29kZT0zNQogICAgIHNldCBsYXN0RXJyb3I9JUVSUk9STEVWRUwlCgkJR09UTyBFUlJPUgoJKQoKCXNldCAvYSBjb3VudGVyPSVjb3VudGVyJSsxCgoJdGltZW91dCA1ID5OVUwgMj4mMQoJR09UTyA6U0VOU0VfT05CT0FSREVEX1NUQVRVU19XQUlUCikKCnNldCAvYSBjb3VudGVyPTAKCjpTRU5TRV9PTkJPQVJERURfV0FJVApSRUcgcXVlcnkgIkhLTE1cU09GVFdBUkVcTWljcm9zb2Z0XFdpbmRvd3MgQWR2YW5jZWQgVGhyZWF0IFByb3RlY3Rpb25cU3RhdHVzIiAvdiBPbmJvYXJkaW5nU3RhdGUgL3JlZzo2NCB8IGZpbmQgL2kgIjB4MSIgPk5VTCAyPiYxCmlmICVFUlJPUkxFVkVMJSBORVEgMCAoCglJRiAlY291bnRlciUgRVFVIDQgKAoJCUBlY2hvIFdpbmRvd3MgRGVmZW5kZXIgQWR2YW5jZWQgVGhyZWF0IFByb3RlY3Rpb24gU2VydmljZSBpcyBub3QgcnVubmluZyBhcyBleHBlY3RlZD4gJVRNUCVcc2Vuc2VUbXAudHh0CgkJc2V0IGVycm9yQ29kZT00MAogICAgIHNldCBsYXN0RXJyb3I9JUVSUk9STEVWRUwlCgkJR09UTyBFUlJPUgoJKQoKCXNldCAvYSBjb3VudGVyPSVjb3VudGVyJSsxCgoJdGltZW91dCA1ID5OVUwgMj4mMQoJR09UTyA6U0VOU0VfT05CT0FSREVEX1dBSVQKKQoKc2V0ICJzdWNjZXNzT3V0cHV0PVN1Y2Nlc3NmdWxseSBvbmJvYXJkZWQgbWFjaGluZSB0byBXaW5kb3dzIERlZmVuZGVyIEFkdmFuY2VkIFRocmVhdCBQcm90ZWN0aW9uIgplY2hvICVzdWNjZXNzT3V0cHV0JSA+TlVMIDI+JjEKZWNoby4KZXZlbnRjcmVhdGUgL2wgQXBwbGljYXRpb24gL3NvIFdEQVRQT25ib2FyZGluZyAvdCBJbmZvcm1hdGlvbiAvaWQgMjAgL2QgIiVzdWNjZXNzT3V0cHV0JSIgPk5VTCAyPiYxCiVwb3dlcnNoZWxsUGF0aCUgLUV4ZWN1dGlvblBvbGljeSBCeXBhc3MgLU5vUHJvZmlsZSAtQ29tbWFuZCAiQWRkLVR5cGUgJ3VzaW5nIFN5c3RlbTsgdXNpbmcgU3lzdGVtLkRpYWdub3N0aWNzOyB1c2luZyBTeXN0ZW0uRGlhZ25vc3RpY3MuVHJhY2luZzsgbmFtZXNwYWNlIFNlbnNlIHsgW0V2ZW50RGF0YShOYW1lID0gXCJPbmJvYXJkaW5nXCIpXXB1YmxpYyBzdHJ1Y3QgT25ib2FyZGluZ3twdWJsaWMgc3RyaW5nIE1lc3NhZ2UgeyBnZXQ7IHNldDsgfX0gcHVibGljIGNsYXNzIFRyYWNlIHtwdWJsaWMgc3RhdGljIEV2ZW50U291cmNlT3B0aW9ucyBUZWxlbWV0cnlDcml0aWNhbE9wdGlvbiA9IG5ldyBFdmVudFNvdXJjZU9wdGlvbnMoKXtMZXZlbCA9IEV2ZW50TGV2ZWwuSW5mb3JtYXRpb25hbCwgS2V5d29yZHMgPSAoRXZlbnRLZXl3b3JkcykweDAwMDAyMDAwMDAwMDAwMDAsIFRhZ3MgPSAoRXZlbnRUYWdzKTB4MDIwMDAwMH07IHB1YmxpYyB2b2lkIFdyaXRlT25ib2FyZGluZ01lc3NhZ2Uoc3RyaW5nIG1lc3NhZ2Upe2VzLldyaXRlKFwiT25ib2FyZGluZ1NjcmlwdFwiLCBUZWxlbWV0cnlDcml0aWNhbE9wdGlvbiwgbmV3IE9uYm9hcmRpbmcge01lc3NhZ2UgPSBtZXNzYWdlfSk7fSBwcml2YXRlIHN0YXRpYyByZWFkb25seSBzdHJpbmdbXSB0ZWxlbWV0cnlUcmFpdHMgPSB7IFwiRVRXX0dST1VQXCIsIFwiezVFQ0IwQkFDLUI5MzAtNDdGNS1BOEE0LUU4MjUzNTI5RURCN31cIiB9OyBwcml2YXRlIEV2ZW50U291cmNlIGVzID0gbmV3IEV2ZW50U291cmNlKFwiTWljcm9zb2Z0LldpbmRvd3MuU2Vuc2UuQ2xpZW50Lk1hbmFnZW1lbnRcIixFdmVudFNvdXJjZVNldHRpbmdzLkV0d1NlbGZEZXNjcmliaW5nRXZlbnRGb3JtYXQsdGVsZW1ldHJ5VHJhaXRzKTt9fSc7ICRsb2dnZXIgPSBOZXctT2JqZWN0IC1UeXBlTmFtZSBTZW5zZS5UcmFjZTsgJGxvZ2dlci5Xcml0ZU9uYm9hcmRpbmdNZXNzYWdlKCclc3VjY2Vzc091dHB1dCUnKSIgPk5VTCAyPiYxCiIlUFJPR1JBTUZJTEVTJVxXaW5kb3dzIERlZmVuZGVyXE1wQ21kUnVuLmV4ZSIgLVJlbG9hZEVuZ2luZSA+TlVMIDI+JjEKCkdPVE8gQ0xFQU5VUAoKOkNMRUFOVVAKaWYgZXhpc3QgJVRNUCVcc2Vuc2VUbXAudHh0IGRlbCAlVE1QJVxzZW5zZVRtcC50eHQKRVhJVCAvQiAlZXJyb3JDb2RlJQo=="), - // }, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/models.go b/sdk/resourcemanager/security/armsecurity/models.go index 1b78ec3604e8..704d176dfb51 100644 --- a/sdk/resourcemanager/security/armsecurity/models.go +++ b/sdk/resourcemanager/security/armsecurity/models.go @@ -8,64 +8,25 @@ package armsecurity -import "time" +// BlobsScanSummary - A summary of the scan results of the blobs that were scanned. +type BlobsScanSummary struct { + // The number of malicious blobs that were detected during the scan. + MaliciousBlobsCount *int64 -// 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 - Kind *ExternalSecuritySolutionKind - - // The external security solution properties for AAD solutions - Properties *AADSolutionProperties - - // 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 -} - -// 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, - } -} + // The number of gigabytes of data that were scanned. + ScannedBlobsInGB *float64 -// 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 number of blobs that were skipped. + SkippedBlobsCount *int64 - // The connectivity state of the external AAD solution - ConnectivityState *AADConnectivityState - DeviceType *string - DeviceVendor *string - - // Represents an OMS workspace to which the solution is connected - Workspace *ConnectedWorkspace + // The total number of blobs that were scanned. + TotalBlobsScanned *int64 } -// APICollection - An API collection as represented by Microsoft Defender for APIs. -type APICollection struct { - // Describes the properties of an API collection. - Properties *APICollectionProperties +// DefenderForStorageSetting - The Defender for Storage resource. +type DefenderForStorageSetting struct { + // Defender for Storage resource properties. + Properties *DefenderForStorageSettingProperties // READ-ONLY; Resource Id ID *string @@ -77,7898 +38,111 @@ type APICollection struct { Type *string } -// APICollectionList - Page of a list of API collections as represented by Microsoft Defender for APIs. -type APICollectionList struct { - // READ-ONLY; The URI to fetch the next page. - NextLink *string - - // READ-ONLY; API collections in this page. - Value []*APICollection -} - -// APICollectionProperties - Describes the properties of an API collection. -type APICollectionProperties struct { - // READ-ONLY; The base URI for this API collection. All endpoints of this API collection extend this base URI. - BaseURL *string - - // READ-ONLY; The resource Id of the resource from where this API collection was discovered. - DiscoveredVia *string - - // READ-ONLY; The display name of the API collection. - DisplayName *string - - // READ-ONLY; The number of API endpoints discovered in this API collection. - NumberOfAPIEndpoints *int64 - - // READ-ONLY; The number of API endpoints in this API collection which are exposing sensitive data in their requests and/or - // responses. - NumberOfAPIEndpointsWithSensitiveDataExposed *int64 - - // READ-ONLY; The number of API endpoints in this API collection for which API traffic from the internet was observed. - NumberOfExternalAPIEndpoints *int64 - - // READ-ONLY; The number of API endpoints in this API collection that have not received any API traffic in the last 30 days. - NumberOfInactiveAPIEndpoints *int64 - - // READ-ONLY; The number of API endpoints in this API collection that are unauthenticated. - NumberOfUnauthenticatedAPIEndpoints *int64 - - // READ-ONLY; Gets the provisioning state of the API collection. - ProvisioningState *ProvisioningState - - // READ-ONLY; The highest priority sensitivity label from Microsoft Purview in this API collection. - SensitivityLabel *string -} - -// ActionableRemediation - Configuration payload for PR Annotations. -type ActionableRemediation struct { - // Repository branch configuration for PR Annotations. - BranchConfiguration *TargetBranchConfiguration - - // Gets or sets list of categories and severity levels. - CategoryConfigurations []*CategoryConfiguration - - // Update Settings. - // 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. - State *ActionableRemediationState -} - -// ActiveConnectionsNotInAllowedRange - Number of active connections is not in allowed range. -type ActiveConnectionsNotInAllowedRange struct { - // REQUIRED; Status of the custom alert. +// DefenderForStorageSettingProperties - Defender for Storage resource properties. +type DefenderForStorageSettingProperties struct { + // Indicates whether Defender for Storage is enabled on this storage account. IsEnabled *bool - // REQUIRED; The maximum threshold. - MaxThreshold *int32 - - // REQUIRED; The minimum threshold. - MinThreshold *int32 - - // REQUIRED; The type of the custom alert rule. - RuleType *string - - // REQUIRED; The time window size in iso8601 format. - TimeWindowSize *string - - // READ-ONLY; The description of the custom alert. - Description *string - - // READ-ONLY; The display name of the custom alert. - DisplayName *string -} - -// GetCustomAlertRule implements the CustomAlertRuleClassification interface for type ActiveConnectionsNotInAllowedRange. -func (a *ActiveConnectionsNotInAllowedRange) GetCustomAlertRule() *CustomAlertRule { - return &CustomAlertRule{ - Description: a.Description, - DisplayName: a.DisplayName, - IsEnabled: a.IsEnabled, - RuleType: a.RuleType, - } -} + // Properties of Malware Scanning. + MalwareScanning *MalwareScanningProperties -// GetThresholdCustomAlertRule implements the ThresholdCustomAlertRuleClassification interface for type ActiveConnectionsNotInAllowedRange. -func (a *ActiveConnectionsNotInAllowedRange) GetThresholdCustomAlertRule() *ThresholdCustomAlertRule { - return &ThresholdCustomAlertRule{ - Description: a.Description, - DisplayName: a.DisplayName, - IsEnabled: a.IsEnabled, - MaxThreshold: a.MaxThreshold, - MinThreshold: a.MinThreshold, - RuleType: a.RuleType, - } -} + // Indicates whether the settings defined for this storage account should override the settings defined for the subscription. + OverrideSubscriptionLevelSettings *bool -// GetTimeWindowCustomAlertRule implements the TimeWindowCustomAlertRuleClassification interface for type ActiveConnectionsNotInAllowedRange. -func (a *ActiveConnectionsNotInAllowedRange) GetTimeWindowCustomAlertRule() *TimeWindowCustomAlertRule { - return &TimeWindowCustomAlertRule{ - Description: a.Description, - DisplayName: a.DisplayName, - IsEnabled: a.IsEnabled, - MaxThreshold: a.MaxThreshold, - MinThreshold: a.MinThreshold, - RuleType: a.RuleType, - TimeWindowSize: a.TimeWindowSize, - } + // Properties of Sensitive Data Discovery. + SensitiveDataDiscovery *SensitiveDataDiscoveryProperties } -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 +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info any - // READ-ONLY; Resource type + // READ-ONLY; The additional info 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 +// MalwareScan - Describes the state of a malware scan operation. +type MalwareScan struct { + Properties *MalwareScanProperties } -// 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 MalwareScanProperties struct { + // The time at which the scan has ended. Only available for a scan which has terminated. + ScanEndTime *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 + // The identifier of the scan. + ScanID *string - // REQUIRED; The rules to enforce - Rules []*Rule -} + // The time at which the scan had been initiated. + ScanStartTime *string -// AdaptiveNetworkHardeningProperties - Adaptive Network Hardening resource properties -type AdaptiveNetworkHardeningProperties struct { - // The Network Security Groups effective on the network interfaces of the protected resource - EffectiveNetworkSecurityGroups []*EffectiveNetworkSecurityGroups + // A status code of the scan operation. + ScanStatus *string - // The security rules which are recommended to be effective on the VM - Rules []*Rule + // A description of the status of the scan. + ScanStatusMessage *string - // The UTC time on which the rules were calculated - RulesCalculationTime *time.Time + // A summary of the scan results. + ScanSummary *ScanSummary } -// AdaptiveNetworkHardeningsList - Response for ListAdaptiveNetworkHardenings API service call -type AdaptiveNetworkHardeningsList struct { - // The URL to get the next set of results - NextLink *string +// MalwareScanningProperties - Properties of Malware Scanning. +type MalwareScanningProperties struct { + // Properties of On Upload malware scanning. + OnUpload *OnUploadProperties - // A list of Adaptive Network Hardenings resources - Value []*AdaptiveNetworkHardening -} + // Optional. Resource id of an Event Grid Topic to send scan results to. + ScanResultsEventGridTopicResourceID *string -// AdditionalData - Details of the sub-assessment -type AdditionalData struct { - // REQUIRED; Sub-assessment resource type - AssessedResourceType *AssessedResourceType + // READ-ONLY; Upon failure or partial success. Additional data describing Malware Scanning enable/disable operation. + OperationStatus *OperationStatus } -// GetAdditionalData implements the AdditionalDataClassification interface for type AdditionalData. -func (a *AdditionalData) GetAdditionalData() *AdditionalData { return a } - -// AdditionalWorkspacesProperties - Properties of the additional workspaces. -type AdditionalWorkspacesProperties struct { - // List of data types sent to workspace - DataTypes []*AdditionalWorkspaceDataType - - // Workspace type. - Type *AdditionalWorkspaceType - - // Workspace resource id - Workspace *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. + CapGBPerMonth *int32 -// AdvancedThreatProtectionProperties - The Advanced Threat Protection settings. -type AdvancedThreatProtectionProperties struct { - // Indicates whether Advanced Threat Protection is enabled. + // Indicates whether On Upload malware scanning should be enabled. IsEnabled *bool } -// AdvancedThreatProtectionSetting - The Advanced Threat Protection resource. -type AdvancedThreatProtectionSetting struct { - // The Advanced Threat Protection settings. - Properties *AdvancedThreatProtectionProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// Alert - Security alert -type Alert struct { - // describes security alert properties. - Properties *AlertProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - 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 - Type *string -} - -// AlertList - List of security alerts -type AlertList struct { - // describes security alert properties. - Value []*Alert - - // READ-ONLY; The URI to fetch the next page. - NextLink *string -} - -// AlertProperties - describes security alert properties. -type AlertProperties struct { - // Custom properties for the alert. - ExtendedProperties map[string]*string - - // Changing set of properties depending on the supportingEvidence type. - SupportingEvidence *AlertPropertiesSupportingEvidence - - // READ-ONLY; The display name of the alert. - AlertDisplayName *string - - // READ-ONLY; Unique identifier for the detection logic (all alert instances from the same detection logic will have the same - // alertType). - AlertType *string - - // READ-ONLY; A direct link to the alert page in Azure Portal. - AlertURI *string - - // READ-ONLY; The display name of the resource most related to this alert. - CompromisedEntity *string - - // READ-ONLY; Key for corelating related alerts. Alerts with the same correlation key considered to be related. - CorrelationKey *string - - // READ-ONLY; Description of the suspicious activity that was detected. - Description *string - - // READ-ONLY; The UTC time of the last event or activity included in the alert in ISO8601 format. - EndTimeUTC *time.Time - - // READ-ONLY; A list of entities related to the alert. - Entities []*AlertEntity - - // READ-ONLY; Links related to the alert - ExtendedLinks []map[string]*string - - // READ-ONLY; The kill chain related intent behind the alert. For list of supported values, and explanations of Azure Security - // Center's supported kill chain intents. - Intent *Intent - - // READ-ONLY; This field determines whether the alert is an incident (a compound grouping of several alerts) or a single alert. - IsIncident *bool - - // READ-ONLY; The UTC processing end time of the alert in ISO8601 format. - ProcessingEndTimeUTC *time.Time - - // READ-ONLY; The name of Azure Security Center pricing tier which powering this alert. Learn more: https://docs.microsoft.com/en-us/azure/security-center/security-center-pricing - 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). - ProductName *string - - // READ-ONLY; Manual action items to take to remediate the alert. - RemediationSteps []*string - - // READ-ONLY; The resource identifiers that can be used to direct the alert to the right product exposure group (tenant, workspace, - // subscription etc.). There can be multiple identifiers of different type per alert. - ResourceIdentifiers []ResourceIdentifierClassification - - // READ-ONLY; 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. - Severity *AlertSeverity - - // READ-ONLY; The UTC time of the first event or activity included in the alert in ISO8601 format. - StartTimeUTC *time.Time - - // READ-ONLY; The life cycle status of the alert. - Status *AlertStatus - - // READ-ONLY; Kill chain related sub-techniques behind the alert. - SubTechniques []*string - - // READ-ONLY; Unique identifier for the alert. - SystemAlertID *string - - // READ-ONLY; kill chain related techniques behind the alert. - Techniques []*string - - // READ-ONLY; The UTC time the alert was generated in ISO8601 format. - TimeGeneratedUTC *time.Time - - // READ-ONLY; The name of the vendor that raises the alert. - VendorName *string - - // READ-ONLY; Schema version. - Version *string -} - -// 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 - Type *string -} - -// 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. - AdditionalProperties map[string]any - - // Bundles list. - Bundles []*BundleType -} - -// GetAlertSimulatorRequestProperties implements the AlertSimulatorRequestPropertiesClassification interface for type AlertSimulatorBundlesRequestProperties. -func (a *AlertSimulatorBundlesRequestProperties) GetAlertSimulatorRequestProperties() *AlertSimulatorRequestProperties { - return &AlertSimulatorRequestProperties{ - AdditionalProperties: a.AdditionalProperties, - Kind: a.Kind, - } -} - -// AlertSimulatorRequestBody - Alert Simulator request body. -type AlertSimulatorRequestBody struct { - // Alert Simulator request body data. - Properties AlertSimulatorRequestPropertiesClassification -} - -// 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. - AdditionalProperties map[string]any -} - -// GetAlertSimulatorRequestProperties implements the AlertSimulatorRequestPropertiesClassification interface for type AlertSimulatorRequestProperties. -func (a *AlertSimulatorRequestProperties) GetAlertSimulatorRequestProperties() *AlertSimulatorRequestProperties { - return a -} - -// AlertSyncSettingProperties - The alert sync setting properties -type AlertSyncSettingProperties struct { - // REQUIRED; Is the alert sync setting enabled - Enabled *bool -} - -// AlertSyncSettings - Represents an alert sync setting -type AlertSyncSettings struct { - // REQUIRED; the kind of the settings string - Kind *SettingKind - - // Alert sync setting data - Properties *AlertSyncSettingProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - 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, - } -} - -// AlertsSuppressionRule - Describes the suppression rule -type AlertsSuppressionRule struct { - // describes AlertsSuppressionRule properties - Properties *AlertsSuppressionRuleProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// AlertsSuppressionRuleProperties - describes AlertsSuppressionRule properties -type AlertsSuppressionRuleProperties struct { - // REQUIRED; Type of the alert to automatically suppress. For all alert types, use '*' - AlertType *string - - // REQUIRED; The reason for dismissing the alert - Reason *string - - // REQUIRED; Possible states of the rule - State *RuleState - - // Any comment regarding the rule - Comment *string - - // Expiration date of the rule, if value is not provided or provided as null there will no expiration at all - ExpirationDateUTC *time.Time - - // The suppression conditions - SuppressionAlertsScope *SuppressionAlertsScope - - // READ-ONLY; The last time this rule was modified - LastModifiedUTC *time.Time -} - -// AlertsSuppressionRulesList - Suppression rules list for subscription. -type AlertsSuppressionRulesList struct { - // REQUIRED - Value []*AlertsSuppressionRule - - // READ-ONLY; URI to fetch the next page. - NextLink *string -} - -// AllowedConnectionsList - List of all possible traffic between Azure resources -type AllowedConnectionsList struct { - // READ-ONLY; The URI to fetch the next page. - NextLink *string +// OperationStatus - A status describing the success/failure of the enablement/disablement operation. +type OperationStatus struct { + // The operation status code. + Code *string - // READ-ONLY - Value []*AllowedConnectionsResource + // Additional information regarding the success/failure of the operation. + Message *string } -// AllowedConnectionsResource - The resource whose properties describes the allowed traffic between Azure resources -type AllowedConnectionsResource struct { +// Resource - Describes an Azure resource. +type Resource struct { // READ-ONLY; Resource Id ID *string - // READ-ONLY; Location where the resource is stored - Location *string - // READ-ONLY; Resource name Name *string - // READ-ONLY; Describes the allowed traffic between Azure resources - Properties *AllowedConnectionsResourceProperties - // READ-ONLY; Resource type Type *string } -// AllowedConnectionsResourceProperties - Describes the allowed traffic between Azure resources -type AllowedConnectionsResourceProperties struct { - // READ-ONLY; The UTC time on which the allowed connections resource was calculated - CalculatedDateTime *time.Time - - // READ-ONLY; List of connectable resources - ConnectableResources []*ConnectableResource -} - -// AllowlistCustomAlertRule - A custom alert rule that checks if a value (depends on the custom alert type) is allowed. -type AllowlistCustomAlertRule struct { - // REQUIRED; The values to allow. The format of the values depends on the rule type. - AllowlistValues []*string - - // REQUIRED; Status of the custom alert. - IsEnabled *bool - - // REQUIRED; The type of the custom alert rule. - RuleType *string - - // READ-ONLY; The description of the custom alert. - Description *string - - // READ-ONLY; The display name of the custom alert. - DisplayName *string - - // READ-ONLY; The value type of the items in the list. - ValueType *ValueType -} - -// GetAllowlistCustomAlertRule implements the AllowlistCustomAlertRuleClassification interface for type AllowlistCustomAlertRule. -func (a *AllowlistCustomAlertRule) GetAllowlistCustomAlertRule() *AllowlistCustomAlertRule { return a } - -// GetCustomAlertRule implements the CustomAlertRuleClassification interface for type AllowlistCustomAlertRule. -func (a *AllowlistCustomAlertRule) GetCustomAlertRule() *CustomAlertRule { - return &CustomAlertRule{ - Description: a.Description, - DisplayName: a.DisplayName, - IsEnabled: a.IsEnabled, - RuleType: a.RuleType, - } -} +// ScanSummary - A summary of the scan results. +type ScanSummary struct { + // A summary of the scan results of the blobs that were scanned. + Blobs *BlobsScanSummary -// GetListCustomAlertRule implements the ListCustomAlertRuleClassification interface for type AllowlistCustomAlertRule. -func (a *AllowlistCustomAlertRule) GetListCustomAlertRule() *ListCustomAlertRule { - return &ListCustomAlertRule{ - Description: a.Description, - DisplayName: a.DisplayName, - IsEnabled: a.IsEnabled, - RuleType: a.RuleType, - ValueType: a.ValueType, - } + // The estimated cost of the scan. Only available for a scan which has terminated. + EstimatedScanCostUSD *float64 } -// AmqpC2DMessagesNotInAllowedRange - Number of cloud to device messages (AMQP protocol) is not in allowed range. -type AmqpC2DMessagesNotInAllowedRange struct { - // REQUIRED; Status of the custom alert. +// SensitiveDataDiscoveryProperties - Properties of Sensitive Data Discovery. +type SensitiveDataDiscoveryProperties struct { + // Indicates whether Sensitive Data Discovery should be enabled. IsEnabled *bool - // REQUIRED; The maximum threshold. - MaxThreshold *int32 - - // REQUIRED; The minimum threshold. - MinThreshold *int32 - - // REQUIRED; The type of the custom alert rule. - RuleType *string - - // REQUIRED; The time window size in iso8601 format. - TimeWindowSize *string - - // READ-ONLY; The description of the custom alert. - Description *string - - // READ-ONLY; The display name of the custom alert. - DisplayName *string -} - -// GetCustomAlertRule implements the CustomAlertRuleClassification interface for type AmqpC2DMessagesNotInAllowedRange. -func (a *AmqpC2DMessagesNotInAllowedRange) GetCustomAlertRule() *CustomAlertRule { - return &CustomAlertRule{ - Description: a.Description, - DisplayName: a.DisplayName, - IsEnabled: a.IsEnabled, - RuleType: a.RuleType, - } -} - -// GetThresholdCustomAlertRule implements the ThresholdCustomAlertRuleClassification interface for type AmqpC2DMessagesNotInAllowedRange. -func (a *AmqpC2DMessagesNotInAllowedRange) GetThresholdCustomAlertRule() *ThresholdCustomAlertRule { - return &ThresholdCustomAlertRule{ - Description: a.Description, - DisplayName: a.DisplayName, - IsEnabled: a.IsEnabled, - MaxThreshold: a.MaxThreshold, - MinThreshold: a.MinThreshold, - RuleType: a.RuleType, - } -} - -// GetTimeWindowCustomAlertRule implements the TimeWindowCustomAlertRuleClassification interface for type AmqpC2DMessagesNotInAllowedRange. -func (a *AmqpC2DMessagesNotInAllowedRange) GetTimeWindowCustomAlertRule() *TimeWindowCustomAlertRule { - return &TimeWindowCustomAlertRule{ - Description: a.Description, - DisplayName: a.DisplayName, - IsEnabled: a.IsEnabled, - MaxThreshold: a.MaxThreshold, - MinThreshold: a.MinThreshold, - RuleType: a.RuleType, - TimeWindowSize: a.TimeWindowSize, - } -} - -// AmqpC2DRejectedMessagesNotInAllowedRange - Number of rejected cloud to device messages (AMQP protocol) is not in allowed -// range. -type AmqpC2DRejectedMessagesNotInAllowedRange struct { - // REQUIRED; Status of the custom alert. - IsEnabled *bool - - // REQUIRED; The maximum threshold. - MaxThreshold *int32 - - // REQUIRED; The minimum threshold. - MinThreshold *int32 - - // REQUIRED; The type of the custom alert rule. - RuleType *string - - // REQUIRED; The time window size in iso8601 format. - TimeWindowSize *string - - // READ-ONLY; The description of the custom alert. - Description *string - - // READ-ONLY; The display name of the custom alert. - DisplayName *string -} - -// GetCustomAlertRule implements the CustomAlertRuleClassification interface for type AmqpC2DRejectedMessagesNotInAllowedRange. -func (a *AmqpC2DRejectedMessagesNotInAllowedRange) GetCustomAlertRule() *CustomAlertRule { - return &CustomAlertRule{ - Description: a.Description, - DisplayName: a.DisplayName, - IsEnabled: a.IsEnabled, - RuleType: a.RuleType, - } -} - -// GetThresholdCustomAlertRule implements the ThresholdCustomAlertRuleClassification interface for type AmqpC2DRejectedMessagesNotInAllowedRange. -func (a *AmqpC2DRejectedMessagesNotInAllowedRange) GetThresholdCustomAlertRule() *ThresholdCustomAlertRule { - return &ThresholdCustomAlertRule{ - Description: a.Description, - DisplayName: a.DisplayName, - IsEnabled: a.IsEnabled, - MaxThreshold: a.MaxThreshold, - MinThreshold: a.MinThreshold, - RuleType: a.RuleType, - } -} - -// GetTimeWindowCustomAlertRule implements the TimeWindowCustomAlertRuleClassification interface for type AmqpC2DRejectedMessagesNotInAllowedRange. -func (a *AmqpC2DRejectedMessagesNotInAllowedRange) GetTimeWindowCustomAlertRule() *TimeWindowCustomAlertRule { - return &TimeWindowCustomAlertRule{ - Description: a.Description, - DisplayName: a.DisplayName, - IsEnabled: a.IsEnabled, - MaxThreshold: a.MaxThreshold, - MinThreshold: a.MinThreshold, - RuleType: a.RuleType, - TimeWindowSize: a.TimeWindowSize, - } -} - -// AmqpD2CMessagesNotInAllowedRange - Number of device to cloud messages (AMQP protocol) is not in allowed range. -type AmqpD2CMessagesNotInAllowedRange struct { - // REQUIRED; Status of the custom alert. - IsEnabled *bool - - // REQUIRED; The maximum threshold. - MaxThreshold *int32 - - // REQUIRED; The minimum threshold. - MinThreshold *int32 - - // REQUIRED; The type of the custom alert rule. - RuleType *string - - // REQUIRED; The time window size in iso8601 format. - TimeWindowSize *string - - // READ-ONLY; The description of the custom alert. - Description *string - - // READ-ONLY; The display name of the custom alert. - DisplayName *string -} - -// GetCustomAlertRule implements the CustomAlertRuleClassification interface for type AmqpD2CMessagesNotInAllowedRange. -func (a *AmqpD2CMessagesNotInAllowedRange) GetCustomAlertRule() *CustomAlertRule { - return &CustomAlertRule{ - Description: a.Description, - DisplayName: a.DisplayName, - IsEnabled: a.IsEnabled, - RuleType: a.RuleType, - } -} - -// GetThresholdCustomAlertRule implements the ThresholdCustomAlertRuleClassification interface for type AmqpD2CMessagesNotInAllowedRange. -func (a *AmqpD2CMessagesNotInAllowedRange) GetThresholdCustomAlertRule() *ThresholdCustomAlertRule { - return &ThresholdCustomAlertRule{ - Description: a.Description, - DisplayName: a.DisplayName, - IsEnabled: a.IsEnabled, - MaxThreshold: a.MaxThreshold, - MinThreshold: a.MinThreshold, - RuleType: a.RuleType, - } -} - -// GetTimeWindowCustomAlertRule implements the TimeWindowCustomAlertRuleClassification interface for type AmqpD2CMessagesNotInAllowedRange. -func (a *AmqpD2CMessagesNotInAllowedRange) GetTimeWindowCustomAlertRule() *TimeWindowCustomAlertRule { - return &TimeWindowCustomAlertRule{ - Description: a.Description, - DisplayName: a.DisplayName, - IsEnabled: a.IsEnabled, - MaxThreshold: a.MaxThreshold, - MinThreshold: a.MinThreshold, - RuleType: a.RuleType, - TimeWindowSize: a.TimeWindowSize, - } -} - -// Application - Security Application over a given scope -type Application struct { - // Properties of a security application - Properties *ApplicationProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - 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 - - // The application Condition's Value like IDs that contain some string, see examples - Value *string -} - -// ApplicationProperties - Describes properties of an application -type ApplicationProperties struct { - // REQUIRED; The application conditionSets - see examples - ConditionSets []any - - // REQUIRED; The application source, what it affects, e.g. Assessments - SourceResourceType *ApplicationSourceResourceType - - // description of the application - Description *string - - // display name of the application - DisplayName *string -} - -// ApplicationsList - Page of a security applications list -type ApplicationsList struct { - // READ-ONLY; The URI to fetch the next page - NextLink *string - - // READ-ONLY; Collection of applications in this page - Value []*Application -} - -// ArcAutoProvisioning - The ARC autoprovisioning configuration -type ArcAutoProvisioning struct { - // Configuration for servers Arc auto provisioning for a given environment - Configuration *ArcAutoProvisioningConfiguration - - // Is arc auto provisioning enabled - Enabled *bool -} - -// ArcAutoProvisioningAws - The ARC autoprovisioning configuration for an AWS environment -type ArcAutoProvisioningAws struct { - // The cloud role ARN in AWS for this feature - CloudRoleArn *string - - // Configuration for servers Arc auto provisioning for a given environment - Configuration *ArcAutoProvisioningConfiguration - - // Is arc auto provisioning enabled - Enabled *bool -} - -// 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 - - // Optional HTTP proxy endpoint to use for the Arc agent - Proxy *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 - - // Is arc auto provisioning enabled - Enabled *bool -} - -// AscLocation - The ASC location of the subscription is in the "name" field -type AscLocation struct { - // An empty set of properties - Properties any - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// AscLocationList - List of locations where ASC saves your data -type AscLocationList struct { - // READ-ONLY; The URI to fetch the next page. - NextLink *string - - // READ-ONLY - Value []*AscLocation -} - -// Assessment - Security assessment on a resource -type Assessment struct { - // Describes properties of an assessment. - Properties *AssessmentProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// AssessmentLinks - Links relevant to the assessment -type AssessmentLinks struct { - // READ-ONLY; Link to assessment in Azure Portal - AzurePortalURI *string -} - -// AssessmentList - Page of a security assessments list -type AssessmentList struct { - // READ-ONLY; 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 - PartnerName *string - - // REQUIRED; Secret to authenticate the partner and verify it created the assessment - write only - Secret *string - - // Name of the product of the partner that created the assessment - ProductName *string -} - -// AssessmentMetadataProperties - Describes properties of an assessment metadata. -type AssessmentMetadataProperties struct { - // REQUIRED; BuiltIn if the assessment based on built-in Azure Policy definition, Custom if the assessment based on custom - // Azure Policy definition - AssessmentType *AssessmentType - - // REQUIRED; User friendly display name of the assessment - DisplayName *string - - // REQUIRED; The severity level of the assessment - Severity *Severity - Categories []*Categories - - // Human readable description of the assessment - Description *string - - // The implementation effort required to remediate this assessment - ImplementationEffort *ImplementationEffort - - // Describes the partner that created the assessment - PartnerData *AssessmentMetadataPartnerData - - // True if this assessment is in preview release status - Preview *bool - - // Human readable description of what you should do to mitigate this security issue - RemediationDescription *string - Threats []*Threats - - // The user impact of the assessment - UserImpact *UserImpact - - // READ-ONLY; Azure resource ID of the policy definition that turns this assessment calculation on - PolicyDefinitionID *string -} - -// AssessmentMetadataPropertiesResponse - Describes properties of an assessment metadata response. -type AssessmentMetadataPropertiesResponse struct { - // REQUIRED; BuiltIn if the assessment based on built-in Azure Policy definition, Custom if the assessment based on custom - // Azure Policy definition - AssessmentType *AssessmentType - - // REQUIRED; User friendly display name of the assessment - DisplayName *string - - // REQUIRED; The severity level of the assessment - Severity *Severity - Categories []*Categories - - // Human readable description of the assessment - Description *string - - // The implementation effort required to remediate this assessment - ImplementationEffort *ImplementationEffort - - // Describes the partner that created the assessment - PartnerData *AssessmentMetadataPartnerData - PlannedDeprecationDate *string - - // True if this assessment is in preview release status - Preview *bool - PublishDates *AssessmentMetadataPropertiesResponsePublishDates - - // Human readable description of what you should do to mitigate this security issue - RemediationDescription *string - Tactics []*Tactics - Techniques []*Techniques - Threats []*Threats - - // The user impact of the assessment - UserImpact *UserImpact - - // READ-ONLY; Azure resource ID of the policy definition that turns this assessment calculation on - PolicyDefinitionID *string -} - -type AssessmentMetadataPropertiesResponsePublishDates struct { - // REQUIRED - Public *string - GA *string -} - -// AssessmentMetadataResponse - Security assessment metadata response -type AssessmentMetadataResponse struct { - // Describes properties of an assessment metadata response. - Properties *AssessmentMetadataPropertiesResponse - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// AssessmentMetadataResponseList - List of security assessment metadata -type AssessmentMetadataResponseList struct { - // READ-ONLY; The URI to fetch the next page. - NextLink *string - - // READ-ONLY - Value []*AssessmentMetadataResponse -} - -// AssessmentPartnerData - Data regarding 3rd party partner integration -type AssessmentPartnerData struct { - // REQUIRED; Name of the company of the partner - PartnerName *string - - // REQUIRED; secret to authenticate the partner - write only - Secret *string -} - -// AssessmentProperties - Describes properties of an assessment. -type AssessmentProperties struct { - // REQUIRED; Details of the resource that was assessed - ResourceDetails ResourceDetailsClassification - - // REQUIRED; The result of the assessment - Status *AssessmentStatus - - // Additional data regarding the assessment - AdditionalData map[string]*string - - // Describes properties of an assessment metadata. - Metadata *AssessmentMetadataProperties - - // Data regarding 3rd party partner integration - PartnersData *AssessmentPartnerData - - // READ-ONLY; User friendly display name of the assessment - DisplayName *string - - // READ-ONLY; Links relevant to the assessment - Links *AssessmentLinks -} - -// AssessmentPropertiesBase - Describes properties of an assessment. -type AssessmentPropertiesBase struct { - // REQUIRED; Details of the resource that was assessed - ResourceDetails ResourceDetailsClassification - - // Additional data regarding the assessment - AdditionalData map[string]*string - - // Describes properties of an assessment metadata. - Metadata *AssessmentMetadataProperties - - // Data regarding 3rd party partner integration - PartnersData *AssessmentPartnerData - - // READ-ONLY; User friendly display name of the assessment - DisplayName *string - - // READ-ONLY; Links relevant to the assessment - Links *AssessmentLinks -} - -// AssessmentPropertiesResponse - Describes properties of an assessment. -type AssessmentPropertiesResponse struct { - // REQUIRED; Details of the resource that was assessed - ResourceDetails ResourceDetailsClassification - - // REQUIRED; The result of the assessment - Status *AssessmentStatusResponse - - // Additional data regarding the assessment - AdditionalData map[string]*string - - // Describes properties of an assessment metadata. - Metadata *AssessmentMetadataProperties - - // Data regarding 3rd party partner integration - PartnersData *AssessmentPartnerData - - // READ-ONLY; User friendly display name of the assessment - DisplayName *string - - // READ-ONLY; Links relevant to the assessment - Links *AssessmentLinks -} - -// AssessmentResponse - Security assessment on a resource - response format -type AssessmentResponse struct { - // Describes properties of an assessment. - Properties *AssessmentPropertiesResponse - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// AssessmentStatus - The result of the assessment -type AssessmentStatus struct { - // REQUIRED; Programmatic code for the status of the assessment - Code *AssessmentStatusCode - - // Programmatic code for the cause of the assessment status - Cause *string - - // Human readable description of the assessment status - Description *string -} - -// AssessmentStatusResponse - The result of the assessment -type AssessmentStatusResponse struct { - // REQUIRED; Programmatic code for the status of the assessment - Code *AssessmentStatusCode - - // Programmatic code for the cause of the assessment status - Cause *string - - // Human readable description of the assessment status - Description *string - - // READ-ONLY; The time that the assessment was created and first evaluated. Returned as UTC time in ISO 8601 format - FirstEvaluationDate *time.Time - - // READ-ONLY; The time that the status of the assessment last changed. Returned as UTC time in ISO 8601 format - StatusChangeDate *time.Time -} - -// AtaExternalSecuritySolution - Represents an ATA security solution which sends logs to an OMS workspace -type AtaExternalSecuritySolution struct { - // REQUIRED; The kind of the external solution - Kind *ExternalSecuritySolutionKind - - // The external security solution properties for ATA solutions - Properties *AtaSolutionProperties - - // 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 -} - -// 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, - } -} - -// 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 - LastEventReceived *string - - // Represents an OMS workspace to which the solution is connected - 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 - - // READ-ONLY; The permissions detected in the cloud account. - GrantedPermissions []*PermissionProperty -} - -// GetAuthenticationDetailsProperties implements the AuthenticationDetailsPropertiesClassification interface for type AuthenticationDetailsProperties. -func (a *AuthenticationDetailsProperties) GetAuthenticationDetailsProperties() *AuthenticationDetailsProperties { - return a -} - -// Authorization payload. -type Authorization struct { - // Gets or sets one-time OAuth code to exchange for refresh and access tokens. - // Only used during PUT/PATCH operations. The secret is cleared during GET. - Code *string -} - -// AutoProvisioningSetting - Auto provisioning setting -type AutoProvisioningSetting struct { - // Auto provisioning setting data - Properties *AutoProvisioningSettingProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// AutoProvisioningSettingList - List of all the auto provisioning settings response -type AutoProvisioningSettingList struct { - // List of all the auto provisioning settings - Value []*AutoProvisioningSetting - - // READ-ONLY; The URI to fetch the next page. - NextLink *string -} - -// AutoProvisioningSettingProperties - describes properties of an auto provisioning setting -type AutoProvisioningSettingProperties struct { - // REQUIRED; Describes what kind of security agent provisioning action to take - AutoProvision *AutoProvision -} - -// Automation - The security automation resource. -type Automation 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 - - // Security automation data - Properties *AutomationProperties - - // 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 -} - -// AutomationAction - The action that should be triggered. -type AutomationAction struct { - // REQUIRED; The type of the action that will be triggered by the Automation - ActionType *ActionType -} - -// GetAutomationAction implements the AutomationActionClassification interface for type AutomationAction. -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 - ActionType *ActionType - - // The target Event Hub connection string (it will not be included in any response). - ConnectionString *string - - // The target Event Hub Azure Resource ID. - EventHubResourceID *string - - // Indicates whether the trusted service is enabled or not. - IsTrustedServiceEnabled *bool - - // READ-ONLY; The target Event Hub SAS policy name. - SasPolicyName *string -} - -// GetAutomationAction implements the AutomationActionClassification interface for type AutomationActionEventHub. -func (a *AutomationActionEventHub) GetAutomationAction() *AutomationAction { - return &AutomationAction{ - ActionType: a.ActionType, - } -} - -// 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 - ActionType *ActionType - - // The triggered Logic App Azure Resource ID. This can also reside on other subscriptions, given that you have permissions - // to trigger the Logic App - LogicAppResourceID *string - - // The Logic App trigger URI endpoint (it will not be included in any response). - URI *string -} - -// GetAutomationAction implements the AutomationActionClassification interface for type AutomationActionLogicApp. -func (a *AutomationActionLogicApp) GetAutomationAction() *AutomationAction { - return &AutomationAction{ - ActionType: a.ActionType, - } -} - -// 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 - ActionType *ActionType - - // The fully qualified Log Analytics Workspace Azure Resource ID. - WorkspaceResourceID *string -} - -// GetAutomationAction implements the AutomationActionClassification interface for type AutomationActionWorkspace. -func (a *AutomationActionWorkspace) GetAutomationAction() *AutomationAction { - return &AutomationAction{ - ActionType: a.ActionType, - } -} - -// AutomationList - List of security automations response. -type AutomationList struct { - // REQUIRED; The list of security automations under the given scope. - Value []*Automation - - // READ-ONLY; The URI to fetch the next page. - NextLink *string -} - -// AutomationProperties - A set of properties that defines the behavior of the automation configuration. To learn more about -// the supported security events data models schemas - please visit https://aka.ms/ASCAutomationSchemas. -type AutomationProperties struct { - // A collection of the actions which are triggered if all the configured rules evaluations, within at least one rule set, - // are true. - Actions []AutomationActionClassification - - // The security automation description. - Description *string - - // Indicates whether the security automation is enabled. - 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. - Scopes []*AutomationScope - - // A collection of the source event types which evaluate the security automation set of rules. - Sources []*AutomationSource -} - -// AutomationRuleSet - A rule set which evaluates all its rules upon an event interception. Only when all the included rules -// in the rule set will be evaluated as 'true', will the event trigger the defined actions. -type AutomationRuleSet struct { - Rules []*AutomationTriggeringRule -} - -// AutomationScope - A single automation scope. -type AutomationScope struct { - // The resources scope description. - Description *string - - // The resources scope path. Can be the subscription on which the automation is defined on or a resource group under that - // subscription (fully qualified Azure resource IDs). - ScopePath *string -} - -// 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. -type AutomationSource struct { - // A valid event source type. - EventSource *EventSource - - // A set of rules which evaluate upon event interception. A logical disjunction is applied between defined rule sets (logical - // 'or'). - RuleSets []*AutomationRuleSet -} - -// 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. -type AutomationTriggeringRule struct { - // The expected value. - ExpectedValue *string - - // A valid comparer operator to use. A case-insensitive comparison will be applied for String PropertyType. - Operator *Operator - - // The JPath of the entity model property that should be checked. - PropertyJPath *string - - // The data type of the compared operands (string, integer, floating point number or a boolean [true/false]] - PropertyType *PropertyType -} - -// AutomationUpdateModel - The update model of security automation resource. -type AutomationUpdateModel struct { - // Security automation data - Properties *AutomationProperties - - // A list of key value pairs that describe the resource. - Tags map[string]*string -} - -// AutomationValidationStatus - The security automation model state property bag. -type AutomationValidationStatus struct { - // Indicates whether the model is valid or not. - IsValid *bool - - // The validation message. - 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. - EnvironmentType *EnvironmentType - - // The AWS account's organizational data - OrganizationalData AwsOrganizationalDataClassification - - // list of regions to scan - Regions []*string - - // Scan interval in hours (value should be between 1-hour to 24-hours) - ScanInterval *int64 - - // READ-ONLY; The AWS account name - AccountName *string -} - -// GetEnvironmentData implements the EnvironmentDataClassification interface for type AwsEnvironmentData. -func (a *AwsEnvironmentData) GetEnvironmentData() *EnvironmentData { - return &EnvironmentData{ - EnvironmentType: a.EnvironmentType, - } -} - -// AwsOrganizationalData - The AWS organization data -type AwsOrganizationalData struct { - // REQUIRED; The multi cloud account's membership type in the organization - OrganizationMembershipType *OrganizationMembershipType -} - -// GetAwsOrganizationalData implements the AwsOrganizationalDataClassification interface for type AwsOrganizationalData. -func (a *AwsOrganizationalData) GetAwsOrganizationalData() *AwsOrganizationalData { return a } - -// AwsOrganizationalDataMaster - The AWS organization data for the master account -type AwsOrganizationalDataMaster struct { - // REQUIRED; The multi cloud account's membership type in the organization - OrganizationMembershipType *OrganizationMembershipType - - // If the multi cloud account is of membership type organization, list of accounts excluded from offering - ExcludedAccountIDs []*string - - // If the multi cloud account is of membership type organization, this will be the name of the onboarding stackset - StacksetName *string -} - -// GetAwsOrganizationalData implements the AwsOrganizationalDataClassification interface for type AwsOrganizationalDataMaster. -func (a *AwsOrganizationalDataMaster) GetAwsOrganizationalData() *AwsOrganizationalData { - return &AwsOrganizationalData{ - OrganizationMembershipType: a.OrganizationMembershipType, - } -} - -// AwsOrganizationalDataMember - The AWS organization data for the member account -type AwsOrganizationalDataMember struct { - // REQUIRED; The multi cloud account's membership type in the organization - OrganizationMembershipType *OrganizationMembershipType - - // If the multi cloud account is not of membership type organization, this will be the ID of the account's parent - ParentHierarchyID *string -} - -// GetAwsOrganizationalData implements the AwsOrganizationalDataClassification interface for type AwsOrganizationalDataMember. -func (a *AwsOrganizationalDataMember) GetAwsOrganizationalData() *AwsOrganizationalData { - return &AwsOrganizationalData{ - OrganizationMembershipType: a.OrganizationMembershipType, - } -} - -// AzureDevOpsOrg - Azure DevOps Organization resource. -type AzureDevOpsOrg struct { - // Azure DevOps Organization properties. - Properties *AzureDevOpsOrgProperties - - // 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; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// AzureDevOpsOrgListResponse - List of RP resources which supports pagination. -type AzureDevOpsOrgListResponse struct { - // Gets or sets next link to scroll over the results. - NextLink *string - - // Gets or sets list of resources. - Value []*AzureDevOpsOrg -} - -// AzureDevOpsOrgProperties - Azure DevOps Organization properties. -type AzureDevOpsOrgProperties struct { - // Configuration payload for PR Annotations. - ActionableRemediation *ActionableRemediation - - // 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. - 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 resource status message. - ProvisioningStatusMessage *string - - // READ-ONLY; Gets or sets 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. - Properties *AzureDevOpsProjectProperties - - // 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; Metadata pertaining to creation and last modification of the resource. - 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. - NextLink *string - - // Gets or sets list of resources. - Value []*AzureDevOpsProject -} - -// AzureDevOpsProjectProperties - Azure DevOps Project properties. -type AzureDevOpsProjectProperties struct { - // Configuration payload for PR Annotations. - ActionableRemediation *ActionableRemediation - - // 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. - 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. - ProvisioningStatusMessage *string - - // READ-ONLY; Gets or sets time when resource was last checked. - ProvisioningStatusUpdateTimeUTC *time.Time -} - -// AzureDevOpsRepository - Azure DevOps Repository resource. -type AzureDevOpsRepository struct { - // Azure DevOps Repository properties. - Properties *AzureDevOpsRepositoryProperties - - // 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; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// AzureDevOpsRepositoryListResponse - List of RP resources which supports pagination. -type AzureDevOpsRepositoryListResponse struct { - // Gets or sets next link to scroll over the results. - NextLink *string - - // Gets or sets list of resources. - Value []*AzureDevOpsRepository -} - -// AzureDevOpsRepositoryProperties - Azure DevOps Repository properties. -type AzureDevOpsRepositoryProperties struct { - // Configuration payload for PR Annotations. - ActionableRemediation *ActionableRemediation - - // 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. - OnboardingState *OnboardingState - - // Gets or sets parent Azure DevOps Organization name. - ParentOrgName *string - - // 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. - ProvisioningState *DevOpsProvisioningState - - // READ-ONLY; Gets or sets resource status message. - ProvisioningStatusMessage *string - - // READ-ONLY; Gets or sets time when resource was last checked. - ProvisioningStatusUpdateTimeUTC *time.Time - - // READ-ONLY; Gets or sets Azure DevOps Repository id. - RepoID *string - - // READ-ONLY; Gets or sets Azure DevOps Repository url. - RepoURL *string - - // READ-ONLY; Gets or sets Azure DevOps repository visibility, whether it is public or private etc. - Visibility *string -} - -// AzureDevOpsScopeEnvironmentData - The AzureDevOps scope connector's environment data -type AzureDevOpsScopeEnvironmentData struct { - // REQUIRED; The type of the environment data. - EnvironmentType *EnvironmentType -} - -// GetEnvironmentData implements the EnvironmentDataClassification interface for type AzureDevOpsScopeEnvironmentData. -func (a *AzureDevOpsScopeEnvironmentData) GetEnvironmentData() *EnvironmentData { - return &EnvironmentData{ - EnvironmentType: a.EnvironmentType, - } -} - -// AzureResourceDetails - Details of the Azure resource that was assessed -type AzureResourceDetails struct { - // REQUIRED; The platform where the assessed resource resides - Source *Source - - // READ-ONLY; Azure resource Id of the assessed resource - ID *string -} - -// GetResourceDetails implements the ResourceDetailsClassification interface for type AzureResourceDetails. -func (a *AzureResourceDetails) GetResourceDetails() *ResourceDetails { - return &ResourceDetails{ - Source: a.Source, - } -} - -// AzureResourceIdentifier - Azure resource identifier. -type AzureResourceIdentifier struct { - // REQUIRED; There can be multiple identifiers of different type per alert, this field specify the identifier type. - Type *ResourceIdentifierType - - // READ-ONLY; ARM resource identifier for the cloud resource being alerted on - AzureResourceID *string -} - -// GetResourceIdentifier implements the ResourceIdentifierClassification interface for type AzureResourceIdentifier. -func (a *AzureResourceIdentifier) GetResourceIdentifier() *ResourceIdentifier { - return &ResourceIdentifier{ - Type: a.Type, - } -} - -// AzureResourceLink - Describes an Azure resource with kind -type AzureResourceLink struct { - // READ-ONLY; Azure resource Id - ID *string -} - -// AzureServersSetting - A vulnerability assessments setting on Azure servers in the defined scope. -type AzureServersSetting struct { - // REQUIRED; The kind of the server vulnerability assessments setting. - 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}" - 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 -} - -// GetServerVulnerabilityAssessmentsSetting implements the ServerVulnerabilityAssessmentsSettingClassification interface for -// type AzureServersSetting. -func (a *AzureServersSetting) GetServerVulnerabilityAssessmentsSetting() *ServerVulnerabilityAssessmentsSetting { - return &ServerVulnerabilityAssessmentsSetting{ - ID: a.ID, - Kind: a.Kind, - Name: a.Name, - 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. - ExpectedResults [][]*string - - // Baseline update time (UTC). - UpdatedTime *time.Time -} - -// BaselineAdjustedResult - The rule result adjusted with baseline. -type BaselineAdjustedResult struct { - // Baseline details. - Baseline *Baseline - - // Results the are not in baseline. - ResultsNotInBaseline [][]*string - - // Results the are in baseline. - ResultsOnlyInBaseline [][]*string - - // The rule result status. - Status *RuleStatus -} - -// BenchmarkReference - The benchmark references. -type BenchmarkReference struct { - // The benchmark name. - Benchmark *string - - // The benchmark reference. - Reference *string -} - -// BuiltInInfoType - Pre-configured sensitive information type -type BuiltInInfoType struct { - // Id of the info type - ID *string - - // Display name of the info type - Name *string - - // Category of the built-in info type - Type *string -} - -// CVE details -type CVE struct { - // READ-ONLY; Link url - Link *string - - // READ-ONLY; CVE title - Title *string -} - -// CVSS details -type CVSS struct { - // READ-ONLY; CVSS base - Base *float32 -} - -// 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. - Category *RuleCategory - - // Gets or sets minimum severity level for a given category. - MinimumSeverityLevel *string -} - -// CefExternalSecuritySolution - Represents a security solution which sends CEF logs to an OMS workspace -type CefExternalSecuritySolution struct { - // REQUIRED; The kind of the external solution - Kind *ExternalSecuritySolutionKind - - // The external security solution properties for CEF solutions - Properties *CefSolutionProperties - - // 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 -} - -// 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, - } -} - -// 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 - DeviceVendor *string - Hostname *string - LastEventReceived *string - - // Represents an OMS workspace to which the solution is connected - Workspace *ConnectedWorkspace -} - -// CloudOffering - The security offering details -type CloudOffering struct { - // REQUIRED; The type of the security offering. - OfferingType *OfferingType - - // READ-ONLY; The offering description. - Description *string -} - -// GetCloudOffering implements the CloudOfferingClassification interface for type CloudOffering. -func (c *CloudOffering) GetCloudOffering() *CloudOffering { return c } - -// Compliance of a scope -type Compliance struct { - // Compliance data - Properties *ComplianceProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - 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 -} - -// 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. -type ComplianceProperties struct { - // READ-ONLY; An array of segment, which is the actually the compliance assessment. - AssessmentResult []*ComplianceSegment - - // READ-ONLY; The timestamp when the Compliance calculation was conducted. - AssessmentTimestampUTCDate *time.Time - - // READ-ONLY; The resource count of the given subscription for which the Compliance calculation was conducted (needed for - // Management Group Compliance calculation). - ResourceCount *int32 -} - -// ComplianceResult - a compliance result -type ComplianceResult struct { - // Compliance result data - Properties *ComplianceResultProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// ComplianceResultList - List of compliance results response -type ComplianceResultList struct { - // REQUIRED; List of compliance results - Value []*ComplianceResult - - // READ-ONLY; The URI to fetch the next page. - NextLink *string -} - -// ComplianceResultProperties - Compliance result data -type ComplianceResultProperties struct { - // READ-ONLY; The status of the resource regarding a single assessment - ResourceStatus *ResourceStatus -} - -// ComplianceSegment - A segment of a compliance assessment. -type ComplianceSegment struct { - // READ-ONLY; The size (%) of the segment. - Percentage *float64 - - // READ-ONLY; The segment type, e.g. compliant, non-compliance, insufficient coverage, N/A, etc. - 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 - ID *string - - // READ-ONLY; The list of Azure resources that the resource has inbound allowed connection from - InboundConnectedResources []*ConnectedResource - - // READ-ONLY; The list of Azure resources that the resource has outbound allowed connection to - OutboundConnectedResources []*ConnectedResource -} - -// ConnectedResource - Describes properties of a connected resource -type ConnectedResource struct { - // READ-ONLY; The Azure resource id of the connected resource - ConnectedResourceID *string - - // READ-ONLY; The allowed tcp ports - TCPPorts *string - - // READ-ONLY; The allowed udp ports - UDPPorts *string -} - -// ConnectedWorkspace - Represents an OMS workspace to which the solution is connected -type ConnectedWorkspace struct { - // Azure resource ID of the connected OMS workspace - ID *string -} - -// ConnectionFromIPNotAllowed - Inbound connection from an ip that isn't allowed. Allow list consists of ipv4 or ipv6 range -// in CIDR notation. -type ConnectionFromIPNotAllowed struct { - // REQUIRED; The values to allow. The format of the values depends on the rule type. - AllowlistValues []*string - - // REQUIRED; Status of the custom alert. - IsEnabled *bool - - // REQUIRED; The type of the custom alert rule. - RuleType *string - - // READ-ONLY; The description of the custom alert. - Description *string - - // READ-ONLY; The display name of the custom alert. - DisplayName *string - - // READ-ONLY; The value type of the items in the list. - ValueType *ValueType -} - -// GetAllowlistCustomAlertRule implements the AllowlistCustomAlertRuleClassification interface for type ConnectionFromIPNotAllowed. -func (c *ConnectionFromIPNotAllowed) GetAllowlistCustomAlertRule() *AllowlistCustomAlertRule { - return &AllowlistCustomAlertRule{ - AllowlistValues: c.AllowlistValues, - Description: c.Description, - DisplayName: c.DisplayName, - IsEnabled: c.IsEnabled, - RuleType: c.RuleType, - ValueType: c.ValueType, - } -} - -// GetCustomAlertRule implements the CustomAlertRuleClassification interface for type ConnectionFromIPNotAllowed. -func (c *ConnectionFromIPNotAllowed) GetCustomAlertRule() *CustomAlertRule { - return &CustomAlertRule{ - Description: c.Description, - DisplayName: c.DisplayName, - IsEnabled: c.IsEnabled, - RuleType: c.RuleType, - } -} - -// GetListCustomAlertRule implements the ListCustomAlertRuleClassification interface for type ConnectionFromIPNotAllowed. -func (c *ConnectionFromIPNotAllowed) GetListCustomAlertRule() *ListCustomAlertRule { - return &ListCustomAlertRule{ - Description: c.Description, - DisplayName: c.DisplayName, - IsEnabled: c.IsEnabled, - RuleType: c.RuleType, - ValueType: c.ValueType, - } -} - -// ConnectionToIPNotAllowed - Outbound connection to an ip that isn't allowed. Allow list consists of ipv4 or ipv6 range in -// CIDR notation. -type ConnectionToIPNotAllowed struct { - // REQUIRED; The values to allow. The format of the values depends on the rule type. - AllowlistValues []*string - - // REQUIRED; Status of the custom alert. - IsEnabled *bool - - // REQUIRED; The type of the custom alert rule. - RuleType *string - - // READ-ONLY; The description of the custom alert. - Description *string - - // READ-ONLY; The display name of the custom alert. - DisplayName *string - - // READ-ONLY; The value type of the items in the list. - ValueType *ValueType -} - -// GetAllowlistCustomAlertRule implements the AllowlistCustomAlertRuleClassification interface for type ConnectionToIPNotAllowed. -func (c *ConnectionToIPNotAllowed) GetAllowlistCustomAlertRule() *AllowlistCustomAlertRule { - return &AllowlistCustomAlertRule{ - AllowlistValues: c.AllowlistValues, - Description: c.Description, - DisplayName: c.DisplayName, - IsEnabled: c.IsEnabled, - RuleType: c.RuleType, - ValueType: c.ValueType, - } -} - -// GetCustomAlertRule implements the CustomAlertRuleClassification interface for type ConnectionToIPNotAllowed. -func (c *ConnectionToIPNotAllowed) GetCustomAlertRule() *CustomAlertRule { - return &CustomAlertRule{ - Description: c.Description, - DisplayName: c.DisplayName, - IsEnabled: c.IsEnabled, - RuleType: c.RuleType, - } -} - -// GetListCustomAlertRule implements the ListCustomAlertRuleClassification interface for type ConnectionToIPNotAllowed. -func (c *ConnectionToIPNotAllowed) GetListCustomAlertRule() *ListCustomAlertRule { - return &ListCustomAlertRule{ - Description: c.Description, - DisplayName: c.DisplayName, - IsEnabled: c.IsEnabled, - RuleType: c.RuleType, - ValueType: c.ValueType, - } -} - -// Connector - The security connector resource. -type Connector 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 - - // Security connector data - Properties *ConnectorProperties - - // 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; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData - - // READ-ONLY; Resource type - Type *string -} - -// ConnectorProperties - A set of properties that defines the security connector configuration. -type ConnectorProperties struct { - // The security connector environment data. - EnvironmentData EnvironmentDataClassification - - // The multi cloud resource's cloud name. - EnvironmentName *CloudName - - // The multi cloud resource identifier (account id in case of AWS connector, project number in case of GCP connector). - HierarchyIdentifier *string - - // A collection of offerings for the security connector. - Offerings []CloudOfferingClassification - - // READ-ONLY; The date on which the trial period will end, if applicable. Trial period exists for 30 days after upgrading - // to payed offerings. - HierarchyIdentifierTrialEndDate *time.Time -} - -// 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. - Value []*Connector - - // READ-ONLY; The URI to fetch the next page. - NextLink *string -} - -// Contact details and configurations for notifications coming from Microsoft Defender for Cloud. -type Contact struct { - // Security contact data - Properties *ContactProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// ContactList - List of security contacts response -type ContactList struct { - // REQUIRED; List of security contacts - Value []*Contact - - // READ-ONLY; The URI to fetch the next page. - NextLink *string -} - -// ContactProperties - Describes security contact properties -type ContactProperties struct { - // List of email addresses which will get notifications from Microsoft Defender for Cloud by the configurations defined in - // this security contact. - Emails *string - - // Indicates whether the security contact is enabled. - IsEnabled *bool - - // Defines whether to send email notifications from Microsoft Defender for Cloud to persons with specific RBAC roles on the - // subscription. - NotificationsByRole *ContactPropertiesNotificationsByRole - - // A collection of sources types which evaluate the email notification. - NotificationsSources []NotificationsSourceClassification - - // The security contact's phone number - Phone *string -} - -// ContactPropertiesNotificationsByRole - Defines whether to send email notifications from Microsoft Defender for Cloud to -// persons with specific RBAC roles on the subscription. -type ContactPropertiesNotificationsByRole struct { - // Defines which RBAC roles will get email notifications from Microsoft Defender for Cloud. List of allowed RBAC roles: - Roles []*SecurityContactRole - - // Defines whether to send email notifications from AMicrosoft Defender for Cloud to persons with specific RBAC roles on the - // subscription. - State *State -} - -// ContainerRegistryVulnerabilityProperties - Additional context fields for container registry Vulnerability assessment -type ContainerRegistryVulnerabilityProperties struct { - // REQUIRED; Sub-assessment resource type - AssessedResourceType *AssessedResourceType - - // READ-ONLY; List of CVEs - Cve []*CVE - - // READ-ONLY; Dictionary from cvss version to cvss details object - Cvss map[string]*CVSS - - // READ-ONLY; Digest of the vulnerable image - ImageDigest *string - - // READ-ONLY; Indicates whether a patch is available or not - Patchable *bool - - // READ-ONLY; Published time - PublishedTime *time.Time - - // READ-ONLY; Name of the repository which the vulnerable image belongs to - RepositoryName *string - - // READ-ONLY; Vulnerability Type. e.g: Vulnerability, Potential Vulnerability, Information Gathered, Vulnerability - Type *string - - // READ-ONLY - VendorReferences []*VendorReference -} - -// GetAdditionalData implements the AdditionalDataClassification interface for type ContainerRegistryVulnerabilityProperties. -func (c *ContainerRegistryVulnerabilityProperties) GetAdditionalData() *AdditionalData { - return &AdditionalData{ - AssessedResourceType: c.AssessedResourceType, - } -} - -// CspmMonitorAwsOffering - The CSPM monitoring for AWS offering -type CspmMonitorAwsOffering struct { - // REQUIRED; The type of the security offering. - OfferingType *OfferingType - - // The native cloud connection configuration - NativeCloudConnection *CspmMonitorAwsOfferingNativeCloudConnection - - // READ-ONLY; The offering description. - Description *string -} - -// GetCloudOffering implements the CloudOfferingClassification interface for type CspmMonitorAwsOffering. -func (c *CspmMonitorAwsOffering) GetCloudOffering() *CloudOffering { - return &CloudOffering{ - Description: c.Description, - OfferingType: c.OfferingType, - } -} - -// CspmMonitorAwsOfferingNativeCloudConnection - The native cloud connection configuration -type CspmMonitorAwsOfferingNativeCloudConnection struct { - // The cloud role ARN in AWS for this feature - CloudRoleArn *string -} - -// CspmMonitorAzureDevOpsOffering - The CSPM monitoring for AzureDevOps offering -type CspmMonitorAzureDevOpsOffering struct { - // REQUIRED; The type of the security offering. - OfferingType *OfferingType - - // READ-ONLY; The offering description. - Description *string -} - -// GetCloudOffering implements the CloudOfferingClassification interface for type CspmMonitorAzureDevOpsOffering. -func (c *CspmMonitorAzureDevOpsOffering) 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. - OfferingType *OfferingType - - // The native cloud connection configuration - NativeCloudConnection *CspmMonitorGcpOfferingNativeCloudConnection - - // READ-ONLY; The offering description. - Description *string -} - -// GetCloudOffering implements the CloudOfferingClassification interface for type CspmMonitorGcpOffering. -func (c *CspmMonitorGcpOffering) GetCloudOffering() *CloudOffering { - return &CloudOffering{ - Description: c.Description, - OfferingType: c.OfferingType, - } -} - -// CspmMonitorGcpOfferingNativeCloudConnection - The native cloud connection configuration -type CspmMonitorGcpOfferingNativeCloudConnection struct { - // The service account email address in GCP for this offering - ServiceAccountEmailAddress *string - - // The GCP workload identity provider id for the offering - WorkloadIdentityProviderID *string -} - -// CspmMonitorGitLabOffering - The CSPM (Cloud security posture management) monitoring for gitlab offering -type CspmMonitorGitLabOffering struct { - // REQUIRED; The type of the security offering. - OfferingType *OfferingType - - // READ-ONLY; The offering description. - Description *string -} - -// GetCloudOffering implements the CloudOfferingClassification interface for type CspmMonitorGitLabOffering. -func (c *CspmMonitorGitLabOffering) GetCloudOffering() *CloudOffering { - return &CloudOffering{ - Description: c.Description, - OfferingType: c.OfferingType, - } -} - -// CspmMonitorGithubOffering - The CSPM monitoring for github offering -type CspmMonitorGithubOffering struct { - // REQUIRED; The type of the security offering. - OfferingType *OfferingType - - // READ-ONLY; The offering description. - Description *string -} - -// GetCloudOffering implements the CloudOfferingClassification interface for type CspmMonitorGithubOffering. -func (c *CspmMonitorGithubOffering) GetCloudOffering() *CloudOffering { - return &CloudOffering{ - Description: c.Description, - OfferingType: c.OfferingType, - } -} - -// CustomAlertRule - A custom alert rule. -type CustomAlertRule struct { - // REQUIRED; Status of the custom alert. - IsEnabled *bool - - // REQUIRED; The type of the custom alert rule. - RuleType *string - - // READ-ONLY; The description of the custom alert. - Description *string - - // READ-ONLY; The display name of the custom alert. - DisplayName *string -} - -// 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 - - // 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 -} - -// 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 - - // 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 -} - -// 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 - - // 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 -} - -// DataExportSettingProperties - The data export setting properties -type DataExportSettingProperties struct { - // REQUIRED; Is the data export setting enabled - Enabled *bool -} - -// DataExportSettings - Represents a data export setting -type DataExportSettings struct { - // REQUIRED; the kind of the settings string - Kind *SettingKind - - // Data export setting data - Properties *DataExportSettingProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - 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, - } -} - -// DefenderCspmAwsOffering - The CSPM P1 for AWS offering -type DefenderCspmAwsOffering struct { - // REQUIRED; The type of the security offering. - OfferingType *OfferingType - - // Defenders CSPM Permissions Management offering configurations - Ciem *DefenderCspmAwsOfferingCiem - - // The Microsoft Defender Data Sensitivity discovery configuration - DataSensitivityDiscovery *DefenderCspmAwsOfferingDataSensitivityDiscovery - - // The databases DSPM configuration - DatabasesDspm *DefenderCspmAwsOfferingDatabasesDspm - - // The Microsoft Defender container agentless discovery K8s configuration - MdcContainersAgentlessDiscoveryK8S *DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S - - // The Microsoft Defender container image assessment configuration - MdcContainersImageAssessment *DefenderCspmAwsOfferingMdcContainersImageAssessment - - // The Microsoft Defender for CSPM offering VM scanning configuration - VMScanners *DefenderCspmAwsOfferingVMScanners - - // READ-ONLY; The offering description. - Description *string -} - -// GetCloudOffering implements the CloudOfferingClassification interface for type DefenderCspmAwsOffering. -func (d *DefenderCspmAwsOffering) GetCloudOffering() *CloudOffering { - return &CloudOffering{ - Description: d.Description, - OfferingType: d.OfferingType, - } -} - -// DefenderCspmAwsOfferingCiem - Defenders CSPM Permissions Management offering configurations -type DefenderCspmAwsOfferingCiem struct { - // Defender CSPM Permissions Management discovery configuration - CiemDiscovery *DefenderCspmAwsOfferingCiemDiscovery - - // AWS Defender CSPM Permissions Management OIDC (open id connect) connection configurations - CiemOidc *DefenderCspmAwsOfferingCiemOidc -} - -// DefenderCspmAwsOfferingCiemDiscovery - Defender CSPM Permissions Management discovery configuration -type DefenderCspmAwsOfferingCiemDiscovery struct { - // The cloud role ARN in AWS for Permissions Management discovery - CloudRoleArn *string -} - -// DefenderCspmAwsOfferingCiemOidc - AWS Defender CSPM Permissions Management OIDC (open id connect) connection configurations -type DefenderCspmAwsOfferingCiemOidc struct { - // the azure active directory app name used of authenticating against AWS - AzureActiveDirectoryAppName *string - - // The cloud role ARN in AWS for Permissions Management used for oidc connection - CloudRoleArn *string -} - -// DefenderCspmAwsOfferingDataSensitivityDiscovery - The Microsoft Defender Data Sensitivity discovery configuration -type DefenderCspmAwsOfferingDataSensitivityDiscovery struct { - // The cloud role ARN in AWS for this feature - CloudRoleArn *string - - // Is Microsoft Defender Data Sensitivity discovery enabled - Enabled *bool -} - -// DefenderCspmAwsOfferingDatabasesDspm - The databases DSPM configuration -type DefenderCspmAwsOfferingDatabasesDspm struct { - // The cloud role ARN in AWS for this feature - CloudRoleArn *string - - // Is databases DSPM protection enabled - Enabled *bool -} - -// DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S - The Microsoft Defender container agentless discovery K8s configuration -type DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S struct { - // The cloud role ARN in AWS for this feature - CloudRoleArn *string - - // Is Microsoft Defender container agentless discovery K8s enabled - Enabled *bool -} - -// DefenderCspmAwsOfferingMdcContainersImageAssessment - The Microsoft Defender container image assessment configuration -type DefenderCspmAwsOfferingMdcContainersImageAssessment struct { - // The cloud role ARN in AWS for this feature - CloudRoleArn *string - - // Is Microsoft Defender container image assessment enabled - Enabled *bool -} - -// DefenderCspmAwsOfferingVMScanners - The Microsoft Defender for CSPM offering VM scanning configuration -type DefenderCspmAwsOfferingVMScanners struct { - // The cloud role ARN in AWS for this feature - CloudRoleArn *string - - // Configuration for VM scanning - Configuration *VMScannersBaseConfiguration - - // Is VM scanning enabled - Enabled *bool -} - -// DefenderCspmGcpOffering - The CSPM P1 for GCP offering -type DefenderCspmGcpOffering struct { - // REQUIRED; The type of the security offering. - OfferingType *OfferingType - - // GCP Defenders CSPM Permissions Management OIDC (Open ID connect) connection configurations - CiemDiscovery *DefenderCspmGcpOfferingCiemDiscovery - - // The Microsoft Defender Data Sensitivity discovery configuration - DataSensitivityDiscovery *DefenderCspmGcpOfferingDataSensitivityDiscovery - - // The Microsoft Defender Container agentless discovery configuration - MdcContainersAgentlessDiscoveryK8S *DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S - - // The Microsoft Defender Container image assessment configuration - MdcContainersImageAssessment *DefenderCspmGcpOfferingMdcContainersImageAssessment - - // The Microsoft Defender for CSPM VM scanning configuration - VMScanners *DefenderCspmGcpOfferingVMScanners - - // READ-ONLY; The offering description. - Description *string -} - -// GetCloudOffering implements the CloudOfferingClassification interface for type DefenderCspmGcpOffering. -func (d *DefenderCspmGcpOffering) GetCloudOffering() *CloudOffering { - return &CloudOffering{ - Description: d.Description, - OfferingType: d.OfferingType, - } -} - -// DefenderCspmGcpOfferingCiemDiscovery - GCP Defenders CSPM Permissions Management OIDC (Open ID connect) connection configurations -type DefenderCspmGcpOfferingCiemDiscovery struct { - // the azure active directory app name used of authenticating against GCP workload identity federation - AzureActiveDirectoryAppName *string - - // The service account email address in GCP for Permissions Management offering - ServiceAccountEmailAddress *string - - // The GCP workload identity provider id for Permissions Management offering - WorkloadIdentityProviderID *string -} - -// DefenderCspmGcpOfferingDataSensitivityDiscovery - The Microsoft Defender Data Sensitivity discovery configuration -type DefenderCspmGcpOfferingDataSensitivityDiscovery struct { - // Is Microsoft Defender Data Sensitivity discovery enabled - Enabled *bool - - // The service account email address in GCP for this feature - ServiceAccountEmailAddress *string - - // The workload identity provider id in GCP for this feature - WorkloadIdentityProviderID *string -} - -// DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S - The Microsoft Defender Container agentless discovery configuration -type DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S struct { - // Is Microsoft Defender container agentless discovery enabled - Enabled *bool - - // The service account email address in GCP for this feature - ServiceAccountEmailAddress *string - - // The workload identity provider id in GCP for this feature - WorkloadIdentityProviderID *string -} - -// DefenderCspmGcpOfferingMdcContainersImageAssessment - The Microsoft Defender Container image assessment configuration -type DefenderCspmGcpOfferingMdcContainersImageAssessment struct { - // Is Microsoft Defender container image assessment enabled - Enabled *bool - - // The service account email address in GCP for this feature - ServiceAccountEmailAddress *string - - // The workload identity provider id in GCP for this feature - WorkloadIdentityProviderID *string -} - -// DefenderCspmGcpOfferingVMScanners - The Microsoft Defender for CSPM VM scanning configuration -type DefenderCspmGcpOfferingVMScanners struct { - // Configuration for VM scanning - Configuration *VMScannersBaseConfiguration - - // Is VM scanning enabled - Enabled *bool -} - -// DefenderFoDatabasesAwsOffering - The Defender for Databases AWS offering -type DefenderFoDatabasesAwsOffering struct { - // REQUIRED; The type of the security offering. - OfferingType *OfferingType - - // The ARC autoprovisioning configuration - ArcAutoProvisioning *DefenderFoDatabasesAwsOfferingArcAutoProvisioning - - // The databases data security posture management (DSPM) configuration - DatabasesDspm *DefenderFoDatabasesAwsOfferingDatabasesDspm - - // The RDS configuration - Rds *DefenderFoDatabasesAwsOfferingRds - - // READ-ONLY; The offering description. - Description *string -} - -// GetCloudOffering implements the CloudOfferingClassification interface for type DefenderFoDatabasesAwsOffering. -func (d *DefenderFoDatabasesAwsOffering) GetCloudOffering() *CloudOffering { - return &CloudOffering{ - Description: d.Description, - OfferingType: d.OfferingType, - } -} - -// DefenderFoDatabasesAwsOfferingArcAutoProvisioning - The ARC autoprovisioning configuration -type DefenderFoDatabasesAwsOfferingArcAutoProvisioning struct { - // The cloud role ARN in AWS for this feature - CloudRoleArn *string - - // Configuration for servers Arc auto provisioning for a given environment - Configuration *ArcAutoProvisioningConfiguration - - // Is arc auto provisioning enabled - Enabled *bool -} - -// DefenderFoDatabasesAwsOfferingDatabasesDspm - The databases data security posture management (DSPM) configuration -type DefenderFoDatabasesAwsOfferingDatabasesDspm struct { - // The cloud role ARN in AWS for this feature - CloudRoleArn *string - - // Is databases data security posture management (DSPM) protection enabled - Enabled *bool -} - -// DefenderFoDatabasesAwsOfferingRds - The RDS configuration -type DefenderFoDatabasesAwsOfferingRds struct { - // The cloud role ARN in AWS for this feature - CloudRoleArn *string - - // Is RDS protection enabled - Enabled *bool -} - -// DefenderForContainersAwsOffering - The Defender for Containers AWS offering -type DefenderForContainersAwsOffering struct { - // REQUIRED; The type of the security offering. - OfferingType *OfferingType - - // The cloudwatch to kinesis connection configuration - CloudWatchToKinesis *DefenderForContainersAwsOfferingCloudWatchToKinesis - - // The externalId used by the data reader to prevent the confused deputy attack - DataCollectionExternalID *string - - // Is audit logs data collection enabled - EnableAuditLogsAutoProvisioning *bool - - // Is Microsoft Defender for Cloud Kubernetes agent auto provisioning enabled - EnableDefenderAgentAutoProvisioning *bool - - // Is Policy Kubernetes agent auto provisioning enabled - EnablePolicyAgentAutoProvisioning *bool - - // The kinesis to s3 connection configuration - KinesisToS3 *DefenderForContainersAwsOfferingKinesisToS3 - - // The retention time in days of kube audit logs set on the CloudWatch log group - KubeAuditRetentionTime *int64 - - // The kubernetes data collection connection configuration - KubernetesDataCollection *DefenderForContainersAwsOfferingKubernetesDataCollection - - // The kubernetes service connection configuration - KubernetesService *DefenderForContainersAwsOfferingKubernetesService - - // The Microsoft Defender container agentless discovery K8s configuration - MdcContainersAgentlessDiscoveryK8S *DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S - - // The Microsoft Defender container image assessment configuration - MdcContainersImageAssessment *DefenderForContainersAwsOfferingMdcContainersImageAssessment - - // The Microsoft Defender for Container K8s VM host scanning configuration - VMScanners *DefenderForContainersAwsOfferingVMScanners - - // READ-ONLY; The offering description. - Description *string -} - -// GetCloudOffering implements the CloudOfferingClassification interface for type DefenderForContainersAwsOffering. -func (d *DefenderForContainersAwsOffering) GetCloudOffering() *CloudOffering { - return &CloudOffering{ - Description: d.Description, - OfferingType: d.OfferingType, - } -} - -// DefenderForContainersAwsOfferingCloudWatchToKinesis - The cloudwatch to kinesis connection configuration -type DefenderForContainersAwsOfferingCloudWatchToKinesis struct { - // The cloud role ARN in AWS used by CloudWatch to transfer data into Kinesis - CloudRoleArn *string -} - -// DefenderForContainersAwsOfferingKinesisToS3 - The kinesis to s3 connection configuration -type DefenderForContainersAwsOfferingKinesisToS3 struct { - // The cloud role ARN in AWS used by Kinesis to transfer data into S3 - CloudRoleArn *string -} - -// DefenderForContainersAwsOfferingKubernetesDataCollection - The kubernetes data collection connection configuration -type DefenderForContainersAwsOfferingKubernetesDataCollection struct { - // The cloud role ARN in AWS for this feature used for reading data - CloudRoleArn *string -} - -// DefenderForContainersAwsOfferingKubernetesService - The kubernetes service connection configuration -type DefenderForContainersAwsOfferingKubernetesService struct { - // The cloud role ARN in AWS for this feature used for provisioning resources - CloudRoleArn *string -} - -// DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S - The Microsoft Defender container agentless discovery -// K8s configuration -type DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S struct { - // The cloud role ARN in AWS for this feature - CloudRoleArn *string - - // Is Microsoft Defender container agentless discovery K8s enabled - Enabled *bool -} - -// DefenderForContainersAwsOfferingMdcContainersImageAssessment - The Microsoft Defender container image assessment configuration -type DefenderForContainersAwsOfferingMdcContainersImageAssessment struct { - // The cloud role ARN in AWS for this feature - CloudRoleArn *string - - // Is Microsoft Defender container image assessment enabled - Enabled *bool -} - -// DefenderForContainersAwsOfferingVMScanners - The Microsoft Defender for Container K8s VM host scanning configuration -type DefenderForContainersAwsOfferingVMScanners struct { - // The cloud role ARN in AWS for this feature - CloudRoleArn *string - - // Configuration for VM scanning - Configuration *VMScannersBaseConfiguration - - // Is VM scanning enabled - Enabled *bool -} - -// DefenderForContainersGcpOffering - The containers GCP offering -type DefenderForContainersGcpOffering struct { - // REQUIRED; The type of the security offering. - OfferingType *OfferingType - - // The native cloud connection configuration - DataPipelineNativeCloudConnection *DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection - - // Is audit logs data collection enabled - EnableAuditLogsAutoProvisioning *bool - - // Is Microsoft Defender for Cloud Kubernetes agent auto provisioning enabled - EnableDefenderAgentAutoProvisioning *bool - - // Is Policy Kubernetes agent auto provisioning enabled - EnablePolicyAgentAutoProvisioning *bool - - // The Microsoft Defender Container agentless discovery configuration - MdcContainersAgentlessDiscoveryK8S *DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S - - // The Microsoft Defender Container image assessment configuration - MdcContainersImageAssessment *DefenderForContainersGcpOfferingMdcContainersImageAssessment - - // The native cloud connection configuration - NativeCloudConnection *DefenderForContainersGcpOfferingNativeCloudConnection - - // The Microsoft Defender for Container K8s VM host scanning configuration - VMScanners *DefenderForContainersGcpOfferingVMScanners - - // READ-ONLY; The offering description. - Description *string -} - -// GetCloudOffering implements the CloudOfferingClassification interface for type DefenderForContainersGcpOffering. -func (d *DefenderForContainersGcpOffering) GetCloudOffering() *CloudOffering { - return &CloudOffering{ - Description: d.Description, - OfferingType: d.OfferingType, - } -} - -// DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection - The native cloud connection configuration -type DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection struct { - // The data collection service account email address in GCP for this offering - ServiceAccountEmailAddress *string - - // The data collection GCP workload identity provider id for this offering - WorkloadIdentityProviderID *string -} - -// DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S - The Microsoft Defender Container agentless discovery -// configuration -type DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S struct { - // Is Microsoft Defender container agentless discovery enabled - Enabled *bool - - // The service account email address in GCP for this feature - ServiceAccountEmailAddress *string - - // The workload identity provider id in GCP for this feature - WorkloadIdentityProviderID *string -} - -// DefenderForContainersGcpOfferingMdcContainersImageAssessment - The Microsoft Defender Container image assessment configuration -type DefenderForContainersGcpOfferingMdcContainersImageAssessment struct { - // Is Microsoft Defender container image assessment enabled - Enabled *bool - - // The service account email address in GCP for this feature - ServiceAccountEmailAddress *string - - // The workload identity provider id in GCP for this feature - WorkloadIdentityProviderID *string -} - -// DefenderForContainersGcpOfferingNativeCloudConnection - The native cloud connection configuration -type DefenderForContainersGcpOfferingNativeCloudConnection struct { - // The service account email address in GCP for this offering - ServiceAccountEmailAddress *string - - // The GCP workload identity provider id for this offering - WorkloadIdentityProviderID *string -} - -// DefenderForContainersGcpOfferingVMScanners - The Microsoft Defender for Container K8s VM host scanning configuration -type DefenderForContainersGcpOfferingVMScanners struct { - // Configuration for VM scanning - Configuration *VMScannersBaseConfiguration - - // Is VM scanning enabled - Enabled *bool -} - -// DefenderForDatabasesGcpOffering - The Defender for Databases GCP offering configurations -type DefenderForDatabasesGcpOffering struct { - // REQUIRED; The type of the security offering. - OfferingType *OfferingType - - // The ARC autoprovisioning configuration - ArcAutoProvisioning *DefenderForDatabasesGcpOfferingArcAutoProvisioning - - // The native cloud connection configuration - DefenderForDatabasesArcAutoProvisioning *DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning - - // READ-ONLY; The offering description. - Description *string -} - -// GetCloudOffering implements the CloudOfferingClassification interface for type DefenderForDatabasesGcpOffering. -func (d *DefenderForDatabasesGcpOffering) GetCloudOffering() *CloudOffering { - return &CloudOffering{ - Description: d.Description, - OfferingType: d.OfferingType, - } -} - -// DefenderForDatabasesGcpOfferingArcAutoProvisioning - The ARC autoprovisioning configuration -type DefenderForDatabasesGcpOfferingArcAutoProvisioning struct { - // Configuration for servers Arc auto provisioning for a given environment - Configuration *ArcAutoProvisioningConfiguration - - // Is arc auto provisioning enabled - Enabled *bool -} - -// DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning - The native cloud connection configuration -type DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning struct { - // The service account email address in GCP for this offering - ServiceAccountEmailAddress *string - - // The GCP workload identity provider id for this offering - WorkloadIdentityProviderID *string -} - -// DefenderForServersAwsOffering - The Defender for Servers AWS offering -type DefenderForServersAwsOffering struct { - // REQUIRED; The type of the security offering. - OfferingType *OfferingType - - // The ARC autoprovisioning configuration - ArcAutoProvisioning *DefenderForServersAwsOfferingArcAutoProvisioning - - // The Defender for servers connection configuration - DefenderForServers *DefenderForServersAwsOfferingDefenderForServers - - // The Microsoft Defender for Endpoint autoprovisioning configuration - MdeAutoProvisioning *DefenderForServersAwsOfferingMdeAutoProvisioning - - // configuration for the servers offering subPlan - SubPlan *DefenderForServersAwsOfferingSubPlan - - // The Microsoft Defender for Server VM scanning configuration - VMScanners *DefenderForServersAwsOfferingVMScanners - - // The Vulnerability Assessment autoprovisioning configuration - VaAutoProvisioning *DefenderForServersAwsOfferingVaAutoProvisioning - - // READ-ONLY; The offering description. - Description *string -} - -// GetCloudOffering implements the CloudOfferingClassification interface for type DefenderForServersAwsOffering. -func (d *DefenderForServersAwsOffering) GetCloudOffering() *CloudOffering { - return &CloudOffering{ - Description: d.Description, - OfferingType: d.OfferingType, - } -} - -// DefenderForServersAwsOfferingArcAutoProvisioning - The ARC autoprovisioning configuration -type DefenderForServersAwsOfferingArcAutoProvisioning struct { - // The cloud role ARN in AWS for this feature - CloudRoleArn *string - - // Configuration for servers Arc auto provisioning for a given environment - Configuration *ArcAutoProvisioningConfiguration - - // Is arc auto provisioning enabled - Enabled *bool -} - -// DefenderForServersAwsOfferingDefenderForServers - The Defender for servers connection configuration -type DefenderForServersAwsOfferingDefenderForServers struct { - // The cloud role ARN in AWS for this feature - CloudRoleArn *string -} - -// DefenderForServersAwsOfferingMdeAutoProvisioning - The Microsoft Defender for Endpoint autoprovisioning configuration -type DefenderForServersAwsOfferingMdeAutoProvisioning struct { - // configuration for Microsoft Defender for Endpoint autoprovisioning - Configuration any - - // Is Microsoft Defender for Endpoint auto provisioning enabled - Enabled *bool -} - -// DefenderForServersAwsOfferingSubPlan - configuration for the servers offering subPlan -type DefenderForServersAwsOfferingSubPlan struct { - // The available sub plans - Type *SubPlan -} - -// DefenderForServersAwsOfferingVMScanners - The Microsoft Defender for Server VM scanning configuration -type DefenderForServersAwsOfferingVMScanners struct { - // The cloud role ARN in AWS for this feature - CloudRoleArn *string - - // Configuration for VM scanning - Configuration *VMScannersBaseConfiguration - - // Is VM scanning enabled - Enabled *bool -} - -// DefenderForServersAwsOfferingVaAutoProvisioning - The Vulnerability Assessment autoprovisioning configuration -type DefenderForServersAwsOfferingVaAutoProvisioning struct { - // configuration for Vulnerability Assessment autoprovisioning - Configuration *DefenderForServersAwsOfferingVaAutoProvisioningConfiguration - - // Is Vulnerability Assessment auto provisioning enabled - Enabled *bool -} - -// DefenderForServersAwsOfferingVaAutoProvisioningConfiguration - configuration for Vulnerability Assessment autoprovisioning -type DefenderForServersAwsOfferingVaAutoProvisioningConfiguration struct { - // The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys' - Type *Type -} - -// DefenderForServersGcpOffering - The Defender for Servers GCP offering configurations -type DefenderForServersGcpOffering struct { - // REQUIRED; The type of the security offering. - OfferingType *OfferingType - - // The ARC autoprovisioning configuration - ArcAutoProvisioning *DefenderForServersGcpOfferingArcAutoProvisioning - - // The Defender for servers connection configuration - DefenderForServers *DefenderForServersGcpOfferingDefenderForServers - - // The Microsoft Defender for Endpoint autoprovisioning configuration - MdeAutoProvisioning *DefenderForServersGcpOfferingMdeAutoProvisioning - - // configuration for the servers offering subPlan - SubPlan *DefenderForServersGcpOfferingSubPlan - - // The Microsoft Defender for Server VM scanning configuration - VMScanners *DefenderForServersGcpOfferingVMScanners - - // The Vulnerability Assessment autoprovisioning configuration - VaAutoProvisioning *DefenderForServersGcpOfferingVaAutoProvisioning - - // READ-ONLY; The offering description. - Description *string -} - -// GetCloudOffering implements the CloudOfferingClassification interface for type DefenderForServersGcpOffering. -func (d *DefenderForServersGcpOffering) GetCloudOffering() *CloudOffering { - return &CloudOffering{ - Description: d.Description, - OfferingType: d.OfferingType, - } -} - -// DefenderForServersGcpOfferingArcAutoProvisioning - The ARC autoprovisioning configuration -type DefenderForServersGcpOfferingArcAutoProvisioning struct { - // Configuration for servers Arc auto provisioning for a given environment - Configuration *ArcAutoProvisioningConfiguration - - // Is arc auto provisioning enabled - Enabled *bool -} - -// DefenderForServersGcpOfferingDefenderForServers - The Defender for servers connection configuration -type DefenderForServersGcpOfferingDefenderForServers struct { - // The service account email address in GCP for this feature - ServiceAccountEmailAddress *string - - // The workload identity provider id in GCP for this feature - WorkloadIdentityProviderID *string -} - -// DefenderForServersGcpOfferingMdeAutoProvisioning - The Microsoft Defender for Endpoint autoprovisioning configuration -type DefenderForServersGcpOfferingMdeAutoProvisioning struct { - // configuration for Microsoft Defender for Endpoint autoprovisioning - Configuration any - - // Is Microsoft Defender for Endpoint auto provisioning enabled - Enabled *bool -} - -// DefenderForServersGcpOfferingSubPlan - configuration for the servers offering subPlan -type DefenderForServersGcpOfferingSubPlan struct { - // The available sub plans - Type *SubPlan -} - -// DefenderForServersGcpOfferingVMScanners - The Microsoft Defender for Server VM scanning configuration -type DefenderForServersGcpOfferingVMScanners struct { - // Configuration for VM scanning - Configuration *VMScannersBaseConfiguration - - // Is VM scanning enabled - Enabled *bool -} - -// DefenderForServersGcpOfferingVaAutoProvisioning - The Vulnerability Assessment autoprovisioning configuration -type DefenderForServersGcpOfferingVaAutoProvisioning struct { - // configuration for Vulnerability Assessment autoprovisioning - Configuration *DefenderForServersGcpOfferingVaAutoProvisioningConfiguration - - // Is Vulnerability Assessment auto provisioning enabled - Enabled *bool -} - -// DefenderForServersGcpOfferingVaAutoProvisioningConfiguration - configuration for Vulnerability Assessment autoprovisioning -type DefenderForServersGcpOfferingVaAutoProvisioningConfiguration struct { - // The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys' - Type *Type -} - -// DefenderForStorageSetting - The Defender for Storage resource. -type DefenderForStorageSetting struct { - // Defender for Storage resource properties. - Properties *DefenderForStorageSettingProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// DefenderForStorageSettingProperties - Defender for Storage resource properties. -type DefenderForStorageSettingProperties struct { - // Indicates whether Defender for Storage is enabled on this storage account. - IsEnabled *bool - - // Properties of Malware Scanning. - MalwareScanning *MalwareScanningProperties - - // Indicates whether the settings defined for this storage account should override the settings defined for the subscription. - OverrideSubscriptionLevelSettings *bool - - // Properties of Sensitive Data Discovery. - SensitiveDataDiscovery *SensitiveDataDiscoveryProperties -} - -// DenylistCustomAlertRule - A custom alert rule that checks if a value (depends on the custom alert type) is denied. -type DenylistCustomAlertRule struct { - // REQUIRED; The values to deny. The format of the values depends on the rule type. - DenylistValues []*string - - // REQUIRED; Status of the custom alert. - IsEnabled *bool - - // REQUIRED; The type of the custom alert rule. - RuleType *string - - // READ-ONLY; The description of the custom alert. - Description *string - - // READ-ONLY; The display name of the custom alert. - DisplayName *string - - // READ-ONLY; The value type of the items in the list. - ValueType *ValueType -} - -// GetCustomAlertRule implements the CustomAlertRuleClassification interface for type DenylistCustomAlertRule. -func (d *DenylistCustomAlertRule) GetCustomAlertRule() *CustomAlertRule { - return &CustomAlertRule{ - Description: d.Description, - DisplayName: d.DisplayName, - IsEnabled: d.IsEnabled, - RuleType: d.RuleType, - } -} - -// GetListCustomAlertRule implements the ListCustomAlertRuleClassification interface for type DenylistCustomAlertRule. -func (d *DenylistCustomAlertRule) GetListCustomAlertRule() *ListCustomAlertRule { - return &ListCustomAlertRule{ - Description: d.Description, - DisplayName: d.DisplayName, - IsEnabled: d.IsEnabled, - RuleType: d.RuleType, - ValueType: d.ValueType, - } -} - -// DevOpsConfiguration - DevOps Configuration resource. -type DevOpsConfiguration struct { - // DevOps Configuration properties. - Properties *DevOpsConfigurationProperties - - // 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; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// DevOpsConfigurationListResponse - List of RP resources which supports pagination. -type DevOpsConfigurationListResponse struct { - // Gets or sets next link to scroll over the results. - NextLink *string - - // Gets or sets list of resources. - Value []*DevOpsConfiguration -} - -// DevOpsConfigurationProperties - DevOps Configuration properties. -type DevOpsConfigurationProperties struct { - // 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. - TopLevelInventoryList []*string - - // READ-ONLY; Gets or sets resource status message. - ProvisioningStatusMessage *string - - // READ-ONLY; Gets or sets time when resource was last checked. - ProvisioningStatusUpdateTimeUTC *time.Time -} - -// DeviceSecurityGroup - The device security group resource -type DeviceSecurityGroup struct { - // Device Security group data - Properties *DeviceSecurityGroupProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// DeviceSecurityGroupList - List of device security groups -type DeviceSecurityGroupList struct { - // List of device security group objects - Value []*DeviceSecurityGroup - - // READ-ONLY; The URI to fetch the next page. - NextLink *string -} - -// DeviceSecurityGroupProperties - describes properties of a security group. -type DeviceSecurityGroupProperties struct { - // The allow-list custom alert rules. - AllowlistRules []AllowlistCustomAlertRuleClassification - - // The deny-list custom alert rules. - DenylistRules []*DenylistCustomAlertRule - - // The list of custom alert threshold rules. - ThresholdRules []ThresholdCustomAlertRuleClassification - - // The list of custom alert time-window rules. - TimeWindowRules []TimeWindowCustomAlertRuleClassification -} - -// DirectMethodInvokesNotInAllowedRange - Number of direct method invokes is not in allowed range. -type DirectMethodInvokesNotInAllowedRange struct { - // REQUIRED; Status of the custom alert. - IsEnabled *bool - - // REQUIRED; The maximum threshold. - MaxThreshold *int32 - - // REQUIRED; The minimum threshold. - MinThreshold *int32 - - // REQUIRED; The type of the custom alert rule. - RuleType *string - - // REQUIRED; The time window size in iso8601 format. - TimeWindowSize *string - - // READ-ONLY; The description of the custom alert. - Description *string - - // READ-ONLY; The display name of the custom alert. - DisplayName *string -} - -// GetCustomAlertRule implements the CustomAlertRuleClassification interface for type DirectMethodInvokesNotInAllowedRange. -func (d *DirectMethodInvokesNotInAllowedRange) GetCustomAlertRule() *CustomAlertRule { - return &CustomAlertRule{ - Description: d.Description, - DisplayName: d.DisplayName, - IsEnabled: d.IsEnabled, - RuleType: d.RuleType, - } -} - -// GetThresholdCustomAlertRule implements the ThresholdCustomAlertRuleClassification interface for type DirectMethodInvokesNotInAllowedRange. -func (d *DirectMethodInvokesNotInAllowedRange) GetThresholdCustomAlertRule() *ThresholdCustomAlertRule { - return &ThresholdCustomAlertRule{ - Description: d.Description, - DisplayName: d.DisplayName, - IsEnabled: d.IsEnabled, - MaxThreshold: d.MaxThreshold, - MinThreshold: d.MinThreshold, - RuleType: d.RuleType, - } -} - -// GetTimeWindowCustomAlertRule implements the TimeWindowCustomAlertRuleClassification interface for type DirectMethodInvokesNotInAllowedRange. -func (d *DirectMethodInvokesNotInAllowedRange) GetTimeWindowCustomAlertRule() *TimeWindowCustomAlertRule { - return &TimeWindowCustomAlertRule{ - Description: d.Description, - DisplayName: d.DisplayName, - IsEnabled: d.IsEnabled, - MaxThreshold: d.MaxThreshold, - MinThreshold: d.MinThreshold, - RuleType: d.RuleType, - TimeWindowSize: d.TimeWindowSize, - } -} - -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 - Name *string - - // READ-ONLY; Resource type - Type *string -} - -type DiscoveredSecuritySolutionList struct { - Value []*DiscoveredSecuritySolution - - // READ-ONLY; The URI to fetch the next page. - NextLink *string -} - -type DiscoveredSecuritySolutionProperties struct { - // REQUIRED; The security solutions' image offer - Offer *string - - // REQUIRED; The security solutions' image publisher - Publisher *string - - // REQUIRED; The security solutions' image sku - SKU *string - - // REQUIRED; The security family of the discovered solution - 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 -} - -// EffectiveNetworkSecurityGroups - Describes the Network Security Groups effective on a network interface -type EffectiveNetworkSecurityGroups struct { - // The Azure resource ID of the network interface - NetworkInterface *string - - // The Network Security Groups effective on the network interface - NetworkSecurityGroups []*string -} - -// EnvironmentData - The security connector environment data. -type EnvironmentData struct { - // REQUIRED; The type of the environment data. - EnvironmentType *EnvironmentType -} - -// GetEnvironmentData implements the EnvironmentDataClassification interface for type EnvironmentData. -func (e *EnvironmentData) GetEnvironmentData() *EnvironmentData { return e } - -// EnvironmentDetails - The environment details of the resource -type EnvironmentDetails struct { - // The hierarchy id of the connector (in case of Azure - the subscription Id, in case of MC - the hierarchyId id) - EnvironmentHierarchyID *string - - // The native resource id of the resource (in case of Azure - the resource Id, in case of MC - the native resource id) - NativeResourceID *string - - // The organizational hierarchy id of the connector (in case of Azure - the subscription Id, in case of MC - the organizational - // hierarchyId id) - OrganizationalHierarchyID *string - - // The subscription Id - SubscriptionID *string - - // The tenant Id - TenantID *string -} - -// ErrorAdditionalInfo - The resource management error additional info. -type ErrorAdditionalInfo struct { - // READ-ONLY; The additional info. - Info any - - // READ-ONLY; The additional info type. - Type *string -} - -// ErrorDetail - The error detail. -type ErrorDetail struct { - // READ-ONLY; The error additional info. - AdditionalInfo []*ErrorAdditionalInfo - - // READ-ONLY; The error code. - Code *string - - // READ-ONLY; The error details. - Details []*ErrorDetail - - // READ-ONLY; The error message. - Message *string - - // READ-ONLY; The error target. - 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 - Override *bool -} - -// Extension - A plan's extension properties -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. - 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 -} - -// 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 - Kind *ExternalSecuritySolutionKind - - // 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 -} - -// GetExternalSecuritySolution implements the ExternalSecuritySolutionClassification interface for type ExternalSecuritySolution. -func (e *ExternalSecuritySolution) GetExternalSecuritySolution() *ExternalSecuritySolution { return e } - -type ExternalSecuritySolutionList struct { - Value []ExternalSecuritySolutionClassification - - // READ-ONLY; The URI to fetch the next page. - 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. - IsEnabled *bool - - // REQUIRED; The maximum threshold. - MaxThreshold *int32 - - // REQUIRED; The minimum threshold. - MinThreshold *int32 - - // REQUIRED; The type of the custom alert rule. - RuleType *string - - // REQUIRED; The time window size in iso8601 format. - TimeWindowSize *string - - // READ-ONLY; The description of the custom alert. - Description *string - - // READ-ONLY; The display name of the custom alert. - DisplayName *string -} - -// GetCustomAlertRule implements the CustomAlertRuleClassification interface for type FailedLocalLoginsNotInAllowedRange. -func (f *FailedLocalLoginsNotInAllowedRange) GetCustomAlertRule() *CustomAlertRule { - return &CustomAlertRule{ - Description: f.Description, - DisplayName: f.DisplayName, - IsEnabled: f.IsEnabled, - RuleType: f.RuleType, - } -} - -// GetThresholdCustomAlertRule implements the ThresholdCustomAlertRuleClassification interface for type FailedLocalLoginsNotInAllowedRange. -func (f *FailedLocalLoginsNotInAllowedRange) GetThresholdCustomAlertRule() *ThresholdCustomAlertRule { - return &ThresholdCustomAlertRule{ - Description: f.Description, - DisplayName: f.DisplayName, - IsEnabled: f.IsEnabled, - MaxThreshold: f.MaxThreshold, - MinThreshold: f.MinThreshold, - RuleType: f.RuleType, - } -} - -// GetTimeWindowCustomAlertRule implements the TimeWindowCustomAlertRuleClassification interface for type FailedLocalLoginsNotInAllowedRange. -func (f *FailedLocalLoginsNotInAllowedRange) GetTimeWindowCustomAlertRule() *TimeWindowCustomAlertRule { - return &TimeWindowCustomAlertRule{ - Description: f.Description, - DisplayName: f.DisplayName, - IsEnabled: f.IsEnabled, - MaxThreshold: f.MaxThreshold, - MinThreshold: f.MinThreshold, - RuleType: f.RuleType, - TimeWindowSize: f.TimeWindowSize, - } -} - -// FileUploadsNotInAllowedRange - Number of file uploads is not in allowed range. -type FileUploadsNotInAllowedRange struct { - // REQUIRED; Status of the custom alert. - IsEnabled *bool - - // REQUIRED; The maximum threshold. - MaxThreshold *int32 - - // REQUIRED; The minimum threshold. - MinThreshold *int32 - - // REQUIRED; The type of the custom alert rule. - RuleType *string - - // REQUIRED; The time window size in iso8601 format. - TimeWindowSize *string - - // READ-ONLY; The description of the custom alert. - Description *string - - // READ-ONLY; The display name of the custom alert. - DisplayName *string -} - -// GetCustomAlertRule implements the CustomAlertRuleClassification interface for type FileUploadsNotInAllowedRange. -func (f *FileUploadsNotInAllowedRange) GetCustomAlertRule() *CustomAlertRule { - return &CustomAlertRule{ - Description: f.Description, - DisplayName: f.DisplayName, - IsEnabled: f.IsEnabled, - RuleType: f.RuleType, - } -} - -// GetThresholdCustomAlertRule implements the ThresholdCustomAlertRuleClassification interface for type FileUploadsNotInAllowedRange. -func (f *FileUploadsNotInAllowedRange) GetThresholdCustomAlertRule() *ThresholdCustomAlertRule { - return &ThresholdCustomAlertRule{ - Description: f.Description, - DisplayName: f.DisplayName, - IsEnabled: f.IsEnabled, - MaxThreshold: f.MaxThreshold, - MinThreshold: f.MinThreshold, - RuleType: f.RuleType, - } -} - -// GetTimeWindowCustomAlertRule implements the TimeWindowCustomAlertRuleClassification interface for type FileUploadsNotInAllowedRange. -func (f *FileUploadsNotInAllowedRange) GetTimeWindowCustomAlertRule() *TimeWindowCustomAlertRule { - return &TimeWindowCustomAlertRule{ - Description: f.Description, - DisplayName: f.DisplayName, - IsEnabled: f.IsEnabled, - MaxThreshold: f.MaxThreshold, - MinThreshold: f.MinThreshold, - RuleType: f.RuleType, - TimeWindowSize: f.TimeWindowSize, - } -} - -// 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 - - // REQUIRED; Type field of the API key (write only) - Type *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 GcpCredentialsDetailsProperties. -func (g *GcpCredentialsDetailsProperties) GetAuthenticationDetailsProperties() *AuthenticationDetailsProperties { - return &AuthenticationDetailsProperties{ - AuthenticationProvisioningState: g.AuthenticationProvisioningState, - AuthenticationType: g.AuthenticationType, - GrantedPermissions: g.GrantedPermissions, - } -} - -// GcpOrganizationalData - The gcpOrganization data -type GcpOrganizationalData struct { - // REQUIRED; The multi cloud account's membership type in the organization - OrganizationMembershipType *OrganizationMembershipType -} - -// GetGcpOrganizationalData implements the GcpOrganizationalDataClassification interface for type GcpOrganizationalData. -func (g *GcpOrganizationalData) GetGcpOrganizationalData() *GcpOrganizationalData { return g } - -// GcpOrganizationalDataMember - The gcpOrganization data for the member account -type GcpOrganizationalDataMember struct { - // REQUIRED; The multi cloud account's membership type in the organization - OrganizationMembershipType *OrganizationMembershipType - - // The GCP management project number from organizational onboarding - ManagementProjectNumber *string - - // If the multi cloud account is not of membership type organization, this will be the ID of the project's parent - ParentHierarchyID *string -} - -// GetGcpOrganizationalData implements the GcpOrganizationalDataClassification interface for type GcpOrganizationalDataMember. -func (g *GcpOrganizationalDataMember) GetGcpOrganizationalData() *GcpOrganizationalData { - return &GcpOrganizationalData{ - OrganizationMembershipType: g.OrganizationMembershipType, - } -} - -// GcpOrganizationalDataOrganization - The gcpOrganization data for the parent account -type GcpOrganizationalDataOrganization struct { - // REQUIRED; The multi cloud account's membership type in the organization - OrganizationMembershipType *OrganizationMembershipType - - // If the multi cloud account is of membership type organization, list of accounts excluded from offering - ExcludedProjectNumbers []*string - - // The service account email address which represents the organization level permissions container. - ServiceAccountEmailAddress *string - - // The GCP workload identity provider id which represents the permissions required to auto provision security connectors - WorkloadIdentityProviderID *string - - // READ-ONLY; GCP organization name - OrganizationName *string -} - -// GetGcpOrganizationalData implements the GcpOrganizationalDataClassification interface for type GcpOrganizationalDataOrganization. -func (g *GcpOrganizationalDataOrganization) GetGcpOrganizationalData() *GcpOrganizationalData { - return &GcpOrganizationalData{ - OrganizationMembershipType: g.OrganizationMembershipType, - } -} - -// GcpProjectDetails - The details about the project represented by the security connector -type GcpProjectDetails struct { - // The GCP Project id - ProjectID *string - - // The unique GCP Project number - ProjectNumber *string - - // READ-ONLY; GCP project name - ProjectName *string - - // READ-ONLY; The GCP workload identity federation pool id - WorkloadIdentityPoolID *string -} - -// GcpProjectEnvironmentData - The GCP project connector environment data -type GcpProjectEnvironmentData struct { - // REQUIRED; The type of the environment data. - EnvironmentType *EnvironmentType - - // The Gcp project's organizational data - OrganizationalData GcpOrganizationalDataClassification - - // The Gcp project's details - ProjectDetails *GcpProjectDetails - - // Scan interval in hours (value should be between 1-hour to 24-hours) - ScanInterval *int64 -} - -// GetEnvironmentData implements the EnvironmentDataClassification interface for type GcpProjectEnvironmentData. -func (g *GcpProjectEnvironmentData) GetEnvironmentData() *EnvironmentData { - return &EnvironmentData{ - EnvironmentType: g.EnvironmentType, - } -} - -// GetSensitivitySettingsListResponse - A list with a single sensitivity settings resource -type GetSensitivitySettingsListResponse struct { - Value []*GetSensitivitySettingsResponse -} - -// GetSensitivitySettingsResponse - Data sensitivity settings for sensitive data discovery -type GetSensitivitySettingsResponse struct { - // The sensitivity settings properties - Properties *GetSensitivitySettingsResponseProperties - - // READ-ONLY; The ID of the sensitivity settings - ID *string - - // READ-ONLY; The name of the sensitivity settings - Name *string - - // READ-ONLY; The type of the sensitivity settings - Type *string -} - -// GetSensitivitySettingsResponseProperties - The sensitivity settings properties -type GetSensitivitySettingsResponseProperties struct { - // Microsoft information protection built-in and custom information types, labels, and integration status. - MipInformation *GetSensitivitySettingsResponsePropertiesMipInformation - - // List of selected sensitive info types' IDs. - SensitiveInfoTypesIDs []*string - - // The id of the sensitivity threshold label. Any label at or above this rank will be considered sensitive. - SensitivityThresholdLabelID *string - - // The order of the sensitivity threshold label. Any label at or above this order will be considered sensitive. If set to - // -1, sensitivity by labels is turned off - SensitivityThresholdLabelOrder *float32 -} - -// GetSensitivitySettingsResponsePropertiesMipInformation - Microsoft information protection built-in and custom information -// types, labels, and integration status. -type GetSensitivitySettingsResponsePropertiesMipInformation struct { - // List of pre-configured sensitive information types - BuiltInInfoTypes []*BuiltInInfoType - - // List of custom user-defined information types - CustomInfoTypes []*InfoType - - // List of Microsoft information protection sensitivity labels - Labels []*Label - - // Microsoft information protection integration status - MipIntegrationStatus *MipIntegrationStatus -} - -// GitHubOwner - GitHub Owner resource. -type GitHubOwner struct { - // GitHub Owner properties. - Properties *GitHubOwnerProperties - - // 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; Metadata pertaining to creation and last modification of the resource. - 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. - NextLink *string - - // Gets or sets list of resources. - Value []*GitHubOwner -} - -// GitHubOwnerProperties - GitHub Owner properties. -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. - 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. - ProvisioningStatusMessage *string - - // READ-ONLY; Gets or sets time when resource was last checked. - ProvisioningStatusUpdateTimeUTC *time.Time -} - -// GitHubRepository - GitHub Repository resource. -type GitHubRepository struct { - // GitHub Repository properties. - Properties *GitHubRepositoryProperties - - // 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; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// GitHubRepositoryListResponse - List of RP resources which supports pagination. -type GitHubRepositoryListResponse struct { - // Gets or sets next link to scroll over the results. - NextLink *string - - // Gets or sets list of resources. - Value []*GitHubRepository -} - -// GitHubRepositoryProperties - GitHub Repository properties. -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. - 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. - ProvisioningState *DevOpsProvisioningState - - // READ-ONLY; Gets or sets resource status message. - ProvisioningStatusMessage *string - - // READ-ONLY; Gets or sets 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". - RepoFullName *string - - // READ-ONLY; Gets or sets GitHub Repository id. - // This is a numeric id defined by Github. Eg: "123456". - RepoID *string - - // READ-ONLY; Gets or sets GitHub Repository name. Eg: "new-repo-1". - RepoName *string - - // READ-ONLY; Gets or sets GitHub Repository url. - RepoURL *string -} - -// GitLabGroup - GitLab Group resource. -type GitLabGroup struct { - // GitLab Group properties. - Properties *GitLabGroupProperties - - // 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; Metadata pertaining to creation and last modification of the resource. - 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. - NextLink *string - - // Gets or sets list of resources. - Value []*GitLabGroup -} - -// GitLabGroupProperties - GitLab Group properties. -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. - 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 - - // READ-ONLY; Gets or sets the fully-qualified name of the Group object. - // This contains the entire namespace hierarchy where namespaces are separated by the '$' character. - FullyQualifiedName *string - - // READ-ONLY; Gets or sets resource status message. - ProvisioningStatusMessage *string - - // READ-ONLY; Gets or sets time when resource was last checked. - ProvisioningStatusUpdateTimeUTC *time.Time - - // READ-ONLY; Gets or sets the url of the GitLab Group. - URL *string -} - -// GitLabProject - GitLab Project resource. -type GitLabProject struct { - // GitLab Project properties. - Properties *GitLabProjectProperties - - // 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; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// GitLabProjectListResponse - List of RP resources which supports pagination. -type GitLabProjectListResponse struct { - // Gets or sets next link to scroll over the results. - NextLink *string - - // Gets or sets list of resources. - Value []*GitLabProject -} - -// GitLabProjectProperties - GitLab Project properties. -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. - 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 - - // READ-ONLY; Gets or sets the fully-qualified name of the project object. - // This contains the entire hierarchy where entities are separated by the '$' character. - FullyQualifiedName *string - - // READ-ONLY; Gets or sets the fully-qualified name of the project's parent group object. - // This contains the entire hierarchy where namespaces are separated by the '$' character. - FullyQualifiedParentGroupName *string - - // READ-ONLY; Gets or sets resource status message. - ProvisioningStatusMessage *string - - // READ-ONLY; Gets or sets time when resource was last checked. - ProvisioningStatusUpdateTimeUTC *time.Time - - // READ-ONLY; Gets or sets the url of the GitLab Project. - URL *string -} - -// GithubScopeEnvironmentData - The github scope connector's environment data -type GithubScopeEnvironmentData struct { - // REQUIRED; The type of the environment data. - EnvironmentType *EnvironmentType -} - -// GetEnvironmentData implements the EnvironmentDataClassification interface for type GithubScopeEnvironmentData. -func (g *GithubScopeEnvironmentData) GetEnvironmentData() *EnvironmentData { - return &EnvironmentData{ - EnvironmentType: g.EnvironmentType, - } -} - -// GitlabScopeEnvironmentData - The GitLab scope connector's environment data -type GitlabScopeEnvironmentData struct { - // REQUIRED; The type of the environment data. - EnvironmentType *EnvironmentType -} - -// GetEnvironmentData implements the EnvironmentDataClassification interface for type GitlabScopeEnvironmentData. -func (g *GitlabScopeEnvironmentData) GetEnvironmentData() *EnvironmentData { - return &EnvironmentData{ - EnvironmentType: g.EnvironmentType, - } -} - -// GovernanceAssignment - Governance assignment over a given scope -type GovernanceAssignment struct { - // The properties of a governance assignment - Properties *GovernanceAssignmentProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// GovernanceAssignmentAdditionalData - Describe the additional data of governance assignment - optional -type GovernanceAssignmentAdditionalData struct { - // Ticket link associated with this governance assignment - for example: https://snow.com - TicketLink *string - - // Ticket number associated with this governance assignment - TicketNumber *int32 - - // The ticket status associated with this governance assignment - for example: Active - TicketStatus *string -} - -// GovernanceAssignmentProperties - Describes properties of an governance assignment -type GovernanceAssignmentProperties struct { - // REQUIRED; The remediation due-date - after this date Secure Score will be affected (in case of active grace-period) - RemediationDueDate *time.Time - - // The additional data for the governance assignment - e.g. links to ticket (optional), see example - AdditionalData *GovernanceAssignmentAdditionalData - - // The email notifications settings for the governance rule, states whether to disable notifications for mangers and owners - GovernanceEmailNotification *GovernanceEmailNotification - - // Defines whether there is a grace period on the governance assignment - IsGracePeriod *bool - - // The Owner for the governance assignment - e.g. user@contoso.com - see example - Owner *string - - // The ETA (estimated time of arrival) for remediation (optional), see example - RemediationEta *RemediationEta -} - -// GovernanceAssignmentsList - Page of a governance assignments list -type GovernanceAssignmentsList struct { - // READ-ONLY; The URI to fetch the next page - NextLink *string - - // READ-ONLY; Collection of governance assignments in this page - Value []*GovernanceAssignment -} - -// GovernanceEmailNotification - The governance email weekly notification configuration. -type GovernanceEmailNotification struct { - // Exclude manager from weekly email notification. - DisableManagerEmailNotification *bool - - // Exclude owner from weekly email notification. - DisableOwnerEmailNotification *bool -} - -// GovernanceRule - Governance rule over a given scope -type GovernanceRule struct { - // Properties of a governance rule - Properties *GovernanceRuleProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// GovernanceRuleEmailNotification - The governance email weekly notification configuration -type GovernanceRuleEmailNotification struct { - // Defines whether manager email notifications are disabled - DisableManagerEmailNotification *bool - - // Defines whether owner email notifications are disabled - DisableOwnerEmailNotification *bool -} - -// GovernanceRuleList - Page of a governance rules list -type GovernanceRuleList struct { - // READ-ONLY; The URI to fetch the next page - NextLink *string - - // READ-ONLY; Collection of governance rules in this page - Value []*GovernanceRule -} - -// GovernanceRuleMetadata - The governance rule metadata -type GovernanceRuleMetadata struct { - // READ-ONLY; Governance rule Created by object id (GUID) - CreatedBy *string - - // READ-ONLY; Governance rule creation date - CreatedOn *time.Time - - // READ-ONLY; Governance rule last updated by object id (GUID) - UpdatedBy *string - - // READ-ONLY; Governance rule last update date - UpdatedOn *time.Time -} - -// GovernanceRuleOwnerSource - Describe the owner source of governance rule -type GovernanceRuleOwnerSource struct { - // The owner type for the governance rule owner source - Type *GovernanceRuleOwnerSourceType - - // The source value e.g. tag key like owner name or email address - Value *string -} - -// GovernanceRuleProperties - Describes properties of an governance rule -type GovernanceRuleProperties struct { - // REQUIRED; The governance rule conditionSets - see examples - ConditionSets []any - - // REQUIRED; Display name of the governance rule - DisplayName *string - - // REQUIRED; The owner source for the governance rule - e.g. Manually by user@contoso.com - see example - OwnerSource *GovernanceRuleOwnerSource - - // REQUIRED; The governance rule priority, priority to the lower number. Rules with the same priority on the same scope will - // not be allowed - RulePriority *int32 - - // REQUIRED; The rule type of the governance rule, defines the source of the rule e.g. Integrated - RuleType *GovernanceRuleType - - // REQUIRED; The governance rule source, what the rule affects, e.g. Assessments - SourceResourceType *GovernanceRuleSourceResourceType - - // Description of the governance rule - Description *string - - // Excluded scopes, filter out the descendants of the scope (on management scopes) - ExcludedScopes []*string - - // The email notifications settings for the governance rule, states whether to disable notifications for mangers and owners - GovernanceEmailNotification *GovernanceRuleEmailNotification - - // Defines whether the rule is management scope rule (master connector as a single scope or management scope) - IncludeMemberScopes *bool - - // Defines whether the rule is active/inactive - IsDisabled *bool - - // Defines whether there is a grace period on the governance rule - IsGracePeriod *bool - - // The governance rule metadata - Metadata *GovernanceRuleMetadata - - // Governance rule remediation timeframe - this is the time that will affect on the grace-period duration e.g. 7.00:00:00 - // - means 7 days - RemediationTimeframe *string - - // READ-ONLY; The tenantId (GUID) - TenantID *string -} - -// HTTPC2DMessagesNotInAllowedRange - Number of cloud to device messages (HTTP protocol) is not in allowed range. -type HTTPC2DMessagesNotInAllowedRange struct { - // REQUIRED; Status of the custom alert. - IsEnabled *bool - - // REQUIRED; The maximum threshold. - MaxThreshold *int32 - - // REQUIRED; The minimum threshold. - MinThreshold *int32 - - // REQUIRED; The type of the custom alert rule. - RuleType *string - - // REQUIRED; The time window size in iso8601 format. - TimeWindowSize *string - - // READ-ONLY; The description of the custom alert. - Description *string - - // READ-ONLY; The display name of the custom alert. - DisplayName *string -} - -// GetCustomAlertRule implements the CustomAlertRuleClassification interface for type HTTPC2DMessagesNotInAllowedRange. -func (h *HTTPC2DMessagesNotInAllowedRange) GetCustomAlertRule() *CustomAlertRule { - return &CustomAlertRule{ - Description: h.Description, - DisplayName: h.DisplayName, - IsEnabled: h.IsEnabled, - RuleType: h.RuleType, - } -} - -// GetThresholdCustomAlertRule implements the ThresholdCustomAlertRuleClassification interface for type HTTPC2DMessagesNotInAllowedRange. -func (h *HTTPC2DMessagesNotInAllowedRange) GetThresholdCustomAlertRule() *ThresholdCustomAlertRule { - return &ThresholdCustomAlertRule{ - Description: h.Description, - DisplayName: h.DisplayName, - IsEnabled: h.IsEnabled, - MaxThreshold: h.MaxThreshold, - MinThreshold: h.MinThreshold, - RuleType: h.RuleType, - } -} - -// GetTimeWindowCustomAlertRule implements the TimeWindowCustomAlertRuleClassification interface for type HTTPC2DMessagesNotInAllowedRange. -func (h *HTTPC2DMessagesNotInAllowedRange) GetTimeWindowCustomAlertRule() *TimeWindowCustomAlertRule { - return &TimeWindowCustomAlertRule{ - Description: h.Description, - DisplayName: h.DisplayName, - IsEnabled: h.IsEnabled, - MaxThreshold: h.MaxThreshold, - MinThreshold: h.MinThreshold, - RuleType: h.RuleType, - TimeWindowSize: h.TimeWindowSize, - } -} - -// HTTPC2DRejectedMessagesNotInAllowedRange - Number of rejected cloud to device messages (HTTP protocol) is not in allowed -// range. -type HTTPC2DRejectedMessagesNotInAllowedRange struct { - // REQUIRED; Status of the custom alert. - IsEnabled *bool - - // REQUIRED; The maximum threshold. - MaxThreshold *int32 - - // REQUIRED; The minimum threshold. - MinThreshold *int32 - - // REQUIRED; The type of the custom alert rule. - RuleType *string - - // REQUIRED; The time window size in iso8601 format. - TimeWindowSize *string - - // READ-ONLY; The description of the custom alert. - Description *string - - // READ-ONLY; The display name of the custom alert. - DisplayName *string -} - -// GetCustomAlertRule implements the CustomAlertRuleClassification interface for type HTTPC2DRejectedMessagesNotInAllowedRange. -func (h *HTTPC2DRejectedMessagesNotInAllowedRange) GetCustomAlertRule() *CustomAlertRule { - return &CustomAlertRule{ - Description: h.Description, - DisplayName: h.DisplayName, - IsEnabled: h.IsEnabled, - RuleType: h.RuleType, - } -} - -// GetThresholdCustomAlertRule implements the ThresholdCustomAlertRuleClassification interface for type HTTPC2DRejectedMessagesNotInAllowedRange. -func (h *HTTPC2DRejectedMessagesNotInAllowedRange) GetThresholdCustomAlertRule() *ThresholdCustomAlertRule { - return &ThresholdCustomAlertRule{ - Description: h.Description, - DisplayName: h.DisplayName, - IsEnabled: h.IsEnabled, - MaxThreshold: h.MaxThreshold, - MinThreshold: h.MinThreshold, - RuleType: h.RuleType, - } -} - -// GetTimeWindowCustomAlertRule implements the TimeWindowCustomAlertRuleClassification interface for type HTTPC2DRejectedMessagesNotInAllowedRange. -func (h *HTTPC2DRejectedMessagesNotInAllowedRange) GetTimeWindowCustomAlertRule() *TimeWindowCustomAlertRule { - return &TimeWindowCustomAlertRule{ - Description: h.Description, - DisplayName: h.DisplayName, - IsEnabled: h.IsEnabled, - MaxThreshold: h.MaxThreshold, - MinThreshold: h.MinThreshold, - RuleType: h.RuleType, - TimeWindowSize: h.TimeWindowSize, - } -} - -// HTTPD2CMessagesNotInAllowedRange - Number of device to cloud messages (HTTP protocol) is not in allowed range. -type HTTPD2CMessagesNotInAllowedRange struct { - // REQUIRED; Status of the custom alert. - IsEnabled *bool - - // REQUIRED; The maximum threshold. - MaxThreshold *int32 - - // REQUIRED; The minimum threshold. - MinThreshold *int32 - - // REQUIRED; The type of the custom alert rule. - RuleType *string - - // REQUIRED; The time window size in iso8601 format. - TimeWindowSize *string - - // READ-ONLY; The description of the custom alert. - Description *string - - // READ-ONLY; The display name of the custom alert. - DisplayName *string -} - -// GetCustomAlertRule implements the CustomAlertRuleClassification interface for type HTTPD2CMessagesNotInAllowedRange. -func (h *HTTPD2CMessagesNotInAllowedRange) GetCustomAlertRule() *CustomAlertRule { - return &CustomAlertRule{ - Description: h.Description, - DisplayName: h.DisplayName, - IsEnabled: h.IsEnabled, - RuleType: h.RuleType, - } -} - -// GetThresholdCustomAlertRule implements the ThresholdCustomAlertRuleClassification interface for type HTTPD2CMessagesNotInAllowedRange. -func (h *HTTPD2CMessagesNotInAllowedRange) GetThresholdCustomAlertRule() *ThresholdCustomAlertRule { - return &ThresholdCustomAlertRule{ - Description: h.Description, - DisplayName: h.DisplayName, - IsEnabled: h.IsEnabled, - MaxThreshold: h.MaxThreshold, - MinThreshold: h.MinThreshold, - RuleType: h.RuleType, - } -} - -// GetTimeWindowCustomAlertRule implements the TimeWindowCustomAlertRuleClassification interface for type HTTPD2CMessagesNotInAllowedRange. -func (h *HTTPD2CMessagesNotInAllowedRange) GetTimeWindowCustomAlertRule() *TimeWindowCustomAlertRule { - return &TimeWindowCustomAlertRule{ - Description: h.Description, - DisplayName: h.DisplayName, - IsEnabled: h.IsEnabled, - MaxThreshold: h.MaxThreshold, - MinThreshold: h.MinThreshold, - RuleType: h.RuleType, - TimeWindowSize: h.TimeWindowSize, - } -} - -// HealthDataClassification - The classification of the health report -type HealthDataClassification struct { - // The component describes the name of the agent/service that scans the issue - Component *string - - // The scenario describes the health scenario issue of the component - Scenario *string - - // The resource scope of the health report - Scope *string -} - -// HealthReport - The health report resource -type HealthReport struct { - // Properties of a health report - Properties *HealthReportProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// HealthReportProperties - Describes properties of the health report -type HealthReportProperties struct { - // The affected defenders plans by unhealthy report - AffectedDefendersPlans []*string - - // The affected defenders sub plans by unhealthy report - AffectedDefendersSubPlans []*string - - // The environment details of the resource - EnvironmentDetails *EnvironmentDetails - - // The classification of the health report - HealthDataClassification *HealthDataClassification - - // A collection of the issues in the report - Issues []*Issue - - // The resource details of the health report - ResourceDetails *ResourceDetailsAutoGenerated - - // The status of the health report - Status *StatusAutoGenerated - - // 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 -} - -// HealthReportsList - Page of health reports list -type HealthReportsList struct { - // READ-ONLY; The URI to fetch the next page - NextLink *string - - // READ-ONLY; Collection of health reports in 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. - Type *string - - // READ-ONLY; The principal ID of resource identity. - PrincipalID *string - - // READ-ONLY; The tenant ID of resource. - TenantID *string -} - -// InfoType - Custom user-defined information type -type InfoType struct { - // Description of the info type - Description *string - - // Id of the info type - ID *string - - // Display name of the info type - Name *string -} - -// InformationProtectionKeyword - The information type keyword. -type InformationProtectionKeyword struct { - // Indicates whether the keyword can be applied on numeric types or not. - CanBeNumeric *bool - - // Indicates whether the keyword is custom or not. - Custom *bool - - // Indicates whether the keyword is excluded or not. - Excluded *bool - - // The keyword pattern. - Pattern *string -} - -// InformationProtectionPolicy - Information protection policy. -type InformationProtectionPolicy struct { - // Information protection policy data - Properties *InformationProtectionPolicyProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// InformationProtectionPolicyList - Information protection policies response. -type InformationProtectionPolicyList struct { - // List of information protection policies. - Value []*InformationProtectionPolicy - - // READ-ONLY; The URI to fetch the next page. - NextLink *string -} - -// InformationProtectionPolicyProperties - describes properties of an information protection policy. -type InformationProtectionPolicyProperties struct { - // The sensitivity information types. - InformationTypes map[string]*InformationType - - // Dictionary of sensitivity labels. - Labels map[string]*SensitivityLabel - - // READ-ONLY; Describes the last UTC time the policy was modified. - LastModifiedUTC *time.Time - - // READ-ONLY; Describes the version of the policy. - Version *string -} - -// InformationType - The information type. -type InformationType struct { - // Indicates whether the information type is custom or not. - Custom *bool - - // The description of the information type. - Description *string - - // The name of the information type. - DisplayName *string - - // Indicates whether the information type is enabled or not. - Enabled *bool - - // The information type keywords. - Keywords []*InformationProtectionKeyword - - // The order of the information type. - Order *int32 - - // The recommended label id to be associated with this information type. - RecommendedLabelID *string -} - -// IoTSecurityAggregatedAlert - Security Solution Aggregated Alert information -type IoTSecurityAggregatedAlert struct { - // IoT Security solution aggregated alert details. - Properties *IoTSecurityAggregatedAlertProperties - - // Resource tags - Tags map[string]*string - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// IoTSecurityAggregatedAlertList - List of IoT Security solution aggregated alert data. -type IoTSecurityAggregatedAlertList struct { - // REQUIRED; List of aggregated alerts data. - Value []*IoTSecurityAggregatedAlert - - // READ-ONLY; When there is too much alert data for one page, use this URI to fetch the next page. - NextLink *string -} - -// IoTSecurityAggregatedAlertProperties - IoT Security solution aggregated alert details. -type IoTSecurityAggregatedAlertProperties struct { - // READ-ONLY; IoT Security solution alert response. - ActionTaken *string - - // READ-ONLY; Date of detection. - AggregatedDateUTC *time.Time - - // READ-ONLY; Display name of the alert type. - AlertDisplayName *string - - // READ-ONLY; Name of the alert type. - AlertType *string - - // READ-ONLY; Number of alerts occurrences within the aggregated time window. - Count *int64 - - // READ-ONLY; Description of the suspected vulnerability and meaning. - Description *string - - // READ-ONLY; Azure resource ID of the resource that received the alerts. - EffectedResourceType *string - - // READ-ONLY; Log analytics query for getting the list of affected devices/alerts. - LogAnalyticsQuery *string - - // READ-ONLY; Recommended steps for remediation. - RemediationSteps *string - - // READ-ONLY; Assessed alert severity. - ReportedSeverity *ReportedSeverity - - // READ-ONLY; The type of the alerted resource (Azure, Non-Azure). - SystemSource *string - - // READ-ONLY; 10 devices with the highest number of occurrences of this alert type, on this day. - TopDevicesList []*IoTSecurityAggregatedAlertPropertiesTopDevicesListItem - - // READ-ONLY; Name of the organization that raised the alert. - VendorName *string -} - -type IoTSecurityAggregatedAlertPropertiesTopDevicesListItem struct { - // READ-ONLY; Number of alerts raised for this device. - AlertsCount *int64 - - // READ-ONLY; Name of the device. - DeviceID *string - - // READ-ONLY; Most recent time this alert was raised for this device, on this day. - LastOccurrence *string -} - -// IoTSecurityAggregatedRecommendation - IoT Security solution recommendation information. -type IoTSecurityAggregatedRecommendation struct { - // Security Solution data - Properties *IoTSecurityAggregatedRecommendationProperties - - // Resource tags - Tags map[string]*string - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// IoTSecurityAggregatedRecommendationList - List of IoT Security solution aggregated recommendations. -type IoTSecurityAggregatedRecommendationList struct { - // REQUIRED; List of aggregated recommendations data. - Value []*IoTSecurityAggregatedRecommendation - - // READ-ONLY; When there is too much alert data for one page, use this URI to fetch the next page. - NextLink *string -} - -// IoTSecurityAggregatedRecommendationProperties - IoT Security solution aggregated recommendation information -type IoTSecurityAggregatedRecommendationProperties struct { - // Name of the recommendation. - RecommendationName *string - - // READ-ONLY; Description of the suspected vulnerability and meaning. - Description *string - - // READ-ONLY; Name of the organization that made the recommendation. - DetectedBy *string - - // READ-ONLY; Number of healthy devices within the IoT Security solution. - HealthyDevices *int64 - - // READ-ONLY; Log analytics query for getting the list of affected devices/alerts. - LogAnalyticsQuery *string - - // READ-ONLY; Display name of the recommendation type. - RecommendationDisplayName *string - - // READ-ONLY; Recommendation-type GUID. - RecommendationTypeID *string - - // READ-ONLY; Recommended steps for remediation - RemediationSteps *string - - // READ-ONLY; Assessed recommendation severity. - ReportedSeverity *ReportedSeverity - - // READ-ONLY; Number of unhealthy devices within the IoT Security solution. - UnhealthyDeviceCount *int64 -} - -// IoTSecurityAlertedDevice - Statistical information about the number of alerts per device during last set number of days. -type IoTSecurityAlertedDevice struct { - // READ-ONLY; Number of alerts raised for this device. - AlertsCount *int64 - - // READ-ONLY; Device identifier. - DeviceID *string -} - -// IoTSecurityDeviceAlert - Statistical information about the number of alerts per alert type during last set number of days -type IoTSecurityDeviceAlert struct { - // READ-ONLY; Display name of the alert - AlertDisplayName *string - - // READ-ONLY; Number of alerts raised for this alert type. - AlertsCount *int64 - - // READ-ONLY; Assessed Alert severity. - ReportedSeverity *ReportedSeverity -} - -// IoTSecurityDeviceRecommendation - Statistical information about the number of recommendations per device, per recommendation -// type. -type IoTSecurityDeviceRecommendation struct { - // READ-ONLY; Number of devices with this recommendation. - DevicesCount *int64 - - // READ-ONLY; Display name of the recommendation. - RecommendationDisplayName *string - - // READ-ONLY; Assessed recommendation severity. - ReportedSeverity *ReportedSeverity -} - -// IoTSecuritySolutionAnalyticsModel - Security analytics of your IoT Security solution -type IoTSecuritySolutionAnalyticsModel struct { - // Security Solution Aggregated Alert data - Properties *IoTSecuritySolutionAnalyticsModelProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - 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 - Value []*IoTSecuritySolutionAnalyticsModel - - // READ-ONLY; When there is too much alert data for one page, use this URI to fetch the next page. - NextLink *string -} - -// IoTSecuritySolutionAnalyticsModelProperties - Security analytics properties of your IoT Security solution -type IoTSecuritySolutionAnalyticsModelProperties struct { - // List of the 3 most prevalent device alerts. - MostPrevalentDeviceAlerts []*IoTSecurityDeviceAlert - - // List of the 3 most prevalent device recommendations. - MostPrevalentDeviceRecommendations []*IoTSecurityDeviceRecommendation - - // List of the 3 devices with the most alerts. - TopAlertedDevices []*IoTSecurityAlertedDevice - - // READ-ONLY; List of device metrics by the aggregation date. - DevicesMetrics []*IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem - - // READ-ONLY; Security analytics of your IoT Security solution. - Metrics *IoTSeverityMetrics - - // READ-ONLY; Number of unhealthy devices within your IoT Security solution. - UnhealthyDeviceCount *int64 -} - -type IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem struct { - // Aggregation of IoT Security solution device alert metrics by date. - Date *time.Time - - // Device alert count by severity. - DevicesMetrics *IoTSeverityMetrics -} - -// IoTSecuritySolutionModel - IoT Security solution configuration and resource information. -type IoTSecuritySolutionModel struct { - // The resource location. - Location *string - - // Security Solution data - Properties *IoTSecuritySolutionProperties - - // Resource tags - Tags map[string]*string - - // 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 -} - -// IoTSecuritySolutionProperties - Security Solution setting data -type IoTSecuritySolutionProperties struct { - // REQUIRED; Resource display name. - DisplayName *string - - // REQUIRED; IoT Hub resource IDs - IotHubs []*string - - // List of additional workspaces - AdditionalWorkspaces []*AdditionalWorkspacesProperties - - // Disabled data sources. Disabling these data sources compromises the system. - DisabledDataSources []*DataSource - - // List of additional options for exporting to workspace data. - Export []*ExportData - - // List of the configuration status for each recommendation type. - RecommendationsConfiguration []*RecommendationConfigurationProperties - - // Status of the IoT Security solution. - Status *SecuritySolutionStatus - - // Unmasked IP address logging status - UnmaskedIPLoggingStatus *UnmaskedIPLoggingStatus - - // Properties of the IoT Security solution's user defined resources. - UserDefinedResources *UserDefinedResourcesProperties - - // Workspace resource ID - Workspace *string - - // READ-ONLY; List of resources that were automatically discovered as relevant to the security solution. - AutoDiscoveredResources []*string -} - -// IoTSecuritySolutionsList - List of IoT Security solutions. -type IoTSecuritySolutionsList struct { - // REQUIRED; List of IoT Security solutions - Value []*IoTSecuritySolutionModel - - // READ-ONLY; The URI to fetch the next page. - NextLink *string -} - -// IoTSeverityMetrics - IoT Security solution analytics severity metrics. -type IoTSeverityMetrics struct { - // Count of high severity alerts/recommendations. - High *int64 - - // Count of low severity alerts/recommendations. - Low *int64 - - // Count of medium severity alerts/recommendations. - Medium *int64 -} - -// Issue - The issue that caused the resource to by unhealthy -type Issue struct { - // REQUIRED; The unique issue key - IssueKey *string - - // Additional data for the given issue. The additional data depends on the issue type - IssueAdditionalData map[string]*string - - // The issue description - IssueDescription *string - - // The issue name - IssueName *string - - // The remediation script to solve this issue - RemediationScript *string - - // Human readable description of what you should do to mitigate this health issue - RemediationSteps *string - - // The affected security values that MDC offers that will be affected by the issue, for example: recommendations, alerts, - // etc - SecurityValues []*string -} - -type JitNetworkAccessPoliciesList struct { - Value []*JitNetworkAccessPolicy - - // READ-ONLY; The URI to fetch the next page. - NextLink *string -} - -type JitNetworkAccessPolicy struct { - // REQUIRED - Properties *JitNetworkAccessPolicyProperties - - // Kind of the resource - Kind *string - - // 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 -} - -type JitNetworkAccessPolicyInitiatePort struct { - // REQUIRED; The time to close the request in UTC - EndTimeUTC *time.Time - - // REQUIRED - Number *int32 - - // Source of the allowed traffic. If omitted, the request will be for the source IP address of the initiate request. - AllowedSourceAddressPrefix *string -} - -type JitNetworkAccessPolicyInitiateRequest struct { - // REQUIRED; A list of virtual machines & ports to open access for - VirtualMachines []*JitNetworkAccessPolicyInitiateVirtualMachine - - // The justification for making the initiate request - Justification *string -} - -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 - Ports []*JitNetworkAccessPolicyInitiatePort -} - -type JitNetworkAccessPolicyProperties struct { - // REQUIRED; Configurations for Microsoft.Compute/virtualMachines resource type. - VirtualMachines []*JitNetworkAccessPolicyVirtualMachine - Requests []*JitNetworkAccessRequest - - // READ-ONLY; Gets the provisioning state of the Just-in-Time policy. - ProvisioningState *string -} - -type JitNetworkAccessPolicyVirtualMachine struct { - // REQUIRED; Resource ID of the virtual machine that is linked to this policy - ID *string - - // REQUIRED; Port configurations for the virtual machine - Ports []*JitNetworkAccessPortRule - - // Public IP address of the Azure Firewall that is linked to this policy, if applicable - PublicIPAddress *string -} - -type JitNetworkAccessPortRule struct { - // REQUIRED; Maximum duration requests can be made for. In ISO 8601 duration format. Minimum 5 minutes, maximum 1 day - MaxRequestAccessDuration *string - - // REQUIRED - Number *int32 - - // REQUIRED - Protocol *Protocol - - // Mutually exclusive with the "allowedSourceAddressPrefixes" parameter. Should be an IP address or CIDR, for example "192.168.0.3" - // or "192.168.0.0/16". - AllowedSourceAddressPrefix *string - - // Mutually exclusive with the "allowedSourceAddressPrefix" parameter. - AllowedSourceAddressPrefixes []*string -} - -type JitNetworkAccessRequest struct { - // REQUIRED; The identity of the person who made the request - Requestor *string - - // REQUIRED; The start time of the request in UTC - StartTimeUTC *time.Time - - // REQUIRED - VirtualMachines []*JitNetworkAccessRequestVirtualMachine - - // The justification for making the initiate request - Justification *string -} - -type JitNetworkAccessRequestPort struct { - // REQUIRED; The date & time at which the request ends in UTC - EndTimeUTC *time.Time - - // REQUIRED - Number *int32 - - // REQUIRED; The status of the port - Status *Status - - // 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" - // or "192.168.0.0/16". - AllowedSourceAddressPrefix *string - - // Mutually exclusive with the "allowedSourceAddressPrefix" parameter. - AllowedSourceAddressPrefixes []*string - - // The port which is mapped to this port's number in the Azure Firewall, if applicable - MappedPort *int32 -} - -type JitNetworkAccessRequestVirtualMachine struct { - // REQUIRED; Resource ID of the virtual machine that is linked to this policy - ID *string - - // REQUIRED; The ports that were opened for the virtual machine - 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 - ID *string - - // The display name of the label - Name *string - - // Labels are ordered by sensitivity level. The higher the order of the label, the more sensitive it is. - Order *float32 -} - -// ListCustomAlertRule - A List custom alert rule. -type ListCustomAlertRule struct { - // REQUIRED; Status of the custom alert. - IsEnabled *bool - - // REQUIRED; The type of the custom alert rule. - RuleType *string - - // READ-ONLY; The description of the custom alert. - Description *string - - // READ-ONLY; The display name of the custom alert. - DisplayName *string - - // READ-ONLY; The value type of the items in the list. - ValueType *ValueType -} - -// GetCustomAlertRule implements the CustomAlertRuleClassification interface for type ListCustomAlertRule. -func (l *ListCustomAlertRule) GetCustomAlertRule() *CustomAlertRule { - return &CustomAlertRule{ - Description: l.Description, - DisplayName: l.DisplayName, - IsEnabled: l.IsEnabled, - RuleType: l.RuleType, - } -} - -// GetListCustomAlertRule implements the ListCustomAlertRuleClassification interface for type ListCustomAlertRule. -func (l *ListCustomAlertRule) GetListCustomAlertRule() *ListCustomAlertRule { return l } - -// LocalUserNotAllowed - Login by a local user that isn't allowed. Allow list consists of login names to allow. -type LocalUserNotAllowed struct { - // REQUIRED; The values to allow. The format of the values depends on the rule type. - AllowlistValues []*string - - // REQUIRED; Status of the custom alert. - IsEnabled *bool - - // REQUIRED; The type of the custom alert rule. - RuleType *string - - // READ-ONLY; The description of the custom alert. - Description *string - - // READ-ONLY; The display name of the custom alert. - DisplayName *string - - // READ-ONLY; The value type of the items in the list. - ValueType *ValueType -} - -// GetAllowlistCustomAlertRule implements the AllowlistCustomAlertRuleClassification interface for type LocalUserNotAllowed. -func (l *LocalUserNotAllowed) GetAllowlistCustomAlertRule() *AllowlistCustomAlertRule { - return &AllowlistCustomAlertRule{ - AllowlistValues: l.AllowlistValues, - Description: l.Description, - DisplayName: l.DisplayName, - IsEnabled: l.IsEnabled, - RuleType: l.RuleType, - ValueType: l.ValueType, - } -} - -// GetCustomAlertRule implements the CustomAlertRuleClassification interface for type LocalUserNotAllowed. -func (l *LocalUserNotAllowed) GetCustomAlertRule() *CustomAlertRule { - return &CustomAlertRule{ - Description: l.Description, - DisplayName: l.DisplayName, - IsEnabled: l.IsEnabled, - RuleType: l.RuleType, - } -} - -// GetListCustomAlertRule implements the ListCustomAlertRuleClassification interface for type LocalUserNotAllowed. -func (l *LocalUserNotAllowed) GetListCustomAlertRule() *ListCustomAlertRule { - return &ListCustomAlertRule{ - Description: l.Description, - DisplayName: l.DisplayName, - IsEnabled: l.IsEnabled, - RuleType: l.RuleType, - ValueType: l.ValueType, - } -} - -// 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. - Type *ResourceIdentifierType - - // READ-ONLY; (optional) The LogAnalytics agent id reporting the event that this alert is based on. - AgentID *string - - // READ-ONLY; The LogAnalytics workspace id that stores this alert. - WorkspaceID *string - - // READ-ONLY; The azure resource group for the LogAnalytics workspace storing this alert - WorkspaceResourceGroup *string - - // READ-ONLY; The azure subscription id for the LogAnalytics workspace storing this alert. - WorkspaceSubscriptionID *string -} - -// GetResourceIdentifier implements the ResourceIdentifierClassification interface for type LogAnalyticsIdentifier. -func (l *LogAnalyticsIdentifier) GetResourceIdentifier() *ResourceIdentifier { - return &ResourceIdentifier{ - Type: l.Type, - } -} - -// MalwareScanningProperties - Properties of Malware Scanning. -type MalwareScanningProperties struct { - // Properties of On Upload malware scanning. - OnUpload *OnUploadProperties - - // Optional. Resource id of an Event Grid Topic to send scan results to. - ScanResultsEventGridTopicResourceID *string - - // READ-ONLY; Upon failure or partial success. Additional data describing Malware Scanning enable/disable operation. - OperationStatus *OperationStatus -} - -// MdeOnboardingData - The resource of the configuration or data needed to onboard the machine to MDE -type MdeOnboardingData struct { - // Properties of the MDE configuration or data parameter needed to onboard the machine to MDE - Properties *MdeOnboardingDataProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// MdeOnboardingDataList - List of all MDE onboarding data resources -type MdeOnboardingDataList struct { - // List of the resources of the configuration or data needed to onboard the machine to MDE - Value []*MdeOnboardingData -} - -// MdeOnboardingDataProperties - Properties of the MDE configuration or data parameter needed to onboard the machine to MDE -type MdeOnboardingDataProperties struct { - // The onboarding package used to onboard Linux machines to MDE, coded in base64. This can also be used for onboarding using - // the dedicated VM Extension - OnboardingPackageLinux []byte - - // The onboarding package used to onboard Windows machines to MDE, coded in base64. This can also be used for onboarding using - // the dedicated VM Extension - OnboardingPackageWindows []byte -} - -// MqttC2DMessagesNotInAllowedRange - Number of cloud to device messages (MQTT protocol) is not in allowed range. -type MqttC2DMessagesNotInAllowedRange struct { - // REQUIRED; Status of the custom alert. - IsEnabled *bool - - // REQUIRED; The maximum threshold. - MaxThreshold *int32 - - // REQUIRED; The minimum threshold. - MinThreshold *int32 - - // REQUIRED; The type of the custom alert rule. - RuleType *string - - // REQUIRED; The time window size in iso8601 format. - TimeWindowSize *string - - // READ-ONLY; The description of the custom alert. - Description *string - - // READ-ONLY; The display name of the custom alert. - DisplayName *string -} - -// GetCustomAlertRule implements the CustomAlertRuleClassification interface for type MqttC2DMessagesNotInAllowedRange. -func (m *MqttC2DMessagesNotInAllowedRange) GetCustomAlertRule() *CustomAlertRule { - return &CustomAlertRule{ - Description: m.Description, - DisplayName: m.DisplayName, - IsEnabled: m.IsEnabled, - RuleType: m.RuleType, - } -} - -// GetThresholdCustomAlertRule implements the ThresholdCustomAlertRuleClassification interface for type MqttC2DMessagesNotInAllowedRange. -func (m *MqttC2DMessagesNotInAllowedRange) GetThresholdCustomAlertRule() *ThresholdCustomAlertRule { - return &ThresholdCustomAlertRule{ - Description: m.Description, - DisplayName: m.DisplayName, - IsEnabled: m.IsEnabled, - MaxThreshold: m.MaxThreshold, - MinThreshold: m.MinThreshold, - RuleType: m.RuleType, - } -} - -// GetTimeWindowCustomAlertRule implements the TimeWindowCustomAlertRuleClassification interface for type MqttC2DMessagesNotInAllowedRange. -func (m *MqttC2DMessagesNotInAllowedRange) GetTimeWindowCustomAlertRule() *TimeWindowCustomAlertRule { - return &TimeWindowCustomAlertRule{ - Description: m.Description, - DisplayName: m.DisplayName, - IsEnabled: m.IsEnabled, - MaxThreshold: m.MaxThreshold, - MinThreshold: m.MinThreshold, - RuleType: m.RuleType, - TimeWindowSize: m.TimeWindowSize, - } -} - -// MqttC2DRejectedMessagesNotInAllowedRange - Number of rejected cloud to device messages (MQTT protocol) is not in allowed -// range. -type MqttC2DRejectedMessagesNotInAllowedRange struct { - // REQUIRED; Status of the custom alert. - IsEnabled *bool - - // REQUIRED; The maximum threshold. - MaxThreshold *int32 - - // REQUIRED; The minimum threshold. - MinThreshold *int32 - - // REQUIRED; The type of the custom alert rule. - RuleType *string - - // REQUIRED; The time window size in iso8601 format. - TimeWindowSize *string - - // READ-ONLY; The description of the custom alert. - Description *string - - // READ-ONLY; The display name of the custom alert. - DisplayName *string -} - -// GetCustomAlertRule implements the CustomAlertRuleClassification interface for type MqttC2DRejectedMessagesNotInAllowedRange. -func (m *MqttC2DRejectedMessagesNotInAllowedRange) GetCustomAlertRule() *CustomAlertRule { - return &CustomAlertRule{ - Description: m.Description, - DisplayName: m.DisplayName, - IsEnabled: m.IsEnabled, - RuleType: m.RuleType, - } -} - -// GetThresholdCustomAlertRule implements the ThresholdCustomAlertRuleClassification interface for type MqttC2DRejectedMessagesNotInAllowedRange. -func (m *MqttC2DRejectedMessagesNotInAllowedRange) GetThresholdCustomAlertRule() *ThresholdCustomAlertRule { - return &ThresholdCustomAlertRule{ - Description: m.Description, - DisplayName: m.DisplayName, - IsEnabled: m.IsEnabled, - MaxThreshold: m.MaxThreshold, - MinThreshold: m.MinThreshold, - RuleType: m.RuleType, - } -} - -// GetTimeWindowCustomAlertRule implements the TimeWindowCustomAlertRuleClassification interface for type MqttC2DRejectedMessagesNotInAllowedRange. -func (m *MqttC2DRejectedMessagesNotInAllowedRange) GetTimeWindowCustomAlertRule() *TimeWindowCustomAlertRule { - return &TimeWindowCustomAlertRule{ - Description: m.Description, - DisplayName: m.DisplayName, - IsEnabled: m.IsEnabled, - MaxThreshold: m.MaxThreshold, - MinThreshold: m.MinThreshold, - RuleType: m.RuleType, - TimeWindowSize: m.TimeWindowSize, - } -} - -// MqttD2CMessagesNotInAllowedRange - Number of device to cloud messages (MQTT protocol) is not in allowed range. -type MqttD2CMessagesNotInAllowedRange struct { - // REQUIRED; Status of the custom alert. - IsEnabled *bool - - // REQUIRED; The maximum threshold. - MaxThreshold *int32 - - // REQUIRED; The minimum threshold. - MinThreshold *int32 - - // REQUIRED; The type of the custom alert rule. - RuleType *string - - // REQUIRED; The time window size in iso8601 format. - TimeWindowSize *string - - // READ-ONLY; The description of the custom alert. - Description *string - - // READ-ONLY; The display name of the custom alert. - DisplayName *string -} - -// GetCustomAlertRule implements the CustomAlertRuleClassification interface for type MqttD2CMessagesNotInAllowedRange. -func (m *MqttD2CMessagesNotInAllowedRange) GetCustomAlertRule() *CustomAlertRule { - return &CustomAlertRule{ - Description: m.Description, - DisplayName: m.DisplayName, - IsEnabled: m.IsEnabled, - RuleType: m.RuleType, - } -} - -// GetThresholdCustomAlertRule implements the ThresholdCustomAlertRuleClassification interface for type MqttD2CMessagesNotInAllowedRange. -func (m *MqttD2CMessagesNotInAllowedRange) GetThresholdCustomAlertRule() *ThresholdCustomAlertRule { - return &ThresholdCustomAlertRule{ - Description: m.Description, - DisplayName: m.DisplayName, - IsEnabled: m.IsEnabled, - MaxThreshold: m.MaxThreshold, - MinThreshold: m.MinThreshold, - RuleType: m.RuleType, - } -} - -// GetTimeWindowCustomAlertRule implements the TimeWindowCustomAlertRuleClassification interface for type MqttD2CMessagesNotInAllowedRange. -func (m *MqttD2CMessagesNotInAllowedRange) GetTimeWindowCustomAlertRule() *TimeWindowCustomAlertRule { - return &TimeWindowCustomAlertRule{ - Description: m.Description, - DisplayName: m.DisplayName, - IsEnabled: m.IsEnabled, - MaxThreshold: m.MaxThreshold, - MinThreshold: m.MinThreshold, - RuleType: m.RuleType, - TimeWindowSize: m.TimeWindowSize, - } -} - -// NotificationsSource - A valid notification source type -type NotificationsSource struct { - // REQUIRED; The source type that will trigger the notification - SourceType *SourceType -} - -// GetNotificationsSource implements the NotificationsSourceClassification interface for type NotificationsSource. -func (n *NotificationsSource) GetNotificationsSource() *NotificationsSource { return n } - -// NotificationsSourceAlert - Alert notification source -type NotificationsSourceAlert struct { - // REQUIRED; The source type that will trigger the notification - SourceType *SourceType - - // Defines the minimal alert severity which will be sent as email notifications - MinimalSeverity *MinimalSeverity -} - -// GetNotificationsSource implements the NotificationsSourceClassification interface for type NotificationsSourceAlert. -func (n *NotificationsSourceAlert) GetNotificationsSource() *NotificationsSource { - return &NotificationsSource{ - SourceType: n.SourceType, - } -} - -// NotificationsSourceAttackPath - Attack path notification source -type NotificationsSourceAttackPath struct { - // REQUIRED; The source type that will trigger the notification - SourceType *SourceType - - // Defines the minimal attach path risk level which will be sent as email notifications - MinimalRiskLevel *MinimalRiskLevel -} - -// GetNotificationsSource implements the NotificationsSourceClassification interface for type NotificationsSourceAttackPath. -func (n *NotificationsSourceAttackPath) GetNotificationsSource() *NotificationsSource { - return &NotificationsSource{ - SourceType: n.SourceType, - } -} - -// OnPremiseResourceDetails - Details of the On Premise resource that was assessed -type OnPremiseResourceDetails struct { - // REQUIRED; The name of the machine - MachineName *string - - // REQUIRED; The platform where the assessed resource resides - Source *Source - - // REQUIRED; The oms agent Id installed on the machine - SourceComputerID *string - - // REQUIRED; The unique Id of the machine - Vmuuid *string - - // REQUIRED; Azure resource Id of the workspace the machine is attached to - 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{ - Source: o.Source, - } -} - -// OnPremiseSQLResourceDetails - Details of the On Premise Sql resource that was assessed -type OnPremiseSQLResourceDetails struct { - // REQUIRED; The Sql database name installed on the machine - DatabaseName *string - - // REQUIRED; The name of the machine - MachineName *string - - // REQUIRED; The Sql server name installed on the machine - ServerName *string - - // REQUIRED; The platform where the assessed resource resides - Source *Source - - // REQUIRED; The oms agent Id installed on the machine - SourceComputerID *string - - // REQUIRED; The unique Id of the machine - Vmuuid *string - - // REQUIRED; Azure resource Id of the workspace the machine is attached to - WorkspaceID *string -} - -// GetOnPremiseResourceDetails implements the OnPremiseResourceDetailsClassification interface for type OnPremiseSQLResourceDetails. -func (o *OnPremiseSQLResourceDetails) GetOnPremiseResourceDetails() *OnPremiseResourceDetails { - return &OnPremiseResourceDetails{ - MachineName: o.MachineName, - Source: o.Source, - SourceComputerID: o.SourceComputerID, - Vmuuid: o.Vmuuid, - WorkspaceID: o.WorkspaceID, - } -} - -// GetResourceDetails implements the ResourceDetailsClassification interface for type OnPremiseSQLResourceDetails. -func (o *OnPremiseSQLResourceDetails) GetResourceDetails() *ResourceDetails { - return &ResourceDetails{ - Source: o.Source, - } -} - -// 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. - CapGBPerMonth *int32 - - // Indicates whether On Upload malware scanning should be enabled. - IsEnabled *bool -} - -// Operation - Possible operation in the REST API of Microsoft.Security -type Operation struct { - // Security operation display - Display *OperationDisplay - - // READ-ONLY; Name of the operation - Name *string - - // READ-ONLY; Where the operation is originated - Origin *string -} - -// OperationDisplay - Security operation display -type OperationDisplay struct { - // READ-ONLY; The description of the operation. - Description *string - - // READ-ONLY; The display name of the security operation. - Operation *string - - // READ-ONLY; The resource provider for the operation. - Provider *string - - // READ-ONLY; The display name of the resource the operation applies to. - Resource *string -} - -// OperationList - List of possible operations for Microsoft.Security resource provider -type OperationList struct { - // List of Security operations - Value []*Operation - - // READ-ONLY; The URI to fetch the next page. - NextLink *string -} - -// OperationResultAutoGenerated - Long run operation status of governance rule over a given scope -type OperationResultAutoGenerated struct { - // READ-ONLY; The status of the long run operation result of governance rule - Status *OperationResult -} - -// OperationStatus - A status describing the success/failure of the enablement/disablement operation. -type OperationStatus struct { - // The operation status code. - Code *string - - // Additional information regarding the success/failure of the operation. - 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. - Status *string - - // The end time of the operation. - EndTime *time.Time - - // If present, details of the operation error. - Error *ErrorDetailAutoGenerated - - // Fully qualified ID for the async operation. - ID *string - - // Name of the async operation. - Name *string - - // The operations list. - Operations []*OperationStatusResult - - // Percent of the operation that is complete. - PercentComplete *float32 - - // The start time of the operation. - StartTime *time.Time -} - -// OperatorList - List of SecurityOperator response. -type OperatorList struct { - // REQUIRED; List of SecurityOperator configurations - Value []*OperatorResource -} - -// OperatorResource - Security operator under a given subscription and pricing -type OperatorResource struct { - // Identity for the resource. - Identity *Identity - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - 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 -} - -// Pricing - 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. -type Pricing struct { - // Pricing data - Properties *PricingProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// PricingList - List of pricing configurations response. -type PricingList struct { - // REQUIRED; List of pricing configurations - Value []*Pricing -} - -// 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. - 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. - 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. - SubPlan *string - - // 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). - 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. - Inherited *Inherited - - // READ-ONLY; The id of the scope inherited from. "Null" if not inherited. This field is only available for resource-level - // pricing. - InheritedFrom *string - - // READ-ONLY; Optional. List of plans that replace this plan. This property exists only if this plan is deprecated. - 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. - ResourcesCoverageStatus *ResourcesCoverageStatus -} - -// 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. - AllowlistValues []*string - - // REQUIRED; Status of the custom alert. - IsEnabled *bool - - // REQUIRED; The type of the custom alert rule. - RuleType *string - - // READ-ONLY; The description of the custom alert. - Description *string - - // READ-ONLY; The display name of the custom alert. - DisplayName *string - - // READ-ONLY; The value type of the items in the list. - ValueType *ValueType -} - -// GetAllowlistCustomAlertRule implements the AllowlistCustomAlertRuleClassification interface for type ProcessNotAllowed. -func (p *ProcessNotAllowed) GetAllowlistCustomAlertRule() *AllowlistCustomAlertRule { - return &AllowlistCustomAlertRule{ - AllowlistValues: p.AllowlistValues, - Description: p.Description, - DisplayName: p.DisplayName, - IsEnabled: p.IsEnabled, - RuleType: p.RuleType, - ValueType: p.ValueType, - } -} - -// GetCustomAlertRule implements the CustomAlertRuleClassification interface for type ProcessNotAllowed. -func (p *ProcessNotAllowed) GetCustomAlertRule() *CustomAlertRule { - return &CustomAlertRule{ - Description: p.Description, - DisplayName: p.DisplayName, - IsEnabled: p.IsEnabled, - RuleType: p.RuleType, - } -} - -// GetListCustomAlertRule implements the ListCustomAlertRuleClassification interface for type ProcessNotAllowed. -func (p *ProcessNotAllowed) GetListCustomAlertRule() *ListCustomAlertRule { - return &ListCustomAlertRule{ - Description: p.Description, - DisplayName: p.DisplayName, - IsEnabled: p.IsEnabled, - RuleType: p.RuleType, - ValueType: p.ValueType, - } -} - -// 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 - - // The application control policy enforcement/protection mode of the machine group - Msi *EnforcementMode - - // The application control policy enforcement/protection mode of the machine group - Script *EnforcementMode -} - -// 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 - - // REQUIRED; The maximum threshold. - MaxThreshold *int32 - - // REQUIRED; The minimum threshold. - MinThreshold *int32 - - // REQUIRED; The type of the custom alert rule. - RuleType *string - - // REQUIRED; The time window size in iso8601 format. - TimeWindowSize *string - - // READ-ONLY; The description of the custom alert. - Description *string - - // READ-ONLY; The display name of the custom alert. - DisplayName *string -} - -// GetCustomAlertRule implements the CustomAlertRuleClassification interface for type QueuePurgesNotInAllowedRange. -func (q *QueuePurgesNotInAllowedRange) GetCustomAlertRule() *CustomAlertRule { - return &CustomAlertRule{ - Description: q.Description, - DisplayName: q.DisplayName, - IsEnabled: q.IsEnabled, - RuleType: q.RuleType, - } -} - -// GetThresholdCustomAlertRule implements the ThresholdCustomAlertRuleClassification interface for type QueuePurgesNotInAllowedRange. -func (q *QueuePurgesNotInAllowedRange) GetThresholdCustomAlertRule() *ThresholdCustomAlertRule { - return &ThresholdCustomAlertRule{ - Description: q.Description, - DisplayName: q.DisplayName, - IsEnabled: q.IsEnabled, - MaxThreshold: q.MaxThreshold, - MinThreshold: q.MinThreshold, - RuleType: q.RuleType, - } -} - -// GetTimeWindowCustomAlertRule implements the TimeWindowCustomAlertRuleClassification interface for type QueuePurgesNotInAllowedRange. -func (q *QueuePurgesNotInAllowedRange) GetTimeWindowCustomAlertRule() *TimeWindowCustomAlertRule { - return &TimeWindowCustomAlertRule{ - Description: q.Description, - DisplayName: q.DisplayName, - IsEnabled: q.IsEnabled, - MaxThreshold: q.MaxThreshold, - MinThreshold: q.MinThreshold, - RuleType: q.RuleType, - TimeWindowSize: q.TimeWindowSize, - } -} - -// RecommendationConfigurationProperties - The type of IoT Security recommendation. -type RecommendationConfigurationProperties struct { - // REQUIRED; The type of IoT Security recommendation. - RecommendationType *RecommendationType - - // REQUIRED; Recommendation status. When the recommendation status is disabled recommendations are not generated. - Status *RecommendationConfigStatus - - // READ-ONLY - Name *string -} - -// RegulatoryComplianceAssessment - Regulatory compliance assessment details and state -type RegulatoryComplianceAssessment struct { - // Regulatory compliance assessment data - Properties *RegulatoryComplianceAssessmentProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// RegulatoryComplianceAssessmentList - List of regulatory compliance assessment response -type RegulatoryComplianceAssessmentList struct { - // REQUIRED - Value []*RegulatoryComplianceAssessment - - // READ-ONLY; The URI to fetch the next page. - NextLink *string -} - -// RegulatoryComplianceAssessmentProperties - Regulatory compliance assessment data -type RegulatoryComplianceAssessmentProperties struct { - // Aggregative state based on the assessment's scanned resources states - State *State - - // READ-ONLY; Link to more detailed assessment results data. The response type will be according to the assessmentType field - AssessmentDetailsLink *string - - // READ-ONLY; The expected type of assessment contained in the AssessmentDetailsLink - AssessmentType *string - - // READ-ONLY; The description of the regulatory compliance assessment - Description *string - - // READ-ONLY; The given assessment's related resources count with failed state. - FailedResources *int32 - - // READ-ONLY; The given assessment's related resources count with passed state. - PassedResources *int32 - - // READ-ONLY; The given assessment's related resources count with skipped state. - SkippedResources *int32 - - // READ-ONLY; The given assessment's related resources count with unsupported state. - UnsupportedResources *int32 -} - -// RegulatoryComplianceControl - Regulatory compliance control details and state -type RegulatoryComplianceControl struct { - // Regulatory compliance control data - Properties *RegulatoryComplianceControlProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// RegulatoryComplianceControlList - List of regulatory compliance controls response -type RegulatoryComplianceControlList struct { - // REQUIRED; List of regulatory compliance controls - Value []*RegulatoryComplianceControl - - // READ-ONLY; The URI to fetch the next page. - NextLink *string -} - -// RegulatoryComplianceControlProperties - Regulatory compliance control data -type RegulatoryComplianceControlProperties struct { - // Aggregative state based on the control's supported assessments states - State *State - - // READ-ONLY; The description of the regulatory compliance control - Description *string - - // READ-ONLY; The number of supported regulatory compliance assessments of the given control with a failed state - FailedAssessments *int32 - - // READ-ONLY; The number of supported regulatory compliance assessments of the given control with a passed state - PassedAssessments *int32 - - // READ-ONLY; The number of supported regulatory compliance assessments of the given control with a skipped state - SkippedAssessments *int32 -} - -// RegulatoryComplianceStandard - Regulatory compliance standard details and state -type RegulatoryComplianceStandard struct { - // Regulatory compliance standard data - Properties *RegulatoryComplianceStandardProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// RegulatoryComplianceStandardList - List of regulatory compliance standards response -type RegulatoryComplianceStandardList struct { - // REQUIRED - Value []*RegulatoryComplianceStandard - - // READ-ONLY; The URI to fetch the next page. - NextLink *string -} - -// RegulatoryComplianceStandardProperties - Regulatory compliance standard data -type RegulatoryComplianceStandardProperties struct { - // Aggregative state based on the standard's supported controls states - State *State - - // READ-ONLY; The number of supported regulatory compliance controls of the given standard with a failed state - FailedControls *int32 - - // READ-ONLY; The number of supported regulatory compliance controls of the given standard with a passed state - PassedControls *int32 - - // READ-ONLY; The number of supported regulatory compliance controls of the given standard with a skipped state - SkippedControls *int32 - - // READ-ONLY; The number of regulatory compliance controls of the given standard which are unsupported by automated assessments - UnsupportedControls *int32 -} - -// Remediation details. -type Remediation struct { - // Is remediation automated. - Automated *bool - - // Remediation description. - Description *string - - // Optional link to remediate in Azure Portal. - PortalLink *string - - // Remediation script. - Scripts []*string -} - -// RemediationEta - The ETA (estimated time of arrival) for remediation -type RemediationEta struct { - // REQUIRED; ETA for remediation. - Eta *time.Time - - // REQUIRED; Justification for change of Eta. - 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 - - // 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 -} - -// 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}" - 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 -type ResourceDetails struct { - // 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 - ConnectorID *string - - // READ-ONLY; The azure id of the resource - ID *string -} - -// ResourceIdentifier - A resource identifier for an alert which can be used to direct the alert to the right product exposure -// group (tenant, workspace, subscription etc.). -type ResourceIdentifier struct { - // REQUIRED; There can be multiple identifiers of different type per alert, this field specify the identifier type. - Type *ResourceIdentifierType -} - -// 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 - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// RuleResultsInput - Rule results input. -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. - Results [][]*string -} - -// RuleResultsProperties - Rule results properties. -type RuleResultsProperties struct { - // Expected results in the baseline. - Results [][]*string -} - -// RulesResults - A list of rules results. -type RulesResults struct { - // List of rule results. - Value []*RuleResults -} - -// RulesResultsInput - Rules results input. -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. - Results map[string][][]*string -} - -// SQLServerVulnerabilityProperties - Details of the resource that was assessed -type SQLServerVulnerabilityProperties struct { - // REQUIRED; Sub-assessment resource type - AssessedResourceType *AssessedResourceType - - // READ-ONLY; The T-SQL query that runs on your SQL database to perform the particular check - Query *string - - // READ-ONLY; The resource type the sub assessment refers to in its resource details - Type *string -} - -// GetAdditionalData implements the AdditionalDataClassification interface for type SQLServerVulnerabilityProperties. -func (s *SQLServerVulnerabilityProperties) GetAdditionalData() *AdditionalData { - return &AdditionalData{ - AssessedResourceType: s.AssessedResourceType, - } -} - -// Scan - A vulnerability assessment scan record. -type Scan struct { - // A vulnerability assessment scan record properties. - Properties *ScanProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// ScanProperties - A vulnerability assessment scan record properties. -type ScanProperties struct { - // The database name. - Database *string - - // Scan results are valid until end time (UTC). - EndTime *time.Time - - // The number of failed rules with high severity. - HighSeverityFailedRulesCount *int32 - - // Baseline created for this database, and has one or more rules. - IsBaselineApplied *bool - - // Last scan time. - LastScanTime *time.Time - - // The number of failed rules with low severity. - LowSeverityFailedRulesCount *int32 - - // The number of failed rules with medium severity. - MediumSeverityFailedRulesCount *int32 - - // The SQL version. - SQLVersion *string - - // The server name. - Server *string - - // The scan start time (UTC). - StartTime *time.Time - - // The scan status. - State *ScanState - - // The number of total failed rules. - TotalFailedRulesCount *int32 - - // The number of total passed rules. - TotalPassedRulesCount *int32 - - // The number of total rules assessed. - TotalRulesCount *int32 - - // The scan trigger type. - TriggerType *ScanTriggerType -} - -// ScanResult - A vulnerability assessment scan result for a single rule. -type ScanResult struct { - // A vulnerability assessment scan result properties for a single rule. - Properties *ScanResultProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// ScanResultProperties - A vulnerability assessment scan result properties for a single rule. -type ScanResultProperties struct { - // The rule result adjusted with baseline. - BaselineAdjustedResult *BaselineAdjustedResult - - // Indicated whether the results specified here are trimmed. - IsTrimmed *bool - - // The results of the query that was run. - QueryResults [][]*string - - // Remediation details. - Remediation *Remediation - - // The rule Id. - RuleID *string - - // vulnerability assessment rule metadata details. - RuleMetadata *VaRule - - // The rule result status. - Status *RuleStatus -} - -// ScanResults - A list of vulnerability assessment scan results. -type ScanResults struct { - // List of vulnerability assessment scan results. - Value []*ScanResult -} - -// Scans - A list of vulnerability assessment scan records. -type Scans struct { - // List of vulnerability assessment scan records. - Value []*Scan -} - -// 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. - Field *string -} - -// ScoreDetails - Calculation result data -type ScoreDetails struct { - // READ-ONLY; Current score - Current *float64 - - // READ-ONLY; Maximum score available - Max *int32 - - // READ-ONLY; Ratio of the current score divided by the maximum. Rounded to 4 digits after the decimal point - Percentage *float64 -} - -// SecureScoreControlDefinitionItem - Information about the security control. -type SecureScoreControlDefinitionItem struct { - // Security Control Definition Properties. - Properties *SecureScoreControlDefinitionItemProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// SecureScoreControlDefinitionItemProperties - Security Control Definition Properties. -type SecureScoreControlDefinitionItemProperties struct { - // READ-ONLY; Array of assessments metadata IDs that are included in this security control - AssessmentDefinitions []*AzureResourceLink - - // READ-ONLY; User friendly description of the control - Description *string - - // READ-ONLY; User friendly display name of the control - DisplayName *string - - // READ-ONLY; Maximum control score (0..10) - MaxScore *int32 - - // READ-ONLY; Source object from which the control was created - Source *SecureScoreControlDefinitionSource -} - -// SecureScoreControlDefinitionList - List of security controls definition -type SecureScoreControlDefinitionList struct { - // READ-ONLY; The URI to fetch the next page. - NextLink *string - - // READ-ONLY; Collection of security controls definition in this page - Value []*SecureScoreControlDefinitionItem -} - -// SecureScoreControlDefinitionSource - The type of the security control (For example, BuiltIn) -type SecureScoreControlDefinitionSource struct { - // The type of security control (for example, BuiltIn) - SourceType *ControlType -} - -// SecureScoreControlDetails - Details of the security control, its score, and the health status of the relevant resources. -type SecureScoreControlDetails struct { - // Calculation result data in control level - Properties *SecureScoreControlScoreDetails - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// SecureScoreControlList - List of security controls -type SecureScoreControlList struct { - // READ-ONLY; 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 - - // READ-ONLY; User friendly display name of the control - DisplayName *string - - // READ-ONLY; Number of healthy resources in the control - HealthyResourceCount *int32 - - // 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 - - // READ-ONLY; The relative weight for this specific control in each of your subscriptions. Used when calculating an aggregated - // score for this control across all of your subscriptions. - Weight *int64 -} - -// SecureScoreItem - Secure score item data model -type SecureScoreItem struct { - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Secure score item - Properties *SecureScoreItemProperties - - // READ-ONLY; Resource type - Type *string -} - -// SecureScoreItemProperties - Describes properties of a calculated secure score. -type SecureScoreItemProperties struct { - // READ-ONLY; The initiative’s name - DisplayName *string - - // READ-ONLY; score object - Score *ScoreDetails - - // READ-ONLY; The relative weight for each subscription. Used when calculating an aggregated secure score for multiple subscriptions. - Weight *int64 -} - -// SecureScoresList - List of secure scores -type SecureScoresList struct { - // READ-ONLY; The URI to fetch the next page. - NextLink *string - - // READ-ONLY; Collection of secure scores in this page - Value []*SecureScoreItem -} - -// SensitiveDataDiscoveryProperties - Properties of Sensitive Data Discovery. -type SensitiveDataDiscoveryProperties struct { - // Indicates whether Sensitive Data Discovery should be enabled. - IsEnabled *bool - - // READ-ONLY; Upon failure or partial success. Additional data describing Sensitive Data Discovery enable/disable operation. - OperationStatus *OperationStatus -} - -// SensitivityLabel - The sensitivity label. -type SensitivityLabel struct { - // The description of the sensitivity label. - Description *string - - // The name of the sensitivity label. - DisplayName *string - - // Indicates whether the label is enabled or not. - Enabled *bool - - // The order of the sensitivity label. - Order *int32 - - // The rank of the sensitivity label. - Rank *Rank -} - -// ServerVulnerabilityAssessment - Describes the server vulnerability assessment details on a resource -type ServerVulnerabilityAssessment struct { - // describes ServerVulnerabilityAssessment properties. - Properties *ServerVulnerabilityAssessmentProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// ServerVulnerabilityAssessmentProperties - describes ServerVulnerabilityAssessment properties. -type ServerVulnerabilityAssessmentProperties struct { - // READ-ONLY; The provisioningState of the vulnerability assessment capability on the VM - ProvisioningState *ServerVulnerabilityAssessmentPropertiesProvisioningState -} - -// ServerVulnerabilityAssessmentsAzureSettingProperties - Describes the vulnerability assessments setting properties on Azure -// servers in the defined scope. -type ServerVulnerabilityAssessmentsAzureSettingProperties struct { - // REQUIRED; The selected vulnerability assessments provider on Azure servers in the defined scope. - SelectedProvider *ServerVulnerabilityAssessmentsAzureSettingSelectedProvider -} - -// ServerVulnerabilityAssessmentsList - List of server vulnerability assessments -type ServerVulnerabilityAssessmentsList struct { - Value []*ServerVulnerabilityAssessment -} - -// ServerVulnerabilityAssessmentsSetting - A base vulnerability assessments setting on servers in the defined scope. -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}" - 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 -} - -// GetServerVulnerabilityAssessmentsSetting implements the ServerVulnerabilityAssessmentsSettingClassification interface for -// type ServerVulnerabilityAssessmentsSetting. -func (s *ServerVulnerabilityAssessmentsSetting) GetServerVulnerabilityAssessmentsSetting() *ServerVulnerabilityAssessmentsSetting { - return s -} - -// ServerVulnerabilityAssessmentsSettingsList - A page of a server vulnerability assessments settings list -type ServerVulnerabilityAssessmentsSettingsList struct { - // READ-ONLY; The URI to fetch the next page - NextLink *string - - // READ-ONLY; A collection of server vulnerability assessments settings in this page - Value []ServerVulnerabilityAssessmentsSettingClassification -} - -// ServerVulnerabilityProperties - Additional context fields for server vulnerability assessment -type ServerVulnerabilityProperties struct { - // REQUIRED; Sub-assessment resource type - AssessedResourceType *AssessedResourceType - - // READ-ONLY; List of CVEs - Cve []*CVE - - // READ-ONLY; Dictionary from cvss version to cvss details object - Cvss map[string]*CVSS - - // READ-ONLY; Indicates whether a patch is available or not - Patchable *bool - - // READ-ONLY; Published time - PublishedTime *time.Time - - // READ-ONLY; Threat name - Threat *string - - // READ-ONLY; Vulnerability Type. e.g: Vulnerability, Potential Vulnerability, Information Gathered - Type *string - - // READ-ONLY - VendorReferences []*VendorReference -} - -// GetAdditionalData implements the AdditionalDataClassification interface for type ServerVulnerabilityProperties. -func (s *ServerVulnerabilityProperties) GetAdditionalData() *AdditionalData { - return &AdditionalData{ - AssessedResourceType: s.AssessedResourceType, - } -} - -// 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 - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// GetSetting implements the SettingClassification interface for type Setting. -func (s *Setting) GetSetting() *Setting { return s } - -// SettingsList - Subscription settings list. -type SettingsList struct { - // The settings list. - Value []SettingClassification - - // READ-ONLY; 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 -} - -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 - Name *string - - // READ-ONLY; Resource type - Type *string -} - -type SolutionList struct { - Value []*Solution - - // READ-ONLY; The URI to fetch the next page. - NextLink *string -} - -type SolutionProperties struct { - // REQUIRED; The security solutions' status - ProtectionStatus *string - - // REQUIRED; The security family provisioning State - ProvisioningState *ProvisioningState - - // REQUIRED; The security family of the security solution - SecurityFamily *SecurityFamily - - // REQUIRED; The security solutions' template - Template *string -} - -type SolutionsReferenceData struct { - // REQUIRED - Properties *SolutionsReferenceDataProperties - - // 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 -} - -type SolutionsReferenceDataList struct { - Value []*SolutionsReferenceData -} - -type SolutionsReferenceDataProperties struct { - // REQUIRED; The security solutions' vendor name - AlertVendorName *string - - // REQUIRED; The security solutions' package info url - PackageInfoURL *string - - // REQUIRED; The security solutions' product name - ProductName *string - - // REQUIRED; The security solutions' publisher - Publisher *string - - // REQUIRED; The security solutions' publisher display name - PublisherDisplayName *string - - // REQUIRED; The security family of the security solution - SecurityFamily *SecurityFamily - - // REQUIRED; The security solutions' template - Template *string -} - -// StatusAutoGenerated - The status of the health report -type StatusAutoGenerated 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. - Properties *SubAssessmentProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// SubAssessmentList - List of security sub-assessments -type SubAssessmentList struct { - // READ-ONLY; The URI to fetch the next page. - NextLink *string - - // READ-ONLY - Value []*SubAssessment -} - -// SubAssessmentProperties - Describes properties of an sub-assessment. -type SubAssessmentProperties struct { - // Details of the sub-assessment - AdditionalData AdditionalDataClassification - - // Details of the resource that was assessed - ResourceDetails ResourceDetailsClassification - - // Status of the sub-assessment - Status *SubAssessmentStatus - - // READ-ONLY; Category of the sub-assessment - Category *string - - // READ-ONLY; Human readable description of the assessment status - Description *string - - // READ-ONLY; User friendly display name of the sub-assessment - DisplayName *string - - // READ-ONLY; Vulnerability ID - ID *string - - // READ-ONLY; Description of the impact of this sub-assessment - Impact *string - - // READ-ONLY; Information on how to remediate this sub-assessment - Remediation *string - - // READ-ONLY; The date and time the sub-assessment was generated - TimeGenerated *time.Time -} - -// SubAssessmentStatus - Status of the sub-assessment -type SubAssessmentStatus struct { - // READ-ONLY; Programmatic code for the cause of the assessment status - Cause *string - - // READ-ONLY; Programmatic code for the status of the assessment - Code *SubAssessmentStatusCode - - // READ-ONLY; Human readable description of the assessment status - Description *string - - // READ-ONLY; The sub-assessment severity level - Severity *Severity -} - -type SuppressionAlertsScope struct { - // REQUIRED; All the conditions inside need to be true in order to suppress the alert - AllOf []*ScopeElement -} - -// SystemData - Metadata pertaining to creation and last modification of the resource. -type SystemData struct { - // The timestamp of resource creation (UTC). - CreatedAt *time.Time - - // The identity that created the resource. - CreatedBy *string - - // The type of identity that created the resource. - CreatedByType *CreatedByType - - // The timestamp of resource last modification (UTC) - LastModifiedAt *time.Time - - // The identity that last modified the resource. - LastModifiedBy *string - - // The type of identity that last modified the resource. - 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. - AnnotateDefaultBranch *AnnotateDefaultBranchState - - // Gets or sets branches that should have annotations. - BranchNames []*string -} - -// Task - Security task that we recommend to do in order to strengthen security -type Task struct { - // Describes properties of a task. - Properties *TaskProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// TaskList - List of security task recommendations -type TaskList struct { - // READ-ONLY; The URI to fetch the next page. - NextLink *string - - // READ-ONLY - 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 - Name *string -} - -// TaskProperties - Describes properties of a task. -type TaskProperties struct { - // Changing set of properties, depending on the task type that is derived from the name field - SecurityTaskParameters *TaskParameters - - // READ-ONLY; The time this task was discovered in UTC - CreationTimeUTC *time.Time - - // READ-ONLY; The time this task's details were last changed in UTC - LastStateChangeTimeUTC *time.Time - - // READ-ONLY; State of the task (Active, Resolved etc.) - State *string - - // READ-ONLY; Additional data on the state of the task - SubState *string -} - -// ThresholdCustomAlertRule - A custom alert rule that checks if a value (depends on the custom alert type) is within the -// given range. -type ThresholdCustomAlertRule struct { - // REQUIRED; Status of the custom alert. - IsEnabled *bool - - // REQUIRED; The maximum threshold. - MaxThreshold *int32 - - // REQUIRED; The minimum threshold. - MinThreshold *int32 - - // REQUIRED; The type of the custom alert rule. - RuleType *string - - // READ-ONLY; The description of the custom alert. - Description *string - - // READ-ONLY; The display name of the custom alert. - DisplayName *string -} - -// GetCustomAlertRule implements the CustomAlertRuleClassification interface for type ThresholdCustomAlertRule. -func (t *ThresholdCustomAlertRule) GetCustomAlertRule() *CustomAlertRule { - return &CustomAlertRule{ - Description: t.Description, - DisplayName: t.DisplayName, - IsEnabled: t.IsEnabled, - RuleType: t.RuleType, - } -} - -// GetThresholdCustomAlertRule implements the ThresholdCustomAlertRuleClassification interface for type ThresholdCustomAlertRule. -func (t *ThresholdCustomAlertRule) GetThresholdCustomAlertRule() *ThresholdCustomAlertRule { return t } - -// TimeWindowCustomAlertRule - A custom alert rule that checks if the number of activities (depends on the custom alert type) -// in a time window is within the given range. -type TimeWindowCustomAlertRule struct { - // REQUIRED; Status of the custom alert. - IsEnabled *bool - - // REQUIRED; The maximum threshold. - MaxThreshold *int32 - - // REQUIRED; The minimum threshold. - MinThreshold *int32 - - // REQUIRED; The type of the custom alert rule. - RuleType *string - - // REQUIRED; The time window size in iso8601 format. - TimeWindowSize *string - - // READ-ONLY; The description of the custom alert. - Description *string - - // READ-ONLY; The display name of the custom alert. - DisplayName *string -} - -// GetCustomAlertRule implements the CustomAlertRuleClassification interface for type TimeWindowCustomAlertRule. -func (t *TimeWindowCustomAlertRule) GetCustomAlertRule() *CustomAlertRule { - return &CustomAlertRule{ - Description: t.Description, - DisplayName: t.DisplayName, - IsEnabled: t.IsEnabled, - RuleType: t.RuleType, - } -} - -// GetThresholdCustomAlertRule implements the ThresholdCustomAlertRuleClassification interface for type TimeWindowCustomAlertRule. -func (t *TimeWindowCustomAlertRule) GetThresholdCustomAlertRule() *ThresholdCustomAlertRule { - return &ThresholdCustomAlertRule{ - Description: t.Description, - DisplayName: t.DisplayName, - IsEnabled: t.IsEnabled, - MaxThreshold: t.MaxThreshold, - MinThreshold: t.MinThreshold, - RuleType: t.RuleType, - } -} - -// GetTimeWindowCustomAlertRule implements the TimeWindowCustomAlertRuleClassification interface for type TimeWindowCustomAlertRule. -func (t *TimeWindowCustomAlertRule) GetTimeWindowCustomAlertRule() *TimeWindowCustomAlertRule { - return t -} - -type TopologyList struct { - // READ-ONLY; The URI to fetch the next page. - NextLink *string - - // READ-ONLY - Value []*TopologyResource -} - -type TopologyResource struct { - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Location where the resource is stored - Location *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY - Properties *TopologyResourceProperties - - // READ-ONLY; Resource type - Type *string -} - -type TopologyResourceProperties struct { - // READ-ONLY; The UTC time on which the topology was calculated - CalculatedDateTime *time.Time - - // READ-ONLY; Azure resources which are part of this topology resource - TopologyResources []*TopologySingleResource -} - -type TopologySingleResource struct { - // READ-ONLY; Azure resources connected to this resource which are in lower level in the topology view - Children []*TopologySingleResourceChild - - // READ-ONLY; The location of this resource - Location *string - - // READ-ONLY; Indicates the resource connectivity level to the Internet (InternetFacing, Internal ,etc.) - NetworkZones *string - - // READ-ONLY; Azure resources connected to this resource which are in higher level in the topology view - Parents []*TopologySingleResourceParent - - // READ-ONLY; Indicates if the resource has security recommendations - RecommendationsExist *bool - - // READ-ONLY; Azure resource id - ResourceID *string - - // READ-ONLY; The security severity of the resource - Severity *string - - // READ-ONLY; Score of the resource based on its security severity - TopologyScore *int32 -} - -type TopologySingleResourceChild struct { - // READ-ONLY; Azure resource id which serves as child resource in topology view - ResourceID *string -} - -type TopologySingleResourceParent struct { - // READ-ONLY; Azure resource id which serves as parent resource in topology view - 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. - IsEnabled *bool - - // REQUIRED; The maximum threshold. - MaxThreshold *int32 - - // REQUIRED; The minimum threshold. - MinThreshold *int32 - - // REQUIRED; The type of the custom alert rule. - RuleType *string - - // REQUIRED; The time window size in iso8601 format. - TimeWindowSize *string - - // READ-ONLY; The description of the custom alert. - Description *string - - // READ-ONLY; The display name of the custom alert. - DisplayName *string -} - -// GetCustomAlertRule implements the CustomAlertRuleClassification interface for type TwinUpdatesNotInAllowedRange. -func (t *TwinUpdatesNotInAllowedRange) GetCustomAlertRule() *CustomAlertRule { - return &CustomAlertRule{ - Description: t.Description, - DisplayName: t.DisplayName, - IsEnabled: t.IsEnabled, - RuleType: t.RuleType, - } -} - -// GetThresholdCustomAlertRule implements the ThresholdCustomAlertRuleClassification interface for type TwinUpdatesNotInAllowedRange. -func (t *TwinUpdatesNotInAllowedRange) GetThresholdCustomAlertRule() *ThresholdCustomAlertRule { - return &ThresholdCustomAlertRule{ - Description: t.Description, - DisplayName: t.DisplayName, - IsEnabled: t.IsEnabled, - MaxThreshold: t.MaxThreshold, - MinThreshold: t.MinThreshold, - RuleType: t.RuleType, - } -} - -// GetTimeWindowCustomAlertRule implements the TimeWindowCustomAlertRuleClassification interface for type TwinUpdatesNotInAllowedRange. -func (t *TwinUpdatesNotInAllowedRange) GetTimeWindowCustomAlertRule() *TimeWindowCustomAlertRule { - return &TimeWindowCustomAlertRule{ - Description: t.Description, - DisplayName: t.DisplayName, - IsEnabled: t.IsEnabled, - MaxThreshold: t.MaxThreshold, - MinThreshold: t.MinThreshold, - RuleType: t.RuleType, - TimeWindowSize: t.TimeWindowSize, - } -} - -// UnauthorizedOperationsNotInAllowedRange - Number of unauthorized operations is not in allowed range. -type UnauthorizedOperationsNotInAllowedRange struct { - // REQUIRED; Status of the custom alert. - IsEnabled *bool - - // REQUIRED; The maximum threshold. - MaxThreshold *int32 - - // REQUIRED; The minimum threshold. - MinThreshold *int32 - - // REQUIRED; The type of the custom alert rule. - RuleType *string - - // REQUIRED; The time window size in iso8601 format. - TimeWindowSize *string - - // READ-ONLY; The description of the custom alert. - Description *string - - // READ-ONLY; The display name of the custom alert. - DisplayName *string -} - -// GetCustomAlertRule implements the CustomAlertRuleClassification interface for type UnauthorizedOperationsNotInAllowedRange. -func (u *UnauthorizedOperationsNotInAllowedRange) GetCustomAlertRule() *CustomAlertRule { - return &CustomAlertRule{ - Description: u.Description, - DisplayName: u.DisplayName, - IsEnabled: u.IsEnabled, - RuleType: u.RuleType, - } -} - -// GetThresholdCustomAlertRule implements the ThresholdCustomAlertRuleClassification interface for type UnauthorizedOperationsNotInAllowedRange. -func (u *UnauthorizedOperationsNotInAllowedRange) GetThresholdCustomAlertRule() *ThresholdCustomAlertRule { - return &ThresholdCustomAlertRule{ - Description: u.Description, - DisplayName: u.DisplayName, - IsEnabled: u.IsEnabled, - MaxThreshold: u.MaxThreshold, - MinThreshold: u.MinThreshold, - RuleType: u.RuleType, - } -} - -// GetTimeWindowCustomAlertRule implements the TimeWindowCustomAlertRuleClassification interface for type UnauthorizedOperationsNotInAllowedRange. -func (u *UnauthorizedOperationsNotInAllowedRange) GetTimeWindowCustomAlertRule() *TimeWindowCustomAlertRule { - return &TimeWindowCustomAlertRule{ - Description: u.Description, - DisplayName: u.DisplayName, - IsEnabled: u.IsEnabled, - MaxThreshold: u.MaxThreshold, - MinThreshold: u.MinThreshold, - RuleType: u.RuleType, - TimeWindowSize: u.TimeWindowSize, - } -} - -// UpdateIoTSecuritySolutionProperties - Update Security Solution setting data -type UpdateIoTSecuritySolutionProperties struct { - // List of the configuration status for each recommendation type. - RecommendationsConfiguration []*RecommendationConfigurationProperties - - // Properties of the IoT Security solution's user defined resources. - UserDefinedResources *UserDefinedResourcesProperties -} - -type UpdateIotSecuritySolutionData struct { - // Security Solution data - Properties *UpdateIoTSecuritySolutionProperties - - // Resource tags - Tags map[string]*string -} - -// UpdateSensitivitySettingsRequest - Request to update data sensitivity settings for sensitive data discovery -type UpdateSensitivitySettingsRequest struct { - // REQUIRED; List of selected sensitive info types' IDs. - SensitiveInfoTypesIDs []*string - - // The id of the sensitivity threshold label. Any label at or above this rank will be considered sensitive. - SensitivityThresholdLabelID *string - - // The order of the sensitivity threshold label. Any label at or above this order will be considered sensitive. If set to - // -1, sensitivity by labels is turned off - SensitivityThresholdLabelOrder *float32 -} - -// UserDefinedResourcesProperties - Properties of the IoT Security solution's user defined resources. -type UserDefinedResourcesProperties struct { - // REQUIRED; Azure Resource Graph query which represents the security solution's user defined resources. Required to start - // with "where type != "Microsoft.Devices/IotHubs"" - Query *string - - // REQUIRED; List of Azure subscription ids on which the user defined resources query should be executed. - 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 - ExclusionTags map[string]*string - - // The scanning mode for the VM scan. - 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. - BenchmarkReferences []*BenchmarkReference - - // The rule category. - Category *string - - // The rule description. - Description *string - - // The rule query details. - QueryCheck *QueryCheck - - // The rule rationale. - Rationale *string - - // The rule Id. - RuleID *string - - // The rule type. - RuleType *RuleType - - // The rule severity. - Severity *RuleSeverity - - // The rule title. - Title *string -} - -// VendorReference - Vendor reference -type VendorReference struct { - // READ-ONLY; Link url - Link *string - - // READ-ONLY; Link title - Title *string -} - -// WorkspaceSetting - Configures where to store the OMS agent data for workspaces under a scope -type WorkspaceSetting struct { - // Workspace setting data - Properties *WorkspaceSettingProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// WorkspaceSettingList - List of workspace settings response -type WorkspaceSettingList struct { - // REQUIRED; List of workspace settings - Value []*WorkspaceSetting - - // READ-ONLY; The URI to fetch the next page. - NextLink *string -} - -// WorkspaceSettingProperties - Workspace setting data -type WorkspaceSettingProperties struct { - // REQUIRED; All the VMs in this scope will send their security data to the mentioned workspace unless overridden by a setting - // with more specific scope - Scope *string - - // REQUIRED; The full Azure ID of the workspace to save the data in - WorkspaceID *string + // READ-ONLY; Upon failure or partial success. Additional data describing Sensitive Data Discovery enable/disable operation. + OperationStatus *OperationStatus } diff --git a/sdk/resourcemanager/security/armsecurity/models_serde.go b/sdk/resourcemanager/security/armsecurity/models_serde.go index 9510c747f9f0..51978c672f33 100644 --- a/sdk/resourcemanager/security/armsecurity/models_serde.go +++ b/sdk/resourcemanager/security/armsecurity/models_serde.go @@ -12,17988 +12,420 @@ import ( "encoding/json" "fmt" "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "reflect" ) -// MarshalJSON implements the json.Marshaller interface for type AADConnectivityStateAutoGenerated. -func (a AADConnectivityStateAutoGenerated) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type BlobsScanSummary. +func (b BlobsScanSummary) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "connectivityState", a.ConnectivityState) + 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 AADConnectivityStateAutoGenerated. -func (a *AADConnectivityStateAutoGenerated) UnmarshalJSON(data []byte) error { +// 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", 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) - populate(objectMap, "id", a.ID) - objectMap["kind"] = ExternalSecuritySolutionKindAAD - populate(objectMap, "location", a.Location) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AADExternalSecuritySolution. -func (a *AADExternalSecuritySolution) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &a.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AADSolutionProperties. -func (a AADSolutionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "connectivityState", a.ConnectivityState) - populate(objectMap, "deviceType", a.DeviceType) - populate(objectMap, "deviceVendor", a.DeviceVendor) - populate(objectMap, "workspace", a.Workspace) - if a.AdditionalProperties != nil { - for key, val := range a.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AADSolutionProperties. -func (a *AADSolutionProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "connectivityState": - err = unpopulate(val, "ConnectivityState", &a.ConnectivityState) - delete(rawMsg, key) - case "deviceType": - err = unpopulate(val, "DeviceType", &a.DeviceType) - delete(rawMsg, key) - case "deviceVendor": - err = unpopulate(val, "DeviceVendor", &a.DeviceVendor) - delete(rawMsg, key) - case "workspace": - err = unpopulate(val, "Workspace", &a.Workspace) - delete(rawMsg, key) - default: - if a.AdditionalProperties == nil { - a.AdditionalProperties = map[string]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 APICollection. -func (a APICollection) 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 APICollection. -func (a *APICollection) UnmarshalJSON(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 APICollectionList. -func (a APICollectionList) 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 APICollectionList. -func (a *APICollectionList) UnmarshalJSON(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 APICollectionProperties. -func (a APICollectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "baseUrl", a.BaseURL) - populate(objectMap, "discoveredVia", a.DiscoveredVia) - populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "numberOfApiEndpoints", a.NumberOfAPIEndpoints) - populate(objectMap, "numberOfApiEndpointsWithSensitiveDataExposed", a.NumberOfAPIEndpointsWithSensitiveDataExposed) - populate(objectMap, "numberOfExternalApiEndpoints", a.NumberOfExternalAPIEndpoints) - populate(objectMap, "numberOfInactiveApiEndpoints", a.NumberOfInactiveAPIEndpoints) - populate(objectMap, "numberOfUnauthenticatedApiEndpoints", a.NumberOfUnauthenticatedAPIEndpoints) - populate(objectMap, "provisioningState", a.ProvisioningState) - populate(objectMap, "sensitivityLabel", a.SensitivityLabel) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type APICollectionProperties. -func (a *APICollectionProperties) UnmarshalJSON(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 "baseUrl": - err = unpopulate(val, "BaseURL", &a.BaseURL) - delete(rawMsg, key) - case "discoveredVia": - err = unpopulate(val, "DiscoveredVia", &a.DiscoveredVia) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &a.DisplayName) - delete(rawMsg, key) - case "numberOfApiEndpoints": - err = unpopulate(val, "NumberOfAPIEndpoints", &a.NumberOfAPIEndpoints) - delete(rawMsg, key) - case "numberOfApiEndpointsWithSensitiveDataExposed": - err = unpopulate(val, "NumberOfAPIEndpointsWithSensitiveDataExposed", &a.NumberOfAPIEndpointsWithSensitiveDataExposed) - delete(rawMsg, key) - case "numberOfExternalApiEndpoints": - err = unpopulate(val, "NumberOfExternalAPIEndpoints", &a.NumberOfExternalAPIEndpoints) - delete(rawMsg, key) - case "numberOfInactiveApiEndpoints": - err = unpopulate(val, "NumberOfInactiveAPIEndpoints", &a.NumberOfInactiveAPIEndpoints) - delete(rawMsg, key) - case "numberOfUnauthenticatedApiEndpoints": - err = unpopulate(val, "NumberOfUnauthenticatedAPIEndpoints", &a.NumberOfUnauthenticatedAPIEndpoints) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) - delete(rawMsg, key) - case "sensitivityLabel": - err = unpopulate(val, "SensitivityLabel", &a.SensitivityLabel) - 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) - populate(objectMap, "branchConfiguration", a.BranchConfiguration) - populate(objectMap, "categoryConfigurations", a.CategoryConfigurations) - populate(objectMap, "inheritFromParentState", a.InheritFromParentState) - populate(objectMap, "state", a.State) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ActionableRemediation. -func (a *ActionableRemediation) UnmarshalJSON(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 "branchConfiguration": - err = unpopulate(val, "BranchConfiguration", &a.BranchConfiguration) - delete(rawMsg, key) - case "categoryConfigurations": - err = unpopulate(val, "CategoryConfigurations", &a.CategoryConfigurations) - delete(rawMsg, key) - case "inheritFromParentState": - err = unpopulate(val, "InheritFromParentState", &a.InheritFromParentState) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &a.State) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ActiveConnectionsNotInAllowedRange. -func (a ActiveConnectionsNotInAllowedRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", a.Description) - populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "isEnabled", a.IsEnabled) - populate(objectMap, "maxThreshold", a.MaxThreshold) - populate(objectMap, "minThreshold", a.MinThreshold) - objectMap["ruleType"] = "ActiveConnectionsNotInAllowedRange" - populate(objectMap, "timeWindowSize", a.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ActiveConnectionsNotInAllowedRange. -func (a *ActiveConnectionsNotInAllowedRange) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &a.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &a.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &a.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &a.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &a.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &a.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &a.TimeWindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AdaptiveApplicationControlGroup. -func (a AdaptiveApplicationControlGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AdaptiveApplicationControlGroup. -func (a *AdaptiveApplicationControlGroup) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &a.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AdaptiveApplicationControlGroupData. -func (a AdaptiveApplicationControlGroupData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AdaptiveApplicationControlGroupData. -func (a *AdaptiveApplicationControlGroupData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "configurationStatus": - err = unpopulate(val, "ConfigurationStatus", &a.ConfigurationStatus) - delete(rawMsg, key) - case "enforcementMode": - err = unpopulate(val, "EnforcementMode", &a.EnforcementMode) - delete(rawMsg, key) - case "issues": - err = unpopulate(val, "Issues", &a.Issues) - delete(rawMsg, key) - case "pathRecommendations": - err = unpopulate(val, "PathRecommendations", &a.PathRecommendations) - delete(rawMsg, key) - case "protectionMode": - err = unpopulate(val, "ProtectionMode", &a.ProtectionMode) - delete(rawMsg, key) - case "recommendationStatus": - err = unpopulate(val, "RecommendationStatus", &a.RecommendationStatus) - delete(rawMsg, key) - case "sourceSystem": - err = unpopulate(val, "SourceSystem", &a.SourceSystem) - delete(rawMsg, key) - case "vmRecommendations": - err = unpopulate(val, "VMRecommendations", &a.VMRecommendations) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AdaptiveApplicationControlGroups. -func (a AdaptiveApplicationControlGroups) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AdaptiveApplicationControlIssueSummary. -func (a AdaptiveApplicationControlIssueSummary) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "issue", a.Issue) - populate(objectMap, "numberOfVms", a.NumberOfVMs) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AdaptiveApplicationControlIssueSummary. -func (a *AdaptiveApplicationControlIssueSummary) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "issue": - err = unpopulate(val, "Issue", &a.Issue) - delete(rawMsg, key) - case "numberOfVms": - err = unpopulate(val, "NumberOfVMs", &a.NumberOfVMs) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AdaptiveNetworkHardening. -func (a AdaptiveNetworkHardening) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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 AdaptiveNetworkHardening. -func (a *AdaptiveNetworkHardening) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AdaptiveNetworkHardeningEnforceRequest. -func (a AdaptiveNetworkHardeningEnforceRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "networkSecurityGroups", a.NetworkSecurityGroups) - populate(objectMap, "rules", a.Rules) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AdaptiveNetworkHardeningEnforceRequest. -func (a *AdaptiveNetworkHardeningEnforceRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "networkSecurityGroups": - err = unpopulate(val, "NetworkSecurityGroups", &a.NetworkSecurityGroups) - delete(rawMsg, key) - case "rules": - err = unpopulate(val, "Rules", &a.Rules) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AdaptiveNetworkHardeningProperties. -func (a AdaptiveNetworkHardeningProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "effectiveNetworkSecurityGroups", a.EffectiveNetworkSecurityGroups) - populate(objectMap, "rules", a.Rules) - populateDateTimeRFC3339(objectMap, "rulesCalculationTime", a.RulesCalculationTime) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AdaptiveNetworkHardeningProperties. -func (a *AdaptiveNetworkHardeningProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "effectiveNetworkSecurityGroups": - err = unpopulate(val, "EffectiveNetworkSecurityGroups", &a.EffectiveNetworkSecurityGroups) - delete(rawMsg, key) - case "rules": - err = unpopulate(val, "Rules", &a.Rules) - delete(rawMsg, key) - case "rulesCalculationTime": - err = unpopulateDateTimeRFC3339(val, "RulesCalculationTime", &a.RulesCalculationTime) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AdaptiveNetworkHardeningsList. -func (a AdaptiveNetworkHardeningsList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AdaptiveNetworkHardeningsList. -func (a *AdaptiveNetworkHardeningsList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &a.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &a.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AdditionalData. -func (a AdditionalData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["assessedResourceType"] = a.AssessedResourceType - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AdditionalData. -func (a *AdditionalData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "assessedResourceType": - err = unpopulate(val, "AssessedResourceType", &a.AssessedResourceType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AdditionalWorkspacesProperties. -func (a AdditionalWorkspacesProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataTypes", a.DataTypes) - populate(objectMap, "type", a.Type) - populate(objectMap, "workspace", a.Workspace) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AdditionalWorkspacesProperties. -func (a *AdditionalWorkspacesProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataTypes": - err = unpopulate(val, "DataTypes", &a.DataTypes) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - case "workspace": - err = unpopulate(val, "Workspace", &a.Workspace) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AdvancedThreatProtectionProperties. -func (a AdvancedThreatProtectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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) - delete(rawMsg, key) - case "alertUri": - err = unpopulate(val, "AlertURI", &a.AlertURI) - delete(rawMsg, key) - case "compromisedEntity": - err = unpopulate(val, "CompromisedEntity", &a.CompromisedEntity) - delete(rawMsg, key) - case "correlationKey": - err = unpopulate(val, "CorrelationKey", &a.CorrelationKey) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &a.Description) - delete(rawMsg, key) - case "endTimeUtc": - err = unpopulateDateTimeRFC3339(val, "EndTimeUTC", &a.EndTimeUTC) - delete(rawMsg, key) - case "entities": - err = unpopulate(val, "Entities", &a.Entities) - delete(rawMsg, key) - case "extendedLinks": - err = unpopulate(val, "ExtendedLinks", &a.ExtendedLinks) - delete(rawMsg, key) - case "extendedProperties": - err = unpopulate(val, "ExtendedProperties", &a.ExtendedProperties) - delete(rawMsg, key) - case "intent": - err = unpopulate(val, "Intent", &a.Intent) - delete(rawMsg, key) - case "isIncident": - err = unpopulate(val, "IsIncident", &a.IsIncident) - delete(rawMsg, key) - case "processingEndTimeUtc": - err = unpopulateDateTimeRFC3339(val, "ProcessingEndTimeUTC", &a.ProcessingEndTimeUTC) - delete(rawMsg, key) - case "productComponentName": - err = unpopulate(val, "ProductComponentName", &a.ProductComponentName) - delete(rawMsg, key) - case "productName": - err = unpopulate(val, "ProductName", &a.ProductName) - delete(rawMsg, key) - case "remediationSteps": - err = unpopulate(val, "RemediationSteps", &a.RemediationSteps) - delete(rawMsg, key) - case "resourceIdentifiers": - a.ResourceIdentifiers, err = unmarshalResourceIdentifierClassificationArray(val) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &a.Severity) - delete(rawMsg, key) - case "startTimeUtc": - err = unpopulateDateTimeRFC3339(val, "StartTimeUTC", &a.StartTimeUTC) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &a.Status) - delete(rawMsg, key) - case "subTechniques": - err = unpopulate(val, "SubTechniques", &a.SubTechniques) - delete(rawMsg, key) - case "supportingEvidence": - err = unpopulate(val, "SupportingEvidence", &a.SupportingEvidence) - delete(rawMsg, key) - case "systemAlertId": - err = unpopulate(val, "SystemAlertID", &a.SystemAlertID) - delete(rawMsg, key) - case "techniques": - err = unpopulate(val, "Techniques", &a.Techniques) - delete(rawMsg, key) - case "timeGeneratedUtc": - err = unpopulateDateTimeRFC3339(val, "TimeGeneratedUTC", &a.TimeGeneratedUTC) - delete(rawMsg, key) - case "vendorName": - err = unpopulate(val, "VendorName", &a.VendorName) - delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &a.Version) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AlertPropertiesSupportingEvidence. -func (a AlertPropertiesSupportingEvidence) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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 AlertPropertiesSupportingEvidence. -func (a *AlertPropertiesSupportingEvidence) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - default: - if a.AdditionalProperties == nil { - a.AdditionalProperties = map[string]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 AlertSimulatorBundlesRequestProperties. -func (a AlertSimulatorBundlesRequestProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "bundles", a.Bundles) - objectMap["kind"] = KindBundles - if a.AdditionalProperties != nil { - for key, val := range a.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertSimulatorBundlesRequestProperties. -func (a *AlertSimulatorBundlesRequestProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "bundles": - err = unpopulate(val, "Bundles", &a.Bundles) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - default: - if a.AdditionalProperties == nil { - a.AdditionalProperties = map[string]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 AlertSimulatorRequestBody. -func (a AlertSimulatorRequestBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "properties", a.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertSimulatorRequestBody. -func (a *AlertSimulatorRequestBody) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "properties": - a.Properties, err = unmarshalAlertSimulatorRequestPropertiesClassification(val) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AlertSimulatorRequestProperties. -func (a AlertSimulatorRequestProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["kind"] = a.Kind - if a.AdditionalProperties != nil { - for key, val := range a.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertSimulatorRequestProperties. -func (a *AlertSimulatorRequestProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - default: - if a.AdditionalProperties == nil { - a.AdditionalProperties = map[string]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 AlertSyncSettingProperties. -func (a AlertSyncSettingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "enabled", a.Enabled) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertSyncSettingProperties. -func (a *AlertSyncSettingProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "enabled": - err = unpopulate(val, "Enabled", &a.Enabled) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AlertSyncSettings. -func (a AlertSyncSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", a.ID) - objectMap["kind"] = SettingKindAlertSyncSettings - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertSyncSettings. -func (a *AlertSyncSettings) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AlertsSuppressionRule. -func (a AlertsSuppressionRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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 AlertsSuppressionRule. -func (a *AlertsSuppressionRule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AlertsSuppressionRuleProperties. -func (a AlertsSuppressionRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "alertType", a.AlertType) - populate(objectMap, "comment", a.Comment) - populateDateTimeRFC3339(objectMap, "expirationDateUtc", a.ExpirationDateUTC) - populateDateTimeRFC3339(objectMap, "lastModifiedUtc", a.LastModifiedUTC) - populate(objectMap, "reason", a.Reason) - populate(objectMap, "state", a.State) - populate(objectMap, "suppressionAlertsScope", a.SuppressionAlertsScope) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertsSuppressionRuleProperties. -func (a *AlertsSuppressionRuleProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "alertType": - err = unpopulate(val, "AlertType", &a.AlertType) - delete(rawMsg, key) - case "comment": - err = unpopulate(val, "Comment", &a.Comment) - delete(rawMsg, key) - case "expirationDateUtc": - err = unpopulateDateTimeRFC3339(val, "ExpirationDateUTC", &a.ExpirationDateUTC) - delete(rawMsg, key) - case "lastModifiedUtc": - err = unpopulateDateTimeRFC3339(val, "LastModifiedUTC", &a.LastModifiedUTC) - delete(rawMsg, key) - case "reason": - err = unpopulate(val, "Reason", &a.Reason) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &a.State) - delete(rawMsg, key) - case "suppressionAlertsScope": - err = unpopulate(val, "SuppressionAlertsScope", &a.SuppressionAlertsScope) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AlertsSuppressionRulesList. -func (a AlertsSuppressionRulesList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertsSuppressionRulesList. -func (a *AlertsSuppressionRulesList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &a.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &a.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AllowedConnectionsList. -func (a AllowedConnectionsList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AllowedConnectionsList. -func (a *AllowedConnectionsList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &a.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &a.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AllowedConnectionsResource. -func (a AllowedConnectionsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AllowedConnectionsResource. -func (a *AllowedConnectionsResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &a.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AllowedConnectionsResourceProperties. -func (a AllowedConnectionsResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "calculatedDateTime", a.CalculatedDateTime) - populate(objectMap, "connectableResources", a.ConnectableResources) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AllowedConnectionsResourceProperties. -func (a *AllowedConnectionsResourceProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "calculatedDateTime": - err = unpopulateDateTimeRFC3339(val, "CalculatedDateTime", &a.CalculatedDateTime) - delete(rawMsg, key) - case "connectableResources": - err = unpopulate(val, "ConnectableResources", &a.ConnectableResources) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AllowlistCustomAlertRule. -func (a AllowlistCustomAlertRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "allowlistValues", a.AllowlistValues) - populate(objectMap, "description", a.Description) - populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "isEnabled", a.IsEnabled) - objectMap["ruleType"] = "AllowlistCustomAlertRule" - populate(objectMap, "valueType", a.ValueType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AllowlistCustomAlertRule. -func (a *AllowlistCustomAlertRule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "allowlistValues": - err = unpopulate(val, "AllowlistValues", &a.AllowlistValues) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &a.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &a.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &a.IsEnabled) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &a.RuleType) - delete(rawMsg, key) - case "valueType": - err = unpopulate(val, "ValueType", &a.ValueType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AmqpC2DMessagesNotInAllowedRange. -func (a AmqpC2DMessagesNotInAllowedRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", a.Description) - populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "isEnabled", a.IsEnabled) - populate(objectMap, "maxThreshold", a.MaxThreshold) - populate(objectMap, "minThreshold", a.MinThreshold) - objectMap["ruleType"] = "AmqpC2DMessagesNotInAllowedRange" - populate(objectMap, "timeWindowSize", a.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AmqpC2DMessagesNotInAllowedRange. -func (a *AmqpC2DMessagesNotInAllowedRange) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &a.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &a.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &a.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &a.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &a.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &a.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &a.TimeWindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AmqpC2DRejectedMessagesNotInAllowedRange. -func (a AmqpC2DRejectedMessagesNotInAllowedRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", a.Description) - populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "isEnabled", a.IsEnabled) - populate(objectMap, "maxThreshold", a.MaxThreshold) - populate(objectMap, "minThreshold", a.MinThreshold) - objectMap["ruleType"] = "AmqpC2DRejectedMessagesNotInAllowedRange" - populate(objectMap, "timeWindowSize", a.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AmqpC2DRejectedMessagesNotInAllowedRange. -func (a *AmqpC2DRejectedMessagesNotInAllowedRange) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &a.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &a.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &a.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &a.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &a.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &a.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &a.TimeWindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AmqpD2CMessagesNotInAllowedRange. -func (a AmqpD2CMessagesNotInAllowedRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", a.Description) - populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "isEnabled", a.IsEnabled) - populate(objectMap, "maxThreshold", a.MaxThreshold) - populate(objectMap, "minThreshold", a.MinThreshold) - objectMap["ruleType"] = "AmqpD2CMessagesNotInAllowedRange" - populate(objectMap, "timeWindowSize", a.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AmqpD2CMessagesNotInAllowedRange. -func (a *AmqpD2CMessagesNotInAllowedRange) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &a.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &a.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &a.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &a.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &a.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &a.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &a.TimeWindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Application. -func (a Application) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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 Application. -func (a *Application) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ApplicationCondition. -func (a ApplicationCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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) { - objectMap := make(map[string]any) - populate(objectMap, "conditionSets", a.ConditionSets) - populate(objectMap, "description", a.Description) - populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "sourceResourceType", a.SourceResourceType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationProperties. -func (a *ApplicationProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "conditionSets": - err = unpopulate(val, "ConditionSets", &a.ConditionSets) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &a.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &a.DisplayName) - delete(rawMsg, key) - case "sourceResourceType": - err = unpopulate(val, "SourceResourceType", &a.SourceResourceType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ApplicationsList. -func (a ApplicationsList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationsList. -func (a *ApplicationsList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &a.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &a.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ArcAutoProvisioning. -func (a ArcAutoProvisioning) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "configuration", a.Configuration) - populate(objectMap, "enabled", a.Enabled) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ArcAutoProvisioning. -func (a *ArcAutoProvisioning) UnmarshalJSON(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 "configuration": - err = unpopulate(val, "Configuration", &a.Configuration) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &a.Enabled) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ArcAutoProvisioningAws. -func (a ArcAutoProvisioningAws) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "cloudRoleArn", a.CloudRoleArn) - populate(objectMap, "configuration", a.Configuration) - populate(objectMap, "enabled", a.Enabled) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ArcAutoProvisioningAws. -func (a *ArcAutoProvisioningAws) UnmarshalJSON(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 "cloudRoleArn": - err = unpopulate(val, "CloudRoleArn", &a.CloudRoleArn) - delete(rawMsg, key) - case "configuration": - err = unpopulate(val, "Configuration", &a.Configuration) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &a.Enabled) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ArcAutoProvisioningConfiguration. -func (a ArcAutoProvisioningConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "privateLinkScope", a.PrivateLinkScope) - populate(objectMap, "proxy", a.Proxy) - return json.Marshal(objectMap) -} - -// 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) - } - for key, val := range rawMsg { - var err error - switch key { - case "privateLinkScope": - err = unpopulate(val, "PrivateLinkScope", &a.PrivateLinkScope) - delete(rawMsg, key) - case "proxy": - err = unpopulate(val, "Proxy", &a.Proxy) - 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 ArcAutoProvisioningGcp. -func (a ArcAutoProvisioningGcp) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "configuration", a.Configuration) - populate(objectMap, "enabled", a.Enabled) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ArcAutoProvisioningGcp. -func (a *ArcAutoProvisioningGcp) UnmarshalJSON(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 "configuration": - err = unpopulate(val, "Configuration", &a.Configuration) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &a.Enabled) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AscLocation. -func (a AscLocation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", a.ID) - populate(objectMap, "name", a.Name) - populateAny(objectMap, "properties", a.Properties) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AscLocation. -func (a *AscLocation) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AscLocationList. -func (a AscLocationList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AscLocationList. -func (a *AscLocationList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &a.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &a.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Assessment. -func (a Assessment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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 Assessment. -func (a *Assessment) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AssessmentLinks. -func (a AssessmentLinks) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "azurePortalUri", a.AzurePortalURI) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentLinks. -func (a *AssessmentLinks) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "azurePortalUri": - err = unpopulate(val, "AzurePortalURI", &a.AzurePortalURI) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AssessmentList. -func (a AssessmentList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentList. -func (a *AssessmentList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &a.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &a.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AssessmentMetadata. -func (a AssessmentMetadata) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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) - populate(objectMap, "partnerName", a.PartnerName) - populate(objectMap, "productName", a.ProductName) - populate(objectMap, "secret", a.Secret) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentMetadataPartnerData. -func (a *AssessmentMetadataPartnerData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "partnerName": - err = unpopulate(val, "PartnerName", &a.PartnerName) - delete(rawMsg, key) - case "productName": - err = unpopulate(val, "ProductName", &a.ProductName) - delete(rawMsg, key) - case "secret": - err = unpopulate(val, "Secret", &a.Secret) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AssessmentMetadataProperties. -func (a AssessmentMetadataProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "assessmentType", a.AssessmentType) - populate(objectMap, "categories", a.Categories) - populate(objectMap, "description", a.Description) - populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "implementationEffort", a.ImplementationEffort) - populate(objectMap, "partnerData", a.PartnerData) - populate(objectMap, "policyDefinitionId", a.PolicyDefinitionID) - populate(objectMap, "preview", a.Preview) - populate(objectMap, "remediationDescription", a.RemediationDescription) - populate(objectMap, "severity", a.Severity) - populate(objectMap, "threats", a.Threats) - populate(objectMap, "userImpact", a.UserImpact) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentMetadataProperties. -func (a *AssessmentMetadataProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "assessmentType": - err = unpopulate(val, "AssessmentType", &a.AssessmentType) - delete(rawMsg, key) - case "categories": - err = unpopulate(val, "Categories", &a.Categories) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &a.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &a.DisplayName) - delete(rawMsg, key) - case "implementationEffort": - err = unpopulate(val, "ImplementationEffort", &a.ImplementationEffort) - delete(rawMsg, key) - case "partnerData": - err = unpopulate(val, "PartnerData", &a.PartnerData) - delete(rawMsg, key) - case "policyDefinitionId": - err = unpopulate(val, "PolicyDefinitionID", &a.PolicyDefinitionID) - delete(rawMsg, key) - case "preview": - err = unpopulate(val, "Preview", &a.Preview) - delete(rawMsg, key) - case "remediationDescription": - err = unpopulate(val, "RemediationDescription", &a.RemediationDescription) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &a.Severity) - delete(rawMsg, key) - case "threats": - err = unpopulate(val, "Threats", &a.Threats) - delete(rawMsg, key) - case "userImpact": - err = unpopulate(val, "UserImpact", &a.UserImpact) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AssessmentMetadataPropertiesResponse. -func (a AssessmentMetadataPropertiesResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "assessmentType", a.AssessmentType) - populate(objectMap, "categories", a.Categories) - populate(objectMap, "description", a.Description) - populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "implementationEffort", a.ImplementationEffort) - populate(objectMap, "partnerData", a.PartnerData) - populate(objectMap, "plannedDeprecationDate", a.PlannedDeprecationDate) - populate(objectMap, "policyDefinitionId", a.PolicyDefinitionID) - populate(objectMap, "preview", a.Preview) - populate(objectMap, "publishDates", a.PublishDates) - populate(objectMap, "remediationDescription", a.RemediationDescription) - populate(objectMap, "severity", a.Severity) - populate(objectMap, "tactics", a.Tactics) - populate(objectMap, "techniques", a.Techniques) - populate(objectMap, "threats", a.Threats) - populate(objectMap, "userImpact", a.UserImpact) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentMetadataPropertiesResponse. -func (a *AssessmentMetadataPropertiesResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "assessmentType": - err = unpopulate(val, "AssessmentType", &a.AssessmentType) - delete(rawMsg, key) - case "categories": - err = unpopulate(val, "Categories", &a.Categories) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &a.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &a.DisplayName) - delete(rawMsg, key) - case "implementationEffort": - err = unpopulate(val, "ImplementationEffort", &a.ImplementationEffort) - delete(rawMsg, key) - case "partnerData": - err = unpopulate(val, "PartnerData", &a.PartnerData) - delete(rawMsg, key) - case "plannedDeprecationDate": - err = unpopulate(val, "PlannedDeprecationDate", &a.PlannedDeprecationDate) - delete(rawMsg, key) - case "policyDefinitionId": - err = unpopulate(val, "PolicyDefinitionID", &a.PolicyDefinitionID) - delete(rawMsg, key) - case "preview": - err = unpopulate(val, "Preview", &a.Preview) - delete(rawMsg, key) - case "publishDates": - err = unpopulate(val, "PublishDates", &a.PublishDates) - delete(rawMsg, key) - case "remediationDescription": - err = unpopulate(val, "RemediationDescription", &a.RemediationDescription) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &a.Severity) - delete(rawMsg, key) - case "tactics": - err = unpopulate(val, "Tactics", &a.Tactics) - delete(rawMsg, key) - case "techniques": - err = unpopulate(val, "Techniques", &a.Techniques) - delete(rawMsg, key) - case "threats": - err = unpopulate(val, "Threats", &a.Threats) - delete(rawMsg, key) - case "userImpact": - err = unpopulate(val, "UserImpact", &a.UserImpact) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AssessmentMetadataPropertiesResponsePublishDates. -func (a AssessmentMetadataPropertiesResponsePublishDates) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "GA", a.GA) - populate(objectMap, "public", a.Public) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentMetadataPropertiesResponsePublishDates. -func (a *AssessmentMetadataPropertiesResponsePublishDates) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "GA": - err = unpopulate(val, "GA", &a.GA) - delete(rawMsg, key) - case "public": - err = unpopulate(val, "Public", &a.Public) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AssessmentMetadataResponse. -func (a AssessmentMetadataResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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 AssessmentMetadataResponse. -func (a *AssessmentMetadataResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AssessmentMetadataResponseList. -func (a AssessmentMetadataResponseList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentMetadataResponseList. -func (a *AssessmentMetadataResponseList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &a.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &a.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AssessmentPartnerData. -func (a AssessmentPartnerData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "partnerName", a.PartnerName) - populate(objectMap, "secret", a.Secret) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentPartnerData. -func (a *AssessmentPartnerData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "partnerName": - err = unpopulate(val, "PartnerName", &a.PartnerName) - delete(rawMsg, key) - case "secret": - err = unpopulate(val, "Secret", &a.Secret) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AssessmentProperties. -func (a AssessmentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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, "status", a.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentProperties. -func (a *AssessmentProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "additionalData": - err = unpopulate(val, "AdditionalData", &a.AdditionalData) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &a.DisplayName) - delete(rawMsg, key) - case "links": - err = unpopulate(val, "Links", &a.Links) - delete(rawMsg, key) - case "metadata": - err = unpopulate(val, "Metadata", &a.Metadata) - delete(rawMsg, key) - case "partnersData": - err = unpopulate(val, "PartnersData", &a.PartnersData) - delete(rawMsg, key) - case "resourceDetails": - a.ResourceDetails, err = unmarshalResourceDetailsClassification(val) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &a.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AssessmentPropertiesBase. -func (a AssessmentPropertiesBase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentPropertiesBase. -func (a *AssessmentPropertiesBase) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "additionalData": - err = unpopulate(val, "AdditionalData", &a.AdditionalData) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &a.DisplayName) - delete(rawMsg, key) - case "links": - err = unpopulate(val, "Links", &a.Links) - delete(rawMsg, key) - case "metadata": - err = unpopulate(val, "Metadata", &a.Metadata) - delete(rawMsg, key) - case "partnersData": - err = unpopulate(val, "PartnersData", &a.PartnersData) - delete(rawMsg, key) - case "resourceDetails": - a.ResourceDetails, err = unmarshalResourceDetailsClassification(val) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AssessmentPropertiesResponse. -func (a AssessmentPropertiesResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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, "status", a.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentPropertiesResponse. -func (a *AssessmentPropertiesResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "additionalData": - err = unpopulate(val, "AdditionalData", &a.AdditionalData) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &a.DisplayName) - delete(rawMsg, key) - case "links": - err = unpopulate(val, "Links", &a.Links) - delete(rawMsg, key) - case "metadata": - err = unpopulate(val, "Metadata", &a.Metadata) - delete(rawMsg, key) - case "partnersData": - err = unpopulate(val, "PartnersData", &a.PartnersData) - delete(rawMsg, key) - case "resourceDetails": - a.ResourceDetails, err = unmarshalResourceDetailsClassification(val) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &a.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AssessmentResponse. -func (a AssessmentResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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 AssessmentResponse. -func (a *AssessmentResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AssessmentStatus. -func (a AssessmentStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "cause", a.Cause) - populate(objectMap, "code", a.Code) - populate(objectMap, "description", a.Description) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentStatus. -func (a *AssessmentStatus) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "cause": - err = unpopulate(val, "Cause", &a.Cause) - delete(rawMsg, key) - case "code": - err = unpopulate(val, "Code", &a.Code) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &a.Description) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AssessmentStatusResponse. -func (a AssessmentStatusResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - 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) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentStatusResponse. -func (a *AssessmentStatusResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "cause": - err = unpopulate(val, "Cause", &a.Cause) - delete(rawMsg, key) - case "code": - err = unpopulate(val, "Code", &a.Code) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &a.Description) - delete(rawMsg, key) - case "firstEvaluationDate": - err = unpopulateDateTimeRFC3339(val, "FirstEvaluationDate", &a.FirstEvaluationDate) - delete(rawMsg, key) - case "statusChangeDate": - err = unpopulateDateTimeRFC3339(val, "StatusChangeDate", &a.StatusChangeDate) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AtaExternalSecuritySolution. -func (a AtaExternalSecuritySolution) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AtaExternalSecuritySolution. -func (a *AtaExternalSecuritySolution) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &a.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AtaSolutionProperties. -func (a AtaSolutionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "deviceType", a.DeviceType) - populate(objectMap, "deviceVendor", a.DeviceVendor) - populate(objectMap, "lastEventReceived", a.LastEventReceived) - populate(objectMap, "workspace", a.Workspace) - if a.AdditionalProperties != nil { - for key, val := range a.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AtaSolutionProperties. -func (a *AtaSolutionProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "deviceType": - err = unpopulate(val, "DeviceType", &a.DeviceType) - delete(rawMsg, key) - case "deviceVendor": - err = unpopulate(val, "DeviceVendor", &a.DeviceVendor) - delete(rawMsg, key) - case "lastEventReceived": - err = unpopulate(val, "LastEventReceived", &a.LastEventReceived) - delete(rawMsg, key) - case "workspace": - err = unpopulate(val, "Workspace", &a.Workspace) - delete(rawMsg, key) - default: - if a.AdditionalProperties == nil { - a.AdditionalProperties = map[string]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 AuthenticationDetailsProperties. -func (a AuthenticationDetailsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "authenticationProvisioningState", a.AuthenticationProvisioningState) - objectMap["authenticationType"] = a.AuthenticationType - populate(objectMap, "grantedPermissions", a.GrantedPermissions) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AuthenticationDetailsProperties. -func (a *AuthenticationDetailsProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "authenticationProvisioningState": - err = unpopulate(val, "AuthenticationProvisioningState", &a.AuthenticationProvisioningState) - delete(rawMsg, key) - case "authenticationType": - err = unpopulate(val, "AuthenticationType", &a.AuthenticationType) - delete(rawMsg, key) - case "grantedPermissions": - err = unpopulate(val, "GrantedPermissions", &a.GrantedPermissions) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Authorization. -func (a Authorization) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "code", a.Code) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Authorization. -func (a *Authorization) UnmarshalJSON(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 "code": - err = unpopulate(val, "Code", &a.Code) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AutoProvisioningSetting. -func (a AutoProvisioningSetting) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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 AutoProvisioningSetting. -func (a *AutoProvisioningSetting) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AutoProvisioningSettingList. -func (a AutoProvisioningSettingList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutoProvisioningSettingList. -func (a *AutoProvisioningSettingList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &a.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &a.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AutoProvisioningSettingProperties. -func (a AutoProvisioningSettingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "autoProvision", a.AutoProvision) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutoProvisioningSettingProperties. -func (a *AutoProvisioningSettingProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "autoProvision": - err = unpopulate(val, "AutoProvision", &a.AutoProvision) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Automation. -func (a Automation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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, "tags", a.Tags) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Automation. -func (a *Automation) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &a.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &a.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AutomationAction. -func (a AutomationAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["actionType"] = a.ActionType - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationAction. -func (a *AutomationAction) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actionType": - err = unpopulate(val, "ActionType", &a.ActionType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AutomationActionEventHub. -func (a AutomationActionEventHub) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["actionType"] = ActionTypeEventHub - populate(objectMap, "connectionString", a.ConnectionString) - populate(objectMap, "eventHubResourceId", a.EventHubResourceID) - populate(objectMap, "isTrustedServiceEnabled", a.IsTrustedServiceEnabled) - populate(objectMap, "sasPolicyName", a.SasPolicyName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationActionEventHub. -func (a *AutomationActionEventHub) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actionType": - err = unpopulate(val, "ActionType", &a.ActionType) - delete(rawMsg, key) - case "connectionString": - err = unpopulate(val, "ConnectionString", &a.ConnectionString) - delete(rawMsg, key) - case "eventHubResourceId": - err = unpopulate(val, "EventHubResourceID", &a.EventHubResourceID) - delete(rawMsg, key) - case "isTrustedServiceEnabled": - err = unpopulate(val, "IsTrustedServiceEnabled", &a.IsTrustedServiceEnabled) - delete(rawMsg, key) - case "sasPolicyName": - err = unpopulate(val, "SasPolicyName", &a.SasPolicyName) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AutomationActionLogicApp. -func (a AutomationActionLogicApp) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["actionType"] = ActionTypeLogicApp - populate(objectMap, "logicAppResourceId", a.LogicAppResourceID) - populate(objectMap, "uri", a.URI) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationActionLogicApp. -func (a *AutomationActionLogicApp) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actionType": - err = unpopulate(val, "ActionType", &a.ActionType) - delete(rawMsg, key) - case "logicAppResourceId": - err = unpopulate(val, "LogicAppResourceID", &a.LogicAppResourceID) - delete(rawMsg, key) - case "uri": - err = unpopulate(val, "URI", &a.URI) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AutomationActionWorkspace. -func (a AutomationActionWorkspace) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["actionType"] = ActionTypeWorkspace - populate(objectMap, "workspaceResourceId", a.WorkspaceResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationActionWorkspace. -func (a *AutomationActionWorkspace) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actionType": - err = unpopulate(val, "ActionType", &a.ActionType) - delete(rawMsg, key) - case "workspaceResourceId": - err = unpopulate(val, "WorkspaceResourceID", &a.WorkspaceResourceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AutomationList. -func (a AutomationList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationList. -func (a *AutomationList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &a.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &a.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AutomationProperties. -func (a AutomationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actions", a.Actions) - populate(objectMap, "description", a.Description) - populate(objectMap, "isEnabled", a.IsEnabled) - populate(objectMap, "scopes", a.Scopes) - populate(objectMap, "sources", a.Sources) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationProperties. -func (a *AutomationProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actions": - a.Actions, err = unmarshalAutomationActionClassificationArray(val) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &a.Description) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &a.IsEnabled) - delete(rawMsg, key) - case "scopes": - err = unpopulate(val, "Scopes", &a.Scopes) - delete(rawMsg, key) - case "sources": - err = unpopulate(val, "Sources", &a.Sources) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AutomationRuleSet. -func (a AutomationRuleSet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "rules", a.Rules) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationRuleSet. -func (a *AutomationRuleSet) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "rules": - err = unpopulate(val, "Rules", &a.Rules) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AutomationScope. -func (a AutomationScope) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", a.Description) - populate(objectMap, "scopePath", a.ScopePath) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationScope. -func (a *AutomationScope) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &a.Description) - delete(rawMsg, key) - case "scopePath": - err = unpopulate(val, "ScopePath", &a.ScopePath) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AutomationSource. -func (a AutomationSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "eventSource", a.EventSource) - populate(objectMap, "ruleSets", a.RuleSets) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationSource. -func (a *AutomationSource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "eventSource": - err = unpopulate(val, "EventSource", &a.EventSource) - delete(rawMsg, key) - case "ruleSets": - err = unpopulate(val, "RuleSets", &a.RuleSets) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AutomationTriggeringRule. -func (a AutomationTriggeringRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "expectedValue", a.ExpectedValue) - populate(objectMap, "operator", a.Operator) - populate(objectMap, "propertyJPath", a.PropertyJPath) - populate(objectMap, "propertyType", a.PropertyType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationTriggeringRule. -func (a *AutomationTriggeringRule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "expectedValue": - err = unpopulate(val, "ExpectedValue", &a.ExpectedValue) - delete(rawMsg, key) - case "operator": - err = unpopulate(val, "Operator", &a.Operator) - delete(rawMsg, key) - case "propertyJPath": - err = unpopulate(val, "PropertyJPath", &a.PropertyJPath) - delete(rawMsg, key) - case "propertyType": - err = unpopulate(val, "PropertyType", &a.PropertyType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AutomationUpdateModel. -func (a AutomationUpdateModel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationUpdateModel. -func (a *AutomationUpdateModel) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AutomationValidationStatus. -func (a AutomationValidationStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "isValid", a.IsValid) - populate(objectMap, "message", a.Message) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationValidationStatus. -func (a *AutomationValidationStatus) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "isValid": - err = unpopulate(val, "IsValid", &a.IsValid) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &a.Message) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AwAssumeRoleAuthenticationDetailsProperties. -func (a AwAssumeRoleAuthenticationDetailsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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) - 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 { - 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 "accountName": - err = unpopulate(val, "AccountName", &a.AccountName) - delete(rawMsg, key) - case "environmentType": - err = unpopulate(val, "EnvironmentType", &a.EnvironmentType) - delete(rawMsg, key) - case "organizationalData": - a.OrganizationalData, err = unmarshalAwsOrganizationalDataClassification(val) - delete(rawMsg, key) - case "regions": - err = unpopulate(val, "Regions", &a.Regions) - delete(rawMsg, key) - case "scanInterval": - err = unpopulate(val, "ScanInterval", &a.ScanInterval) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AwsOrganizationalData. -func (a AwsOrganizationalData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["organizationMembershipType"] = a.OrganizationMembershipType - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AwsOrganizationalData. -func (a *AwsOrganizationalData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "organizationMembershipType": - err = unpopulate(val, "OrganizationMembershipType", &a.OrganizationMembershipType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AwsOrganizationalDataMaster. -func (a AwsOrganizationalDataMaster) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "excludedAccountIds", a.ExcludedAccountIDs) - objectMap["organizationMembershipType"] = OrganizationMembershipTypeOrganization - populate(objectMap, "stacksetName", a.StacksetName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AwsOrganizationalDataMaster. -func (a *AwsOrganizationalDataMaster) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "excludedAccountIds": - err = unpopulate(val, "ExcludedAccountIDs", &a.ExcludedAccountIDs) - delete(rawMsg, key) - case "organizationMembershipType": - err = unpopulate(val, "OrganizationMembershipType", &a.OrganizationMembershipType) - delete(rawMsg, key) - case "stacksetName": - err = unpopulate(val, "StacksetName", &a.StacksetName) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AwsOrganizationalDataMember. -func (a AwsOrganizationalDataMember) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["organizationMembershipType"] = OrganizationMembershipTypeMember - populate(objectMap, "parentHierarchyId", a.ParentHierarchyID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AwsOrganizationalDataMember. -func (a *AwsOrganizationalDataMember) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "organizationMembershipType": - err = unpopulate(val, "OrganizationMembershipType", &a.OrganizationMembershipType) - delete(rawMsg, key) - case "parentHierarchyId": - err = unpopulate(val, "ParentHierarchyID", &a.ParentHierarchyID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureDevOpsOrg. -func (a AzureDevOpsOrg) 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 AzureDevOpsOrg. -func (a *AzureDevOpsOrg) UnmarshalJSON(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 "systemData": - err = unpopulate(val, "SystemData", &a.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureDevOpsOrgListResponse. -func (a AzureDevOpsOrgListResponse) 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 AzureDevOpsOrgListResponse. -func (a *AzureDevOpsOrgListResponse) UnmarshalJSON(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 AzureDevOpsOrgProperties. -func (a AzureDevOpsOrgProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actionableRemediation", a.ActionableRemediation) - populate(objectMap, "onboardingState", a.OnboardingState) - populate(objectMap, "provisioningState", a.ProvisioningState) - populate(objectMap, "provisioningStatusMessage", a.ProvisioningStatusMessage) - populateDateTimeRFC3339(objectMap, "provisioningStatusUpdateTimeUtc", a.ProvisioningStatusUpdateTimeUTC) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureDevOpsOrgProperties. -func (a *AzureDevOpsOrgProperties) UnmarshalJSON(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 "actionableRemediation": - err = unpopulate(val, "ActionableRemediation", &a.ActionableRemediation) - delete(rawMsg, key) - case "onboardingState": - err = unpopulate(val, "OnboardingState", &a.OnboardingState) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) - delete(rawMsg, key) - case "provisioningStatusMessage": - 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) - 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 AzureDevOpsProject. -func (a AzureDevOpsProject) 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 AzureDevOpsProject. -func (a *AzureDevOpsProject) UnmarshalJSON(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 "systemData": - err = unpopulate(val, "SystemData", &a.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type 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) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureDevOpsProjectListResponse. -func (a *AzureDevOpsProjectListResponse) UnmarshalJSON(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 AzureDevOpsProjectProperties. -func (a AzureDevOpsProjectProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actionableRemediation", a.ActionableRemediation) - populate(objectMap, "onboardingState", a.OnboardingState) - populate(objectMap, "parentOrgName", a.ParentOrgName) - populate(objectMap, "projectId", a.ProjectID) - populate(objectMap, "provisioningState", a.ProvisioningState) - populate(objectMap, "provisioningStatusMessage", a.ProvisioningStatusMessage) - populateDateTimeRFC3339(objectMap, "provisioningStatusUpdateTimeUtc", a.ProvisioningStatusUpdateTimeUTC) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureDevOpsProjectProperties. -func (a *AzureDevOpsProjectProperties) UnmarshalJSON(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 "actionableRemediation": - err = unpopulate(val, "ActionableRemediation", &a.ActionableRemediation) - delete(rawMsg, key) - case "onboardingState": - err = unpopulate(val, "OnboardingState", &a.OnboardingState) - delete(rawMsg, key) - case "parentOrgName": - err = unpopulate(val, "ParentOrgName", &a.ParentOrgName) - delete(rawMsg, key) - case "projectId": - err = unpopulate(val, "ProjectID", &a.ProjectID) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) - delete(rawMsg, key) - case "provisioningStatusMessage": - 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 AzureDevOpsRepository. -func (a AzureDevOpsRepository) 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 AzureDevOpsRepository. -func (a *AzureDevOpsRepository) UnmarshalJSON(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 "systemData": - err = unpopulate(val, "SystemData", &a.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureDevOpsRepositoryListResponse. -func (a AzureDevOpsRepositoryListResponse) 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 AzureDevOpsRepositoryListResponse. -func (a *AzureDevOpsRepositoryListResponse) UnmarshalJSON(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 AzureDevOpsRepositoryProperties. -func (a AzureDevOpsRepositoryProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actionableRemediation", a.ActionableRemediation) - populate(objectMap, "onboardingState", a.OnboardingState) - populate(objectMap, "parentOrgName", a.ParentOrgName) - populate(objectMap, "parentProjectName", a.ParentProjectName) - populate(objectMap, "provisioningState", a.ProvisioningState) - populate(objectMap, "provisioningStatusMessage", a.ProvisioningStatusMessage) - populateDateTimeRFC3339(objectMap, "provisioningStatusUpdateTimeUtc", a.ProvisioningStatusUpdateTimeUTC) - populate(objectMap, "repoId", a.RepoID) - populate(objectMap, "repoUrl", a.RepoURL) - populate(objectMap, "visibility", a.Visibility) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureDevOpsRepositoryProperties. -func (a *AzureDevOpsRepositoryProperties) UnmarshalJSON(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 "actionableRemediation": - err = unpopulate(val, "ActionableRemediation", &a.ActionableRemediation) - delete(rawMsg, key) - case "onboardingState": - err = unpopulate(val, "OnboardingState", &a.OnboardingState) - delete(rawMsg, key) - case "parentOrgName": - err = unpopulate(val, "ParentOrgName", &a.ParentOrgName) - delete(rawMsg, key) - case "parentProjectName": - err = unpopulate(val, "ParentProjectName", &a.ParentProjectName) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) - delete(rawMsg, key) - case "provisioningStatusMessage": - err = unpopulate(val, "ProvisioningStatusMessage", &a.ProvisioningStatusMessage) - delete(rawMsg, key) - case "provisioningStatusUpdateTimeUtc": - err = unpopulateDateTimeRFC3339(val, "ProvisioningStatusUpdateTimeUTC", &a.ProvisioningStatusUpdateTimeUTC) - delete(rawMsg, key) - case "repoId": - err = unpopulate(val, "RepoID", &a.RepoID) - delete(rawMsg, key) - case "repoUrl": - err = unpopulate(val, "RepoURL", &a.RepoURL) - delete(rawMsg, key) - case "visibility": - err = unpopulate(val, "Visibility", &a.Visibility) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureDevOpsScopeEnvironmentData. -func (a AzureDevOpsScopeEnvironmentData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["environmentType"] = EnvironmentTypeAzureDevOpsScope - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureDevOpsScopeEnvironmentData. -func (a *AzureDevOpsScopeEnvironmentData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "environmentType": - err = unpopulate(val, "EnvironmentType", &a.EnvironmentType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureResourceDetails. -func (a AzureResourceDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", a.ID) - objectMap["source"] = SourceAzure - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResourceDetails. -func (a *AzureResourceDetails) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &a.Source) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureResourceIdentifier. -func (a AzureResourceIdentifier) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "azureResourceId", a.AzureResourceID) - objectMap["type"] = ResourceIdentifierTypeAzureResource - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResourceIdentifier. -func (a *AzureResourceIdentifier) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "azureResourceId": - err = unpopulate(val, "AzureResourceID", &a.AzureResourceID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureResourceLink. -func (a AzureResourceLink) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", a.ID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResourceLink. -func (a *AzureResourceLink) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureServersSetting. -func (a AzureServersSetting) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", a.ID) - objectMap["kind"] = ServerVulnerabilityAssessmentsSettingKindAzureServersSetting - 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 AzureServersSetting. -func (a *AzureServersSetting) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &a.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type 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) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Baseline. -func (b *Baseline) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "expectedResults": - err = unpopulate(val, "ExpectedResults", &b.ExpectedResults) - delete(rawMsg, key) - case "updatedTime": - err = unpopulateDateTimeRFC3339(val, "UpdatedTime", &b.UpdatedTime) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BaselineAdjustedResult. -func (b BaselineAdjustedResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "baseline", b.Baseline) - populate(objectMap, "resultsNotInBaseline", b.ResultsNotInBaseline) - populate(objectMap, "resultsOnlyInBaseline", b.ResultsOnlyInBaseline) - populate(objectMap, "status", b.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BaselineAdjustedResult. -func (b *BaselineAdjustedResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "baseline": - err = unpopulate(val, "Baseline", &b.Baseline) - delete(rawMsg, key) - case "resultsNotInBaseline": - err = unpopulate(val, "ResultsNotInBaseline", &b.ResultsNotInBaseline) - delete(rawMsg, key) - case "resultsOnlyInBaseline": - err = unpopulate(val, "ResultsOnlyInBaseline", &b.ResultsOnlyInBaseline) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &b.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BenchmarkReference. -func (b BenchmarkReference) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "benchmark", b.Benchmark) - populate(objectMap, "reference", b.Reference) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BenchmarkReference. -func (b *BenchmarkReference) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "benchmark": - err = unpopulate(val, "Benchmark", &b.Benchmark) - delete(rawMsg, key) - case "reference": - err = unpopulate(val, "Reference", &b.Reference) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BuiltInInfoType. -func (b BuiltInInfoType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", b.ID) - populate(objectMap, "name", b.Name) - populate(objectMap, "type", b.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BuiltInInfoType. -func (b *BuiltInInfoType) UnmarshalJSON(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 "id": - err = unpopulate(val, "ID", &b.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &b.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &b.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CVE. -func (c CVE) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "link", c.Link) - populate(objectMap, "title", c.Title) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CVE. -func (c *CVE) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "link": - err = unpopulate(val, "Link", &c.Link) - delete(rawMsg, key) - case "title": - err = unpopulate(val, "Title", &c.Title) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CVSS. -func (c CVSS) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "base", c.Base) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CVSS. -func (c *CVSS) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "base": - err = unpopulate(val, "Base", &c.Base) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CategoryConfiguration. -func (c CategoryConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "category", c.Category) - populate(objectMap, "minimumSeverityLevel", c.MinimumSeverityLevel) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CategoryConfiguration. -func (c *CategoryConfiguration) UnmarshalJSON(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 "category": - err = unpopulate(val, "Category", &c.Category) - delete(rawMsg, key) - case "minimumSeverityLevel": - err = unpopulate(val, "MinimumSeverityLevel", &c.MinimumSeverityLevel) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CefExternalSecuritySolution. -func (c CefExternalSecuritySolution) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", c.ID) - objectMap["kind"] = ExternalSecuritySolutionKindCEF - populate(objectMap, "location", c.Location) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "type", c.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CefExternalSecuritySolution. -func (c *CefExternalSecuritySolution) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &c.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &c.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &c.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &c.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CefSolutionProperties. -func (c CefSolutionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "agent", c.Agent) - populate(objectMap, "deviceType", c.DeviceType) - populate(objectMap, "deviceVendor", c.DeviceVendor) - populate(objectMap, "hostname", c.Hostname) - populate(objectMap, "lastEventReceived", c.LastEventReceived) - populate(objectMap, "workspace", c.Workspace) - if c.AdditionalProperties != nil { - for key, val := range c.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CefSolutionProperties. -func (c *CefSolutionProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "agent": - err = unpopulate(val, "Agent", &c.Agent) - delete(rawMsg, key) - case "deviceType": - err = unpopulate(val, "DeviceType", &c.DeviceType) - delete(rawMsg, key) - case "deviceVendor": - err = unpopulate(val, "DeviceVendor", &c.DeviceVendor) - delete(rawMsg, key) - case "hostname": - err = unpopulate(val, "Hostname", &c.Hostname) - delete(rawMsg, key) - case "lastEventReceived": - err = unpopulate(val, "LastEventReceived", &c.LastEventReceived) - delete(rawMsg, key) - case "workspace": - err = unpopulate(val, "Workspace", &c.Workspace) - delete(rawMsg, key) - default: - if c.AdditionalProperties == nil { - c.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - c.AdditionalProperties[key] = aux - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CloudOffering. -func (c CloudOffering) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", c.Description) - objectMap["offeringType"] = c.OfferingType - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CloudOffering. -func (c *CloudOffering) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &c.Description) - delete(rawMsg, key) - case "offeringType": - err = unpopulate(val, "OfferingType", &c.OfferingType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Compliance. -func (c Compliance) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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 Compliance. -func (c *Compliance) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &c.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &c.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ComplianceList. -func (c ComplianceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ComplianceList. -func (c *ComplianceList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &c.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &c.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ComplianceProperties. -func (c ComplianceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "assessmentResult", c.AssessmentResult) - populateDateTimeRFC3339(objectMap, "assessmentTimestampUtcDate", c.AssessmentTimestampUTCDate) - populate(objectMap, "resourceCount", c.ResourceCount) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ComplianceProperties. -func (c *ComplianceProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "assessmentResult": - err = unpopulate(val, "AssessmentResult", &c.AssessmentResult) - delete(rawMsg, key) - case "assessmentTimestampUtcDate": - err = unpopulateDateTimeRFC3339(val, "AssessmentTimestampUTCDate", &c.AssessmentTimestampUTCDate) - delete(rawMsg, key) - case "resourceCount": - err = unpopulate(val, "ResourceCount", &c.ResourceCount) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ComplianceResult. -func (c ComplianceResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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 ComplianceResult. -func (c *ComplianceResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &c.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &c.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ComplianceResultList. -func (c ComplianceResultList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ComplianceResultList. -func (c *ComplianceResultList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &c.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &c.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ComplianceResultProperties. -func (c ComplianceResultProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "resourceStatus", c.ResourceStatus) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ComplianceResultProperties. -func (c *ComplianceResultProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "resourceStatus": - err = unpopulate(val, "ResourceStatus", &c.ResourceStatus) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ComplianceSegment. -func (c ComplianceSegment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "percentage", c.Percentage) - populate(objectMap, "segmentType", c.SegmentType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ComplianceSegment. -func (c *ComplianceSegment) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "percentage": - err = unpopulate(val, "Percentage", &c.Percentage) - delete(rawMsg, key) - case "segmentType": - err = unpopulate(val, "SegmentType", &c.SegmentType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Condition. -func (c Condition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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) - populate(objectMap, "id", c.ID) - populate(objectMap, "inboundConnectedResources", c.InboundConnectedResources) - populate(objectMap, "outboundConnectedResources", c.OutboundConnectedResources) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectableResource. -func (c *ConnectableResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &c.ID) - delete(rawMsg, key) - case "inboundConnectedResources": - err = unpopulate(val, "InboundConnectedResources", &c.InboundConnectedResources) - delete(rawMsg, key) - case "outboundConnectedResources": - err = unpopulate(val, "OutboundConnectedResources", &c.OutboundConnectedResources) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ConnectedResource. -func (c ConnectedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "connectedResourceId", c.ConnectedResourceID) - populate(objectMap, "tcpPorts", c.TCPPorts) - populate(objectMap, "udpPorts", c.UDPPorts) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedResource. -func (c *ConnectedResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "connectedResourceId": - err = unpopulate(val, "ConnectedResourceID", &c.ConnectedResourceID) - delete(rawMsg, key) - case "tcpPorts": - err = unpopulate(val, "TCPPorts", &c.TCPPorts) - delete(rawMsg, key) - case "udpPorts": - err = unpopulate(val, "UDPPorts", &c.UDPPorts) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ConnectedWorkspace. -func (c ConnectedWorkspace) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", c.ID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedWorkspace. -func (c *ConnectedWorkspace) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &c.ID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ConnectionFromIPNotAllowed. -func (c ConnectionFromIPNotAllowed) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "allowlistValues", c.AllowlistValues) - populate(objectMap, "description", c.Description) - populate(objectMap, "displayName", c.DisplayName) - populate(objectMap, "isEnabled", c.IsEnabled) - objectMap["ruleType"] = "ConnectionFromIpNotAllowed" - populate(objectMap, "valueType", c.ValueType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionFromIPNotAllowed. -func (c *ConnectionFromIPNotAllowed) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "allowlistValues": - err = unpopulate(val, "AllowlistValues", &c.AllowlistValues) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &c.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &c.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &c.IsEnabled) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &c.RuleType) - delete(rawMsg, key) - case "valueType": - err = unpopulate(val, "ValueType", &c.ValueType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ConnectionToIPNotAllowed. -func (c ConnectionToIPNotAllowed) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "allowlistValues", c.AllowlistValues) - populate(objectMap, "description", c.Description) - populate(objectMap, "displayName", c.DisplayName) - populate(objectMap, "isEnabled", c.IsEnabled) - objectMap["ruleType"] = "ConnectionToIpNotAllowed" - populate(objectMap, "valueType", c.ValueType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionToIPNotAllowed. -func (c *ConnectionToIPNotAllowed) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "allowlistValues": - err = unpopulate(val, "AllowlistValues", &c.AllowlistValues) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &c.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &c.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &c.IsEnabled) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &c.RuleType) - delete(rawMsg, key) - case "valueType": - err = unpopulate(val, "ValueType", &c.ValueType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Connector. -func (c Connector) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "etag", c.Etag) - populate(objectMap, "id", c.ID) - populate(objectMap, "kind", c.Kind) - populate(objectMap, "location", c.Location) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "systemData", c.SystemData) - populate(objectMap, "tags", c.Tags) - populate(objectMap, "type", c.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Connector. -func (c *Connector) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &c.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &c.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &c.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &c.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &c.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &c.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &c.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ConnectorProperties. -func (c ConnectorProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "environmentData", c.EnvironmentData) - populate(objectMap, "environmentName", c.EnvironmentName) - populate(objectMap, "hierarchyIdentifier", c.HierarchyIdentifier) - populateDateTimeRFC3339(objectMap, "hierarchyIdentifierTrialEndDate", c.HierarchyIdentifierTrialEndDate) - populate(objectMap, "offerings", c.Offerings) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectorProperties. -func (c *ConnectorProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "environmentData": - c.EnvironmentData, err = unmarshalEnvironmentDataClassification(val) - delete(rawMsg, key) - case "environmentName": - err = unpopulate(val, "EnvironmentName", &c.EnvironmentName) - delete(rawMsg, key) - case "hierarchyIdentifier": - err = unpopulate(val, "HierarchyIdentifier", &c.HierarchyIdentifier) - delete(rawMsg, key) - case "hierarchyIdentifierTrialEndDate": - err = unpopulateDateTimeRFC3339(val, "HierarchyIdentifierTrialEndDate", &c.HierarchyIdentifierTrialEndDate) - delete(rawMsg, key) - case "offerings": - c.Offerings, err = unmarshalCloudOfferingClassificationArray(val) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ConnectorSetting. -func (c ConnectorSetting) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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 ConnectorSetting. -func (c *ConnectorSetting) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &c.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &c.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ConnectorSettingList. -func (c ConnectorSettingList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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 { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &c.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &c.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ContactProperties. -func (c ContactProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "emails", c.Emails) - populate(objectMap, "isEnabled", c.IsEnabled) - populate(objectMap, "notificationsByRole", c.NotificationsByRole) - populate(objectMap, "notificationsSources", c.NotificationsSources) - populate(objectMap, "phone", c.Phone) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ContactProperties. -func (c *ContactProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "emails": - err = unpopulate(val, "Emails", &c.Emails) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &c.IsEnabled) - delete(rawMsg, key) - case "notificationsByRole": - err = unpopulate(val, "NotificationsByRole", &c.NotificationsByRole) - delete(rawMsg, key) - case "notificationsSources": - c.NotificationsSources, err = unmarshalNotificationsSourceClassificationArray(val) - delete(rawMsg, key) - case "phone": - err = unpopulate(val, "Phone", &c.Phone) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ContactPropertiesNotificationsByRole. -func (c ContactPropertiesNotificationsByRole) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "roles", c.Roles) - populate(objectMap, "state", c.State) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ContactPropertiesNotificationsByRole. -func (c *ContactPropertiesNotificationsByRole) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "roles": - err = unpopulate(val, "Roles", &c.Roles) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &c.State) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ContainerRegistryVulnerabilityProperties. -func (c ContainerRegistryVulnerabilityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["assessedResourceType"] = AssessedResourceTypeContainerRegistryVulnerability - populate(objectMap, "cve", c.Cve) - populate(objectMap, "cvss", c.Cvss) - populate(objectMap, "imageDigest", c.ImageDigest) - populate(objectMap, "patchable", c.Patchable) - populateDateTimeRFC3339(objectMap, "publishedTime", c.PublishedTime) - populate(objectMap, "repositoryName", c.RepositoryName) - populate(objectMap, "type", c.Type) - populate(objectMap, "vendorReferences", c.VendorReferences) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerRegistryVulnerabilityProperties. -func (c *ContainerRegistryVulnerabilityProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "assessedResourceType": - err = unpopulate(val, "AssessedResourceType", &c.AssessedResourceType) - delete(rawMsg, key) - case "cve": - err = unpopulate(val, "Cve", &c.Cve) - delete(rawMsg, key) - case "cvss": - err = unpopulate(val, "Cvss", &c.Cvss) - delete(rawMsg, key) - case "imageDigest": - err = unpopulate(val, "ImageDigest", &c.ImageDigest) - delete(rawMsg, key) - case "patchable": - err = unpopulate(val, "Patchable", &c.Patchable) - delete(rawMsg, key) - case "publishedTime": - err = unpopulateDateTimeRFC3339(val, "PublishedTime", &c.PublishedTime) - delete(rawMsg, key) - case "repositoryName": - err = unpopulate(val, "RepositoryName", &c.RepositoryName) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) - delete(rawMsg, key) - case "vendorReferences": - err = unpopulate(val, "VendorReferences", &c.VendorReferences) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CspmMonitorAwsOffering. -func (c CspmMonitorAwsOffering) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", c.Description) - populate(objectMap, "nativeCloudConnection", c.NativeCloudConnection) - objectMap["offeringType"] = OfferingTypeCspmMonitorAws - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CspmMonitorAwsOffering. -func (c *CspmMonitorAwsOffering) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &c.Description) - delete(rawMsg, key) - case "nativeCloudConnection": - err = unpopulate(val, "NativeCloudConnection", &c.NativeCloudConnection) - delete(rawMsg, key) - case "offeringType": - err = unpopulate(val, "OfferingType", &c.OfferingType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CspmMonitorAwsOfferingNativeCloudConnection. -func (c CspmMonitorAwsOfferingNativeCloudConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "cloudRoleArn", c.CloudRoleArn) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CspmMonitorAwsOfferingNativeCloudConnection. -func (c *CspmMonitorAwsOfferingNativeCloudConnection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "cloudRoleArn": - err = unpopulate(val, "CloudRoleArn", &c.CloudRoleArn) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CspmMonitorAzureDevOpsOffering. -func (c CspmMonitorAzureDevOpsOffering) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", c.Description) - objectMap["offeringType"] = OfferingTypeCspmMonitorAzureDevOps - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CspmMonitorAzureDevOpsOffering. -func (c *CspmMonitorAzureDevOpsOffering) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &c.Description) - delete(rawMsg, key) - case "offeringType": - err = unpopulate(val, "OfferingType", &c.OfferingType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CspmMonitorGcpOffering. -func (c CspmMonitorGcpOffering) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", c.Description) - populate(objectMap, "nativeCloudConnection", c.NativeCloudConnection) - objectMap["offeringType"] = OfferingTypeCspmMonitorGcp - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CspmMonitorGcpOffering. -func (c *CspmMonitorGcpOffering) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &c.Description) - delete(rawMsg, key) - case "nativeCloudConnection": - err = unpopulate(val, "NativeCloudConnection", &c.NativeCloudConnection) - delete(rawMsg, key) - case "offeringType": - err = unpopulate(val, "OfferingType", &c.OfferingType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CspmMonitorGcpOfferingNativeCloudConnection. -func (c CspmMonitorGcpOfferingNativeCloudConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "serviceAccountEmailAddress", c.ServiceAccountEmailAddress) - populate(objectMap, "workloadIdentityProviderId", c.WorkloadIdentityProviderID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CspmMonitorGcpOfferingNativeCloudConnection. -func (c *CspmMonitorGcpOfferingNativeCloudConnection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "serviceAccountEmailAddress": - err = unpopulate(val, "ServiceAccountEmailAddress", &c.ServiceAccountEmailAddress) - delete(rawMsg, key) - case "workloadIdentityProviderId": - err = unpopulate(val, "WorkloadIdentityProviderID", &c.WorkloadIdentityProviderID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CspmMonitorGitLabOffering. -func (c CspmMonitorGitLabOffering) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", c.Description) - objectMap["offeringType"] = OfferingTypeCspmMonitorGitLab - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CspmMonitorGitLabOffering. -func (c *CspmMonitorGitLabOffering) UnmarshalJSON(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 CspmMonitorGithubOffering. -func (c CspmMonitorGithubOffering) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", c.Description) - objectMap["offeringType"] = OfferingTypeCspmMonitorGithub - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CspmMonitorGithubOffering. -func (c *CspmMonitorGithubOffering) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &c.Description) - delete(rawMsg, key) - case "offeringType": - err = unpopulate(val, "OfferingType", &c.OfferingType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CustomAlertRule. -func (c CustomAlertRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", c.Description) - populate(objectMap, "displayName", c.DisplayName) - populate(objectMap, "isEnabled", c.IsEnabled) - objectMap["ruleType"] = c.RuleType - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CustomAlertRule. -func (c *CustomAlertRule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &c.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &c.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &c.IsEnabled) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &c.RuleType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CustomAssessmentAutomation. -func (c CustomAssessmentAutomation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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 CustomAssessmentAutomation. -func (c *CustomAssessmentAutomation) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &c.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &c.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &c.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CustomAssessmentAutomationProperties. -func (c CustomAssessmentAutomationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "assessmentKey", c.AssessmentKey) - populate(objectMap, "compressedQuery", c.CompressedQuery) - populate(objectMap, "description", c.Description) - populate(objectMap, "displayName", c.DisplayName) - populate(objectMap, "remediationDescription", c.RemediationDescription) - if c.Severity == nil { - c.Severity = to.Ptr(SeverityEnumLow) - } - populate(objectMap, "severity", c.Severity) - if c.SupportedCloud == nil { - c.SupportedCloud = to.Ptr(SupportedCloudEnumAWS) - } - populate(objectMap, "supportedCloud", c.SupportedCloud) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CustomAssessmentAutomationProperties. -func (c *CustomAssessmentAutomationProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "assessmentKey": - err = unpopulate(val, "AssessmentKey", &c.AssessmentKey) - delete(rawMsg, key) - case "compressedQuery": - err = unpopulate(val, "CompressedQuery", &c.CompressedQuery) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &c.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &c.DisplayName) - delete(rawMsg, key) - case "remediationDescription": - err = unpopulate(val, "RemediationDescription", &c.RemediationDescription) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &c.Severity) - delete(rawMsg, key) - case "supportedCloud": - err = unpopulate(val, "SupportedCloud", &c.SupportedCloud) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CustomAssessmentAutomationRequest. -func (c CustomAssessmentAutomationRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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 CustomAssessmentAutomationRequest. -func (c *CustomAssessmentAutomationRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &c.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &c.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CustomAssessmentAutomationRequestProperties. -func (c CustomAssessmentAutomationRequestProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CustomAssessmentAutomationRequestProperties. -func (c *CustomAssessmentAutomationRequestProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "compressedQuery": - err = unpopulate(val, "CompressedQuery", &c.CompressedQuery) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &c.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &c.DisplayName) - delete(rawMsg, key) - case "remediationDescription": - err = unpopulate(val, "RemediationDescription", &c.RemediationDescription) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &c.Severity) - delete(rawMsg, key) - case "supportedCloud": - err = unpopulate(val, "SupportedCloud", &c.SupportedCloud) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CustomAssessmentAutomationsListResult. -func (c CustomAssessmentAutomationsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CustomAssessmentAutomationsListResult. -func (c *CustomAssessmentAutomationsListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &c.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &c.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CustomEntityStoreAssignment. -func (c CustomEntityStoreAssignment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderCspmAwsOffering. -func (d DefenderCspmAwsOffering) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "ciem", d.Ciem) - populate(objectMap, "dataSensitivityDiscovery", d.DataSensitivityDiscovery) - populate(objectMap, "databasesDspm", d.DatabasesDspm) - populate(objectMap, "description", d.Description) - populate(objectMap, "mdcContainersAgentlessDiscoveryK8s", d.MdcContainersAgentlessDiscoveryK8S) - populate(objectMap, "mdcContainersImageAssessment", d.MdcContainersImageAssessment) - objectMap["offeringType"] = OfferingTypeDefenderCspmAws - populate(objectMap, "vmScanners", d.VMScanners) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderCspmAwsOffering. -func (d *DefenderCspmAwsOffering) UnmarshalJSON(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 "ciem": - err = unpopulate(val, "Ciem", &d.Ciem) - delete(rawMsg, key) - case "dataSensitivityDiscovery": - err = unpopulate(val, "DataSensitivityDiscovery", &d.DataSensitivityDiscovery) - 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 "mdcContainersAgentlessDiscoveryK8s": - err = unpopulate(val, "MdcContainersAgentlessDiscoveryK8S", &d.MdcContainersAgentlessDiscoveryK8S) - 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 "vmScanners": - err = unpopulate(val, "VMScanners", &d.VMScanners) - 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 DefenderCspmAwsOfferingCiem. -func (d DefenderCspmAwsOfferingCiem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "ciemDiscovery", d.CiemDiscovery) - populate(objectMap, "ciemOidc", d.CiemOidc) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderCspmAwsOfferingCiem. -func (d *DefenderCspmAwsOfferingCiem) UnmarshalJSON(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 "ciemDiscovery": - err = unpopulate(val, "CiemDiscovery", &d.CiemDiscovery) - delete(rawMsg, key) - case "ciemOidc": - err = unpopulate(val, "CiemOidc", &d.CiemOidc) - 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 DefenderCspmAwsOfferingCiemDiscovery. -func (d DefenderCspmAwsOfferingCiemDiscovery) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "cloudRoleArn", d.CloudRoleArn) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderCspmAwsOfferingCiemDiscovery. -func (d *DefenderCspmAwsOfferingCiemDiscovery) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "cloudRoleArn": - err = unpopulate(val, "CloudRoleArn", &d.CloudRoleArn) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderCspmAwsOfferingCiemOidc. -func (d DefenderCspmAwsOfferingCiemOidc) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "azureActiveDirectoryAppName", d.AzureActiveDirectoryAppName) - populate(objectMap, "cloudRoleArn", d.CloudRoleArn) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderCspmAwsOfferingCiemOidc. -func (d *DefenderCspmAwsOfferingCiemOidc) UnmarshalJSON(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 "azureActiveDirectoryAppName": - err = unpopulate(val, "AzureActiveDirectoryAppName", &d.AzureActiveDirectoryAppName) - delete(rawMsg, key) - case "cloudRoleArn": - err = unpopulate(val, "CloudRoleArn", &d.CloudRoleArn) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderCspmAwsOfferingDataSensitivityDiscovery. -func (d DefenderCspmAwsOfferingDataSensitivityDiscovery) 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 DefenderCspmAwsOfferingDataSensitivityDiscovery. -func (d *DefenderCspmAwsOfferingDataSensitivityDiscovery) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "cloudRoleArn": - err = unpopulate(val, "CloudRoleArn", &d.CloudRoleArn) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &d.Enabled) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderCspmAwsOfferingDatabasesDspm. -func (d DefenderCspmAwsOfferingDatabasesDspm) 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 DefenderCspmAwsOfferingDatabasesDspm. -func (d *DefenderCspmAwsOfferingDatabasesDspm) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "cloudRoleArn": - err = unpopulate(val, "CloudRoleArn", &d.CloudRoleArn) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &d.Enabled) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S. -func (d DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S) 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 DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S. -func (d *DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "cloudRoleArn": - err = unpopulate(val, "CloudRoleArn", &d.CloudRoleArn) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &d.Enabled) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderCspmAwsOfferingMdcContainersImageAssessment. -func (d DefenderCspmAwsOfferingMdcContainersImageAssessment) 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 DefenderCspmAwsOfferingMdcContainersImageAssessment. -func (d *DefenderCspmAwsOfferingMdcContainersImageAssessment) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "cloudRoleArn": - err = unpopulate(val, "CloudRoleArn", &d.CloudRoleArn) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &d.Enabled) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderCspmAwsOfferingVMScanners. -func (d DefenderCspmAwsOfferingVMScanners) 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 DefenderCspmAwsOfferingVMScanners. -func (d *DefenderCspmAwsOfferingVMScanners) UnmarshalJSON(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 DefenderCspmGcpOffering. -func (d DefenderCspmGcpOffering) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "ciemDiscovery", d.CiemDiscovery) - populate(objectMap, "dataSensitivityDiscovery", d.DataSensitivityDiscovery) - populate(objectMap, "description", d.Description) - populate(objectMap, "mdcContainersAgentlessDiscoveryK8s", d.MdcContainersAgentlessDiscoveryK8S) - populate(objectMap, "mdcContainersImageAssessment", d.MdcContainersImageAssessment) - objectMap["offeringType"] = OfferingTypeDefenderCspmGcp - populate(objectMap, "vmScanners", d.VMScanners) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderCspmGcpOffering. -func (d *DefenderCspmGcpOffering) UnmarshalJSON(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 "ciemDiscovery": - err = unpopulate(val, "CiemDiscovery", &d.CiemDiscovery) - delete(rawMsg, key) - case "dataSensitivityDiscovery": - err = unpopulate(val, "DataSensitivityDiscovery", &d.DataSensitivityDiscovery) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &d.Description) - delete(rawMsg, key) - case "mdcContainersAgentlessDiscoveryK8s": - err = unpopulate(val, "MdcContainersAgentlessDiscoveryK8S", &d.MdcContainersAgentlessDiscoveryK8S) - 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 "vmScanners": - err = unpopulate(val, "VMScanners", &d.VMScanners) - 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 DefenderCspmGcpOfferingCiemDiscovery. -func (d DefenderCspmGcpOfferingCiemDiscovery) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "azureActiveDirectoryAppName", d.AzureActiveDirectoryAppName) - populate(objectMap, "serviceAccountEmailAddress", d.ServiceAccountEmailAddress) - populate(objectMap, "workloadIdentityProviderId", d.WorkloadIdentityProviderID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderCspmGcpOfferingCiemDiscovery. -func (d *DefenderCspmGcpOfferingCiemDiscovery) UnmarshalJSON(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 "azureActiveDirectoryAppName": - err = unpopulate(val, "AzureActiveDirectoryAppName", &d.AzureActiveDirectoryAppName) - delete(rawMsg, key) - case "serviceAccountEmailAddress": - err = unpopulate(val, "ServiceAccountEmailAddress", &d.ServiceAccountEmailAddress) - delete(rawMsg, key) - case "workloadIdentityProviderId": - err = unpopulate(val, "WorkloadIdentityProviderID", &d.WorkloadIdentityProviderID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderCspmGcpOfferingDataSensitivityDiscovery. -func (d DefenderCspmGcpOfferingDataSensitivityDiscovery) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "enabled", d.Enabled) - populate(objectMap, "serviceAccountEmailAddress", d.ServiceAccountEmailAddress) - populate(objectMap, "workloadIdentityProviderId", d.WorkloadIdentityProviderID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderCspmGcpOfferingDataSensitivityDiscovery. -func (d *DefenderCspmGcpOfferingDataSensitivityDiscovery) UnmarshalJSON(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) - case "serviceAccountEmailAddress": - err = unpopulate(val, "ServiceAccountEmailAddress", &d.ServiceAccountEmailAddress) - delete(rawMsg, key) - case "workloadIdentityProviderId": - err = unpopulate(val, "WorkloadIdentityProviderID", &d.WorkloadIdentityProviderID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S. -func (d DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "enabled", d.Enabled) - populate(objectMap, "serviceAccountEmailAddress", d.ServiceAccountEmailAddress) - populate(objectMap, "workloadIdentityProviderId", d.WorkloadIdentityProviderID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S. -func (d *DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S) UnmarshalJSON(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) - case "serviceAccountEmailAddress": - err = unpopulate(val, "ServiceAccountEmailAddress", &d.ServiceAccountEmailAddress) - delete(rawMsg, key) - case "workloadIdentityProviderId": - err = unpopulate(val, "WorkloadIdentityProviderID", &d.WorkloadIdentityProviderID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderCspmGcpOfferingMdcContainersImageAssessment. -func (d DefenderCspmGcpOfferingMdcContainersImageAssessment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "enabled", d.Enabled) - populate(objectMap, "serviceAccountEmailAddress", d.ServiceAccountEmailAddress) - populate(objectMap, "workloadIdentityProviderId", d.WorkloadIdentityProviderID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderCspmGcpOfferingMdcContainersImageAssessment. -func (d *DefenderCspmGcpOfferingMdcContainersImageAssessment) UnmarshalJSON(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) - case "serviceAccountEmailAddress": - err = unpopulate(val, "ServiceAccountEmailAddress", &d.ServiceAccountEmailAddress) - delete(rawMsg, key) - case "workloadIdentityProviderId": - err = unpopulate(val, "WorkloadIdentityProviderID", &d.WorkloadIdentityProviderID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderCspmGcpOfferingVMScanners. -func (d DefenderCspmGcpOfferingVMScanners) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "configuration", d.Configuration) - populate(objectMap, "enabled", d.Enabled) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderCspmGcpOfferingVMScanners. -func (d *DefenderCspmGcpOfferingVMScanners) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "configuration": - err = unpopulate(val, "Configuration", &d.Configuration) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &d.Enabled) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderFoDatabasesAwsOffering. -func (d DefenderFoDatabasesAwsOffering) 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) - 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 { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "cloudRoleArn": - err = unpopulate(val, "CloudRoleArn", &d.CloudRoleArn) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &d.Enabled) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderFoDatabasesAwsOfferingRds. -func (d DefenderFoDatabasesAwsOfferingRds) 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 DefenderFoDatabasesAwsOfferingRds. -func (d *DefenderFoDatabasesAwsOfferingRds) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "cloudRoleArn": - err = unpopulate(val, "CloudRoleArn", &d.CloudRoleArn) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &d.Enabled) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForContainersAwsOffering. -func (d DefenderForContainersAwsOffering) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "cloudWatchToKinesis", d.CloudWatchToKinesis) - populate(objectMap, "dataCollectionExternalId", d.DataCollectionExternalID) - populate(objectMap, "description", d.Description) - populate(objectMap, "enableAuditLogsAutoProvisioning", d.EnableAuditLogsAutoProvisioning) - populate(objectMap, "enableDefenderAgentAutoProvisioning", d.EnableDefenderAgentAutoProvisioning) - populate(objectMap, "enablePolicyAgentAutoProvisioning", d.EnablePolicyAgentAutoProvisioning) - populate(objectMap, "kinesisToS3", d.KinesisToS3) - populate(objectMap, "kubeAuditRetentionTime", d.KubeAuditRetentionTime) - populate(objectMap, "kubernetesDataCollection", d.KubernetesDataCollection) - populate(objectMap, "kubernetesService", d.KubernetesService) - populate(objectMap, "mdcContainersAgentlessDiscoveryK8s", d.MdcContainersAgentlessDiscoveryK8S) - populate(objectMap, "mdcContainersImageAssessment", d.MdcContainersImageAssessment) - objectMap["offeringType"] = OfferingTypeDefenderForContainersAws - populate(objectMap, "vmScanners", d.VMScanners) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForContainersAwsOffering. -func (d *DefenderForContainersAwsOffering) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "cloudWatchToKinesis": - err = unpopulate(val, "CloudWatchToKinesis", &d.CloudWatchToKinesis) - delete(rawMsg, key) - case "dataCollectionExternalId": - err = unpopulate(val, "DataCollectionExternalID", &d.DataCollectionExternalID) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &d.Description) - delete(rawMsg, key) - case "enableAuditLogsAutoProvisioning": - err = unpopulate(val, "EnableAuditLogsAutoProvisioning", &d.EnableAuditLogsAutoProvisioning) - delete(rawMsg, key) - case "enableDefenderAgentAutoProvisioning": - err = unpopulate(val, "EnableDefenderAgentAutoProvisioning", &d.EnableDefenderAgentAutoProvisioning) - delete(rawMsg, key) - case "enablePolicyAgentAutoProvisioning": - err = unpopulate(val, "EnablePolicyAgentAutoProvisioning", &d.EnablePolicyAgentAutoProvisioning) - delete(rawMsg, key) - case "kinesisToS3": - err = unpopulate(val, "KinesisToS3", &d.KinesisToS3) - delete(rawMsg, key) - case "kubeAuditRetentionTime": - err = unpopulate(val, "KubeAuditRetentionTime", &d.KubeAuditRetentionTime) - delete(rawMsg, key) - case "kubernetesDataCollection": - err = unpopulate(val, "KubernetesDataCollection", &d.KubernetesDataCollection) - delete(rawMsg, key) - case "kubernetesService": - err = unpopulate(val, "KubernetesService", &d.KubernetesService) - delete(rawMsg, key) - case "mdcContainersAgentlessDiscoveryK8s": - err = unpopulate(val, "MdcContainersAgentlessDiscoveryK8S", &d.MdcContainersAgentlessDiscoveryK8S) - 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 "vmScanners": - err = unpopulate(val, "VMScanners", &d.VMScanners) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForContainersAwsOfferingCloudWatchToKinesis. -func (d DefenderForContainersAwsOfferingCloudWatchToKinesis) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "cloudRoleArn", d.CloudRoleArn) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForContainersAwsOfferingCloudWatchToKinesis. -func (d *DefenderForContainersAwsOfferingCloudWatchToKinesis) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "cloudRoleArn": - err = unpopulate(val, "CloudRoleArn", &d.CloudRoleArn) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForContainersAwsOfferingKinesisToS3. -func (d DefenderForContainersAwsOfferingKinesisToS3) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "cloudRoleArn", d.CloudRoleArn) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForContainersAwsOfferingKinesisToS3. -func (d *DefenderForContainersAwsOfferingKinesisToS3) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "cloudRoleArn": - err = unpopulate(val, "CloudRoleArn", &d.CloudRoleArn) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForContainersAwsOfferingKubernetesDataCollection. -func (d DefenderForContainersAwsOfferingKubernetesDataCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "cloudRoleArn", d.CloudRoleArn) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForContainersAwsOfferingKubernetesDataCollection. -func (d *DefenderForContainersAwsOfferingKubernetesDataCollection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "cloudRoleArn": - err = unpopulate(val, "CloudRoleArn", &d.CloudRoleArn) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForContainersAwsOfferingKubernetesService. -func (d DefenderForContainersAwsOfferingKubernetesService) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "cloudRoleArn", d.CloudRoleArn) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForContainersAwsOfferingKubernetesService. -func (d *DefenderForContainersAwsOfferingKubernetesService) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "cloudRoleArn": - err = unpopulate(val, "CloudRoleArn", &d.CloudRoleArn) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S. -func (d DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S) 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 DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S. -func (d *DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "cloudRoleArn": - err = unpopulate(val, "CloudRoleArn", &d.CloudRoleArn) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &d.Enabled) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForContainersAwsOfferingMdcContainersImageAssessment. -func (d DefenderForContainersAwsOfferingMdcContainersImageAssessment) 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 DefenderForContainersAwsOfferingMdcContainersImageAssessment. -func (d *DefenderForContainersAwsOfferingMdcContainersImageAssessment) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "cloudRoleArn": - err = unpopulate(val, "CloudRoleArn", &d.CloudRoleArn) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &d.Enabled) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForContainersAwsOfferingVMScanners. -func (d DefenderForContainersAwsOfferingVMScanners) 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 DefenderForContainersAwsOfferingVMScanners. -func (d *DefenderForContainersAwsOfferingVMScanners) UnmarshalJSON(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 DefenderForContainersGcpOffering. -func (d DefenderForContainersGcpOffering) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataPipelineNativeCloudConnection", d.DataPipelineNativeCloudConnection) - populate(objectMap, "description", d.Description) - populate(objectMap, "enableAuditLogsAutoProvisioning", d.EnableAuditLogsAutoProvisioning) - populate(objectMap, "enableDefenderAgentAutoProvisioning", d.EnableDefenderAgentAutoProvisioning) - populate(objectMap, "enablePolicyAgentAutoProvisioning", d.EnablePolicyAgentAutoProvisioning) - populate(objectMap, "mdcContainersAgentlessDiscoveryK8s", d.MdcContainersAgentlessDiscoveryK8S) - populate(objectMap, "mdcContainersImageAssessment", d.MdcContainersImageAssessment) - populate(objectMap, "nativeCloudConnection", d.NativeCloudConnection) - objectMap["offeringType"] = OfferingTypeDefenderForContainersGcp - populate(objectMap, "vmScanners", d.VMScanners) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForContainersGcpOffering. -func (d *DefenderForContainersGcpOffering) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataPipelineNativeCloudConnection": - err = unpopulate(val, "DataPipelineNativeCloudConnection", &d.DataPipelineNativeCloudConnection) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &d.Description) - delete(rawMsg, key) - case "enableAuditLogsAutoProvisioning": - err = unpopulate(val, "EnableAuditLogsAutoProvisioning", &d.EnableAuditLogsAutoProvisioning) - delete(rawMsg, key) - case "enableDefenderAgentAutoProvisioning": - err = unpopulate(val, "EnableDefenderAgentAutoProvisioning", &d.EnableDefenderAgentAutoProvisioning) - delete(rawMsg, key) - case "enablePolicyAgentAutoProvisioning": - err = unpopulate(val, "EnablePolicyAgentAutoProvisioning", &d.EnablePolicyAgentAutoProvisioning) - delete(rawMsg, key) - case "mdcContainersAgentlessDiscoveryK8s": - err = unpopulate(val, "MdcContainersAgentlessDiscoveryK8S", &d.MdcContainersAgentlessDiscoveryK8S) - delete(rawMsg, key) - case "mdcContainersImageAssessment": - err = unpopulate(val, "MdcContainersImageAssessment", &d.MdcContainersImageAssessment) - delete(rawMsg, key) - case "nativeCloudConnection": - err = unpopulate(val, "NativeCloudConnection", &d.NativeCloudConnection) - delete(rawMsg, key) - case "offeringType": - err = unpopulate(val, "OfferingType", &d.OfferingType) - delete(rawMsg, key) - case "vmScanners": - err = unpopulate(val, "VMScanners", &d.VMScanners) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection. -func (d DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "serviceAccountEmailAddress", d.ServiceAccountEmailAddress) - populate(objectMap, "workloadIdentityProviderId", d.WorkloadIdentityProviderID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection. -func (d *DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "serviceAccountEmailAddress": - err = unpopulate(val, "ServiceAccountEmailAddress", &d.ServiceAccountEmailAddress) - delete(rawMsg, key) - case "workloadIdentityProviderId": - err = unpopulate(val, "WorkloadIdentityProviderID", &d.WorkloadIdentityProviderID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S. -func (d DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "enabled", d.Enabled) - populate(objectMap, "serviceAccountEmailAddress", d.ServiceAccountEmailAddress) - populate(objectMap, "workloadIdentityProviderId", d.WorkloadIdentityProviderID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S. -func (d *DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S) UnmarshalJSON(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) - case "serviceAccountEmailAddress": - err = unpopulate(val, "ServiceAccountEmailAddress", &d.ServiceAccountEmailAddress) - delete(rawMsg, key) - case "workloadIdentityProviderId": - err = unpopulate(val, "WorkloadIdentityProviderID", &d.WorkloadIdentityProviderID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForContainersGcpOfferingMdcContainersImageAssessment. -func (d DefenderForContainersGcpOfferingMdcContainersImageAssessment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "enabled", d.Enabled) - populate(objectMap, "serviceAccountEmailAddress", d.ServiceAccountEmailAddress) - populate(objectMap, "workloadIdentityProviderId", d.WorkloadIdentityProviderID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForContainersGcpOfferingMdcContainersImageAssessment. -func (d *DefenderForContainersGcpOfferingMdcContainersImageAssessment) UnmarshalJSON(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) - case "serviceAccountEmailAddress": - err = unpopulate(val, "ServiceAccountEmailAddress", &d.ServiceAccountEmailAddress) - delete(rawMsg, key) - case "workloadIdentityProviderId": - err = unpopulate(val, "WorkloadIdentityProviderID", &d.WorkloadIdentityProviderID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForContainersGcpOfferingNativeCloudConnection. -func (d DefenderForContainersGcpOfferingNativeCloudConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "serviceAccountEmailAddress", d.ServiceAccountEmailAddress) - populate(objectMap, "workloadIdentityProviderId", d.WorkloadIdentityProviderID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForContainersGcpOfferingNativeCloudConnection. -func (d *DefenderForContainersGcpOfferingNativeCloudConnection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "serviceAccountEmailAddress": - err = unpopulate(val, "ServiceAccountEmailAddress", &d.ServiceAccountEmailAddress) - delete(rawMsg, key) - case "workloadIdentityProviderId": - err = unpopulate(val, "WorkloadIdentityProviderID", &d.WorkloadIdentityProviderID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForContainersGcpOfferingVMScanners. -func (d DefenderForContainersGcpOfferingVMScanners) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "configuration", d.Configuration) - populate(objectMap, "enabled", d.Enabled) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForContainersGcpOfferingVMScanners. -func (d *DefenderForContainersGcpOfferingVMScanners) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "configuration": - err = unpopulate(val, "Configuration", &d.Configuration) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &d.Enabled) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForDatabasesGcpOffering. -func (d DefenderForDatabasesGcpOffering) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "arcAutoProvisioning", d.ArcAutoProvisioning) - populate(objectMap, "defenderForDatabasesArcAutoProvisioning", d.DefenderForDatabasesArcAutoProvisioning) - populate(objectMap, "description", d.Description) - objectMap["offeringType"] = OfferingTypeDefenderForDatabasesGcp - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForDatabasesGcpOffering. -func (d *DefenderForDatabasesGcpOffering) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "arcAutoProvisioning": - err = unpopulate(val, "ArcAutoProvisioning", &d.ArcAutoProvisioning) - delete(rawMsg, key) - case "defenderForDatabasesArcAutoProvisioning": - err = unpopulate(val, "DefenderForDatabasesArcAutoProvisioning", &d.DefenderForDatabasesArcAutoProvisioning) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &d.Description) - delete(rawMsg, key) - case "offeringType": - err = unpopulate(val, "OfferingType", &d.OfferingType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForDatabasesGcpOfferingArcAutoProvisioning. -func (d DefenderForDatabasesGcpOfferingArcAutoProvisioning) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "configuration", d.Configuration) - populate(objectMap, "enabled", d.Enabled) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForDatabasesGcpOfferingArcAutoProvisioning. -func (d *DefenderForDatabasesGcpOfferingArcAutoProvisioning) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "configuration": - err = unpopulate(val, "Configuration", &d.Configuration) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &d.Enabled) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning. -func (d DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "serviceAccountEmailAddress", d.ServiceAccountEmailAddress) - populate(objectMap, "workloadIdentityProviderId", d.WorkloadIdentityProviderID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning. -func (d *DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "serviceAccountEmailAddress": - err = unpopulate(val, "ServiceAccountEmailAddress", &d.ServiceAccountEmailAddress) - delete(rawMsg, key) - case "workloadIdentityProviderId": - err = unpopulate(val, "WorkloadIdentityProviderID", &d.WorkloadIdentityProviderID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForServersAwsOffering. -func (d DefenderForServersAwsOffering) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "arcAutoProvisioning", d.ArcAutoProvisioning) - populate(objectMap, "defenderForServers", d.DefenderForServers) - populate(objectMap, "description", d.Description) - populate(objectMap, "mdeAutoProvisioning", d.MdeAutoProvisioning) - objectMap["offeringType"] = OfferingTypeDefenderForServersAws - populate(objectMap, "subPlan", d.SubPlan) - populate(objectMap, "vmScanners", d.VMScanners) - populate(objectMap, "vaAutoProvisioning", d.VaAutoProvisioning) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersAwsOffering. -func (d *DefenderForServersAwsOffering) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "arcAutoProvisioning": - err = unpopulate(val, "ArcAutoProvisioning", &d.ArcAutoProvisioning) - delete(rawMsg, key) - case "defenderForServers": - err = unpopulate(val, "DefenderForServers", &d.DefenderForServers) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &d.Description) - delete(rawMsg, key) - case "mdeAutoProvisioning": - err = unpopulate(val, "MdeAutoProvisioning", &d.MdeAutoProvisioning) - delete(rawMsg, key) - case "offeringType": - err = unpopulate(val, "OfferingType", &d.OfferingType) - delete(rawMsg, key) - case "subPlan": - err = unpopulate(val, "SubPlan", &d.SubPlan) - delete(rawMsg, key) - case "vmScanners": - err = unpopulate(val, "VMScanners", &d.VMScanners) - delete(rawMsg, key) - case "vaAutoProvisioning": - err = unpopulate(val, "VaAutoProvisioning", &d.VaAutoProvisioning) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForServersAwsOfferingArcAutoProvisioning. -func (d DefenderForServersAwsOfferingArcAutoProvisioning) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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 DefenderForServersAwsOfferingArcAutoProvisioning. -func (d *DefenderForServersAwsOfferingArcAutoProvisioning) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "cloudRoleArn": - err = unpopulate(val, "CloudRoleArn", &d.CloudRoleArn) - delete(rawMsg, key) - case "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 DefenderForServersAwsOfferingDefenderForServers. -func (d DefenderForServersAwsOfferingDefenderForServers) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "cloudRoleArn", d.CloudRoleArn) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersAwsOfferingDefenderForServers. -func (d *DefenderForServersAwsOfferingDefenderForServers) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "cloudRoleArn": - err = unpopulate(val, "CloudRoleArn", &d.CloudRoleArn) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForServersAwsOfferingMdeAutoProvisioning. -func (d DefenderForServersAwsOfferingMdeAutoProvisioning) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateAny(objectMap, "configuration", d.Configuration) - populate(objectMap, "enabled", d.Enabled) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersAwsOfferingMdeAutoProvisioning. -func (d *DefenderForServersAwsOfferingMdeAutoProvisioning) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "configuration": - err = unpopulate(val, "Configuration", &d.Configuration) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &d.Enabled) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForServersAwsOfferingSubPlan. -func (d DefenderForServersAwsOfferingSubPlan) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersAwsOfferingSubPlan. -func (d *DefenderForServersAwsOfferingSubPlan) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "type": - err = unpopulate(val, "Type", &d.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForServersAwsOfferingVMScanners. -func (d DefenderForServersAwsOfferingVMScanners) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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 DefenderForServersAwsOfferingVMScanners. -func (d *DefenderForServersAwsOfferingVMScanners) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "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 DefenderForServersAwsOfferingVaAutoProvisioning. -func (d DefenderForServersAwsOfferingVaAutoProvisioning) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "configuration", d.Configuration) - populate(objectMap, "enabled", d.Enabled) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersAwsOfferingVaAutoProvisioning. -func (d *DefenderForServersAwsOfferingVaAutoProvisioning) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "configuration": - err = unpopulate(val, "Configuration", &d.Configuration) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &d.Enabled) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForServersAwsOfferingVaAutoProvisioningConfiguration. -func (d DefenderForServersAwsOfferingVaAutoProvisioningConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersAwsOfferingVaAutoProvisioningConfiguration. -func (d *DefenderForServersAwsOfferingVaAutoProvisioningConfiguration) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "type": - err = unpopulate(val, "Type", &d.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForServersGcpOffering. -func (d DefenderForServersGcpOffering) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "arcAutoProvisioning", d.ArcAutoProvisioning) - populate(objectMap, "defenderForServers", d.DefenderForServers) - populate(objectMap, "description", d.Description) - populate(objectMap, "mdeAutoProvisioning", d.MdeAutoProvisioning) - objectMap["offeringType"] = OfferingTypeDefenderForServersGcp - populate(objectMap, "subPlan", d.SubPlan) - populate(objectMap, "vmScanners", d.VMScanners) - populate(objectMap, "vaAutoProvisioning", d.VaAutoProvisioning) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersGcpOffering. -func (d *DefenderForServersGcpOffering) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "arcAutoProvisioning": - err = unpopulate(val, "ArcAutoProvisioning", &d.ArcAutoProvisioning) - delete(rawMsg, key) - case "defenderForServers": - err = unpopulate(val, "DefenderForServers", &d.DefenderForServers) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &d.Description) - delete(rawMsg, key) - case "mdeAutoProvisioning": - err = unpopulate(val, "MdeAutoProvisioning", &d.MdeAutoProvisioning) - delete(rawMsg, key) - case "offeringType": - err = unpopulate(val, "OfferingType", &d.OfferingType) - delete(rawMsg, key) - case "subPlan": - err = unpopulate(val, "SubPlan", &d.SubPlan) - delete(rawMsg, key) - case "vmScanners": - err = unpopulate(val, "VMScanners", &d.VMScanners) - delete(rawMsg, key) - case "vaAutoProvisioning": - err = unpopulate(val, "VaAutoProvisioning", &d.VaAutoProvisioning) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForServersGcpOfferingArcAutoProvisioning. -func (d DefenderForServersGcpOfferingArcAutoProvisioning) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "configuration", d.Configuration) - populate(objectMap, "enabled", d.Enabled) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersGcpOfferingArcAutoProvisioning. -func (d *DefenderForServersGcpOfferingArcAutoProvisioning) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "configuration": - err = unpopulate(val, "Configuration", &d.Configuration) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &d.Enabled) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForServersGcpOfferingDefenderForServers. -func (d DefenderForServersGcpOfferingDefenderForServers) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "serviceAccountEmailAddress", d.ServiceAccountEmailAddress) - populate(objectMap, "workloadIdentityProviderId", d.WorkloadIdentityProviderID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersGcpOfferingDefenderForServers. -func (d *DefenderForServersGcpOfferingDefenderForServers) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "serviceAccountEmailAddress": - err = unpopulate(val, "ServiceAccountEmailAddress", &d.ServiceAccountEmailAddress) - delete(rawMsg, key) - case "workloadIdentityProviderId": - err = unpopulate(val, "WorkloadIdentityProviderID", &d.WorkloadIdentityProviderID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForServersGcpOfferingMdeAutoProvisioning. -func (d DefenderForServersGcpOfferingMdeAutoProvisioning) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateAny(objectMap, "configuration", d.Configuration) - populate(objectMap, "enabled", d.Enabled) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersGcpOfferingMdeAutoProvisioning. -func (d *DefenderForServersGcpOfferingMdeAutoProvisioning) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "configuration": - err = unpopulate(val, "Configuration", &d.Configuration) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &d.Enabled) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForServersGcpOfferingSubPlan. -func (d DefenderForServersGcpOfferingSubPlan) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersGcpOfferingSubPlan. -func (d *DefenderForServersGcpOfferingSubPlan) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "type": - err = unpopulate(val, "Type", &d.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForServersGcpOfferingVMScanners. -func (d DefenderForServersGcpOfferingVMScanners) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "configuration", d.Configuration) - populate(objectMap, "enabled", d.Enabled) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersGcpOfferingVMScanners. -func (d *DefenderForServersGcpOfferingVMScanners) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "configuration": - err = unpopulate(val, "Configuration", &d.Configuration) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &d.Enabled) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForServersGcpOfferingVaAutoProvisioning. -func (d DefenderForServersGcpOfferingVaAutoProvisioning) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "configuration", d.Configuration) - populate(objectMap, "enabled", d.Enabled) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersGcpOfferingVaAutoProvisioning. -func (d *DefenderForServersGcpOfferingVaAutoProvisioning) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "configuration": - err = unpopulate(val, "Configuration", &d.Configuration) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &d.Enabled) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForServersGcpOfferingVaAutoProvisioningConfiguration. -func (d DefenderForServersGcpOfferingVaAutoProvisioningConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersGcpOfferingVaAutoProvisioningConfiguration. -func (d *DefenderForServersGcpOfferingVaAutoProvisioningConfiguration) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "type": - err = unpopulate(val, "Type", &d.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForStorageSetting. -func (d DefenderForStorageSetting) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", d.ID) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForStorageSetting. -func (d *DefenderForStorageSetting) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &d.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefenderForStorageSettingProperties. -func (d DefenderForStorageSettingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "isEnabled", d.IsEnabled) - populate(objectMap, "malwareScanning", d.MalwareScanning) - populate(objectMap, "overrideSubscriptionLevelSettings", d.OverrideSubscriptionLevelSettings) - populate(objectMap, "sensitiveDataDiscovery", d.SensitiveDataDiscovery) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForStorageSettingProperties. -func (d *DefenderForStorageSettingProperties) UnmarshalJSON(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 "isEnabled": - err = unpopulate(val, "IsEnabled", &d.IsEnabled) - delete(rawMsg, key) - case "malwareScanning": - err = unpopulate(val, "MalwareScanning", &d.MalwareScanning) - delete(rawMsg, key) - case "overrideSubscriptionLevelSettings": - err = unpopulate(val, "OverrideSubscriptionLevelSettings", &d.OverrideSubscriptionLevelSettings) - delete(rawMsg, key) - case "sensitiveDataDiscovery": - err = unpopulate(val, "SensitiveDataDiscovery", &d.SensitiveDataDiscovery) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DenylistCustomAlertRule. -func (d DenylistCustomAlertRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "denylistValues", d.DenylistValues) - populate(objectMap, "description", d.Description) - populate(objectMap, "displayName", d.DisplayName) - populate(objectMap, "isEnabled", d.IsEnabled) - objectMap["ruleType"] = "DenylistCustomAlertRule" - populate(objectMap, "valueType", d.ValueType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DenylistCustomAlertRule. -func (d *DenylistCustomAlertRule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "denylistValues": - err = unpopulate(val, "DenylistValues", &d.DenylistValues) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &d.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &d.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &d.IsEnabled) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &d.RuleType) - delete(rawMsg, key) - case "valueType": - err = unpopulate(val, "ValueType", &d.ValueType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DevOpsConfiguration. -func (d DevOpsConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - 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) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DevOpsConfiguration. -func (d *DevOpsConfiguration) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &d.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &d.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DevOpsConfigurationListResponse. -func (d DevOpsConfigurationListResponse) 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 DevOpsConfigurationListResponse. -func (d *DevOpsConfigurationListResponse) UnmarshalJSON(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 DevOpsConfigurationProperties. -func (d DevOpsConfigurationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "authorization", d.Authorization) - populate(objectMap, "autoDiscovery", d.AutoDiscovery) - populate(objectMap, "provisioningState", d.ProvisioningState) - populate(objectMap, "provisioningStatusMessage", d.ProvisioningStatusMessage) - populateDateTimeRFC3339(objectMap, "provisioningStatusUpdateTimeUtc", d.ProvisioningStatusUpdateTimeUTC) - populate(objectMap, "topLevelInventoryList", d.TopLevelInventoryList) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DevOpsConfigurationProperties. -func (d *DevOpsConfigurationProperties) UnmarshalJSON(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 "authorization": - err = unpopulate(val, "Authorization", &d.Authorization) - delete(rawMsg, key) - case "autoDiscovery": - err = unpopulate(val, "AutoDiscovery", &d.AutoDiscovery) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) - delete(rawMsg, key) - case "provisioningStatusMessage": - err = unpopulate(val, "ProvisioningStatusMessage", &d.ProvisioningStatusMessage) - delete(rawMsg, key) - case "provisioningStatusUpdateTimeUtc": - err = unpopulateDateTimeRFC3339(val, "ProvisioningStatusUpdateTimeUTC", &d.ProvisioningStatusUpdateTimeUTC) - delete(rawMsg, key) - case "topLevelInventoryList": - err = unpopulate(val, "TopLevelInventoryList", &d.TopLevelInventoryList) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DeviceSecurityGroup. -func (d DeviceSecurityGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", d.ID) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DeviceSecurityGroup. -func (d *DeviceSecurityGroup) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &d.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DeviceSecurityGroupList. -func (d DeviceSecurityGroupList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DeviceSecurityGroupList. -func (d *DeviceSecurityGroupList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &d.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &d.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DeviceSecurityGroupProperties. -func (d DeviceSecurityGroupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "allowlistRules", d.AllowlistRules) - populate(objectMap, "denylistRules", d.DenylistRules) - populate(objectMap, "thresholdRules", d.ThresholdRules) - populate(objectMap, "timeWindowRules", d.TimeWindowRules) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DeviceSecurityGroupProperties. -func (d *DeviceSecurityGroupProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "allowlistRules": - d.AllowlistRules, err = unmarshalAllowlistCustomAlertRuleClassificationArray(val) - delete(rawMsg, key) - case "denylistRules": - err = unpopulate(val, "DenylistRules", &d.DenylistRules) - delete(rawMsg, key) - case "thresholdRules": - d.ThresholdRules, err = unmarshalThresholdCustomAlertRuleClassificationArray(val) - delete(rawMsg, key) - case "timeWindowRules": - d.TimeWindowRules, err = unmarshalTimeWindowCustomAlertRuleClassificationArray(val) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DirectMethodInvokesNotInAllowedRange. -func (d DirectMethodInvokesNotInAllowedRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", d.Description) - populate(objectMap, "displayName", d.DisplayName) - populate(objectMap, "isEnabled", d.IsEnabled) - populate(objectMap, "maxThreshold", d.MaxThreshold) - populate(objectMap, "minThreshold", d.MinThreshold) - objectMap["ruleType"] = "DirectMethodInvokesNotInAllowedRange" - populate(objectMap, "timeWindowSize", d.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DirectMethodInvokesNotInAllowedRange. -func (d *DirectMethodInvokesNotInAllowedRange) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &d.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &d.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &d.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &d.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &d.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &d.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &d.TimeWindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DiscoveredSecuritySolution. -func (d DiscoveredSecuritySolution) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", d.ID) - populate(objectMap, "location", d.Location) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DiscoveredSecuritySolution. -func (d *DiscoveredSecuritySolution) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &d.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &d.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DiscoveredSecuritySolutionList. -func (d DiscoveredSecuritySolutionList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DiscoveredSecuritySolutionList. -func (d *DiscoveredSecuritySolutionList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &d.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &d.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DiscoveredSecuritySolutionProperties. -func (d DiscoveredSecuritySolutionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "offer", d.Offer) - populate(objectMap, "publisher", d.Publisher) - populate(objectMap, "sku", d.SKU) - populate(objectMap, "securityFamily", d.SecurityFamily) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DiscoveredSecuritySolutionProperties. -func (d *DiscoveredSecuritySolutionProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "offer": - err = unpopulate(val, "Offer", &d.Offer) - delete(rawMsg, key) - case "publisher": - err = unpopulate(val, "Publisher", &d.Publisher) - delete(rawMsg, key) - case "sku": - err = unpopulate(val, "SKU", &d.SKU) - delete(rawMsg, key) - case "securityFamily": - err = unpopulate(val, "SecurityFamily", &d.SecurityFamily) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ETag. -func (e ETag) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "etag", e.Etag) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ETag. -func (e *ETag) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &e.Etag) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EffectiveNetworkSecurityGroups. -func (e EffectiveNetworkSecurityGroups) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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) - delete(rawMsg, key) - case "networkSecurityGroups": - err = unpopulate(val, "NetworkSecurityGroups", &e.NetworkSecurityGroups) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EnvironmentData. -func (e EnvironmentData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["environmentType"] = e.EnvironmentType - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EnvironmentData. -func (e *EnvironmentData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "environmentType": - err = unpopulate(val, "EnvironmentType", &e.EnvironmentType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EnvironmentDetails. -func (e EnvironmentDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "environmentHierarchyId", e.EnvironmentHierarchyID) - populate(objectMap, "nativeResourceId", e.NativeResourceID) - populate(objectMap, "organizationalHierarchyId", e.OrganizationalHierarchyID) - populate(objectMap, "subscriptionId", e.SubscriptionID) - populate(objectMap, "tenantId", e.TenantID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EnvironmentDetails. -func (e *EnvironmentDetails) UnmarshalJSON(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 "environmentHierarchyId": - err = unpopulate(val, "EnvironmentHierarchyID", &e.EnvironmentHierarchyID) - delete(rawMsg, key) - case "nativeResourceId": - err = unpopulate(val, "NativeResourceID", &e.NativeResourceID) - delete(rawMsg, key) - case "organizationalHierarchyId": - err = unpopulate(val, "OrganizationalHierarchyID", &e.OrganizationalHierarchyID) - delete(rawMsg, key) - case "subscriptionId": - err = unpopulate(val, "SubscriptionID", &e.SubscriptionID) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &e.TenantID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. -func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateAny(objectMap, "info", e.Info) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. -func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "info": - err = unpopulate(val, "Info", &e.Info) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. -func (e ErrorDetail) 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) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. -func (e *ErrorDetail) UnmarshalJSON(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 "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) - 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 ErrorDetailAutoGenerated. -func (e ErrorDetailAutoGenerated) 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) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetailAutoGenerated. -func (e *ErrorDetailAutoGenerated) UnmarshalJSON(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 "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) - 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 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) { - objectMap := make(map[string]any) - populate(objectMap, "additionalExtensionProperties", e.AdditionalExtensionProperties) - populate(objectMap, "isEnabled", e.IsEnabled) - populate(objectMap, "name", e.Name) - populate(objectMap, "operationStatus", e.OperationStatus) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Extension. -func (e *Extension) UnmarshalJSON(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 "additionalExtensionProperties": - err = unpopulate(val, "AdditionalExtensionProperties", &e.AdditionalExtensionProperties) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &e.IsEnabled) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "operationStatus": - err = unpopulate(val, "OperationStatus", &e.OperationStatus) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ExternalSecuritySolution. -func (e ExternalSecuritySolution) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", e.ID) - objectMap["kind"] = e.Kind - populate(objectMap, "location", e.Location) - populate(objectMap, "name", e.Name) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ExternalSecuritySolution. -func (e *ExternalSecuritySolution) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &e.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &e.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &e.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ExternalSecuritySolutionList. -func (e ExternalSecuritySolutionList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", e.NextLink) - populate(objectMap, "value", e.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ExternalSecuritySolutionList. -func (e *ExternalSecuritySolutionList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &e.NextLink) - delete(rawMsg, key) - case "value": - e.Value, err = unmarshalExternalSecuritySolutionClassificationArray(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 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) - populate(objectMap, "description", f.Description) - populate(objectMap, "displayName", f.DisplayName) - populate(objectMap, "isEnabled", f.IsEnabled) - populate(objectMap, "maxThreshold", f.MaxThreshold) - populate(objectMap, "minThreshold", f.MinThreshold) - objectMap["ruleType"] = "FailedLocalLoginsNotInAllowedRange" - populate(objectMap, "timeWindowSize", f.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FailedLocalLoginsNotInAllowedRange. -func (f *FailedLocalLoginsNotInAllowedRange) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &f.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &f.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &f.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &f.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &f.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &f.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &f.TimeWindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type FileUploadsNotInAllowedRange. -func (f FileUploadsNotInAllowedRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", f.Description) - populate(objectMap, "displayName", f.DisplayName) - populate(objectMap, "isEnabled", f.IsEnabled) - populate(objectMap, "maxThreshold", f.MaxThreshold) - populate(objectMap, "minThreshold", f.MinThreshold) - objectMap["ruleType"] = "FileUploadsNotInAllowedRange" - populate(objectMap, "timeWindowSize", f.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FileUploadsNotInAllowedRange. -func (f *FileUploadsNotInAllowedRange) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &f.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &f.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &f.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &f.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &f.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &f.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &f.TimeWindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GcpCredentialsDetailsProperties. -func (g GcpCredentialsDetailsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GcpCredentialsDetailsProperties. -func (g *GcpCredentialsDetailsProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "authProviderX509CertUrl": - err = unpopulate(val, "AuthProviderX509CertURL", &g.AuthProviderX509CertURL) - delete(rawMsg, key) - case "authUri": - err = unpopulate(val, "AuthURI", &g.AuthURI) - delete(rawMsg, key) - case "authenticationProvisioningState": - err = unpopulate(val, "AuthenticationProvisioningState", &g.AuthenticationProvisioningState) - delete(rawMsg, key) - case "authenticationType": - err = unpopulate(val, "AuthenticationType", &g.AuthenticationType) - delete(rawMsg, key) - case "clientEmail": - err = unpopulate(val, "ClientEmail", &g.ClientEmail) - delete(rawMsg, key) - case "clientId": - err = unpopulate(val, "ClientID", &g.ClientID) - delete(rawMsg, key) - case "clientX509CertUrl": - err = unpopulate(val, "ClientX509CertURL", &g.ClientX509CertURL) - delete(rawMsg, key) - case "grantedPermissions": - err = unpopulate(val, "GrantedPermissions", &g.GrantedPermissions) - delete(rawMsg, key) - case "organizationId": - err = unpopulate(val, "OrganizationID", &g.OrganizationID) - delete(rawMsg, key) - case "privateKey": - err = unpopulate(val, "PrivateKey", &g.PrivateKey) - delete(rawMsg, key) - case "privateKeyId": - err = unpopulate(val, "PrivateKeyID", &g.PrivateKeyID) - delete(rawMsg, key) - case "projectId": - err = unpopulate(val, "ProjectID", &g.ProjectID) - delete(rawMsg, key) - case "tokenUri": - err = unpopulate(val, "TokenURI", &g.TokenURI) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &g.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GcpOrganizationalData. -func (g GcpOrganizationalData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["organizationMembershipType"] = g.OrganizationMembershipType - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GcpOrganizationalData. -func (g *GcpOrganizationalData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "organizationMembershipType": - err = unpopulate(val, "OrganizationMembershipType", &g.OrganizationMembershipType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GcpOrganizationalDataMember. -func (g GcpOrganizationalDataMember) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "managementProjectNumber", g.ManagementProjectNumber) - objectMap["organizationMembershipType"] = OrganizationMembershipTypeMember - populate(objectMap, "parentHierarchyId", g.ParentHierarchyID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GcpOrganizationalDataMember. -func (g *GcpOrganizationalDataMember) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "managementProjectNumber": - err = unpopulate(val, "ManagementProjectNumber", &g.ManagementProjectNumber) - delete(rawMsg, key) - case "organizationMembershipType": - err = unpopulate(val, "OrganizationMembershipType", &g.OrganizationMembershipType) - delete(rawMsg, key) - case "parentHierarchyId": - err = unpopulate(val, "ParentHierarchyID", &g.ParentHierarchyID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GcpOrganizationalDataOrganization. -func (g GcpOrganizationalDataOrganization) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "excludedProjectNumbers", g.ExcludedProjectNumbers) - objectMap["organizationMembershipType"] = OrganizationMembershipTypeOrganization - populate(objectMap, "organizationName", g.OrganizationName) - populate(objectMap, "serviceAccountEmailAddress", g.ServiceAccountEmailAddress) - populate(objectMap, "workloadIdentityProviderId", g.WorkloadIdentityProviderID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GcpOrganizationalDataOrganization. -func (g *GcpOrganizationalDataOrganization) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "excludedProjectNumbers": - err = unpopulate(val, "ExcludedProjectNumbers", &g.ExcludedProjectNumbers) - delete(rawMsg, key) - case "organizationMembershipType": - err = unpopulate(val, "OrganizationMembershipType", &g.OrganizationMembershipType) - delete(rawMsg, key) - case "organizationName": - err = unpopulate(val, "OrganizationName", &g.OrganizationName) - delete(rawMsg, key) - case "serviceAccountEmailAddress": - err = unpopulate(val, "ServiceAccountEmailAddress", &g.ServiceAccountEmailAddress) - delete(rawMsg, key) - case "workloadIdentityProviderId": - err = unpopulate(val, "WorkloadIdentityProviderID", &g.WorkloadIdentityProviderID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GcpProjectDetails. -func (g GcpProjectDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "projectId", g.ProjectID) - populate(objectMap, "projectName", g.ProjectName) - populate(objectMap, "projectNumber", g.ProjectNumber) - populate(objectMap, "workloadIdentityPoolId", g.WorkloadIdentityPoolID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GcpProjectDetails. -func (g *GcpProjectDetails) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "projectId": - err = unpopulate(val, "ProjectID", &g.ProjectID) - delete(rawMsg, key) - case "projectName": - err = unpopulate(val, "ProjectName", &g.ProjectName) - delete(rawMsg, key) - case "projectNumber": - err = unpopulate(val, "ProjectNumber", &g.ProjectNumber) - delete(rawMsg, key) - case "workloadIdentityPoolId": - err = unpopulate(val, "WorkloadIdentityPoolID", &g.WorkloadIdentityPoolID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GcpProjectEnvironmentData. -func (g GcpProjectEnvironmentData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["environmentType"] = EnvironmentTypeGcpProject - populate(objectMap, "organizationalData", g.OrganizationalData) - populate(objectMap, "projectDetails", g.ProjectDetails) - populate(objectMap, "scanInterval", g.ScanInterval) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GcpProjectEnvironmentData. -func (g *GcpProjectEnvironmentData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "environmentType": - err = unpopulate(val, "EnvironmentType", &g.EnvironmentType) - delete(rawMsg, key) - case "organizationalData": - g.OrganizationalData, err = unmarshalGcpOrganizationalDataClassification(val) - delete(rawMsg, key) - case "projectDetails": - err = unpopulate(val, "ProjectDetails", &g.ProjectDetails) - delete(rawMsg, key) - case "scanInterval": - err = unpopulate(val, "ScanInterval", &g.ScanInterval) - 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 GetSensitivitySettingsListResponse. -func (g GetSensitivitySettingsListResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", g.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GetSensitivitySettingsListResponse. -func (g *GetSensitivitySettingsListResponse) UnmarshalJSON(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 "value": - err = unpopulate(val, "Value", &g.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GetSensitivitySettingsResponse. -func (g GetSensitivitySettingsResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", g.ID) - populate(objectMap, "name", g.Name) - populate(objectMap, "properties", g.Properties) - populate(objectMap, "type", g.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GetSensitivitySettingsResponse. -func (g *GetSensitivitySettingsResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &g.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &g.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &g.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &g.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GetSensitivitySettingsResponseProperties. -func (g GetSensitivitySettingsResponseProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "mipInformation", g.MipInformation) - populate(objectMap, "sensitiveInfoTypesIds", g.SensitiveInfoTypesIDs) - populate(objectMap, "sensitivityThresholdLabelId", g.SensitivityThresholdLabelID) - populate(objectMap, "sensitivityThresholdLabelOrder", g.SensitivityThresholdLabelOrder) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GetSensitivitySettingsResponseProperties. -func (g *GetSensitivitySettingsResponseProperties) UnmarshalJSON(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 "mipInformation": - err = unpopulate(val, "MipInformation", &g.MipInformation) - delete(rawMsg, key) - case "sensitiveInfoTypesIds": - err = unpopulate(val, "SensitiveInfoTypesIDs", &g.SensitiveInfoTypesIDs) - delete(rawMsg, key) - case "sensitivityThresholdLabelId": - err = unpopulate(val, "SensitivityThresholdLabelID", &g.SensitivityThresholdLabelID) - delete(rawMsg, key) - case "sensitivityThresholdLabelOrder": - err = unpopulate(val, "SensitivityThresholdLabelOrder", &g.SensitivityThresholdLabelOrder) - 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 GetSensitivitySettingsResponsePropertiesMipInformation. -func (g GetSensitivitySettingsResponsePropertiesMipInformation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "builtInInfoTypes", g.BuiltInInfoTypes) - populate(objectMap, "customInfoTypes", g.CustomInfoTypes) - populate(objectMap, "labels", g.Labels) - populate(objectMap, "mipIntegrationStatus", g.MipIntegrationStatus) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GetSensitivitySettingsResponsePropertiesMipInformation. -func (g *GetSensitivitySettingsResponsePropertiesMipInformation) UnmarshalJSON(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 "builtInInfoTypes": - err = unpopulate(val, "BuiltInInfoTypes", &g.BuiltInInfoTypes) - delete(rawMsg, key) - case "customInfoTypes": - err = unpopulate(val, "CustomInfoTypes", &g.CustomInfoTypes) - delete(rawMsg, key) - case "labels": - err = unpopulate(val, "Labels", &g.Labels) - delete(rawMsg, key) - case "mipIntegrationStatus": - err = unpopulate(val, "MipIntegrationStatus", &g.MipIntegrationStatus) - 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 GitHubOwner. -func (g GitHubOwner) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - 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) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GitHubOwner. -func (g *GitHubOwner) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &g.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &g.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &g.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &g.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &g.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type 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) - populate(objectMap, "nextLink", g.NextLink) - populate(objectMap, "value", g.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GitHubOwnerListResponse. -func (g *GitHubOwnerListResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &g.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &g.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GitHubOwnerProperties. -func (g GitHubOwnerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "gitHubInternalId", g.GitHubInternalID) - populate(objectMap, "onboardingState", g.OnboardingState) - populate(objectMap, "ownerUrl", g.OwnerURL) - populate(objectMap, "provisioningState", g.ProvisioningState) - populate(objectMap, "provisioningStatusMessage", g.ProvisioningStatusMessage) - populateDateTimeRFC3339(objectMap, "provisioningStatusUpdateTimeUtc", g.ProvisioningStatusUpdateTimeUTC) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GitHubOwnerProperties. -func (g *GitHubOwnerProperties) UnmarshalJSON(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 "gitHubInternalId": - err = unpopulate(val, "GitHubInternalID", &g.GitHubInternalID) - delete(rawMsg, key) - case "onboardingState": - err = unpopulate(val, "OnboardingState", &g.OnboardingState) - delete(rawMsg, key) - case "ownerUrl": - err = unpopulate(val, "OwnerURL", &g.OwnerURL) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &g.ProvisioningState) - delete(rawMsg, key) - case "provisioningStatusMessage": - err = unpopulate(val, "ProvisioningStatusMessage", &g.ProvisioningStatusMessage) - delete(rawMsg, key) - case "provisioningStatusUpdateTimeUtc": - err = unpopulateDateTimeRFC3339(val, "ProvisioningStatusUpdateTimeUTC", &g.ProvisioningStatusUpdateTimeUTC) - 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 GitHubRepository. -func (g GitHubRepository) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - 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) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GitHubRepository. -func (g *GitHubRepository) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &g.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &g.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &g.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &g.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &g.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GitHubRepositoryListResponse. -func (g GitHubRepositoryListResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", g.NextLink) - populate(objectMap, "value", g.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GitHubRepositoryListResponse. -func (g *GitHubRepositoryListResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &g.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &g.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GitHubRepositoryProperties. -func (g GitHubRepositoryProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "onboardingState", g.OnboardingState) - populate(objectMap, "parentOwnerName", g.ParentOwnerName) - populate(objectMap, "provisioningState", g.ProvisioningState) - populate(objectMap, "provisioningStatusMessage", g.ProvisioningStatusMessage) - populateDateTimeRFC3339(objectMap, "provisioningStatusUpdateTimeUtc", g.ProvisioningStatusUpdateTimeUTC) - populate(objectMap, "repoFullName", g.RepoFullName) - populate(objectMap, "repoId", g.RepoID) - populate(objectMap, "repoName", g.RepoName) - populate(objectMap, "repoUrl", g.RepoURL) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GitHubRepositoryProperties. -func (g *GitHubRepositoryProperties) UnmarshalJSON(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 "onboardingState": - err = unpopulate(val, "OnboardingState", &g.OnboardingState) - delete(rawMsg, key) - case "parentOwnerName": - err = unpopulate(val, "ParentOwnerName", &g.ParentOwnerName) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &g.ProvisioningState) - delete(rawMsg, key) - case "provisioningStatusMessage": - err = unpopulate(val, "ProvisioningStatusMessage", &g.ProvisioningStatusMessage) - delete(rawMsg, key) - case "provisioningStatusUpdateTimeUtc": - err = unpopulateDateTimeRFC3339(val, "ProvisioningStatusUpdateTimeUTC", &g.ProvisioningStatusUpdateTimeUTC) - delete(rawMsg, key) - case "repoFullName": - err = unpopulate(val, "RepoFullName", &g.RepoFullName) - delete(rawMsg, key) - case "repoId": - err = unpopulate(val, "RepoID", &g.RepoID) - delete(rawMsg, key) - case "repoName": - err = unpopulate(val, "RepoName", &g.RepoName) - delete(rawMsg, key) - case "repoUrl": - err = unpopulate(val, "RepoURL", &g.RepoURL) - 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 GitLabGroup. -func (g GitLabGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - 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) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GitLabGroup. -func (g *GitLabGroup) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &g.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &g.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &g.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &g.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &g.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type 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) - populate(objectMap, "nextLink", g.NextLink) - populate(objectMap, "value", g.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GitLabGroupListResponse. -func (g *GitLabGroupListResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &g.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &g.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GitLabGroupProperties. -func (g GitLabGroupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "fullyQualifiedFriendlyName", g.FullyQualifiedFriendlyName) - populate(objectMap, "fullyQualifiedName", g.FullyQualifiedName) - populate(objectMap, "onboardingState", g.OnboardingState) - populate(objectMap, "provisioningState", g.ProvisioningState) - populate(objectMap, "provisioningStatusMessage", g.ProvisioningStatusMessage) - populateDateTimeRFC3339(objectMap, "provisioningStatusUpdateTimeUtc", g.ProvisioningStatusUpdateTimeUTC) - populate(objectMap, "url", g.URL) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GitLabGroupProperties. -func (g *GitLabGroupProperties) UnmarshalJSON(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 "fullyQualifiedFriendlyName": - err = unpopulate(val, "FullyQualifiedFriendlyName", &g.FullyQualifiedFriendlyName) - delete(rawMsg, key) - case "fullyQualifiedName": - err = unpopulate(val, "FullyQualifiedName", &g.FullyQualifiedName) - delete(rawMsg, key) - case "onboardingState": - err = unpopulate(val, "OnboardingState", &g.OnboardingState) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &g.ProvisioningState) - delete(rawMsg, key) - case "provisioningStatusMessage": - err = unpopulate(val, "ProvisioningStatusMessage", &g.ProvisioningStatusMessage) - delete(rawMsg, key) - case "provisioningStatusUpdateTimeUtc": - err = unpopulateDateTimeRFC3339(val, "ProvisioningStatusUpdateTimeUTC", &g.ProvisioningStatusUpdateTimeUTC) - delete(rawMsg, key) - case "url": - err = unpopulate(val, "URL", &g.URL) - 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 GitLabProject. -func (g GitLabProject) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - 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) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GitLabProject. -func (g *GitLabProject) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &g.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &g.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &g.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &g.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &g.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GitLabProjectListResponse. -func (g GitLabProjectListResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", g.NextLink) - populate(objectMap, "value", g.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GitLabProjectListResponse. -func (g *GitLabProjectListResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &g.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &g.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GitLabProjectProperties. -func (g GitLabProjectProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "fullyQualifiedFriendlyName", g.FullyQualifiedFriendlyName) - populate(objectMap, "fullyQualifiedName", g.FullyQualifiedName) - populate(objectMap, "fullyQualifiedParentGroupName", g.FullyQualifiedParentGroupName) - populate(objectMap, "onboardingState", g.OnboardingState) - populate(objectMap, "provisioningState", g.ProvisioningState) - populate(objectMap, "provisioningStatusMessage", g.ProvisioningStatusMessage) - populateDateTimeRFC3339(objectMap, "provisioningStatusUpdateTimeUtc", g.ProvisioningStatusUpdateTimeUTC) - populate(objectMap, "url", g.URL) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GitLabProjectProperties. -func (g *GitLabProjectProperties) UnmarshalJSON(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 "fullyQualifiedFriendlyName": - err = unpopulate(val, "FullyQualifiedFriendlyName", &g.FullyQualifiedFriendlyName) - delete(rawMsg, key) - case "fullyQualifiedName": - err = unpopulate(val, "FullyQualifiedName", &g.FullyQualifiedName) - delete(rawMsg, key) - case "fullyQualifiedParentGroupName": - err = unpopulate(val, "FullyQualifiedParentGroupName", &g.FullyQualifiedParentGroupName) - delete(rawMsg, key) - case "onboardingState": - err = unpopulate(val, "OnboardingState", &g.OnboardingState) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &g.ProvisioningState) - delete(rawMsg, key) - case "provisioningStatusMessage": - err = unpopulate(val, "ProvisioningStatusMessage", &g.ProvisioningStatusMessage) - delete(rawMsg, key) - case "provisioningStatusUpdateTimeUtc": - err = unpopulateDateTimeRFC3339(val, "ProvisioningStatusUpdateTimeUTC", &g.ProvisioningStatusUpdateTimeUTC) - delete(rawMsg, key) - case "url": - err = unpopulate(val, "URL", &g.URL) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GithubScopeEnvironmentData. -func (g GithubScopeEnvironmentData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["environmentType"] = EnvironmentTypeGithubScope - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GithubScopeEnvironmentData. -func (g *GithubScopeEnvironmentData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "environmentType": - err = unpopulate(val, "EnvironmentType", &g.EnvironmentType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GitlabScopeEnvironmentData. -func (g GitlabScopeEnvironmentData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["environmentType"] = EnvironmentTypeGitlabScope - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GitlabScopeEnvironmentData. -func (g *GitlabScopeEnvironmentData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "environmentType": - err = unpopulate(val, "EnvironmentType", &g.EnvironmentType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GovernanceAssignment. -func (g GovernanceAssignment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", g.ID) - populate(objectMap, "name", g.Name) - populate(objectMap, "properties", g.Properties) - populate(objectMap, "type", g.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GovernanceAssignment. -func (g *GovernanceAssignment) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &g.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &g.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &g.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &g.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GovernanceAssignmentAdditionalData. -func (g GovernanceAssignmentAdditionalData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "ticketLink", g.TicketLink) - populate(objectMap, "ticketNumber", g.TicketNumber) - populate(objectMap, "ticketStatus", g.TicketStatus) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GovernanceAssignmentAdditionalData. -func (g *GovernanceAssignmentAdditionalData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "ticketLink": - err = unpopulate(val, "TicketLink", &g.TicketLink) - delete(rawMsg, key) - case "ticketNumber": - err = unpopulate(val, "TicketNumber", &g.TicketNumber) - delete(rawMsg, key) - case "ticketStatus": - err = unpopulate(val, "TicketStatus", &g.TicketStatus) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GovernanceAssignmentProperties. -func (g GovernanceAssignmentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "additionalData", g.AdditionalData) - populate(objectMap, "governanceEmailNotification", g.GovernanceEmailNotification) - populate(objectMap, "isGracePeriod", g.IsGracePeriod) - populate(objectMap, "owner", g.Owner) - populateDateTimeRFC3339(objectMap, "remediationDueDate", g.RemediationDueDate) - populate(objectMap, "remediationEta", g.RemediationEta) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GovernanceAssignmentProperties. -func (g *GovernanceAssignmentProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "additionalData": - err = unpopulate(val, "AdditionalData", &g.AdditionalData) - delete(rawMsg, key) - case "governanceEmailNotification": - err = unpopulate(val, "GovernanceEmailNotification", &g.GovernanceEmailNotification) - delete(rawMsg, key) - case "isGracePeriod": - err = unpopulate(val, "IsGracePeriod", &g.IsGracePeriod) - delete(rawMsg, key) - case "owner": - err = unpopulate(val, "Owner", &g.Owner) - delete(rawMsg, key) - case "remediationDueDate": - err = unpopulateDateTimeRFC3339(val, "RemediationDueDate", &g.RemediationDueDate) - delete(rawMsg, key) - case "remediationEta": - err = unpopulate(val, "RemediationEta", &g.RemediationEta) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GovernanceAssignmentsList. -func (g GovernanceAssignmentsList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", g.NextLink) - populate(objectMap, "value", g.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GovernanceAssignmentsList. -func (g *GovernanceAssignmentsList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &g.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &g.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GovernanceEmailNotification. -func (g GovernanceEmailNotification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "disableManagerEmailNotification", g.DisableManagerEmailNotification) - populate(objectMap, "disableOwnerEmailNotification", g.DisableOwnerEmailNotification) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GovernanceEmailNotification. -func (g *GovernanceEmailNotification) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "disableManagerEmailNotification": - err = unpopulate(val, "DisableManagerEmailNotification", &g.DisableManagerEmailNotification) - delete(rawMsg, key) - case "disableOwnerEmailNotification": - err = unpopulate(val, "DisableOwnerEmailNotification", &g.DisableOwnerEmailNotification) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GovernanceRule. -func (g GovernanceRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", g.ID) - populate(objectMap, "name", g.Name) - populate(objectMap, "properties", g.Properties) - populate(objectMap, "type", g.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GovernanceRule. -func (g *GovernanceRule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &g.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &g.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &g.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &g.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GovernanceRuleEmailNotification. -func (g GovernanceRuleEmailNotification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "disableManagerEmailNotification", g.DisableManagerEmailNotification) - populate(objectMap, "disableOwnerEmailNotification", g.DisableOwnerEmailNotification) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GovernanceRuleEmailNotification. -func (g *GovernanceRuleEmailNotification) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "disableManagerEmailNotification": - err = unpopulate(val, "DisableManagerEmailNotification", &g.DisableManagerEmailNotification) - delete(rawMsg, key) - case "disableOwnerEmailNotification": - err = unpopulate(val, "DisableOwnerEmailNotification", &g.DisableOwnerEmailNotification) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GovernanceRuleList. -func (g GovernanceRuleList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", g.NextLink) - populate(objectMap, "value", g.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GovernanceRuleList. -func (g *GovernanceRuleList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &g.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &g.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GovernanceRuleMetadata. -func (g GovernanceRuleMetadata) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "createdBy", g.CreatedBy) - populateDateTimeRFC3339(objectMap, "createdOn", g.CreatedOn) - populate(objectMap, "updatedBy", g.UpdatedBy) - populateDateTimeRFC3339(objectMap, "updatedOn", g.UpdatedOn) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GovernanceRuleMetadata. -func (g *GovernanceRuleMetadata) UnmarshalJSON(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 "createdBy": - err = unpopulate(val, "CreatedBy", &g.CreatedBy) - delete(rawMsg, key) - case "createdOn": - err = unpopulateDateTimeRFC3339(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) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GovernanceRuleOwnerSource. -func (g GovernanceRuleOwnerSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "type", g.Type) - populate(objectMap, "value", g.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GovernanceRuleOwnerSource. -func (g *GovernanceRuleOwnerSource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "type": - err = unpopulate(val, "Type", &g.Type) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &g.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GovernanceRuleProperties. -func (g GovernanceRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "conditionSets", g.ConditionSets) - populate(objectMap, "description", g.Description) - populate(objectMap, "displayName", g.DisplayName) - populate(objectMap, "excludedScopes", g.ExcludedScopes) - populate(objectMap, "governanceEmailNotification", g.GovernanceEmailNotification) - populate(objectMap, "includeMemberScopes", g.IncludeMemberScopes) - populate(objectMap, "isDisabled", g.IsDisabled) - populate(objectMap, "isGracePeriod", g.IsGracePeriod) - populate(objectMap, "metadata", g.Metadata) - populate(objectMap, "ownerSource", g.OwnerSource) - populate(objectMap, "remediationTimeframe", g.RemediationTimeframe) - populate(objectMap, "rulePriority", g.RulePriority) - populate(objectMap, "ruleType", g.RuleType) - populate(objectMap, "sourceResourceType", g.SourceResourceType) - populate(objectMap, "tenantId", g.TenantID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GovernanceRuleProperties. -func (g *GovernanceRuleProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "conditionSets": - err = unpopulate(val, "ConditionSets", &g.ConditionSets) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &g.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &g.DisplayName) - delete(rawMsg, key) - case "excludedScopes": - err = unpopulate(val, "ExcludedScopes", &g.ExcludedScopes) - delete(rawMsg, key) - case "governanceEmailNotification": - err = unpopulate(val, "GovernanceEmailNotification", &g.GovernanceEmailNotification) - delete(rawMsg, key) - case "includeMemberScopes": - err = unpopulate(val, "IncludeMemberScopes", &g.IncludeMemberScopes) - delete(rawMsg, key) - case "isDisabled": - err = unpopulate(val, "IsDisabled", &g.IsDisabled) - delete(rawMsg, key) - case "isGracePeriod": - err = unpopulate(val, "IsGracePeriod", &g.IsGracePeriod) - delete(rawMsg, key) - case "metadata": - err = unpopulate(val, "Metadata", &g.Metadata) - delete(rawMsg, key) - case "ownerSource": - err = unpopulate(val, "OwnerSource", &g.OwnerSource) - delete(rawMsg, key) - case "remediationTimeframe": - err = unpopulate(val, "RemediationTimeframe", &g.RemediationTimeframe) - delete(rawMsg, key) - case "rulePriority": - err = unpopulate(val, "RulePriority", &g.RulePriority) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &g.RuleType) - delete(rawMsg, key) - case "sourceResourceType": - err = unpopulate(val, "SourceResourceType", &g.SourceResourceType) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &g.TenantID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type HTTPC2DMessagesNotInAllowedRange. -func (h HTTPC2DMessagesNotInAllowedRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", h.Description) - populate(objectMap, "displayName", h.DisplayName) - populate(objectMap, "isEnabled", h.IsEnabled) - populate(objectMap, "maxThreshold", h.MaxThreshold) - populate(objectMap, "minThreshold", h.MinThreshold) - objectMap["ruleType"] = "HttpC2DMessagesNotInAllowedRange" - populate(objectMap, "timeWindowSize", h.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPC2DMessagesNotInAllowedRange. -func (h *HTTPC2DMessagesNotInAllowedRange) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &h.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &h.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &h.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &h.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &h.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &h.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &h.TimeWindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type HTTPC2DRejectedMessagesNotInAllowedRange. -func (h HTTPC2DRejectedMessagesNotInAllowedRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", h.Description) - populate(objectMap, "displayName", h.DisplayName) - populate(objectMap, "isEnabled", h.IsEnabled) - populate(objectMap, "maxThreshold", h.MaxThreshold) - populate(objectMap, "minThreshold", h.MinThreshold) - objectMap["ruleType"] = "HttpC2DRejectedMessagesNotInAllowedRange" - populate(objectMap, "timeWindowSize", h.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPC2DRejectedMessagesNotInAllowedRange. -func (h *HTTPC2DRejectedMessagesNotInAllowedRange) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &h.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &h.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &h.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &h.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &h.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &h.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &h.TimeWindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type HTTPD2CMessagesNotInAllowedRange. -func (h HTTPD2CMessagesNotInAllowedRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", h.Description) - populate(objectMap, "displayName", h.DisplayName) - populate(objectMap, "isEnabled", h.IsEnabled) - populate(objectMap, "maxThreshold", h.MaxThreshold) - populate(objectMap, "minThreshold", h.MinThreshold) - objectMap["ruleType"] = "HttpD2CMessagesNotInAllowedRange" - populate(objectMap, "timeWindowSize", h.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPD2CMessagesNotInAllowedRange. -func (h *HTTPD2CMessagesNotInAllowedRange) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &h.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &h.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &h.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &h.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &h.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &h.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &h.TimeWindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type HealthDataClassification. -func (h HealthDataClassification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "component", h.Component) - populate(objectMap, "scenario", h.Scenario) - populate(objectMap, "scope", h.Scope) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type HealthDataClassification. -func (h *HealthDataClassification) UnmarshalJSON(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 "component": - err = unpopulate(val, "Component", &h.Component) - delete(rawMsg, key) - case "scenario": - err = unpopulate(val, "Scenario", &h.Scenario) - delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &h.Scope) - 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 HealthReport. -func (h HealthReport) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", h.ID) - populate(objectMap, "name", h.Name) - populate(objectMap, "properties", h.Properties) - populate(objectMap, "type", h.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type HealthReport. -func (h *HealthReport) UnmarshalJSON(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 "id": - err = unpopulate(val, "ID", &h.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &h.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &h.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &h.Type) - 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 HealthReportProperties. -func (h HealthReportProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "affectedDefendersPlans", h.AffectedDefendersPlans) - populate(objectMap, "affectedDefendersSubPlans", h.AffectedDefendersSubPlans) - populate(objectMap, "environmentDetails", h.EnvironmentDetails) - populate(objectMap, "healthDataClassification", h.HealthDataClassification) - populate(objectMap, "issues", h.Issues) - populate(objectMap, "reportAdditionalData", h.ReportAdditionalData) - populate(objectMap, "resourceDetails", h.ResourceDetails) - populate(objectMap, "status", h.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type HealthReportProperties. -func (h *HealthReportProperties) UnmarshalJSON(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 "affectedDefendersPlans": - err = unpopulate(val, "AffectedDefendersPlans", &h.AffectedDefendersPlans) - delete(rawMsg, key) - case "affectedDefendersSubPlans": - err = unpopulate(val, "AffectedDefendersSubPlans", &h.AffectedDefendersSubPlans) - delete(rawMsg, key) - case "environmentDetails": - err = unpopulate(val, "EnvironmentDetails", &h.EnvironmentDetails) - delete(rawMsg, key) - case "healthDataClassification": - err = unpopulate(val, "HealthDataClassification", &h.HealthDataClassification) - delete(rawMsg, key) - case "issues": - err = unpopulate(val, "Issues", &h.Issues) - delete(rawMsg, key) - case "reportAdditionalData": - err = unpopulate(val, "ReportAdditionalData", &h.ReportAdditionalData) - delete(rawMsg, key) - case "resourceDetails": - err = unpopulate(val, "ResourceDetails", &h.ResourceDetails) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &h.Status) - 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) - populate(objectMap, "nextLink", h.NextLink) - populate(objectMap, "value", h.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type HealthReportsList. -func (h *HealthReportsList) UnmarshalJSON(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 "nextLink": - err = unpopulate(val, "NextLink", &h.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &h.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type HybridComputeSettingsProperties. -func (h HybridComputeSettingsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Identity. -func (i *Identity) UnmarshalJSON(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 "principalId": - err = unpopulate(val, "PrincipalID", &i.PrincipalID) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &i.TenantID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type InfoType. -func (i InfoType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", i.Description) - populate(objectMap, "id", i.ID) - populate(objectMap, "name", i.Name) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type InfoType. -func (i *InfoType) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &i.Description) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &i.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &i.Name) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type InformationProtectionKeyword. -func (i InformationProtectionKeyword) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "canBeNumeric", i.CanBeNumeric) - populate(objectMap, "custom", i.Custom) - populate(objectMap, "excluded", i.Excluded) - populate(objectMap, "pattern", i.Pattern) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type InformationProtectionKeyword. -func (i *InformationProtectionKeyword) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "canBeNumeric": - err = unpopulate(val, "CanBeNumeric", &i.CanBeNumeric) - delete(rawMsg, key) - case "custom": - err = unpopulate(val, "Custom", &i.Custom) - delete(rawMsg, key) - case "excluded": - err = unpopulate(val, "Excluded", &i.Excluded) - delete(rawMsg, key) - case "pattern": - err = unpopulate(val, "Pattern", &i.Pattern) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type InformationProtectionPolicy. -func (i InformationProtectionPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", i.ID) - populate(objectMap, "name", i.Name) - populate(objectMap, "properties", i.Properties) - populate(objectMap, "type", i.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type InformationProtectionPolicy. -func (i *InformationProtectionPolicy) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &i.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &i.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &i.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type InformationProtectionPolicyList. -func (i InformationProtectionPolicyList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", i.NextLink) - populate(objectMap, "value", i.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type InformationProtectionPolicyList. -func (i *InformationProtectionPolicyList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &i.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &i.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type InformationProtectionPolicyProperties. -func (i InformationProtectionPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "informationTypes", i.InformationTypes) - populate(objectMap, "labels", i.Labels) - populateDateTimeRFC3339(objectMap, "lastModifiedUtc", i.LastModifiedUTC) - populate(objectMap, "version", i.Version) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type InformationProtectionPolicyProperties. -func (i *InformationProtectionPolicyProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "informationTypes": - err = unpopulate(val, "InformationTypes", &i.InformationTypes) - delete(rawMsg, key) - case "labels": - err = unpopulate(val, "Labels", &i.Labels) - delete(rawMsg, key) - case "lastModifiedUtc": - err = unpopulateDateTimeRFC3339(val, "LastModifiedUTC", &i.LastModifiedUTC) - delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &i.Version) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type InformationType. -func (i InformationType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "custom", i.Custom) - populate(objectMap, "description", i.Description) - populate(objectMap, "displayName", i.DisplayName) - populate(objectMap, "enabled", i.Enabled) - populate(objectMap, "keywords", i.Keywords) - populate(objectMap, "order", i.Order) - populate(objectMap, "recommendedLabelId", i.RecommendedLabelID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type InformationType. -func (i *InformationType) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "custom": - err = unpopulate(val, "Custom", &i.Custom) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &i.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &i.DisplayName) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &i.Enabled) - delete(rawMsg, key) - case "keywords": - err = unpopulate(val, "Keywords", &i.Keywords) - delete(rawMsg, key) - case "order": - err = unpopulate(val, "Order", &i.Order) - delete(rawMsg, key) - case "recommendedLabelId": - err = unpopulate(val, "RecommendedLabelID", &i.RecommendedLabelID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type 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, "tags", i.Tags) - populate(objectMap, "type", i.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecurityAggregatedAlert. -func (i *IoTSecurityAggregatedAlert) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &i.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &i.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &i.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &i.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IoTSecurityAggregatedAlertList. -func (i IoTSecurityAggregatedAlertList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", i.NextLink) - populate(objectMap, "value", i.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecurityAggregatedAlertList. -func (i *IoTSecurityAggregatedAlertList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &i.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &i.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IoTSecurityAggregatedAlertProperties. -func (i IoTSecurityAggregatedAlertProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actionTaken", i.ActionTaken) - populateDateType(objectMap, "aggregatedDateUtc", i.AggregatedDateUTC) - populate(objectMap, "alertDisplayName", i.AlertDisplayName) - populate(objectMap, "alertType", i.AlertType) - populate(objectMap, "count", i.Count) - populate(objectMap, "description", i.Description) - populate(objectMap, "effectedResourceType", i.EffectedResourceType) - populate(objectMap, "logAnalyticsQuery", i.LogAnalyticsQuery) - populate(objectMap, "remediationSteps", i.RemediationSteps) - populate(objectMap, "reportedSeverity", i.ReportedSeverity) - populate(objectMap, "systemSource", i.SystemSource) - populate(objectMap, "topDevicesList", i.TopDevicesList) - populate(objectMap, "vendorName", i.VendorName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecurityAggregatedAlertProperties. -func (i *IoTSecurityAggregatedAlertProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actionTaken": - err = unpopulate(val, "ActionTaken", &i.ActionTaken) - delete(rawMsg, key) - case "aggregatedDateUtc": - err = unpopulateDateType(val, "AggregatedDateUTC", &i.AggregatedDateUTC) - delete(rawMsg, key) - case "alertDisplayName": - err = unpopulate(val, "AlertDisplayName", &i.AlertDisplayName) - delete(rawMsg, key) - case "alertType": - err = unpopulate(val, "AlertType", &i.AlertType) - delete(rawMsg, key) - case "count": - err = unpopulate(val, "Count", &i.Count) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &i.Description) - delete(rawMsg, key) - case "effectedResourceType": - err = unpopulate(val, "EffectedResourceType", &i.EffectedResourceType) - delete(rawMsg, key) - case "logAnalyticsQuery": - err = unpopulate(val, "LogAnalyticsQuery", &i.LogAnalyticsQuery) - delete(rawMsg, key) - case "remediationSteps": - err = unpopulate(val, "RemediationSteps", &i.RemediationSteps) - delete(rawMsg, key) - case "reportedSeverity": - err = unpopulate(val, "ReportedSeverity", &i.ReportedSeverity) - delete(rawMsg, key) - case "systemSource": - err = unpopulate(val, "SystemSource", &i.SystemSource) - delete(rawMsg, key) - case "topDevicesList": - err = unpopulate(val, "TopDevicesList", &i.TopDevicesList) - delete(rawMsg, key) - case "vendorName": - err = unpopulate(val, "VendorName", &i.VendorName) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IoTSecurityAggregatedAlertPropertiesTopDevicesListItem. -func (i IoTSecurityAggregatedAlertPropertiesTopDevicesListItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "alertsCount", i.AlertsCount) - populate(objectMap, "deviceId", i.DeviceID) - populate(objectMap, "lastOccurrence", i.LastOccurrence) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecurityAggregatedAlertPropertiesTopDevicesListItem. -func (i *IoTSecurityAggregatedAlertPropertiesTopDevicesListItem) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "alertsCount": - err = unpopulate(val, "AlertsCount", &i.AlertsCount) - delete(rawMsg, key) - case "deviceId": - err = unpopulate(val, "DeviceID", &i.DeviceID) - delete(rawMsg, key) - case "lastOccurrence": - err = unpopulate(val, "LastOccurrence", &i.LastOccurrence) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IoTSecurityAggregatedRecommendation. -func (i IoTSecurityAggregatedRecommendation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", i.ID) - populate(objectMap, "name", i.Name) - populate(objectMap, "properties", i.Properties) - populate(objectMap, "tags", i.Tags) - populate(objectMap, "type", i.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecurityAggregatedRecommendation. -func (i *IoTSecurityAggregatedRecommendation) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &i.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &i.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &i.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &i.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IoTSecurityAggregatedRecommendationList. -func (i IoTSecurityAggregatedRecommendationList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", i.NextLink) - populate(objectMap, "value", i.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecurityAggregatedRecommendationList. -func (i *IoTSecurityAggregatedRecommendationList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &i.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &i.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IoTSecurityAggregatedRecommendationProperties. -func (i IoTSecurityAggregatedRecommendationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", i.Description) - populate(objectMap, "detectedBy", i.DetectedBy) - populate(objectMap, "healthyDevices", i.HealthyDevices) - populate(objectMap, "logAnalyticsQuery", i.LogAnalyticsQuery) - populate(objectMap, "recommendationDisplayName", i.RecommendationDisplayName) - populate(objectMap, "recommendationName", i.RecommendationName) - populate(objectMap, "recommendationTypeId", i.RecommendationTypeID) - populate(objectMap, "remediationSteps", i.RemediationSteps) - populate(objectMap, "reportedSeverity", i.ReportedSeverity) - populate(objectMap, "unhealthyDeviceCount", i.UnhealthyDeviceCount) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecurityAggregatedRecommendationProperties. -func (i *IoTSecurityAggregatedRecommendationProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &i.Description) - delete(rawMsg, key) - case "detectedBy": - err = unpopulate(val, "DetectedBy", &i.DetectedBy) - delete(rawMsg, key) - case "healthyDevices": - err = unpopulate(val, "HealthyDevices", &i.HealthyDevices) - delete(rawMsg, key) - case "logAnalyticsQuery": - err = unpopulate(val, "LogAnalyticsQuery", &i.LogAnalyticsQuery) - delete(rawMsg, key) - case "recommendationDisplayName": - err = unpopulate(val, "RecommendationDisplayName", &i.RecommendationDisplayName) - delete(rawMsg, key) - case "recommendationName": - err = unpopulate(val, "RecommendationName", &i.RecommendationName) - delete(rawMsg, key) - case "recommendationTypeId": - err = unpopulate(val, "RecommendationTypeID", &i.RecommendationTypeID) - delete(rawMsg, key) - case "remediationSteps": - err = unpopulate(val, "RemediationSteps", &i.RemediationSteps) - delete(rawMsg, key) - case "reportedSeverity": - err = unpopulate(val, "ReportedSeverity", &i.ReportedSeverity) - delete(rawMsg, key) - case "unhealthyDeviceCount": - err = unpopulate(val, "UnhealthyDeviceCount", &i.UnhealthyDeviceCount) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IoTSecurityAlertedDevice. -func (i IoTSecurityAlertedDevice) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "alertsCount", i.AlertsCount) - populate(objectMap, "deviceId", i.DeviceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecurityAlertedDevice. -func (i *IoTSecurityAlertedDevice) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "alertsCount": - err = unpopulate(val, "AlertsCount", &i.AlertsCount) - delete(rawMsg, key) - case "deviceId": - err = unpopulate(val, "DeviceID", &i.DeviceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IoTSecurityDeviceAlert. -func (i IoTSecurityDeviceAlert) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "alertDisplayName", i.AlertDisplayName) - populate(objectMap, "alertsCount", i.AlertsCount) - populate(objectMap, "reportedSeverity", i.ReportedSeverity) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecurityDeviceAlert. -func (i *IoTSecurityDeviceAlert) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "alertDisplayName": - err = unpopulate(val, "AlertDisplayName", &i.AlertDisplayName) - delete(rawMsg, key) - case "alertsCount": - err = unpopulate(val, "AlertsCount", &i.AlertsCount) - delete(rawMsg, key) - case "reportedSeverity": - err = unpopulate(val, "ReportedSeverity", &i.ReportedSeverity) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IoTSecurityDeviceRecommendation. -func (i IoTSecurityDeviceRecommendation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "devicesCount", i.DevicesCount) - populate(objectMap, "recommendationDisplayName", i.RecommendationDisplayName) - populate(objectMap, "reportedSeverity", i.ReportedSeverity) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecurityDeviceRecommendation. -func (i *IoTSecurityDeviceRecommendation) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "devicesCount": - err = unpopulate(val, "DevicesCount", &i.DevicesCount) - delete(rawMsg, key) - case "recommendationDisplayName": - err = unpopulate(val, "RecommendationDisplayName", &i.RecommendationDisplayName) - delete(rawMsg, key) - case "reportedSeverity": - err = unpopulate(val, "ReportedSeverity", &i.ReportedSeverity) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IoTSecuritySolutionAnalyticsModel. -func (i IoTSecuritySolutionAnalyticsModel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", i.ID) - populate(objectMap, "name", i.Name) - populate(objectMap, "properties", i.Properties) - populate(objectMap, "type", i.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecuritySolutionAnalyticsModel. -func (i *IoTSecuritySolutionAnalyticsModel) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &i.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &i.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &i.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IoTSecuritySolutionAnalyticsModelList. -func (i IoTSecuritySolutionAnalyticsModelList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", i.NextLink) - populate(objectMap, "value", i.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecuritySolutionAnalyticsModelList. -func (i *IoTSecuritySolutionAnalyticsModelList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &i.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &i.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IoTSecuritySolutionAnalyticsModelProperties. -func (i IoTSecuritySolutionAnalyticsModelProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "devicesMetrics", i.DevicesMetrics) - populate(objectMap, "metrics", i.Metrics) - populate(objectMap, "mostPrevalentDeviceAlerts", i.MostPrevalentDeviceAlerts) - populate(objectMap, "mostPrevalentDeviceRecommendations", i.MostPrevalentDeviceRecommendations) - populate(objectMap, "topAlertedDevices", i.TopAlertedDevices) - populate(objectMap, "unhealthyDeviceCount", i.UnhealthyDeviceCount) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecuritySolutionAnalyticsModelProperties. -func (i *IoTSecuritySolutionAnalyticsModelProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "devicesMetrics": - err = unpopulate(val, "DevicesMetrics", &i.DevicesMetrics) - delete(rawMsg, key) - case "metrics": - err = unpopulate(val, "Metrics", &i.Metrics) - delete(rawMsg, key) - case "mostPrevalentDeviceAlerts": - err = unpopulate(val, "MostPrevalentDeviceAlerts", &i.MostPrevalentDeviceAlerts) - delete(rawMsg, key) - case "mostPrevalentDeviceRecommendations": - err = unpopulate(val, "MostPrevalentDeviceRecommendations", &i.MostPrevalentDeviceRecommendations) - delete(rawMsg, key) - case "topAlertedDevices": - err = unpopulate(val, "TopAlertedDevices", &i.TopAlertedDevices) - delete(rawMsg, key) - case "unhealthyDeviceCount": - err = unpopulate(val, "UnhealthyDeviceCount", &i.UnhealthyDeviceCount) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem. -func (i IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "date", i.Date) - populate(objectMap, "devicesMetrics", i.DevicesMetrics) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem. -func (i *IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "date": - err = unpopulateDateTimeRFC3339(val, "Date", &i.Date) - delete(rawMsg, key) - case "devicesMetrics": - err = unpopulate(val, "DevicesMetrics", &i.DevicesMetrics) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IoTSecuritySolutionModel. -func (i IoTSecuritySolutionModel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", i.ID) - populate(objectMap, "location", i.Location) - populate(objectMap, "name", i.Name) - populate(objectMap, "properties", i.Properties) - populate(objectMap, "systemData", i.SystemData) - populate(objectMap, "tags", i.Tags) - populate(objectMap, "type", i.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecuritySolutionModel. -func (i *IoTSecuritySolutionModel) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &i.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &i.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &i.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &i.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &i.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &i.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IoTSecuritySolutionProperties. -func (i IoTSecuritySolutionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "additionalWorkspaces", i.AdditionalWorkspaces) - populate(objectMap, "autoDiscoveredResources", i.AutoDiscoveredResources) - populate(objectMap, "disabledDataSources", i.DisabledDataSources) - populate(objectMap, "displayName", i.DisplayName) - populate(objectMap, "export", i.Export) - populate(objectMap, "iotHubs", i.IotHubs) - populate(objectMap, "recommendationsConfiguration", i.RecommendationsConfiguration) - populate(objectMap, "status", i.Status) - populate(objectMap, "unmaskedIpLoggingStatus", i.UnmaskedIPLoggingStatus) - populate(objectMap, "userDefinedResources", i.UserDefinedResources) - populate(objectMap, "workspace", i.Workspace) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecuritySolutionProperties. -func (i *IoTSecuritySolutionProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "additionalWorkspaces": - err = unpopulate(val, "AdditionalWorkspaces", &i.AdditionalWorkspaces) - delete(rawMsg, key) - case "autoDiscoveredResources": - err = unpopulate(val, "AutoDiscoveredResources", &i.AutoDiscoveredResources) - delete(rawMsg, key) - case "disabledDataSources": - err = unpopulate(val, "DisabledDataSources", &i.DisabledDataSources) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &i.DisplayName) - delete(rawMsg, key) - case "export": - err = unpopulate(val, "Export", &i.Export) - delete(rawMsg, key) - case "iotHubs": - err = unpopulate(val, "IotHubs", &i.IotHubs) - delete(rawMsg, key) - case "recommendationsConfiguration": - err = unpopulate(val, "RecommendationsConfiguration", &i.RecommendationsConfiguration) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &i.Status) - delete(rawMsg, key) - case "unmaskedIpLoggingStatus": - err = unpopulate(val, "UnmaskedIPLoggingStatus", &i.UnmaskedIPLoggingStatus) - delete(rawMsg, key) - case "userDefinedResources": - err = unpopulate(val, "UserDefinedResources", &i.UserDefinedResources) - delete(rawMsg, key) - case "workspace": - err = unpopulate(val, "Workspace", &i.Workspace) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IoTSecuritySolutionsList. -func (i IoTSecuritySolutionsList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", i.NextLink) - populate(objectMap, "value", i.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecuritySolutionsList. -func (i *IoTSecuritySolutionsList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &i.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &i.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IoTSeverityMetrics. -func (i IoTSeverityMetrics) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "high", i.High) - populate(objectMap, "low", i.Low) - populate(objectMap, "medium", i.Medium) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSeverityMetrics. -func (i *IoTSeverityMetrics) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "high": - err = unpopulate(val, "High", &i.High) - delete(rawMsg, key) - case "low": - err = unpopulate(val, "Low", &i.Low) - delete(rawMsg, key) - case "medium": - err = unpopulate(val, "Medium", &i.Medium) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Issue. -func (i Issue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "issueAdditionalData", i.IssueAdditionalData) - populate(objectMap, "issueDescription", i.IssueDescription) - populate(objectMap, "issueKey", i.IssueKey) - populate(objectMap, "issueName", i.IssueName) - populate(objectMap, "remediationScript", i.RemediationScript) - populate(objectMap, "remediationSteps", i.RemediationSteps) - populate(objectMap, "securityValues", i.SecurityValues) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Issue. -func (i *Issue) UnmarshalJSON(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 "issueAdditionalData": - err = unpopulate(val, "IssueAdditionalData", &i.IssueAdditionalData) - delete(rawMsg, key) - case "issueDescription": - err = unpopulate(val, "IssueDescription", &i.IssueDescription) - delete(rawMsg, key) - case "issueKey": - err = unpopulate(val, "IssueKey", &i.IssueKey) - delete(rawMsg, key) - case "issueName": - err = unpopulate(val, "IssueName", &i.IssueName) - delete(rawMsg, key) - case "remediationScript": - err = unpopulate(val, "RemediationScript", &i.RemediationScript) - delete(rawMsg, key) - case "remediationSteps": - err = unpopulate(val, "RemediationSteps", &i.RemediationSteps) - delete(rawMsg, key) - case "securityValues": - err = unpopulate(val, "SecurityValues", &i.SecurityValues) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessPoliciesList. -func (j JitNetworkAccessPoliciesList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", j.NextLink) - populate(objectMap, "value", j.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JitNetworkAccessPoliciesList. -func (j *JitNetworkAccessPoliciesList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &j.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &j.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessPolicy. -func (j JitNetworkAccessPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", j.ID) - populate(objectMap, "kind", j.Kind) - populate(objectMap, "location", j.Location) - populate(objectMap, "name", j.Name) - populate(objectMap, "properties", j.Properties) - populate(objectMap, "type", j.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JitNetworkAccessPolicy. -func (j *JitNetworkAccessPolicy) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &j.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &j.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &j.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &j.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &j.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &j.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessPolicyInitiatePort. -func (j JitNetworkAccessPolicyInitiatePort) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "allowedSourceAddressPrefix", j.AllowedSourceAddressPrefix) - populateDateTimeRFC3339(objectMap, "endTimeUtc", j.EndTimeUTC) - populate(objectMap, "number", j.Number) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JitNetworkAccessPolicyInitiatePort. -func (j *JitNetworkAccessPolicyInitiatePort) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "allowedSourceAddressPrefix": - err = unpopulate(val, "AllowedSourceAddressPrefix", &j.AllowedSourceAddressPrefix) - delete(rawMsg, key) - case "endTimeUtc": - err = unpopulateDateTimeRFC3339(val, "EndTimeUTC", &j.EndTimeUTC) - delete(rawMsg, key) - case "number": - err = unpopulate(val, "Number", &j.Number) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessPolicyInitiateRequest. -func (j JitNetworkAccessPolicyInitiateRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "justification", j.Justification) - populate(objectMap, "virtualMachines", j.VirtualMachines) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JitNetworkAccessPolicyInitiateRequest. -func (j *JitNetworkAccessPolicyInitiateRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "justification": - err = unpopulate(val, "Justification", &j.Justification) - delete(rawMsg, key) - case "virtualMachines": - err = unpopulate(val, "VirtualMachines", &j.VirtualMachines) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessPolicyInitiateVirtualMachine. -func (j JitNetworkAccessPolicyInitiateVirtualMachine) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", j.ID) - populate(objectMap, "ports", j.Ports) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JitNetworkAccessPolicyInitiateVirtualMachine. -func (j *JitNetworkAccessPolicyInitiateVirtualMachine) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &j.ID) - delete(rawMsg, key) - case "ports": - err = unpopulate(val, "Ports", &j.Ports) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessPolicyProperties. -func (j JitNetworkAccessPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "provisioningState", j.ProvisioningState) - populate(objectMap, "requests", j.Requests) - populate(objectMap, "virtualMachines", j.VirtualMachines) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JitNetworkAccessPolicyProperties. -func (j *JitNetworkAccessPolicyProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &j.ProvisioningState) - delete(rawMsg, key) - case "requests": - err = unpopulate(val, "Requests", &j.Requests) - delete(rawMsg, key) - case "virtualMachines": - err = unpopulate(val, "VirtualMachines", &j.VirtualMachines) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessPolicyVirtualMachine. -func (j JitNetworkAccessPolicyVirtualMachine) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", j.ID) - populate(objectMap, "ports", j.Ports) - populate(objectMap, "publicIpAddress", j.PublicIPAddress) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JitNetworkAccessPolicyVirtualMachine. -func (j *JitNetworkAccessPolicyVirtualMachine) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &j.ID) - delete(rawMsg, key) - case "ports": - err = unpopulate(val, "Ports", &j.Ports) - delete(rawMsg, key) - case "publicIpAddress": - err = unpopulate(val, "PublicIPAddress", &j.PublicIPAddress) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessPortRule. -func (j JitNetworkAccessPortRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "allowedSourceAddressPrefix", j.AllowedSourceAddressPrefix) - populate(objectMap, "allowedSourceAddressPrefixes", j.AllowedSourceAddressPrefixes) - populate(objectMap, "maxRequestAccessDuration", j.MaxRequestAccessDuration) - populate(objectMap, "number", j.Number) - populate(objectMap, "protocol", j.Protocol) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JitNetworkAccessPortRule. -func (j *JitNetworkAccessPortRule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "allowedSourceAddressPrefix": - err = unpopulate(val, "AllowedSourceAddressPrefix", &j.AllowedSourceAddressPrefix) - delete(rawMsg, key) - case "allowedSourceAddressPrefixes": - err = unpopulate(val, "AllowedSourceAddressPrefixes", &j.AllowedSourceAddressPrefixes) - delete(rawMsg, key) - case "maxRequestAccessDuration": - err = unpopulate(val, "MaxRequestAccessDuration", &j.MaxRequestAccessDuration) - delete(rawMsg, key) - case "number": - err = unpopulate(val, "Number", &j.Number) - delete(rawMsg, key) - case "protocol": - err = unpopulate(val, "Protocol", &j.Protocol) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessRequest. -func (j JitNetworkAccessRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "justification", j.Justification) - populate(objectMap, "requestor", j.Requestor) - populateDateTimeRFC3339(objectMap, "startTimeUtc", j.StartTimeUTC) - populate(objectMap, "virtualMachines", j.VirtualMachines) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JitNetworkAccessRequest. -func (j *JitNetworkAccessRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "justification": - err = unpopulate(val, "Justification", &j.Justification) - delete(rawMsg, key) - case "requestor": - err = unpopulate(val, "Requestor", &j.Requestor) - delete(rawMsg, key) - case "startTimeUtc": - err = unpopulateDateTimeRFC3339(val, "StartTimeUTC", &j.StartTimeUTC) - delete(rawMsg, key) - case "virtualMachines": - err = unpopulate(val, "VirtualMachines", &j.VirtualMachines) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessRequestPort. -func (j JitNetworkAccessRequestPort) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "allowedSourceAddressPrefix", j.AllowedSourceAddressPrefix) - populate(objectMap, "allowedSourceAddressPrefixes", j.AllowedSourceAddressPrefixes) - populateDateTimeRFC3339(objectMap, "endTimeUtc", j.EndTimeUTC) - populate(objectMap, "mappedPort", j.MappedPort) - populate(objectMap, "number", j.Number) - populate(objectMap, "status", j.Status) - populate(objectMap, "statusReason", j.StatusReason) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JitNetworkAccessRequestPort. -func (j *JitNetworkAccessRequestPort) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "allowedSourceAddressPrefix": - err = unpopulate(val, "AllowedSourceAddressPrefix", &j.AllowedSourceAddressPrefix) - delete(rawMsg, key) - case "allowedSourceAddressPrefixes": - err = unpopulate(val, "AllowedSourceAddressPrefixes", &j.AllowedSourceAddressPrefixes) - delete(rawMsg, key) - case "endTimeUtc": - err = unpopulateDateTimeRFC3339(val, "EndTimeUTC", &j.EndTimeUTC) - delete(rawMsg, key) - case "mappedPort": - err = unpopulate(val, "MappedPort", &j.MappedPort) - delete(rawMsg, key) - case "number": - err = unpopulate(val, "Number", &j.Number) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &j.Status) - delete(rawMsg, key) - case "statusReason": - err = unpopulate(val, "StatusReason", &j.StatusReason) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessRequestVirtualMachine. -func (j JitNetworkAccessRequestVirtualMachine) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", j.ID) - populate(objectMap, "ports", j.Ports) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JitNetworkAccessRequestVirtualMachine. -func (j *JitNetworkAccessRequestVirtualMachine) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &j.ID) - delete(rawMsg, key) - case "ports": - err = unpopulate(val, "Ports", &j.Ports) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type KindAutoGenerated. -func (k KindAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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) - populate(objectMap, "id", l.ID) - populate(objectMap, "name", l.Name) - populate(objectMap, "order", l.Order) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Label. -func (l *Label) UnmarshalJSON(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 "id": - err = unpopulate(val, "ID", &l.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &l.Name) - delete(rawMsg, key) - case "order": - err = unpopulate(val, "Order", &l.Order) - 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 ListCustomAlertRule. -func (l ListCustomAlertRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", l.Description) - populate(objectMap, "displayName", l.DisplayName) - populate(objectMap, "isEnabled", l.IsEnabled) - objectMap["ruleType"] = "ListCustomAlertRule" - populate(objectMap, "valueType", l.ValueType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ListCustomAlertRule. -func (l *ListCustomAlertRule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &l.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &l.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &l.IsEnabled) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &l.RuleType) - delete(rawMsg, key) - case "valueType": - err = unpopulate(val, "ValueType", &l.ValueType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LocalUserNotAllowed. -func (l LocalUserNotAllowed) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "allowlistValues", l.AllowlistValues) - populate(objectMap, "description", l.Description) - populate(objectMap, "displayName", l.DisplayName) - populate(objectMap, "isEnabled", l.IsEnabled) - objectMap["ruleType"] = "LocalUserNotAllowed" - populate(objectMap, "valueType", l.ValueType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LocalUserNotAllowed. -func (l *LocalUserNotAllowed) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "allowlistValues": - err = unpopulate(val, "AllowlistValues", &l.AllowlistValues) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &l.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &l.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &l.IsEnabled) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &l.RuleType) - delete(rawMsg, key) - case "valueType": - err = unpopulate(val, "ValueType", &l.ValueType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Location. -func (l Location) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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) - populate(objectMap, "agentId", l.AgentID) - objectMap["type"] = ResourceIdentifierTypeLogAnalytics - populate(objectMap, "workspaceId", l.WorkspaceID) - populate(objectMap, "workspaceResourceGroup", l.WorkspaceResourceGroup) - populate(objectMap, "workspaceSubscriptionId", l.WorkspaceSubscriptionID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogAnalyticsIdentifier. -func (l *LogAnalyticsIdentifier) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "agentId": - err = unpopulate(val, "AgentID", &l.AgentID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &l.Type) - delete(rawMsg, key) - case "workspaceId": - err = unpopulate(val, "WorkspaceID", &l.WorkspaceID) - delete(rawMsg, key) - case "workspaceResourceGroup": - err = unpopulate(val, "WorkspaceResourceGroup", &l.WorkspaceResourceGroup) - delete(rawMsg, key) - case "workspaceSubscriptionId": - err = unpopulate(val, "WorkspaceSubscriptionID", &l.WorkspaceSubscriptionID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MalwareScanningProperties. -func (m MalwareScanningProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "onUpload", m.OnUpload) - populate(objectMap, "operationStatus", m.OperationStatus) - populate(objectMap, "scanResultsEventGridTopicResourceId", m.ScanResultsEventGridTopicResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MalwareScanningProperties. -func (m *MalwareScanningProperties) UnmarshalJSON(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 "onUpload": - err = unpopulate(val, "OnUpload", &m.OnUpload) - delete(rawMsg, key) - case "operationStatus": - err = unpopulate(val, "OperationStatus", &m.OperationStatus) - delete(rawMsg, key) - case "scanResultsEventGridTopicResourceId": - err = unpopulate(val, "ScanResultsEventGridTopicResourceID", &m.ScanResultsEventGridTopicResourceID) - 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 MdeOnboardingData. -func (m MdeOnboardingData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", m.ID) - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MdeOnboardingData. -func (m *MdeOnboardingData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &m.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &m.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MdeOnboardingDataList. -func (m MdeOnboardingDataList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", m.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MdeOnboardingDataList. -func (m *MdeOnboardingDataList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &m.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MdeOnboardingDataProperties. -func (m MdeOnboardingDataProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateByteArray(objectMap, "onboardingPackageLinux", m.OnboardingPackageLinux, func() any { - return runtime.EncodeByteArray(m.OnboardingPackageLinux, runtime.Base64StdFormat) - }) - populateByteArray(objectMap, "onboardingPackageWindows", m.OnboardingPackageWindows, func() any { - return runtime.EncodeByteArray(m.OnboardingPackageWindows, runtime.Base64StdFormat) - }) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MdeOnboardingDataProperties. -func (m *MdeOnboardingDataProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "onboardingPackageLinux": - if val != nil && string(val) != "null" { - err = runtime.DecodeByteArray(string(val), &m.OnboardingPackageLinux, runtime.Base64StdFormat) - } - delete(rawMsg, key) - case "onboardingPackageWindows": - if val != nil && string(val) != "null" { - err = runtime.DecodeByteArray(string(val), &m.OnboardingPackageWindows, runtime.Base64StdFormat) - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MqttC2DMessagesNotInAllowedRange. -func (m MqttC2DMessagesNotInAllowedRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", m.Description) - populate(objectMap, "displayName", m.DisplayName) - populate(objectMap, "isEnabled", m.IsEnabled) - populate(objectMap, "maxThreshold", m.MaxThreshold) - populate(objectMap, "minThreshold", m.MinThreshold) - objectMap["ruleType"] = "MqttC2DMessagesNotInAllowedRange" - populate(objectMap, "timeWindowSize", m.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MqttC2DMessagesNotInAllowedRange. -func (m *MqttC2DMessagesNotInAllowedRange) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &m.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &m.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &m.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &m.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &m.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &m.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &m.TimeWindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MqttC2DRejectedMessagesNotInAllowedRange. -func (m MqttC2DRejectedMessagesNotInAllowedRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", m.Description) - populate(objectMap, "displayName", m.DisplayName) - populate(objectMap, "isEnabled", m.IsEnabled) - populate(objectMap, "maxThreshold", m.MaxThreshold) - populate(objectMap, "minThreshold", m.MinThreshold) - objectMap["ruleType"] = "MqttC2DRejectedMessagesNotInAllowedRange" - populate(objectMap, "timeWindowSize", m.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MqttC2DRejectedMessagesNotInAllowedRange. -func (m *MqttC2DRejectedMessagesNotInAllowedRange) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &m.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &m.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &m.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &m.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &m.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &m.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &m.TimeWindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MqttD2CMessagesNotInAllowedRange. -func (m MqttD2CMessagesNotInAllowedRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", m.Description) - populate(objectMap, "displayName", m.DisplayName) - populate(objectMap, "isEnabled", m.IsEnabled) - populate(objectMap, "maxThreshold", m.MaxThreshold) - populate(objectMap, "minThreshold", m.MinThreshold) - objectMap["ruleType"] = "MqttD2CMessagesNotInAllowedRange" - populate(objectMap, "timeWindowSize", m.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MqttD2CMessagesNotInAllowedRange. -func (m *MqttD2CMessagesNotInAllowedRange) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &m.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &m.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &m.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &m.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &m.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &m.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &m.TimeWindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NotificationsSource. -func (n NotificationsSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["sourceType"] = n.SourceType - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NotificationsSource. -func (n *NotificationsSource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "sourceType": - err = unpopulate(val, "SourceType", &n.SourceType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NotificationsSourceAlert. -func (n NotificationsSourceAlert) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "minimalSeverity", n.MinimalSeverity) - objectMap["sourceType"] = SourceTypeAlert - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NotificationsSourceAlert. -func (n *NotificationsSourceAlert) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "minimalSeverity": - err = unpopulate(val, "MinimalSeverity", &n.MinimalSeverity) - delete(rawMsg, key) - case "sourceType": - err = unpopulate(val, "SourceType", &n.SourceType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NotificationsSourceAttackPath. -func (n NotificationsSourceAttackPath) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "minimalRiskLevel", n.MinimalRiskLevel) - objectMap["sourceType"] = SourceTypeAttackPath - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NotificationsSourceAttackPath. -func (n *NotificationsSourceAttackPath) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "minimalRiskLevel": - err = unpopulate(val, "MinimalRiskLevel", &n.MinimalRiskLevel) - delete(rawMsg, key) - case "sourceType": - err = unpopulate(val, "SourceType", &n.SourceType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OnPremiseResourceDetails. -func (o OnPremiseResourceDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "machineName", o.MachineName) - objectMap["source"] = SourceOnPremise - populate(objectMap, "sourceComputerId", o.SourceComputerID) - populate(objectMap, "vmuuid", o.Vmuuid) - populate(objectMap, "workspaceId", o.WorkspaceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OnPremiseResourceDetails. -func (o *OnPremiseResourceDetails) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "machineName": - err = unpopulate(val, "MachineName", &o.MachineName) - delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &o.Source) - delete(rawMsg, key) - case "sourceComputerId": - err = unpopulate(val, "SourceComputerID", &o.SourceComputerID) - delete(rawMsg, key) - case "vmuuid": - err = unpopulate(val, "Vmuuid", &o.Vmuuid) - delete(rawMsg, key) - case "workspaceId": - err = unpopulate(val, "WorkspaceID", &o.WorkspaceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OnPremiseSQLResourceDetails. -func (o OnPremiseSQLResourceDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "databaseName", o.DatabaseName) - populate(objectMap, "machineName", o.MachineName) - populate(objectMap, "serverName", o.ServerName) - objectMap["source"] = SourceOnPremiseSQL - populate(objectMap, "sourceComputerId", o.SourceComputerID) - populate(objectMap, "vmuuid", o.Vmuuid) - populate(objectMap, "workspaceId", o.WorkspaceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OnPremiseSQLResourceDetails. -func (o *OnPremiseSQLResourceDetails) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "databaseName": - err = unpopulate(val, "DatabaseName", &o.DatabaseName) - delete(rawMsg, key) - case "machineName": - err = unpopulate(val, "MachineName", &o.MachineName) - delete(rawMsg, key) - case "serverName": - err = unpopulate(val, "ServerName", &o.ServerName) - delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &o.Source) - delete(rawMsg, key) - case "sourceComputerId": - err = unpopulate(val, "SourceComputerID", &o.SourceComputerID) - delete(rawMsg, key) - case "vmuuid": - err = unpopulate(val, "Vmuuid", &o.Vmuuid) - delete(rawMsg, key) - case "workspaceId": - err = unpopulate(val, "WorkspaceID", &o.WorkspaceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OnUploadProperties. -func (o OnUploadProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "capGBPerMonth", o.CapGBPerMonth) - populate(objectMap, "isEnabled", o.IsEnabled) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OnUploadProperties. -func (o *OnUploadProperties) UnmarshalJSON(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 "capGBPerMonth": - err = unpopulate(val, "CapGBPerMonth", &o.CapGBPerMonth) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &o.IsEnabled) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Operation. -func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "display", o.Display) - populate(objectMap, "name", o.Name) - populate(objectMap, "origin", o.Origin) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. -func (o *Operation) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "display": - err = unpopulate(val, "Display", &o.Display) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "origin": - err = unpopulate(val, "Origin", &o.Origin) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. -func (o OperationDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", o.Description) - populate(objectMap, "operation", o.Operation) - populate(objectMap, "provider", o.Provider) - populate(objectMap, "resource", o.Resource) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. -func (o *OperationDisplay) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &o.Description) - delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &o.Operation) - delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &o.Provider) - delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &o.Resource) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationList. -func (o OperationList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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 { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &o.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &o.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationResultAutoGenerated. -func (o OperationResultAutoGenerated) 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 { - 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 "status": - err = unpopulate(val, "Status", &o.Status) - 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 OperationStatus. -func (o OperationStatus) 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 OperationStatus. -func (o *OperationStatus) UnmarshalJSON(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 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) - 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, "status", o.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatusResult. -func (o *OperationStatusResult) UnmarshalJSON(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 "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &o.EndTime) - delete(rawMsg, key) - case "error": - err = unpopulate(val, "Error", &o.Error) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &o.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "operations": - err = unpopulate(val, "Operations", &o.Operations) - delete(rawMsg, key) - case "percentComplete": - err = unpopulate(val, "PercentComplete", &o.PercentComplete) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &o.StartTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &o.Status) - 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 OperatorList. -func (o OperatorList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", o.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperatorList. -func (o *OperatorList) UnmarshalJSON(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 "value": - err = unpopulate(val, "Value", &o.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperatorResource. -func (o OperatorResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", o.ID) - populate(objectMap, "identity", o.Identity) - populate(objectMap, "name", o.Name) - populate(objectMap, "type", o.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperatorResource. -func (o *OperatorResource) UnmarshalJSON(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 "id": - err = unpopulate(val, "ID", &o.ID) - delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &o.Identity) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &o.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PathRecommendation. -func (p PathRecommendation) 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) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PathRecommendation. -func (p *PathRecommendation) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "action": - err = unpopulate(val, "Action", &p.Action) - delete(rawMsg, key) - case "common": - err = unpopulate(val, "Common", &p.Common) - delete(rawMsg, key) - case "configurationStatus": - err = unpopulate(val, "ConfigurationStatus", &p.ConfigurationStatus) - delete(rawMsg, key) - case "fileType": - err = unpopulate(val, "FileType", &p.FileType) - delete(rawMsg, key) - case "path": - err = unpopulate(val, "Path", &p.Path) - delete(rawMsg, key) - case "publisherInfo": - err = unpopulate(val, "PublisherInfo", &p.PublisherInfo) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - case "userSids": - err = unpopulate(val, "UserSids", &p.UserSids) - delete(rawMsg, key) - case "usernames": - err = unpopulate(val, "Usernames", &p.Usernames) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Pricing. -func (p Pricing) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Pricing. -func (p *Pricing) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PricingList. -func (p PricingList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PricingList. -func (p *PricingList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &p.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PricingProperties. -func (p PricingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "deprecated", p.Deprecated) - populateDateTimeRFC3339(objectMap, "enablementTime", p.EnablementTime) - populate(objectMap, "enforce", p.Enforce) - populate(objectMap, "extensions", p.Extensions) - populate(objectMap, "freeTrialRemainingTime", p.FreeTrialRemainingTime) - populate(objectMap, "inherited", p.Inherited) - populate(objectMap, "inheritedFrom", p.InheritedFrom) - populate(objectMap, "pricingTier", p.PricingTier) - populate(objectMap, "replacedBy", p.ReplacedBy) - populate(objectMap, "resourcesCoverageStatus", p.ResourcesCoverageStatus) - populate(objectMap, "subPlan", p.SubPlan) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PricingProperties. -func (p *PricingProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "deprecated": - err = unpopulate(val, "Deprecated", &p.Deprecated) - delete(rawMsg, key) - case "enablementTime": - err = unpopulateDateTimeRFC3339(val, "EnablementTime", &p.EnablementTime) - delete(rawMsg, key) - case "enforce": - err = unpopulate(val, "Enforce", &p.Enforce) - delete(rawMsg, key) - case "extensions": - err = unpopulate(val, "Extensions", &p.Extensions) - delete(rawMsg, key) - case "freeTrialRemainingTime": - err = unpopulate(val, "FreeTrialRemainingTime", &p.FreeTrialRemainingTime) - delete(rawMsg, key) - case "inherited": - err = unpopulate(val, "Inherited", &p.Inherited) - delete(rawMsg, key) - case "inheritedFrom": - err = unpopulate(val, "InheritedFrom", &p.InheritedFrom) - delete(rawMsg, key) - case "pricingTier": - err = unpopulate(val, "PricingTier", &p.PricingTier) - delete(rawMsg, key) - case "replacedBy": - err = unpopulate(val, "ReplacedBy", &p.ReplacedBy) - delete(rawMsg, key) - case "resourcesCoverageStatus": - err = unpopulate(val, "ResourcesCoverageStatus", &p.ResourcesCoverageStatus) - delete(rawMsg, key) - case "subPlan": - err = unpopulate(val, "SubPlan", &p.SubPlan) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ProcessNotAllowed. -func (p ProcessNotAllowed) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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 { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ProtectionMode. -func (p ProtectionMode) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "exe", p.Exe) - populate(objectMap, "executable", p.Executable) - populate(objectMap, "msi", p.Msi) - populate(objectMap, "script", p.Script) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectionMode. -func (p *ProtectionMode) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "exe": - err = unpopulate(val, "Exe", &p.Exe) - delete(rawMsg, key) - case "executable": - err = unpopulate(val, "Executable", &p.Executable) - delete(rawMsg, key) - case "msi": - err = unpopulate(val, "Msi", &p.Msi) - delete(rawMsg, key) - case "script": - err = unpopulate(val, "Script", &p.Script) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ProxyResource. -func (p ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - 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 { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "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 ProxyServerProperties. -func (p ProxyServerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "ip", p.IP) - populate(objectMap, "port", p.Port) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyServerProperties. -func (p *ProxyServerProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "ip": - err = unpopulate(val, "IP", &p.IP) - delete(rawMsg, key) - case "port": - err = unpopulate(val, "Port", &p.Port) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PublisherInfo. -func (p PublisherInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "binaryName", p.BinaryName) - populate(objectMap, "productName", p.ProductName) - populate(objectMap, "publisherName", p.PublisherName) - populate(objectMap, "version", p.Version) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PublisherInfo. -func (p *PublisherInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "binaryName": - err = unpopulate(val, "BinaryName", &p.BinaryName) - delete(rawMsg, key) - case "productName": - err = unpopulate(val, "ProductName", &p.ProductName) - delete(rawMsg, key) - case "publisherName": - err = unpopulate(val, "PublisherName", &p.PublisherName) - delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &p.Version) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type QueryCheck. -func (q QueryCheck) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "columnNames", q.ColumnNames) - populate(objectMap, "expectedResult", q.ExpectedResult) - populate(objectMap, "query", q.Query) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type QueryCheck. -func (q *QueryCheck) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "columnNames": - err = unpopulate(val, "ColumnNames", &q.ColumnNames) - delete(rawMsg, key) - case "expectedResult": - err = unpopulate(val, "ExpectedResult", &q.ExpectedResult) - delete(rawMsg, key) - case "query": - err = unpopulate(val, "Query", &q.Query) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type QueuePurgesNotInAllowedRange. -func (q QueuePurgesNotInAllowedRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", q.Description) - populate(objectMap, "displayName", q.DisplayName) - populate(objectMap, "isEnabled", q.IsEnabled) - populate(objectMap, "maxThreshold", q.MaxThreshold) - populate(objectMap, "minThreshold", q.MinThreshold) - objectMap["ruleType"] = "QueuePurgesNotInAllowedRange" - populate(objectMap, "timeWindowSize", q.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type QueuePurgesNotInAllowedRange. -func (q *QueuePurgesNotInAllowedRange) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &q.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &q.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &q.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &q.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &q.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &q.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &q.TimeWindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RecommendationConfigurationProperties. -func (r RecommendationConfigurationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", r.Name) - populate(objectMap, "recommendationType", r.RecommendationType) - populate(objectMap, "status", r.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendationConfigurationProperties. -func (r *RecommendationConfigurationProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "recommendationType": - err = unpopulate(val, "RecommendationType", &r.RecommendationType) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RegulatoryComplianceAssessment. -func (r RegulatoryComplianceAssessment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RegulatoryComplianceAssessment. -func (r *RegulatoryComplianceAssessment) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RegulatoryComplianceAssessmentList. -func (r RegulatoryComplianceAssessmentList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RegulatoryComplianceAssessmentList. -func (r *RegulatoryComplianceAssessmentList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RegulatoryComplianceAssessmentProperties. -func (r RegulatoryComplianceAssessmentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "assessmentDetailsLink", r.AssessmentDetailsLink) - populate(objectMap, "assessmentType", r.AssessmentType) - populate(objectMap, "description", r.Description) - populate(objectMap, "failedResources", r.FailedResources) - populate(objectMap, "passedResources", r.PassedResources) - populate(objectMap, "skippedResources", r.SkippedResources) - populate(objectMap, "state", r.State) - populate(objectMap, "unsupportedResources", r.UnsupportedResources) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RegulatoryComplianceAssessmentProperties. -func (r *RegulatoryComplianceAssessmentProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "assessmentDetailsLink": - err = unpopulate(val, "AssessmentDetailsLink", &r.AssessmentDetailsLink) - delete(rawMsg, key) - case "assessmentType": - err = unpopulate(val, "AssessmentType", &r.AssessmentType) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &r.Description) - delete(rawMsg, key) - case "failedResources": - err = unpopulate(val, "FailedResources", &r.FailedResources) - delete(rawMsg, key) - case "passedResources": - err = unpopulate(val, "PassedResources", &r.PassedResources) - delete(rawMsg, key) - case "skippedResources": - err = unpopulate(val, "SkippedResources", &r.SkippedResources) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &r.State) - delete(rawMsg, key) - case "unsupportedResources": - err = unpopulate(val, "UnsupportedResources", &r.UnsupportedResources) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RegulatoryComplianceControl. -func (r RegulatoryComplianceControl) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RegulatoryComplianceControl. -func (r *RegulatoryComplianceControl) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RegulatoryComplianceControlList. -func (r RegulatoryComplianceControlList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RegulatoryComplianceControlList. -func (r *RegulatoryComplianceControlList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RegulatoryComplianceControlProperties. -func (r RegulatoryComplianceControlProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", r.Description) - populate(objectMap, "failedAssessments", r.FailedAssessments) - populate(objectMap, "passedAssessments", r.PassedAssessments) - populate(objectMap, "skippedAssessments", r.SkippedAssessments) - populate(objectMap, "state", r.State) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RegulatoryComplianceControlProperties. -func (r *RegulatoryComplianceControlProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &r.Description) - delete(rawMsg, key) - case "failedAssessments": - err = unpopulate(val, "FailedAssessments", &r.FailedAssessments) - delete(rawMsg, key) - case "passedAssessments": - err = unpopulate(val, "PassedAssessments", &r.PassedAssessments) - delete(rawMsg, key) - case "skippedAssessments": - err = unpopulate(val, "SkippedAssessments", &r.SkippedAssessments) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &r.State) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RegulatoryComplianceStandard. -func (r RegulatoryComplianceStandard) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RegulatoryComplianceStandard. -func (r *RegulatoryComplianceStandard) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RegulatoryComplianceStandardList. -func (r RegulatoryComplianceStandardList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RegulatoryComplianceStandardList. -func (r *RegulatoryComplianceStandardList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RegulatoryComplianceStandardProperties. -func (r RegulatoryComplianceStandardProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "failedControls", r.FailedControls) - populate(objectMap, "passedControls", r.PassedControls) - populate(objectMap, "skippedControls", r.SkippedControls) - populate(objectMap, "state", r.State) - populate(objectMap, "unsupportedControls", r.UnsupportedControls) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RegulatoryComplianceStandardProperties. -func (r *RegulatoryComplianceStandardProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "failedControls": - err = unpopulate(val, "FailedControls", &r.FailedControls) - delete(rawMsg, key) - case "passedControls": - err = unpopulate(val, "PassedControls", &r.PassedControls) - delete(rawMsg, key) - case "skippedControls": - err = unpopulate(val, "SkippedControls", &r.SkippedControls) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &r.State) - delete(rawMsg, key) - case "unsupportedControls": - err = unpopulate(val, "UnsupportedControls", &r.UnsupportedControls) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Remediation. -func (r Remediation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "automated", r.Automated) - populate(objectMap, "description", r.Description) - populate(objectMap, "portalLink", r.PortalLink) - populate(objectMap, "scripts", r.Scripts) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Remediation. -func (r *Remediation) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "automated": - err = unpopulate(val, "Automated", &r.Automated) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &r.Description) - delete(rawMsg, key) - case "portalLink": - err = unpopulate(val, "PortalLink", &r.PortalLink) - delete(rawMsg, key) - case "scripts": - err = unpopulate(val, "Scripts", &r.Scripts) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RemediationEta. -func (r RemediationEta) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "eta", r.Eta) - populate(objectMap, "justification", r.Justification) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RemediationEta. -func (r *RemediationEta) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "eta": - err = unpopulateDateTimeRFC3339(val, "Eta", &r.Eta) - delete(rawMsg, key) - case "justification": - err = unpopulate(val, "Justification", &r.Justification) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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) { - 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 ResourceAutoGenerated. -func (r *ResourceAutoGenerated) UnmarshalJSON(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 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) - 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) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ResourceDetailsAutoGenerated. -func (r ResourceDetailsAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "connectorId", r.ConnectorID) - populate(objectMap, "id", r.ID) - 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 { - 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) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ResourceIdentifier. -func (r ResourceIdentifier) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["type"] = r.Type - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceIdentifier. -func (r *ResourceIdentifier) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Rule. -func (r Rule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleResults. -func (r *RuleResults) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RuleResultsInput. -func (r RuleResultsInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "latestScan", r.LatestScan) - populate(objectMap, "results", r.Results) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleResultsInput. -func (r *RuleResultsInput) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "latestScan": - err = unpopulate(val, "LatestScan", &r.LatestScan) - delete(rawMsg, key) - case "results": - err = unpopulate(val, "Results", &r.Results) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RuleResultsProperties. -func (r RuleResultsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "results", r.Results) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleResultsProperties. -func (r *RuleResultsProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "results": - err = unpopulate(val, "Results", &r.Results) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RulesResults. -func (r RulesResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RulesResults. -func (r *RulesResults) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &r.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RulesResultsInput. -func (r RulesResultsInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "latestScan", r.LatestScan) - populate(objectMap, "results", r.Results) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RulesResultsInput. -func (r *RulesResultsInput) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "latestScan": - err = unpopulate(val, "LatestScan", &r.LatestScan) - delete(rawMsg, key) - case "results": - err = unpopulate(val, "Results", &r.Results) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SQLServerVulnerabilityProperties. -func (s SQLServerVulnerabilityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["assessedResourceType"] = AssessedResourceTypeSQLServerVulnerability - populate(objectMap, "query", s.Query) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLServerVulnerabilityProperties. -func (s *SQLServerVulnerabilityProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "assessedResourceType": - err = unpopulate(val, "AssessedResourceType", &s.AssessedResourceType) - delete(rawMsg, key) - case "query": - err = unpopulate(val, "Query", &s.Query) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Scan. -func (s Scan) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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 Scan. -func (s *Scan) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScanProperties. -func (s ScanProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "database", s.Database) - populateDateTimeRFC3339(objectMap, "endTime", s.EndTime) - populate(objectMap, "highSeverityFailedRulesCount", s.HighSeverityFailedRulesCount) - populate(objectMap, "isBaselineApplied", s.IsBaselineApplied) - populateDateTimeRFC3339(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) - populate(objectMap, "state", s.State) - populate(objectMap, "totalFailedRulesCount", s.TotalFailedRulesCount) - populate(objectMap, "totalPassedRulesCount", s.TotalPassedRulesCount) - populate(objectMap, "totalRulesCount", s.TotalRulesCount) - populate(objectMap, "triggerType", s.TriggerType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScanProperties. -func (s *ScanProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "database": - err = unpopulate(val, "Database", &s.Database) - delete(rawMsg, key) - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &s.EndTime) - delete(rawMsg, key) - case "highSeverityFailedRulesCount": - err = unpopulate(val, "HighSeverityFailedRulesCount", &s.HighSeverityFailedRulesCount) - delete(rawMsg, key) - case "isBaselineApplied": - err = unpopulate(val, "IsBaselineApplied", &s.IsBaselineApplied) - delete(rawMsg, key) - case "lastScanTime": - err = unpopulateDateTimeRFC3339(val, "LastScanTime", &s.LastScanTime) - delete(rawMsg, key) - case "lowSeverityFailedRulesCount": - err = unpopulate(val, "LowSeverityFailedRulesCount", &s.LowSeverityFailedRulesCount) - delete(rawMsg, key) - case "mediumSeverityFailedRulesCount": - err = unpopulate(val, "MediumSeverityFailedRulesCount", &s.MediumSeverityFailedRulesCount) - delete(rawMsg, key) - case "sqlVersion": - err = unpopulate(val, "SQLVersion", &s.SQLVersion) - delete(rawMsg, key) - case "server": - err = unpopulate(val, "Server", &s.Server) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &s.StartTime) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &s.State) - delete(rawMsg, key) - case "totalFailedRulesCount": - err = unpopulate(val, "TotalFailedRulesCount", &s.TotalFailedRulesCount) - delete(rawMsg, key) - case "totalPassedRulesCount": - err = unpopulate(val, "TotalPassedRulesCount", &s.TotalPassedRulesCount) - delete(rawMsg, key) - case "totalRulesCount": - err = unpopulate(val, "TotalRulesCount", &s.TotalRulesCount) - delete(rawMsg, key) - case "triggerType": - err = unpopulate(val, "TriggerType", &s.TriggerType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScanResult. -func (s ScanResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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 ScanResult. -func (s *ScanResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScanResultProperties. -func (s ScanResultProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "baselineAdjustedResult", s.BaselineAdjustedResult) - populate(objectMap, "isTrimmed", s.IsTrimmed) - populate(objectMap, "queryResults", s.QueryResults) - populate(objectMap, "remediation", s.Remediation) - populate(objectMap, "ruleId", s.RuleID) - populate(objectMap, "ruleMetadata", s.RuleMetadata) - populate(objectMap, "status", s.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScanResultProperties. -func (s *ScanResultProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "baselineAdjustedResult": - err = unpopulate(val, "BaselineAdjustedResult", &s.BaselineAdjustedResult) - delete(rawMsg, key) - case "isTrimmed": - err = unpopulate(val, "IsTrimmed", &s.IsTrimmed) - delete(rawMsg, key) - case "queryResults": - err = unpopulate(val, "QueryResults", &s.QueryResults) - delete(rawMsg, key) - case "remediation": - err = unpopulate(val, "Remediation", &s.Remediation) - delete(rawMsg, key) - case "ruleId": - err = unpopulate(val, "RuleID", &s.RuleID) - delete(rawMsg, key) - case "ruleMetadata": - err = unpopulate(val, "RuleMetadata", &s.RuleMetadata) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &s.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScanResults. -func (s ScanResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScanResults. -func (s *ScanResults) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &s.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Scans. -func (s Scans) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Scans. -func (s *Scans) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &s.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScopeElement. -func (s ScopeElement) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "field", s.Field) - if s.AdditionalProperties != nil { - for key, val := range s.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScopeElement. -func (s *ScopeElement) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "field": - err = unpopulate(val, "Field", &s.Field) - delete(rawMsg, key) - default: - if s.AdditionalProperties == nil { - s.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - s.AdditionalProperties[key] = aux - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScoreDetails. -func (s ScoreDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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 ScoreDetails. -func (s *ScoreDetails) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "current": - err = unpopulate(val, "Current", &s.Current) - delete(rawMsg, key) - case "max": - err = unpopulate(val, "Max", &s.Max) - delete(rawMsg, key) - case "percentage": - err = unpopulate(val, "Percentage", &s.Percentage) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SecureScoreControlDefinitionItem. -func (s SecureScoreControlDefinitionItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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 SecureScoreControlDefinitionItem. -func (s *SecureScoreControlDefinitionItem) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SecureScoreControlDefinitionItemProperties. -func (s SecureScoreControlDefinitionItemProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "assessmentDefinitions", s.AssessmentDefinitions) - populate(objectMap, "description", s.Description) - populate(objectMap, "displayName", s.DisplayName) - populate(objectMap, "maxScore", s.MaxScore) - populate(objectMap, "source", s.Source) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SecureScoreControlDefinitionItemProperties. -func (s *SecureScoreControlDefinitionItemProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "assessmentDefinitions": - err = unpopulate(val, "AssessmentDefinitions", &s.AssessmentDefinitions) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &s.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &s.DisplayName) - delete(rawMsg, key) - case "maxScore": - err = unpopulate(val, "MaxScore", &s.MaxScore) - delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &s.Source) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SecureScoreControlDefinitionList. -func (s SecureScoreControlDefinitionList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SecureScoreControlDefinitionList. -func (s *SecureScoreControlDefinitionList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SecureScoreControlDefinitionSource. -func (s SecureScoreControlDefinitionSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "sourceType", s.SourceType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SecureScoreControlDefinitionSource. -func (s *SecureScoreControlDefinitionSource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "sourceType": - err = unpopulate(val, "SourceType", &s.SourceType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SecureScoreControlDetails. -func (s SecureScoreControlDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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 SecureScoreControlDetails. -func (s *SecureScoreControlDetails) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SecureScoreControlList. -func (s SecureScoreControlList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SecureScoreControlList. -func (s *SecureScoreControlList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SecureScoreControlScore. -func (s SecureScoreControlScore) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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) - populate(objectMap, "definition", s.Definition) - populate(objectMap, "displayName", s.DisplayName) - populate(objectMap, "healthyResourceCount", s.HealthyResourceCount) - populate(objectMap, "notApplicableResourceCount", s.NotApplicableResourceCount) - populate(objectMap, "score", s.Score) - populate(objectMap, "unhealthyResourceCount", s.UnhealthyResourceCount) - populate(objectMap, "weight", s.Weight) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SecureScoreControlScoreDetails. -func (s *SecureScoreControlScoreDetails) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "definition": - err = unpopulate(val, "Definition", &s.Definition) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &s.DisplayName) - delete(rawMsg, key) - case "healthyResourceCount": - err = unpopulate(val, "HealthyResourceCount", &s.HealthyResourceCount) - delete(rawMsg, key) - case "notApplicableResourceCount": - err = unpopulate(val, "NotApplicableResourceCount", &s.NotApplicableResourceCount) - delete(rawMsg, key) - case "score": - err = unpopulate(val, "Score", &s.Score) - delete(rawMsg, key) - case "unhealthyResourceCount": - err = unpopulate(val, "UnhealthyResourceCount", &s.UnhealthyResourceCount) - delete(rawMsg, key) - case "weight": - err = unpopulate(val, "Weight", &s.Weight) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SecureScoreItem. -func (s SecureScoreItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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 SecureScoreItem. -func (s *SecureScoreItem) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SecureScoreItemProperties. -func (s SecureScoreItemProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "displayName", s.DisplayName) - populate(objectMap, "score", s.Score) - populate(objectMap, "weight", s.Weight) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SecureScoreItemProperties. -func (s *SecureScoreItemProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &s.DisplayName) - delete(rawMsg, key) - case "score": - err = unpopulate(val, "Score", &s.Score) - delete(rawMsg, key) - case "weight": - err = unpopulate(val, "Weight", &s.Weight) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SecureScoresList. -func (s SecureScoresList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SecureScoresList. -func (s *SecureScoresList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SensitiveDataDiscoveryProperties. -func (s SensitiveDataDiscoveryProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "isEnabled", s.IsEnabled) - populate(objectMap, "operationStatus", s.OperationStatus) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SensitiveDataDiscoveryProperties. -func (s *SensitiveDataDiscoveryProperties) UnmarshalJSON(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 "isEnabled": - err = unpopulate(val, "IsEnabled", &s.IsEnabled) - delete(rawMsg, key) - case "operationStatus": - err = unpopulate(val, "OperationStatus", &s.OperationStatus) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SensitivityLabel. -func (s SensitivityLabel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", s.Description) - populate(objectMap, "displayName", s.DisplayName) - populate(objectMap, "enabled", s.Enabled) - populate(objectMap, "order", s.Order) - populate(objectMap, "rank", s.Rank) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SensitivityLabel. -func (s *SensitivityLabel) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &s.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &s.DisplayName) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &s.Enabled) - delete(rawMsg, key) - case "order": - err = unpopulate(val, "Order", &s.Order) - delete(rawMsg, key) - case "rank": - err = unpopulate(val, "Rank", &s.Rank) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ServerVulnerabilityAssessment. -func (s ServerVulnerabilityAssessment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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 ServerVulnerabilityAssessment. -func (s *ServerVulnerabilityAssessment) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ServerVulnerabilityAssessmentProperties. -func (s ServerVulnerabilityAssessmentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "provisioningState", s.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerVulnerabilityAssessmentProperties. -func (s *ServerVulnerabilityAssessmentProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ServerVulnerabilityAssessmentsAzureSettingProperties. -func (s ServerVulnerabilityAssessmentsAzureSettingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "selectedProvider", s.SelectedProvider) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerVulnerabilityAssessmentsAzureSettingProperties. -func (s *ServerVulnerabilityAssessmentsAzureSettingProperties) UnmarshalJSON(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 "selectedProvider": - err = unpopulate(val, "SelectedProvider", &s.SelectedProvider) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ServerVulnerabilityAssessmentsList. -func (s ServerVulnerabilityAssessmentsList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerVulnerabilityAssessmentsList. -func (s *ServerVulnerabilityAssessmentsList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &s.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ServerVulnerabilityAssessmentsSetting. -func (s ServerVulnerabilityAssessmentsSetting) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) - objectMap["kind"] = s.Kind - populate(objectMap, "name", s.Name) - populate(objectMap, "systemData", s.SystemData) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerVulnerabilityAssessmentsSetting. -func (s *ServerVulnerabilityAssessmentsSetting) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &s.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "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 ServerVulnerabilityAssessmentsSettingsList. -func (s ServerVulnerabilityAssessmentsSettingsList) 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 ServerVulnerabilityAssessmentsSettingsList. -func (s *ServerVulnerabilityAssessmentsSettingsList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) - delete(rawMsg, key) - case "value": - s.Value, err = unmarshalServerVulnerabilityAssessmentsSettingClassificationArray(val) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ServerVulnerabilityProperties. -func (s ServerVulnerabilityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["assessedResourceType"] = "ServerVulnerabilityAssessment" - populate(objectMap, "cve", s.Cve) - populate(objectMap, "cvss", s.Cvss) - populate(objectMap, "patchable", s.Patchable) - populateDateTimeRFC3339(objectMap, "publishedTime", s.PublishedTime) - populate(objectMap, "threat", s.Threat) - populate(objectMap, "type", s.Type) - populate(objectMap, "vendorReferences", s.VendorReferences) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerVulnerabilityProperties. -func (s *ServerVulnerabilityProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "assessedResourceType": - err = unpopulate(val, "AssessedResourceType", &s.AssessedResourceType) - delete(rawMsg, key) - case "cve": - err = unpopulate(val, "Cve", &s.Cve) - delete(rawMsg, key) - case "cvss": - err = unpopulate(val, "Cvss", &s.Cvss) - delete(rawMsg, key) - case "patchable": - err = unpopulate(val, "Patchable", &s.Patchable) - delete(rawMsg, key) - case "publishedTime": - err = unpopulateDateTimeRFC3339(val, "PublishedTime", &s.PublishedTime) - delete(rawMsg, key) - case "threat": - err = unpopulate(val, "Threat", &s.Threat) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - case "vendorReferences": - err = unpopulate(val, "VendorReferences", &s.VendorReferences) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ServicePrincipalProperties. -func (s ServicePrincipalProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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, "name", s.Name) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Setting. -func (s *Setting) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &s.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SettingsList. -func (s SettingsList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SettingsList. -func (s *SettingsList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) - delete(rawMsg, key) - case "value": - s.Value, err = unmarshalSettingClassificationArray(val) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Software. -func (s Software) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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) - populate(objectMap, "id", s.ID) - populate(objectMap, "location", s.Location) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Solution. -func (s *Solution) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &s.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SolutionList. -func (s SolutionList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionList. -func (s *SolutionList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SolutionProperties. -func (s SolutionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "protectionStatus", s.ProtectionStatus) - populate(objectMap, "provisioningState", s.ProvisioningState) - populate(objectMap, "securityFamily", s.SecurityFamily) - populate(objectMap, "template", s.Template) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionProperties. -func (s *SolutionProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "protectionStatus": - err = unpopulate(val, "ProtectionStatus", &s.ProtectionStatus) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) - delete(rawMsg, key) - case "securityFamily": - err = unpopulate(val, "SecurityFamily", &s.SecurityFamily) - delete(rawMsg, key) - case "template": - err = unpopulate(val, "Template", &s.Template) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SolutionsReferenceData. -func (s SolutionsReferenceData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) - populate(objectMap, "location", s.Location) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionsReferenceData. -func (s *SolutionsReferenceData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &s.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SolutionsReferenceDataList. -func (s SolutionsReferenceDataList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionsReferenceDataList. -func (s *SolutionsReferenceDataList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &s.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SolutionsReferenceDataProperties. -func (s SolutionsReferenceDataProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "alertVendorName", s.AlertVendorName) - populate(objectMap, "packageInfoUrl", s.PackageInfoURL) - populate(objectMap, "productName", s.ProductName) - populate(objectMap, "publisher", s.Publisher) - populate(objectMap, "publisherDisplayName", s.PublisherDisplayName) - populate(objectMap, "securityFamily", s.SecurityFamily) - populate(objectMap, "template", s.Template) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionsReferenceDataProperties. -func (s *SolutionsReferenceDataProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "alertVendorName": - err = unpopulate(val, "AlertVendorName", &s.AlertVendorName) - delete(rawMsg, key) - case "packageInfoUrl": - err = unpopulate(val, "PackageInfoURL", &s.PackageInfoURL) - delete(rawMsg, key) - case "productName": - err = unpopulate(val, "ProductName", &s.ProductName) - delete(rawMsg, key) - case "publisher": - err = unpopulate(val, "Publisher", &s.Publisher) - delete(rawMsg, key) - case "publisherDisplayName": - err = unpopulate(val, "PublisherDisplayName", &s.PublisherDisplayName) - delete(rawMsg, key) - case "securityFamily": - err = unpopulate(val, "SecurityFamily", &s.SecurityFamily) - delete(rawMsg, key) - case "template": - err = unpopulate(val, "Template", &s.Template) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type StatusAutoGenerated. -func (s StatusAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "code", s.Code) - populateDateTimeRFC3339(objectMap, "firstEvaluationDate", s.FirstEvaluationDate) - populateDateTimeRFC3339(objectMap, "lastScannedDate", s.LastScannedDate) - populate(objectMap, "reason", s.Reason) - populateDateTimeRFC3339(objectMap, "statusChangeDate", s.StatusChangeDate) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StatusAutoGenerated. -func (s *StatusAutoGenerated) UnmarshalJSON(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 = unpopulateDateTimeRFC3339(val, "FirstEvaluationDate", &s.FirstEvaluationDate) - delete(rawMsg, key) - case "lastScannedDate": - err = unpopulateDateTimeRFC3339(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) - 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) - populate(objectMap, "id", s.ID) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SubAssessment. -func (s *SubAssessment) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SubAssessmentList. -func (s SubAssessmentList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SubAssessmentList. -func (s *SubAssessmentList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SubAssessmentProperties. -func (s SubAssessmentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "additionalData", s.AdditionalData) - populate(objectMap, "category", s.Category) - populate(objectMap, "description", s.Description) - populate(objectMap, "displayName", s.DisplayName) - populate(objectMap, "id", s.ID) - populate(objectMap, "impact", s.Impact) - populate(objectMap, "remediation", s.Remediation) - populate(objectMap, "resourceDetails", s.ResourceDetails) - populate(objectMap, "status", s.Status) - populateDateTimeRFC3339(objectMap, "timeGenerated", s.TimeGenerated) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SubAssessmentProperties. -func (s *SubAssessmentProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "additionalData": - s.AdditionalData, err = unmarshalAdditionalDataClassification(val) - delete(rawMsg, key) - case "category": - err = unpopulate(val, "Category", &s.Category) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &s.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &s.DisplayName) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "impact": - err = unpopulate(val, "Impact", &s.Impact) - delete(rawMsg, key) - case "remediation": - err = unpopulate(val, "Remediation", &s.Remediation) - delete(rawMsg, key) - case "resourceDetails": - s.ResourceDetails, err = unmarshalResourceDetailsClassification(val) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &s.Status) - delete(rawMsg, key) - case "timeGenerated": - err = unpopulateDateTimeRFC3339(val, "TimeGenerated", &s.TimeGenerated) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SubAssessmentStatus. -func (s SubAssessmentStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "cause", s.Cause) - populate(objectMap, "code", s.Code) - populate(objectMap, "description", s.Description) - populate(objectMap, "severity", s.Severity) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SubAssessmentStatus. -func (s *SubAssessmentStatus) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "cause": - err = unpopulate(val, "Cause", &s.Cause) - delete(rawMsg, key) - case "code": - err = unpopulate(val, "Code", &s.Code) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &s.Description) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &s.Severity) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SuppressionAlertsScope. -func (s SuppressionAlertsScope) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "allOf", s.AllOf) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SuppressionAlertsScope. -func (s *SuppressionAlertsScope) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "allOf": - err = unpopulate(val, "AllOf", &s.AllOf) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Tags. -func (t Tags) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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) - populate(objectMap, "annotateDefaultBranch", t.AnnotateDefaultBranch) - populate(objectMap, "branchNames", t.BranchNames) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TargetBranchConfiguration. -func (t *TargetBranchConfiguration) UnmarshalJSON(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 "annotateDefaultBranch": - err = unpopulate(val, "AnnotateDefaultBranch", &t.AnnotateDefaultBranch) - delete(rawMsg, key) - case "branchNames": - err = unpopulate(val, "BranchNames", &t.BranchNames) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Task. -func (t Task) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", t.ID) - populate(objectMap, "name", t.Name) - populate(objectMap, "properties", t.Properties) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Task. -func (t *Task) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &t.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &t.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TaskList. -func (t TaskList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", t.NextLink) - populate(objectMap, "value", t.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TaskList. -func (t *TaskList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &t.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &t.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TaskParameters. -func (t TaskParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", t.Name) - if t.AdditionalProperties != nil { - for key, val := range t.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TaskParameters. -func (t *TaskParameters) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) - default: - if t.AdditionalProperties == nil { - t.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - t.AdditionalProperties[key] = aux - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TaskProperties. -func (t TaskProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "creationTimeUtc", t.CreationTimeUTC) - populateDateTimeRFC3339(objectMap, "lastStateChangeTimeUtc", t.LastStateChangeTimeUTC) - populate(objectMap, "securityTaskParameters", t.SecurityTaskParameters) - populate(objectMap, "state", t.State) - populate(objectMap, "subState", t.SubState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TaskProperties. -func (t *TaskProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "creationTimeUtc": - err = unpopulateDateTimeRFC3339(val, "CreationTimeUTC", &t.CreationTimeUTC) - delete(rawMsg, key) - case "lastStateChangeTimeUtc": - err = unpopulateDateTimeRFC3339(val, "LastStateChangeTimeUTC", &t.LastStateChangeTimeUTC) - delete(rawMsg, key) - case "securityTaskParameters": - err = unpopulate(val, "SecurityTaskParameters", &t.SecurityTaskParameters) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &t.State) - delete(rawMsg, key) - case "subState": - err = unpopulate(val, "SubState", &t.SubState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ThresholdCustomAlertRule. -func (t ThresholdCustomAlertRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", t.Description) - populate(objectMap, "displayName", t.DisplayName) - populate(objectMap, "isEnabled", t.IsEnabled) - populate(objectMap, "maxThreshold", t.MaxThreshold) - populate(objectMap, "minThreshold", t.MinThreshold) - objectMap["ruleType"] = "ThresholdCustomAlertRule" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ThresholdCustomAlertRule. -func (t *ThresholdCustomAlertRule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &t.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &t.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &t.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &t.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &t.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &t.RuleType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TimeWindowCustomAlertRule. -func (t TimeWindowCustomAlertRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", t.Description) - populate(objectMap, "displayName", t.DisplayName) - populate(objectMap, "isEnabled", t.IsEnabled) - populate(objectMap, "maxThreshold", t.MaxThreshold) - populate(objectMap, "minThreshold", t.MinThreshold) - objectMap["ruleType"] = "TimeWindowCustomAlertRule" - populate(objectMap, "timeWindowSize", t.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TimeWindowCustomAlertRule. -func (t *TimeWindowCustomAlertRule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &t.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &t.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &t.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &t.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &t.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &t.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &t.TimeWindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TopologyList. -func (t TopologyList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", t.NextLink) - populate(objectMap, "value", t.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TopologyList. -func (t *TopologyList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &t.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &t.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TopologyResource. -func (t TopologyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "properties", t.Properties) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TopologyResource. -func (t *TopologyResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &t.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &t.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &t.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TopologyResourceProperties. -func (t TopologyResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "calculatedDateTime", t.CalculatedDateTime) - populate(objectMap, "topologyResources", t.TopologyResources) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TopologyResourceProperties. -func (t *TopologyResourceProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "calculatedDateTime": - err = unpopulateDateTimeRFC3339(val, "CalculatedDateTime", &t.CalculatedDateTime) - delete(rawMsg, key) - case "topologyResources": - err = unpopulate(val, "TopologyResources", &t.TopologyResources) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TopologySingleResource. -func (t TopologySingleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "children", t.Children) - populate(objectMap, "location", t.Location) - populate(objectMap, "networkZones", t.NetworkZones) - populate(objectMap, "parents", t.Parents) - populate(objectMap, "recommendationsExist", t.RecommendationsExist) - populate(objectMap, "resourceId", t.ResourceID) - populate(objectMap, "severity", t.Severity) - populate(objectMap, "topologyScore", t.TopologyScore) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TopologySingleResource. -func (t *TopologySingleResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "children": - err = unpopulate(val, "Children", &t.Children) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &t.Location) - delete(rawMsg, key) - case "networkZones": - err = unpopulate(val, "NetworkZones", &t.NetworkZones) - delete(rawMsg, key) - case "parents": - err = unpopulate(val, "Parents", &t.Parents) - delete(rawMsg, key) - case "recommendationsExist": - err = unpopulate(val, "RecommendationsExist", &t.RecommendationsExist) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &t.ResourceID) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &t.Severity) - delete(rawMsg, key) - case "topologyScore": - err = unpopulate(val, "TopologyScore", &t.TopologyScore) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TopologySingleResourceChild. -func (t TopologySingleResourceChild) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "resourceId", t.ResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TopologySingleResourceChild. -func (t *TopologySingleResourceChild) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "resourceId": - err = unpopulate(val, "ResourceID", &t.ResourceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TopologySingleResourceParent. -func (t TopologySingleResourceParent) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "resourceId", t.ResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TopologySingleResourceParent. -func (t *TopologySingleResourceParent) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "resourceId": - err = unpopulate(val, "ResourceID", &t.ResourceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]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) - populate(objectMap, "description", t.Description) - populate(objectMap, "displayName", t.DisplayName) - populate(objectMap, "isEnabled", t.IsEnabled) - populate(objectMap, "maxThreshold", t.MaxThreshold) - populate(objectMap, "minThreshold", t.MinThreshold) - objectMap["ruleType"] = "TwinUpdatesNotInAllowedRange" - populate(objectMap, "timeWindowSize", t.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TwinUpdatesNotInAllowedRange. -func (t *TwinUpdatesNotInAllowedRange) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &t.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &t.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &t.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &t.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &t.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &t.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &t.TimeWindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type UnauthorizedOperationsNotInAllowedRange. -func (u UnauthorizedOperationsNotInAllowedRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", u.Description) - populate(objectMap, "displayName", u.DisplayName) - populate(objectMap, "isEnabled", u.IsEnabled) - populate(objectMap, "maxThreshold", u.MaxThreshold) - populate(objectMap, "minThreshold", u.MinThreshold) - objectMap["ruleType"] = "UnauthorizedOperationsNotInAllowedRange" - populate(objectMap, "timeWindowSize", u.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type UnauthorizedOperationsNotInAllowedRange. -func (u *UnauthorizedOperationsNotInAllowedRange) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &u.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &u.DisplayName) + case "maliciousBlobsCount": + err = unpopulate(val, "MaliciousBlobsCount", &b.MaliciousBlobsCount) delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &u.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &u.MaxThreshold) + case "scannedBlobsInGB": + err = unpopulate(val, "ScannedBlobsInGB", &b.ScannedBlobsInGB) delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &u.MinThreshold) + case "skippedBlobsCount": + err = unpopulate(val, "SkippedBlobsCount", &b.SkippedBlobsCount) delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &u.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &u.TimeWindowSize) + case "totalBlobsScanned": + err = unpopulate(val, "TotalBlobsScanned", &b.TotalBlobsScanned) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type UpdateIoTSecuritySolutionProperties. -func (u UpdateIoTSecuritySolutionProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DefenderForStorageSetting. +func (d DefenderForStorageSetting) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "recommendationsConfiguration", u.RecommendationsConfiguration) - populate(objectMap, "userDefinedResources", u.UserDefinedResources) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateIoTSecuritySolutionProperties. -func (u *UpdateIoTSecuritySolutionProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForStorageSetting. +func (d *DefenderForStorageSetting) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "recommendationsConfiguration": - err = unpopulate(val, "RecommendationsConfiguration", &u.RecommendationsConfiguration) + case "id": + err = unpopulate(val, "ID", &d.ID) delete(rawMsg, key) - case "userDefinedResources": - err = unpopulate(val, "UserDefinedResources", &u.UserDefinedResources) + case "name": + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type UpdateIotSecuritySolutionData. -func (u UpdateIotSecuritySolutionData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "properties", u.Properties) - populate(objectMap, "tags", u.Tags) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateIotSecuritySolutionData. -func (u *UpdateIotSecuritySolutionData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) - } - for key, val := range rawMsg { - var err error - switch key { case "properties": - err = unpopulate(val, "Properties", &u.Properties) + err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &u.Tags) + case "type": + err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type UpdateSensitivitySettingsRequest. -func (u UpdateSensitivitySettingsRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DefenderForStorageSettingProperties. +func (d DefenderForStorageSettingProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "sensitiveInfoTypesIds", u.SensitiveInfoTypesIDs) - populate(objectMap, "sensitivityThresholdLabelId", u.SensitivityThresholdLabelID) - populate(objectMap, "sensitivityThresholdLabelOrder", u.SensitivityThresholdLabelOrder) + populate(objectMap, "isEnabled", d.IsEnabled) + populate(objectMap, "malwareScanning", d.MalwareScanning) + populate(objectMap, "overrideSubscriptionLevelSettings", d.OverrideSubscriptionLevelSettings) + populate(objectMap, "sensitiveDataDiscovery", d.SensitiveDataDiscovery) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateSensitivitySettingsRequest. -func (u *UpdateSensitivitySettingsRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForStorageSettingProperties. +func (d *DefenderForStorageSettingProperties) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "sensitiveInfoTypesIds": - err = unpopulate(val, "SensitiveInfoTypesIDs", &u.SensitiveInfoTypesIDs) - delete(rawMsg, key) - case "sensitivityThresholdLabelId": - err = unpopulate(val, "SensitivityThresholdLabelID", &u.SensitivityThresholdLabelID) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &d.IsEnabled) delete(rawMsg, key) - case "sensitivityThresholdLabelOrder": - err = unpopulate(val, "SensitivityThresholdLabelOrder", &u.SensitivityThresholdLabelOrder) + case "malwareScanning": + err = unpopulate(val, "MalwareScanning", &d.MalwareScanning) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type UserDefinedResourcesProperties. -func (u UserDefinedResourcesProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "query", u.Query) - populate(objectMap, "querySubscriptions", u.QuerySubscriptions) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type UserDefinedResourcesProperties. -func (u *UserDefinedResourcesProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "query": - err = unpopulate(val, "Query", &u.Query) + case "overrideSubscriptionLevelSettings": + err = unpopulate(val, "OverrideSubscriptionLevelSettings", &d.OverrideSubscriptionLevelSettings) delete(rawMsg, key) - case "querySubscriptions": - err = unpopulate(val, "QuerySubscriptions", &u.QuerySubscriptions) + case "sensitiveDataDiscovery": + err = unpopulate(val, "SensitiveDataDiscovery", &d.SensitiveDataDiscovery) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type UserRecommendation. -func (u UserRecommendation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "recommendationAction", u.RecommendationAction) - populate(objectMap, "username", u.Username) + populateAny(objectMap, "info", e.Info) + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type UserRecommendation. -func (u *UserRecommendation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "recommendationAction": - err = unpopulate(val, "RecommendationAction", &u.RecommendationAction) + case "info": + err = unpopulate(val, "Info", &e.Info) delete(rawMsg, key) - case "username": - err = unpopulate(val, "Username", &u.Username) + case "type": + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type VMRecommendation. -func (v VMRecommendation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MalwareScan. +func (m MalwareScan) 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) + populate(objectMap, "properties", m.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VMRecommendation. -func (v *VMRecommendation) UnmarshalJSON(data []byte) error { +// 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", v, err) + return fmt.Errorf("unmarshalling type %T: %v", m, 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) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type VMScannersAws. -func (v VMScannersAws) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MalwareScanProperties. +func (m MalwareScanProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "cloudRoleArn", v.CloudRoleArn) - populate(objectMap, "configuration", v.Configuration) - populate(objectMap, "enabled", v.Enabled) + 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 VMScannersAws. -func (v *VMScannersAws) UnmarshalJSON(data []byte) error { +// 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", v, err) + return fmt.Errorf("unmarshalling type %T: %v", m, 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) + case "scanEndTime": + err = unpopulate(val, "ScanEndTime", &m.ScanEndTime) delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &v.Enabled) + case "scanId": + err = unpopulate(val, "ScanID", &m.ScanID) 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) + case "scanStartTime": + err = unpopulate(val, "ScanStartTime", &m.ScanStartTime) delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &v.Enabled) + case "scanStatus": + err = unpopulate(val, "ScanStatus", &m.ScanStatus) 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) - populate(objectMap, "exclusionTags", v.ExclusionTags) - populate(objectMap, "scanningMode", v.ScanningMode) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VMScannersBaseConfiguration. -func (v *VMScannersBaseConfiguration) UnmarshalJSON(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 "exclusionTags": - err = unpopulate(val, "ExclusionTags", &v.ExclusionTags) + case "scanStatusMessage": + err = unpopulate(val, "ScanStatusMessage", &m.ScanStatusMessage) delete(rawMsg, key) - case "scanningMode": - err = unpopulate(val, "ScanningMode", &v.ScanningMode) + case "scanSummary": + err = unpopulate(val, "ScanSummary", &m.ScanSummary) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type VMScannersGcp. -func (v VMScannersGcp) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MalwareScanningProperties. +func (m MalwareScanningProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "configuration", v.Configuration) - populate(objectMap, "enabled", v.Enabled) + populate(objectMap, "onUpload", m.OnUpload) + populate(objectMap, "operationStatus", m.OperationStatus) + populate(objectMap, "scanResultsEventGridTopicResourceId", m.ScanResultsEventGridTopicResourceID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VMScannersGcp. -func (v *VMScannersGcp) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MalwareScanningProperties. +func (m *MalwareScanningProperties) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "configuration": - err = unpopulate(val, "Configuration", &v.Configuration) + case "onUpload": + err = unpopulate(val, "OnUpload", &m.OnUpload) + delete(rawMsg, key) + case "operationStatus": + err = unpopulate(val, "OperationStatus", &m.OperationStatus) delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &v.Enabled) + case "scanResultsEventGridTopicResourceId": + err = unpopulate(val, "ScanResultsEventGridTopicResourceID", &m.ScanResultsEventGridTopicResourceID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type VaRule. -func (v VaRule) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OnUploadProperties. +func (o OnUploadProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "benchmarkReferences", v.BenchmarkReferences) - populate(objectMap, "category", v.Category) - populate(objectMap, "description", v.Description) - populate(objectMap, "queryCheck", v.QueryCheck) - populate(objectMap, "rationale", v.Rationale) - populate(objectMap, "ruleId", v.RuleID) - populate(objectMap, "ruleType", v.RuleType) - populate(objectMap, "severity", v.Severity) - populate(objectMap, "title", v.Title) + populate(objectMap, "capGBPerMonth", o.CapGBPerMonth) + populate(objectMap, "isEnabled", o.IsEnabled) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VaRule. -func (v *VaRule) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OnUploadProperties. +func (o *OnUploadProperties) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "benchmarkReferences": - err = unpopulate(val, "BenchmarkReferences", &v.BenchmarkReferences) - delete(rawMsg, key) - case "category": - err = unpopulate(val, "Category", &v.Category) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &v.Description) - delete(rawMsg, key) - case "queryCheck": - err = unpopulate(val, "QueryCheck", &v.QueryCheck) - delete(rawMsg, key) - case "rationale": - err = unpopulate(val, "Rationale", &v.Rationale) - delete(rawMsg, key) - case "ruleId": - err = unpopulate(val, "RuleID", &v.RuleID) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &v.RuleType) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &v.Severity) + case "capGBPerMonth": + err = unpopulate(val, "CapGBPerMonth", &o.CapGBPerMonth) delete(rawMsg, key) - case "title": - err = unpopulate(val, "Title", &v.Title) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &o.IsEnabled) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type VendorReference. -func (v VendorReference) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationStatus. +func (o OperationStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "link", v.Link) - populate(objectMap, "title", v.Title) + populate(objectMap, "code", o.Code) + populate(objectMap, "message", o.Message) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VendorReference. -func (v *VendorReference) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatus. +func (o *OperationStatus) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "link": - err = unpopulate(val, "Link", &v.Link) + case "code": + err = unpopulate(val, "Code", &o.Code) delete(rawMsg, key) - case "title": - err = unpopulate(val, "Title", &v.Title) + case "message": + err = unpopulate(val, "Message", &o.Message) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WorkspaceSetting. -func (w WorkspaceSetting) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", w.ID) - populate(objectMap, "name", w.Name) - populate(objectMap, "properties", w.Properties) - populate(objectMap, "type", w.Type) + 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 WorkspaceSetting. -func (w *WorkspaceSetting) UnmarshalJSON(data []byte) error { +// 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", w, err) + 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", &w.ID) + err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &w.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &w.Properties) + err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &w.Type) + err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WorkspaceSettingList. -func (w WorkspaceSettingList) 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, "nextLink", w.NextLink) - populate(objectMap, "value", w.Value) + populate(objectMap, "blobs", s.Blobs) + populate(objectMap, "estimatedScanCostUSD", s.EstimatedScanCostUSD) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkspaceSettingList. -func (w *WorkspaceSettingList) 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", w, err) + 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", &w.NextLink) + case "blobs": + err = unpopulate(val, "Blobs", &s.Blobs) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &w.Value) + case "estimatedScanCostUSD": + err = unpopulate(val, "EstimatedScanCostUSD", &s.EstimatedScanCostUSD) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WorkspaceSettingProperties. -func (w WorkspaceSettingProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SensitiveDataDiscoveryProperties. +func (s SensitiveDataDiscoveryProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "scope", w.Scope) - populate(objectMap, "workspaceId", w.WorkspaceID) + populate(objectMap, "isEnabled", s.IsEnabled) + populate(objectMap, "operationStatus", s.OperationStatus) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkspaceSettingProperties. -func (w *WorkspaceSettingProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SensitiveDataDiscoveryProperties. +func (s *SensitiveDataDiscoveryProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "scope": - err = unpopulate(val, "Scope", &w.Scope) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &s.IsEnabled) delete(rawMsg, key) - case "workspaceId": - err = unpopulate(val, "WorkspaceID", &w.WorkspaceID) + case "operationStatus": + err = unpopulate(val, "OperationStatus", &s.OperationStatus) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil @@ -18019,16 +451,6 @@ func populateAny(m map[string]any, k string, v any) { } } -func populateByteArray[T any](m map[string]any, k string, b []T, convert func() any) { - if azcore.IsNullValue(b) { - m[k] = nil - } else if len(b) == 0 { - return - } else { - m[k] = convert() - } -} - func unpopulate(data json.RawMessage, fn string, v any) error { if data == nil || string(data) == "null" { return nil diff --git a/sdk/resourcemanager/security/armsecurity/operations_client.go b/sdk/resourcemanager/security/armsecurity/operations_client.go deleted file mode 100644 index 3157d1c8d7c2..000000000000 --- a/sdk/resourcemanager/security/armsecurity/operations_client.go +++ /dev/null @@ -1,88 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armsecurity - -import ( - "context" - "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" -) - -// OperationsClient contains the methods for the Operations group. -// Don't use this type directly, use NewOperationsClient() instead. -type OperationsClient struct { - internal *arm.Client -} - -// 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. -func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &OperationsClient{ - internal: cl, - } - return client, nil -} - -// NewListPager - Exposes all available operations for discovery purposes. -// -// Generated from API version 2015-06-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]{ - More: func(page OperationsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.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 OperationsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *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") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// 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 { - return OperationsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/operators_client.go b/sdk/resourcemanager/security/armsecurity/operators_client.go deleted file mode 100644 index 9e66b7c8f881..000000000000 --- a/sdk/resourcemanager/security/armsecurity/operators_client.go +++ /dev/null @@ -1,286 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// OperatorsClient contains the methods for the SecurityOperators group. -// Don't use this type directly, use NewOperatorsClient() instead. -type OperatorsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewOperatorsClient creates a new instance of OperatorsClient 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 NewOperatorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperatorsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &OperatorsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Creates Microsoft Defender for Cloud security operator on the given scope. -// 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 -// - 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) { - var err error - const operationName = "OperatorsClient.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, pricingName, securityOperatorName, options) - if err != nil { - return OperatorsClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return OperatorsClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return OperatorsClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *OperatorsClient) createOrUpdateCreateRequest(ctx context.Context, pricingName string, securityOperatorName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if pricingName == "" { - return nil, errors.New("parameter pricingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{pricingName}", url.PathEscape(pricingName)) - if securityOperatorName == "" { - return nil, errors.New("parameter securityOperatorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{securityOperatorName}", url.PathEscape(securityOperatorName)) - 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-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *OperatorsClient) createOrUpdateHandleResponse(resp *http.Response) (OperatorsClientCreateOrUpdateResponse, error) { - result := OperatorsClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperatorResource); err != nil { - return OperatorsClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Delete Microsoft Defender for Cloud securityOperator in the subscription. -// 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 -// - 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 - const operationName = "OperatorsClient.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, pricingName, securityOperatorName, options) - if err != nil { - return OperatorsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return OperatorsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return OperatorsClientDeleteResponse{}, err - } - return OperatorsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *OperatorsClient) deleteCreateRequest(ctx context.Context, pricingName string, securityOperatorName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if pricingName == "" { - return nil, errors.New("parameter pricingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{pricingName}", url.PathEscape(pricingName)) - if securityOperatorName == "" { - return nil, errors.New("parameter securityOperatorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{securityOperatorName}", url.PathEscape(securityOperatorName)) - 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-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get a specific security operator for the requested scope. -// 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 -// - 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 - const operationName = "OperatorsClient.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, pricingName, securityOperatorName, options) - if err != nil { - return OperatorsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return OperatorsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return OperatorsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *OperatorsClient) getCreateRequest(ctx context.Context, pricingName string, securityOperatorName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if pricingName == "" { - return nil, errors.New("parameter pricingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{pricingName}", url.PathEscape(pricingName)) - if securityOperatorName == "" { - return nil, errors.New("parameter securityOperatorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{securityOperatorName}", url.PathEscape(securityOperatorName)) - 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-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 *OperatorsClient) getHandleResponse(resp *http.Response) (OperatorsClientGetResponse, error) { - result := OperatorsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperatorResource); err != nil { - return OperatorsClientGetResponse{}, err - } - return result, nil -} - -// List - Lists Microsoft Defender for Cloud securityOperators in the subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// -// 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 -} - -// listCreateRequest creates the List request. -func (client *OperatorsClient) listCreateRequest(ctx context.Context, pricingName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if pricingName == "" { - return nil, errors.New("parameter pricingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{pricingName}", url.PathEscape(pricingName)) - 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-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 *OperatorsClient) listHandleResponse(resp *http.Response) (OperatorsClientListResponse, error) { - result := OperatorsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperatorList); err != nil { - return OperatorsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/operators_client_example_test.go b/sdk/resourcemanager/security/armsecurity/operators_client_example_test.go deleted file mode 100644 index 14d50b3eca91..000000000000 --- a/sdk/resourcemanager/security/armsecurity/operators_client_example_test.go +++ /dev/null @@ -1,128 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-01-01-preview/examples/SecurityOperators/ListSecurityOperators_example.json -func ExampleOperatorsClient_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.NewOperatorsClient().List(ctx, "CloudPosture", 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.OperatorList = armsecurity.OperatorList{ - // Value: []*armsecurity.OperatorResource{ - // { - // Name: to.Ptr("DefenderCSPMSecurityOperator"), - // Type: to.Ptr("Microsoft.Security/pricings/securityOperator"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/pricings/CloudPosture/securityOperators/DefenderCSPMSecurityOperator"), - // Identity: &armsecurity.Identity{ - // Type: to.Ptr("SystemAssigned"), - // PrincipalID: to.Ptr("44ee8e7e-7f52-4750-b937-27490fbf7663"), - // TenantID: to.Ptr("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/2023-01-01-preview/examples/SecurityOperators/GetSecurityOperatorByName_example.json -func ExampleOperatorsClient_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.NewOperatorsClient().Get(ctx, "CloudPosture", "DefenderCSPMSecurityOperator", 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.OperatorResource = armsecurity.OperatorResource{ - // Name: to.Ptr("DefenderCSPMSecurityOperator"), - // Type: to.Ptr("Microsoft.Security/pricings/securityOperator"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/pricings/CloudPosture/securityOperators/DefenderCSPMSecurityOperator"), - // Identity: &armsecurity.Identity{ - // Type: to.Ptr("SystemAssigned"), - // PrincipalID: to.Ptr("44ee8e7e-7f52-4750-b937-27490fbf7663"), - // TenantID: to.Ptr("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/2023-01-01-preview/examples/SecurityOperators/PutSecurityOperatorByName_example.json -func ExampleOperatorsClient_CreateOrUpdate() { - 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.NewOperatorsClient().CreateOrUpdate(ctx, "CloudPosture", "DefenderCSPMSecurityOperator", 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.OperatorResource = armsecurity.OperatorResource{ - // Name: to.Ptr("DefenderCSPMSecurityOperator"), - // Type: to.Ptr("Microsoft.Security/pricings/securityOperator"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/pricings/CloudPosture/securityOperators/DefenderCSPMSecurityOperator"), - // Identity: &armsecurity.Identity{ - // Type: to.Ptr("SystemAssigned"), - // PrincipalID: to.Ptr("44ee8e7e-7f52-4750-b937-27490fbf7663"), - // TenantID: to.Ptr("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/2023-01-01-preview/examples/SecurityOperators/DeleteSecurityOperatorByName_example.json -func ExampleOperatorsClient_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.NewOperatorsClient().Delete(ctx, "CloudPosture", "DefenderCSPMSecurityOperator", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/options.go b/sdk/resourcemanager/security/armsecurity/options.go index 23cfae73dfc9..0aece295ef3e 100644 --- a/sdk/resourcemanager/security/armsecurity/options.go +++ b/sdk/resourcemanager/security/armsecurity/options.go @@ -8,1388 +8,30 @@ package armsecurity -// APICollectionsClientBeginOnboardAzureAPIManagementAPIOptions contains the optional parameters for the APICollectionsClient.BeginOnboardAzureAPIManagementAPI +// DefenderForStorageClientCancelMalwareScanOptions contains the optional parameters for the DefenderForStorageClient.CancelMalwareScan // method. -type APICollectionsClientBeginOnboardAzureAPIManagementAPIOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// APICollectionsClientGetByAzureAPIManagementServiceOptions contains the optional parameters for the APICollectionsClient.GetByAzureAPIManagementService -// method. -type APICollectionsClientGetByAzureAPIManagementServiceOptions struct { - // placeholder for future optional parameters -} - -// APICollectionsClientListByAzureAPIManagementServiceOptions contains the optional parameters for the APICollectionsClient.NewListByAzureAPIManagementServicePager -// method. -type APICollectionsClientListByAzureAPIManagementServiceOptions struct { - // placeholder for future optional parameters -} - -// APICollectionsClientListByResourceGroupOptions contains the optional parameters for the APICollectionsClient.NewListByResourceGroupPager -// method. -type APICollectionsClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// APICollectionsClientListBySubscriptionOptions contains the optional parameters for the APICollectionsClient.NewListBySubscriptionPager -// method. -type APICollectionsClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// APICollectionsClientOffboardAzureAPIManagementAPIOptions contains the optional parameters for the APICollectionsClient.OffboardAzureAPIManagementAPI -// method. -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 { - // placeholder for future optional parameters -} - -// AdvancedThreatProtectionClientGetOptions contains the optional parameters for the AdvancedThreatProtectionClient.Get method. -type AdvancedThreatProtectionClientGetOptions struct { - // placeholder for future optional parameters -} - -// AlertsClientBeginSimulateOptions contains the optional parameters for the AlertsClient.BeginSimulate method. -type AlertsClientBeginSimulateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// AlertsClientGetResourceGroupLevelOptions contains the optional parameters for the AlertsClient.GetResourceGroupLevel method. -type AlertsClientGetResourceGroupLevelOptions struct { - // placeholder for future optional parameters -} - -// AlertsClientGetSubscriptionLevelOptions contains the optional parameters for the AlertsClient.GetSubscriptionLevel method. -type AlertsClientGetSubscriptionLevelOptions struct { - // placeholder for future optional parameters -} - -// AlertsClientListByResourceGroupOptions contains the optional parameters for the AlertsClient.NewListByResourceGroupPager -// method. -type AlertsClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// AlertsClientListOptions contains the optional parameters for the AlertsClient.NewListPager method. -type AlertsClientListOptions struct { - // placeholder for future optional parameters -} - -// AlertsClientListResourceGroupLevelByRegionOptions contains the optional parameters for the AlertsClient.NewListResourceGroupLevelByRegionPager -// method. -type AlertsClientListResourceGroupLevelByRegionOptions struct { - // placeholder for future optional parameters -} - -// AlertsClientListSubscriptionLevelByRegionOptions contains the optional parameters for the AlertsClient.NewListSubscriptionLevelByRegionPager -// method. -type AlertsClientListSubscriptionLevelByRegionOptions struct { - // placeholder for future optional parameters -} - -// AlertsClientUpdateResourceGroupLevelStateToActivateOptions contains the optional parameters for the AlertsClient.UpdateResourceGroupLevelStateToActivate -// method. -type AlertsClientUpdateResourceGroupLevelStateToActivateOptions struct { - // placeholder for future optional parameters -} - -// AlertsClientUpdateResourceGroupLevelStateToDismissOptions contains the optional parameters for the AlertsClient.UpdateResourceGroupLevelStateToDismiss -// method. -type AlertsClientUpdateResourceGroupLevelStateToDismissOptions struct { - // placeholder for future optional parameters -} - -// AlertsClientUpdateResourceGroupLevelStateToInProgressOptions contains the optional parameters for the AlertsClient.UpdateResourceGroupLevelStateToInProgress -// method. -type AlertsClientUpdateResourceGroupLevelStateToInProgressOptions struct { - // placeholder for future optional parameters -} - -// AlertsClientUpdateResourceGroupLevelStateToResolveOptions contains the optional parameters for the AlertsClient.UpdateResourceGroupLevelStateToResolve -// method. -type AlertsClientUpdateResourceGroupLevelStateToResolveOptions struct { - // placeholder for future optional parameters -} - -// AlertsClientUpdateSubscriptionLevelStateToActivateOptions contains the optional parameters for the AlertsClient.UpdateSubscriptionLevelStateToActivate -// method. -type AlertsClientUpdateSubscriptionLevelStateToActivateOptions struct { - // placeholder for future optional parameters -} - -// AlertsClientUpdateSubscriptionLevelStateToDismissOptions contains the optional parameters for the AlertsClient.UpdateSubscriptionLevelStateToDismiss -// method. -type AlertsClientUpdateSubscriptionLevelStateToDismissOptions struct { - // placeholder for future optional parameters -} - -// AlertsClientUpdateSubscriptionLevelStateToInProgressOptions contains the optional parameters for the AlertsClient.UpdateSubscriptionLevelStateToInProgress -// method. -type AlertsClientUpdateSubscriptionLevelStateToInProgressOptions struct { - // placeholder for future optional parameters -} - -// AlertsClientUpdateSubscriptionLevelStateToResolveOptions contains the optional parameters for the AlertsClient.UpdateSubscriptionLevelStateToResolve -// method. -type AlertsClientUpdateSubscriptionLevelStateToResolveOptions struct { - // placeholder for future optional parameters -} - -// AlertsSuppressionRulesClientDeleteOptions contains the optional parameters for the AlertsSuppressionRulesClient.Delete -// method. -type AlertsSuppressionRulesClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// AlertsSuppressionRulesClientGetOptions contains the optional parameters for the AlertsSuppressionRulesClient.Get method. -type AlertsSuppressionRulesClientGetOptions struct { - // placeholder for future optional parameters -} - -// AlertsSuppressionRulesClientListOptions contains the optional parameters for the AlertsSuppressionRulesClient.NewListPager -// method. -type AlertsSuppressionRulesClientListOptions struct { - // Type of the alert to get rules for - AlertType *string -} - -// AlertsSuppressionRulesClientUpdateOptions contains the optional parameters for the AlertsSuppressionRulesClient.Update -// method. -type AlertsSuppressionRulesClientUpdateOptions struct { - // placeholder for future optional parameters -} - -// AllowedConnectionsClientGetOptions contains the optional parameters for the AllowedConnectionsClient.Get method. -type AllowedConnectionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// AllowedConnectionsClientListByHomeRegionOptions contains the optional parameters for the AllowedConnectionsClient.NewListByHomeRegionPager -// method. -type AllowedConnectionsClientListByHomeRegionOptions struct { - // placeholder for future optional parameters -} - -// AllowedConnectionsClientListOptions contains the optional parameters for the AllowedConnectionsClient.NewListPager method. -type AllowedConnectionsClientListOptions struct { - // placeholder for future optional parameters -} - -// ApplicationClientCreateOrUpdateOptions contains the optional parameters for the ApplicationClient.CreateOrUpdate method. -type ApplicationClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// ApplicationClientDeleteOptions contains the optional parameters for the ApplicationClient.Delete method. -type ApplicationClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ApplicationClientGetOptions contains the optional parameters for the ApplicationClient.Get method. -type ApplicationClientGetOptions struct { - // placeholder for future optional parameters -} - -// ApplicationsClientListOptions contains the optional parameters for the ApplicationsClient.NewListPager method. -type ApplicationsClientListOptions struct { - // placeholder for future optional parameters -} - -// AssessmentsClientCreateOrUpdateOptions contains the optional parameters for the AssessmentsClient.CreateOrUpdate method. -type AssessmentsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// AssessmentsClientDeleteOptions contains the optional parameters for the AssessmentsClient.Delete method. -type AssessmentsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// AssessmentsClientGetOptions contains the optional parameters for the AssessmentsClient.Get method. -type AssessmentsClientGetOptions struct { - // OData expand. Optional. - Expand *ExpandEnum -} - -// AssessmentsClientListOptions contains the optional parameters for the AssessmentsClient.NewListPager method. -type AssessmentsClientListOptions struct { - // placeholder for future optional parameters -} - -// AssessmentsMetadataClientCreateInSubscriptionOptions contains the optional parameters for the AssessmentsMetadataClient.CreateInSubscription -// method. -type AssessmentsMetadataClientCreateInSubscriptionOptions struct { - // placeholder for future optional parameters -} - -// AssessmentsMetadataClientDeleteInSubscriptionOptions contains the optional parameters for the AssessmentsMetadataClient.DeleteInSubscription -// method. -type AssessmentsMetadataClientDeleteInSubscriptionOptions struct { - // placeholder for future optional parameters -} - -// AssessmentsMetadataClientGetInSubscriptionOptions contains the optional parameters for the AssessmentsMetadataClient.GetInSubscription -// method. -type AssessmentsMetadataClientGetInSubscriptionOptions struct { - // placeholder for future optional parameters -} - -// AssessmentsMetadataClientGetOptions contains the optional parameters for the AssessmentsMetadataClient.Get method. -type AssessmentsMetadataClientGetOptions struct { - // placeholder for future optional parameters -} - -// AssessmentsMetadataClientListBySubscriptionOptions contains the optional parameters for the AssessmentsMetadataClient.NewListBySubscriptionPager -// method. -type AssessmentsMetadataClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// AssessmentsMetadataClientListOptions contains the optional parameters for the AssessmentsMetadataClient.NewListPager method. -type AssessmentsMetadataClientListOptions struct { - // placeholder for future optional parameters -} - -// AutoProvisioningSettingsClientCreateOptions contains the optional parameters for the AutoProvisioningSettingsClient.Create -// method. -type AutoProvisioningSettingsClientCreateOptions struct { - // placeholder for future optional parameters -} - -// AutoProvisioningSettingsClientGetOptions contains the optional parameters for the AutoProvisioningSettingsClient.Get method. -type AutoProvisioningSettingsClientGetOptions struct { - // placeholder for future optional parameters -} - -// AutoProvisioningSettingsClientListOptions contains the optional parameters for the AutoProvisioningSettingsClient.NewListPager -// method. -type AutoProvisioningSettingsClientListOptions struct { - // placeholder for future optional parameters -} - -// AutomationsClientCreateOrUpdateOptions contains the optional parameters for the AutomationsClient.CreateOrUpdate method. -type AutomationsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// AutomationsClientDeleteOptions contains the optional parameters for the AutomationsClient.Delete method. -type AutomationsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// AutomationsClientGetOptions contains the optional parameters for the AutomationsClient.Get method. -type AutomationsClientGetOptions struct { - // placeholder for future optional parameters -} - -// AutomationsClientListByResourceGroupOptions contains the optional parameters for the AutomationsClient.NewListByResourceGroupPager -// method. -type AutomationsClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// AutomationsClientListOptions contains the optional parameters for the AutomationsClient.NewListPager method. -type AutomationsClientListOptions struct { - // placeholder for future optional parameters -} - -// AutomationsClientUpdateOptions contains the optional parameters for the AutomationsClient.Update method. -type AutomationsClientUpdateOptions struct { - // placeholder for future optional parameters -} - -// AutomationsClientValidateOptions contains the optional parameters for the AutomationsClient.Validate method. -type AutomationsClientValidateOptions struct { - // placeholder for future optional parameters -} - -// AzureDevOpsOrgsClientBeginCreateOrUpdateOptions contains the optional parameters for the AzureDevOpsOrgsClient.BeginCreateOrUpdate -// method. -type AzureDevOpsOrgsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO 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. - ResumeToken string -} - -// AzureDevOpsOrgsClientGetOptions contains the optional parameters for the AzureDevOpsOrgsClient.Get method. -type AzureDevOpsOrgsClientGetOptions struct { - // placeholder for future optional parameters -} - -// AzureDevOpsOrgsClientListAvailableOptions contains the optional parameters for the AzureDevOpsOrgsClient.ListAvailable -// method. -type AzureDevOpsOrgsClientListAvailableOptions struct { - // placeholder for future optional parameters -} - -// AzureDevOpsOrgsClientListOptions contains the optional parameters for the AzureDevOpsOrgsClient.NewListPager method. -type AzureDevOpsOrgsClientListOptions struct { - // placeholder for future optional parameters -} - -// AzureDevOpsProjectsClientBeginCreateOrUpdateOptions contains the optional parameters for the AzureDevOpsProjectsClient.BeginCreateOrUpdate -// method. -type AzureDevOpsProjectsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO 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. - ResumeToken string -} - -// AzureDevOpsProjectsClientGetOptions contains the optional parameters for the AzureDevOpsProjectsClient.Get method. -type AzureDevOpsProjectsClientGetOptions struct { - // placeholder for future optional parameters -} - -// AzureDevOpsProjectsClientListOptions contains the optional parameters for the AzureDevOpsProjectsClient.NewListPager method. -type AzureDevOpsProjectsClientListOptions struct { - // placeholder for future optional parameters -} - -// AzureDevOpsReposClientBeginCreateOrUpdateOptions contains the optional parameters for the AzureDevOpsReposClient.BeginCreateOrUpdate -// method. -type AzureDevOpsReposClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO 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. - ResumeToken string -} - -// AzureDevOpsReposClientGetOptions contains the optional parameters for the AzureDevOpsReposClient.Get method. -type AzureDevOpsReposClientGetOptions struct { - // placeholder for future optional parameters -} - -// AzureDevOpsReposClientListOptions contains the optional parameters for the AzureDevOpsReposClient.NewListPager method. -type AzureDevOpsReposClientListOptions struct { - // placeholder for future optional parameters -} - -// ComplianceResultsClientGetOptions contains the optional parameters for the ComplianceResultsClient.Get method. -type ComplianceResultsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ComplianceResultsClientListOptions contains the optional parameters for the ComplianceResultsClient.NewListPager method. -type ComplianceResultsClientListOptions struct { - // placeholder for future optional parameters -} - -// CompliancesClientGetOptions contains the optional parameters for the CompliancesClient.Get method. -type CompliancesClientGetOptions struct { - // placeholder for future optional parameters -} - -// CompliancesClientListOptions contains the optional parameters for the CompliancesClient.NewListPager method. -type CompliancesClientListOptions struct { - // placeholder for future optional parameters -} - -// ConnectorApplicationClientCreateOrUpdateOptions contains the optional parameters for the ConnectorApplicationClient.CreateOrUpdate -// method. -type ConnectorApplicationClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// ConnectorApplicationClientDeleteOptions contains the optional parameters for the ConnectorApplicationClient.Delete method. -type ConnectorApplicationClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ConnectorApplicationClientGetOptions contains the optional parameters for the ConnectorApplicationClient.Get method. -type ConnectorApplicationClientGetOptions struct { - // placeholder for future optional parameters -} - -// ConnectorApplicationsClientListOptions contains the optional parameters for the ConnectorApplicationsClient.NewListPager -// method. -type ConnectorApplicationsClientListOptions struct { - // placeholder for future optional parameters -} - -// ConnectorsClientCreateOrUpdateOptions contains the optional parameters for the ConnectorsClient.CreateOrUpdate method. -type ConnectorsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// ConnectorsClientDeleteOptions contains the optional parameters for the ConnectorsClient.Delete method. -type ConnectorsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ConnectorsClientGetOptions contains the optional parameters for the ConnectorsClient.Get method. -type ConnectorsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ConnectorsClientListByResourceGroupOptions contains the optional parameters for the ConnectorsClient.NewListByResourceGroupPager -// method. -type ConnectorsClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// ConnectorsClientListOptions contains the optional parameters for the ConnectorsClient.NewListPager method. -type ConnectorsClientListOptions struct { - // placeholder for future optional parameters -} - -// ConnectorsClientUpdateOptions contains the optional parameters for the ConnectorsClient.Update method. -type ConnectorsClientUpdateOptions struct { - // placeholder for future optional parameters -} - -// ContactsClientCreateOptions contains the optional parameters for the ContactsClient.Create method. -type ContactsClientCreateOptions struct { - // placeholder for future optional parameters -} - -// ContactsClientDeleteOptions contains the optional parameters for the ContactsClient.Delete method. -type ContactsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ContactsClientGetOptions contains the optional parameters for the ContactsClient.Get method. -type ContactsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ContactsClientListOptions contains the optional parameters for the ContactsClient.NewListPager method. -type ContactsClientListOptions struct { - // placeholder for future optional parameters -} - -// CustomAssessmentAutomationsClientCreateOptions contains the optional parameters for the CustomAssessmentAutomationsClient.Create -// method. -type CustomAssessmentAutomationsClientCreateOptions struct { - // placeholder for future optional parameters -} - -// CustomAssessmentAutomationsClientDeleteOptions contains the optional parameters for the CustomAssessmentAutomationsClient.Delete -// method. -type CustomAssessmentAutomationsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// CustomAssessmentAutomationsClientGetOptions contains the optional parameters for the CustomAssessmentAutomationsClient.Get -// method. -type CustomAssessmentAutomationsClientGetOptions struct { - // placeholder for future optional parameters -} - -// CustomAssessmentAutomationsClientListByResourceGroupOptions contains the optional parameters for the CustomAssessmentAutomationsClient.NewListByResourceGroupPager -// method. -type CustomAssessmentAutomationsClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// CustomAssessmentAutomationsClientListBySubscriptionOptions contains the optional parameters for the CustomAssessmentAutomationsClient.NewListBySubscriptionPager -// method. -type CustomAssessmentAutomationsClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// CustomEntityStoreAssignmentsClientCreateOptions contains the optional parameters for the CustomEntityStoreAssignmentsClient.Create -// method. -type CustomEntityStoreAssignmentsClientCreateOptions struct { - // placeholder for future optional parameters -} - -// CustomEntityStoreAssignmentsClientDeleteOptions contains the optional parameters for the CustomEntityStoreAssignmentsClient.Delete -// method. -type CustomEntityStoreAssignmentsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// CustomEntityStoreAssignmentsClientGetOptions contains the optional parameters for the CustomEntityStoreAssignmentsClient.Get -// method. -type CustomEntityStoreAssignmentsClientGetOptions struct { - // placeholder for future optional parameters -} - -// CustomEntityStoreAssignmentsClientListByResourceGroupOptions contains the optional parameters for the CustomEntityStoreAssignmentsClient.NewListByResourceGroupPager -// method. -type CustomEntityStoreAssignmentsClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// CustomEntityStoreAssignmentsClientListBySubscriptionOptions contains the optional parameters for the CustomEntityStoreAssignmentsClient.NewListBySubscriptionPager -// 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 { - // 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. - ResumeToken string -} - -// DevOpsConfigurationsClientBeginDeleteOptions contains the optional parameters for the DevOpsConfigurationsClient.BeginDelete -// method. -type DevOpsConfigurationsClientBeginDeleteOptions struct { - // Resumes the LRO 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. - ResumeToken string -} - -// DevOpsConfigurationsClientGetOptions contains the optional parameters for the DevOpsConfigurationsClient.Get method. -type DevOpsConfigurationsClientGetOptions struct { - // placeholder for future optional parameters -} - -// DevOpsConfigurationsClientListOptions contains the optional parameters for the DevOpsConfigurationsClient.NewListPager -// method. -type DevOpsConfigurationsClientListOptions struct { - // placeholder for future optional parameters -} - -// DevOpsOperationResultsClientGetOptions contains the optional parameters for the DevOpsOperationResultsClient.Get method. -type DevOpsOperationResultsClientGetOptions struct { - // placeholder for future optional parameters -} - -// DeviceSecurityGroupsClientCreateOrUpdateOptions contains the optional parameters for the DeviceSecurityGroupsClient.CreateOrUpdate -// method. -type DeviceSecurityGroupsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// DeviceSecurityGroupsClientDeleteOptions contains the optional parameters for the DeviceSecurityGroupsClient.Delete method. -type DeviceSecurityGroupsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// DeviceSecurityGroupsClientGetOptions contains the optional parameters for the DeviceSecurityGroupsClient.Get method. -type DeviceSecurityGroupsClientGetOptions struct { - // placeholder for future optional parameters -} - -// DeviceSecurityGroupsClientListOptions contains the optional parameters for the DeviceSecurityGroupsClient.NewListPager -// method. -type DeviceSecurityGroupsClientListOptions struct { - // placeholder for future optional parameters -} - -// DiscoveredSecuritySolutionsClientGetOptions contains the optional parameters for the DiscoveredSecuritySolutionsClient.Get -// method. -type DiscoveredSecuritySolutionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// DiscoveredSecuritySolutionsClientListByHomeRegionOptions contains the optional parameters for the DiscoveredSecuritySolutionsClient.NewListByHomeRegionPager -// method. -type DiscoveredSecuritySolutionsClientListByHomeRegionOptions struct { - // placeholder for future optional parameters -} - -// DiscoveredSecuritySolutionsClientListOptions contains the optional parameters for the DiscoveredSecuritySolutionsClient.NewListPager -// method. -type DiscoveredSecuritySolutionsClientListOptions struct { - // placeholder for future optional parameters -} - -// ExternalSecuritySolutionsClientGetOptions contains the optional parameters for the ExternalSecuritySolutionsClient.Get -// method. -type ExternalSecuritySolutionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ExternalSecuritySolutionsClientListByHomeRegionOptions contains the optional parameters for the ExternalSecuritySolutionsClient.NewListByHomeRegionPager -// method. -type ExternalSecuritySolutionsClientListByHomeRegionOptions struct { - // placeholder for future optional parameters -} - -// ExternalSecuritySolutionsClientListOptions contains the optional parameters for the ExternalSecuritySolutionsClient.NewListPager -// method. -type ExternalSecuritySolutionsClientListOptions struct { - // placeholder for future optional parameters -} - -// GitHubOwnersClientGetOptions contains the optional parameters for the GitHubOwnersClient.Get method. -type GitHubOwnersClientGetOptions struct { - // placeholder for future optional parameters -} - -// GitHubOwnersClientListAvailableOptions contains the optional parameters for the GitHubOwnersClient.ListAvailable method. -type GitHubOwnersClientListAvailableOptions struct { - // placeholder for future optional parameters -} - -// GitHubOwnersClientListOptions contains the optional parameters for the GitHubOwnersClient.NewListPager method. -type GitHubOwnersClientListOptions struct { - // placeholder for future optional parameters -} - -// GitHubReposClientGetOptions contains the optional parameters for the GitHubReposClient.Get method. -type GitHubReposClientGetOptions struct { - // placeholder for future optional parameters -} - -// GitHubReposClientListOptions contains the optional parameters for the GitHubReposClient.NewListPager method. -type GitHubReposClientListOptions struct { - // placeholder for future optional parameters -} - -// GitLabGroupsClientGetOptions contains the optional parameters for the GitLabGroupsClient.Get method. -type GitLabGroupsClientGetOptions struct { - // placeholder for future optional parameters -} - -// GitLabGroupsClientListAvailableOptions contains the optional parameters for the GitLabGroupsClient.ListAvailable method. -type GitLabGroupsClientListAvailableOptions struct { - // placeholder for future optional parameters -} - -// GitLabGroupsClientListOptions contains the optional parameters for the GitLabGroupsClient.NewListPager method. -type GitLabGroupsClientListOptions struct { - // placeholder for future optional parameters -} - -// GitLabProjectsClientGetOptions contains the optional parameters for the GitLabProjectsClient.Get method. -type GitLabProjectsClientGetOptions struct { - // placeholder for future optional parameters -} - -// GitLabProjectsClientListOptions contains the optional parameters for the GitLabProjectsClient.NewListPager method. -type GitLabProjectsClientListOptions struct { - // placeholder for future optional parameters -} - -// GitLabSubgroupsClientListOptions contains the optional parameters for the GitLabSubgroupsClient.List method. -type GitLabSubgroupsClientListOptions struct { - // placeholder for future optional parameters -} - -// GovernanceAssignmentsClientCreateOrUpdateOptions contains the optional parameters for the GovernanceAssignmentsClient.CreateOrUpdate -// method. -type GovernanceAssignmentsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// GovernanceAssignmentsClientDeleteOptions contains the optional parameters for the GovernanceAssignmentsClient.Delete method. -type GovernanceAssignmentsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// GovernanceAssignmentsClientGetOptions contains the optional parameters for the GovernanceAssignmentsClient.Get method. -type GovernanceAssignmentsClientGetOptions struct { - // placeholder for future optional parameters -} - -// GovernanceAssignmentsClientListOptions contains the optional parameters for the GovernanceAssignmentsClient.NewListPager -// method. -type GovernanceAssignmentsClientListOptions struct { - // placeholder for future optional parameters -} - -// GovernanceRulesClientBeginDeleteOptions contains the optional parameters for the GovernanceRulesClient.BeginDelete method. -type GovernanceRulesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// GovernanceRulesClientBeginExecuteOptions contains the optional parameters for the GovernanceRulesClient.BeginExecute method. -type GovernanceRulesClientBeginExecuteOptions struct { - // Execute governance rule over a given scope - ExecuteGovernanceRuleParams *ExecuteGovernanceRuleParams - - // Resumes the LRO from the provided token. - ResumeToken string -} - -// GovernanceRulesClientCreateOrUpdateOptions contains the optional parameters for the GovernanceRulesClient.CreateOrUpdate -// method. -type GovernanceRulesClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// GovernanceRulesClientGetOptions contains the optional parameters for the GovernanceRulesClient.Get method. -type GovernanceRulesClientGetOptions struct { - // placeholder for future optional parameters -} - -// GovernanceRulesClientListOptions contains the optional parameters for the GovernanceRulesClient.NewListPager method. -type GovernanceRulesClientListOptions struct { - // placeholder for future optional parameters -} - -// GovernanceRulesClientOperationResultsOptions contains the optional parameters for the GovernanceRulesClient.OperationResults -// method. -type GovernanceRulesClientOperationResultsOptions struct { - // placeholder for future optional parameters -} - -// HealthReportsClientGetOptions contains the optional parameters for the HealthReportsClient.Get method. -type HealthReportsClientGetOptions struct { - // placeholder for future optional parameters -} - -// HealthReportsClientListOptions contains the optional parameters for the HealthReportsClient.NewListPager method. -type HealthReportsClientListOptions struct { - // placeholder for future optional parameters -} - -// InformationProtectionPoliciesClientCreateOrUpdateOptions contains the optional parameters for the InformationProtectionPoliciesClient.CreateOrUpdate -// method. -type InformationProtectionPoliciesClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// InformationProtectionPoliciesClientGetOptions contains the optional parameters for the InformationProtectionPoliciesClient.Get -// method. -type InformationProtectionPoliciesClientGetOptions struct { - // placeholder for future optional parameters -} - -// InformationProtectionPoliciesClientListOptions contains the optional parameters for the InformationProtectionPoliciesClient.NewListPager -// method. -type InformationProtectionPoliciesClientListOptions struct { - // placeholder for future optional parameters -} - -// IotSecuritySolutionAnalyticsClientGetOptions contains the optional parameters for the IotSecuritySolutionAnalyticsClient.Get -// method. -type IotSecuritySolutionAnalyticsClientGetOptions struct { - // placeholder for future optional parameters -} - -// IotSecuritySolutionAnalyticsClientListOptions contains the optional parameters for the IotSecuritySolutionAnalyticsClient.List -// method. -type IotSecuritySolutionAnalyticsClientListOptions struct { - // placeholder for future optional parameters -} - -// IotSecuritySolutionClientCreateOrUpdateOptions contains the optional parameters for the IotSecuritySolutionClient.CreateOrUpdate -// method. -type IotSecuritySolutionClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// IotSecuritySolutionClientDeleteOptions contains the optional parameters for the IotSecuritySolutionClient.Delete method. -type IotSecuritySolutionClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// IotSecuritySolutionClientGetOptions contains the optional parameters for the IotSecuritySolutionClient.Get method. -type IotSecuritySolutionClientGetOptions struct { - // placeholder for future optional parameters -} - -// IotSecuritySolutionClientListByResourceGroupOptions contains the optional parameters for the IotSecuritySolutionClient.NewListByResourceGroupPager -// method. -type IotSecuritySolutionClientListByResourceGroupOptions struct { - // Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. - Filter *string -} - -// IotSecuritySolutionClientListBySubscriptionOptions contains the optional parameters for the IotSecuritySolutionClient.NewListBySubscriptionPager -// method. -type IotSecuritySolutionClientListBySubscriptionOptions struct { - // Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. - Filter *string -} - -// IotSecuritySolutionClientUpdateOptions contains the optional parameters for the IotSecuritySolutionClient.Update method. -type IotSecuritySolutionClientUpdateOptions struct { - // placeholder for future optional parameters -} - -// IotSecuritySolutionsAnalyticsAggregatedAlertClientDismissOptions contains the optional parameters for the IotSecuritySolutionsAnalyticsAggregatedAlertClient.Dismiss -// method. -type IotSecuritySolutionsAnalyticsAggregatedAlertClientDismissOptions struct { - // placeholder for future optional parameters -} - -// IotSecuritySolutionsAnalyticsAggregatedAlertClientGetOptions contains the optional parameters for the IotSecuritySolutionsAnalyticsAggregatedAlertClient.Get -// method. -type IotSecuritySolutionsAnalyticsAggregatedAlertClientGetOptions struct { - // placeholder for future optional parameters -} - -// IotSecuritySolutionsAnalyticsAggregatedAlertClientListOptions contains the optional parameters for the IotSecuritySolutionsAnalyticsAggregatedAlertClient.NewListPager -// method. -type IotSecuritySolutionsAnalyticsAggregatedAlertClientListOptions struct { - // Number of results to retrieve. - Top *int32 -} - -// IotSecuritySolutionsAnalyticsRecommendationClientGetOptions contains the optional parameters for the IotSecuritySolutionsAnalyticsRecommendationClient.Get -// method. -type IotSecuritySolutionsAnalyticsRecommendationClientGetOptions struct { - // placeholder for future optional parameters -} - -// IotSecuritySolutionsAnalyticsRecommendationClientListOptions contains the optional parameters for the IotSecuritySolutionsAnalyticsRecommendationClient.NewListPager -// method. -type IotSecuritySolutionsAnalyticsRecommendationClientListOptions struct { - // Number of results to retrieve. - Top *int32 -} - -// JitNetworkAccessPoliciesClientCreateOrUpdateOptions contains the optional parameters for the JitNetworkAccessPoliciesClient.CreateOrUpdate -// method. -type JitNetworkAccessPoliciesClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// JitNetworkAccessPoliciesClientDeleteOptions contains the optional parameters for the JitNetworkAccessPoliciesClient.Delete -// method. -type JitNetworkAccessPoliciesClientDeleteOptions struct { +type DefenderForStorageClientCancelMalwareScanOptions struct { // placeholder for future optional parameters } -// JitNetworkAccessPoliciesClientGetOptions contains the optional parameters for the JitNetworkAccessPoliciesClient.Get method. -type JitNetworkAccessPoliciesClientGetOptions struct { - // placeholder for future optional parameters -} - -// JitNetworkAccessPoliciesClientInitiateOptions contains the optional parameters for the JitNetworkAccessPoliciesClient.Initiate -// method. -type JitNetworkAccessPoliciesClientInitiateOptions struct { - // placeholder for future optional parameters -} - -// JitNetworkAccessPoliciesClientListByRegionOptions contains the optional parameters for the JitNetworkAccessPoliciesClient.NewListByRegionPager -// method. -type JitNetworkAccessPoliciesClientListByRegionOptions struct { - // placeholder for future optional parameters -} - -// JitNetworkAccessPoliciesClientListByResourceGroupAndRegionOptions contains the optional parameters for the JitNetworkAccessPoliciesClient.NewListByResourceGroupAndRegionPager -// method. -type JitNetworkAccessPoliciesClientListByResourceGroupAndRegionOptions struct { - // placeholder for future optional parameters -} - -// JitNetworkAccessPoliciesClientListByResourceGroupOptions contains the optional parameters for the JitNetworkAccessPoliciesClient.NewListByResourceGroupPager -// method. -type JitNetworkAccessPoliciesClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// JitNetworkAccessPoliciesClientListOptions contains the optional parameters for the JitNetworkAccessPoliciesClient.NewListPager -// method. -type JitNetworkAccessPoliciesClientListOptions struct { - // placeholder for future optional parameters -} - -// LocationsClientGetOptions contains the optional parameters for the LocationsClient.Get method. -type LocationsClientGetOptions struct { - // placeholder for future optional parameters -} - -// LocationsClientListOptions contains the optional parameters for the LocationsClient.NewListPager method. -type LocationsClientListOptions struct { - // placeholder for future optional parameters -} - -// MdeOnboardingsClientGetOptions contains the optional parameters for the MdeOnboardingsClient.Get method. -type MdeOnboardingsClientGetOptions struct { - // placeholder for future optional parameters -} - -// MdeOnboardingsClientListOptions contains the optional parameters for the MdeOnboardingsClient.List method. -type MdeOnboardingsClientListOptions struct { - // placeholder for future optional parameters -} - -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters -} - -// OperatorsClientCreateOrUpdateOptions contains the optional parameters for the OperatorsClient.CreateOrUpdate method. -type OperatorsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// OperatorsClientDeleteOptions contains the optional parameters for the OperatorsClient.Delete method. -type OperatorsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// OperatorsClientGetOptions contains the optional parameters for the OperatorsClient.Get method. -type OperatorsClientGetOptions struct { - // placeholder for future optional parameters -} - -// OperatorsClientListOptions contains the optional parameters for the OperatorsClient.List method. -type OperatorsClientListOptions struct { - // placeholder for future optional parameters -} - -// PricingsClientDeleteOptions contains the optional parameters for the PricingsClient.Delete method. -type PricingsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// PricingsClientGetOptions contains the optional parameters for the PricingsClient.Get method. -type PricingsClientGetOptions struct { - // placeholder for future optional parameters -} - -// PricingsClientListOptions contains the optional parameters for the PricingsClient.List method. -type PricingsClientListOptions struct { - // OData filter. Optional. - Filter *string -} - -// PricingsClientUpdateOptions contains the optional parameters for the PricingsClient.Update method. -type PricingsClientUpdateOptions struct { - // placeholder for future optional parameters -} - -// RegulatoryComplianceAssessmentsClientGetOptions contains the optional parameters for the RegulatoryComplianceAssessmentsClient.Get -// method. -type RegulatoryComplianceAssessmentsClientGetOptions struct { - // placeholder for future optional parameters -} - -// RegulatoryComplianceAssessmentsClientListOptions contains the optional parameters for the RegulatoryComplianceAssessmentsClient.NewListPager -// method. -type RegulatoryComplianceAssessmentsClientListOptions struct { - // OData filter. Optional. - Filter *string -} - -// RegulatoryComplianceControlsClientGetOptions contains the optional parameters for the RegulatoryComplianceControlsClient.Get -// method. -type RegulatoryComplianceControlsClientGetOptions struct { - // placeholder for future optional parameters -} - -// RegulatoryComplianceControlsClientListOptions contains the optional parameters for the RegulatoryComplianceControlsClient.NewListPager -// method. -type RegulatoryComplianceControlsClientListOptions struct { - // OData filter. Optional. - Filter *string -} - -// RegulatoryComplianceStandardsClientGetOptions contains the optional parameters for the RegulatoryComplianceStandardsClient.Get -// method. -type RegulatoryComplianceStandardsClientGetOptions struct { - // placeholder for future optional parameters -} - -// RegulatoryComplianceStandardsClientListOptions contains the optional parameters for the RegulatoryComplianceStandardsClient.NewListPager -// method. -type RegulatoryComplianceStandardsClientListOptions struct { - // OData filter. Optional. - Filter *string -} - -// SQLVulnerabilityAssessmentBaselineRulesClientAddOptions contains the optional parameters for the SQLVulnerabilityAssessmentBaselineRulesClient.Add -// method. -type SQLVulnerabilityAssessmentBaselineRulesClientAddOptions struct { - // The baseline rules. - Body *RulesResultsInput -} - -// SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateOptions contains the optional parameters for the SQLVulnerabilityAssessmentBaselineRulesClient.CreateOrUpdate -// method. -type SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateOptions struct { - // The baseline results for this rule. - Body *RuleResultsInput -} - -// SQLVulnerabilityAssessmentBaselineRulesClientDeleteOptions contains the optional parameters for the SQLVulnerabilityAssessmentBaselineRulesClient.Delete -// method. -type SQLVulnerabilityAssessmentBaselineRulesClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// SQLVulnerabilityAssessmentBaselineRulesClientGetOptions contains the optional parameters for the SQLVulnerabilityAssessmentBaselineRulesClient.Get -// method. -type SQLVulnerabilityAssessmentBaselineRulesClientGetOptions struct { - // placeholder for future optional parameters -} - -// SQLVulnerabilityAssessmentBaselineRulesClientListOptions contains the optional parameters for the SQLVulnerabilityAssessmentBaselineRulesClient.List -// method. -type SQLVulnerabilityAssessmentBaselineRulesClientListOptions struct { - // placeholder for future optional parameters -} - -// SQLVulnerabilityAssessmentScanResultsClientGetOptions contains the optional parameters for the SQLVulnerabilityAssessmentScanResultsClient.Get -// method. -type SQLVulnerabilityAssessmentScanResultsClientGetOptions struct { - // placeholder for future optional parameters -} - -// SQLVulnerabilityAssessmentScanResultsClientListOptions contains the optional parameters for the SQLVulnerabilityAssessmentScanResultsClient.List -// method. -type SQLVulnerabilityAssessmentScanResultsClientListOptions struct { - // placeholder for future optional parameters -} - -// SQLVulnerabilityAssessmentScansClientGetOptions contains the optional parameters for the SQLVulnerabilityAssessmentScansClient.Get -// method. -type SQLVulnerabilityAssessmentScansClientGetOptions struct { - // placeholder for future optional parameters -} - -// SQLVulnerabilityAssessmentScansClientListOptions contains the optional parameters for the SQLVulnerabilityAssessmentScansClient.List -// method. -type SQLVulnerabilityAssessmentScansClientListOptions struct { - // placeholder for future optional parameters -} - -// SecureScoreControlDefinitionsClientListBySubscriptionOptions contains the optional parameters for the SecureScoreControlDefinitionsClient.NewListBySubscriptionPager -// method. -type SecureScoreControlDefinitionsClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// SecureScoreControlDefinitionsClientListOptions contains the optional parameters for the SecureScoreControlDefinitionsClient.NewListPager -// method. -type SecureScoreControlDefinitionsClientListOptions struct { - // placeholder for future optional parameters -} - -// SecureScoreControlsClientListBySecureScoreOptions contains the optional parameters for the SecureScoreControlsClient.NewListBySecureScorePager -// method. -type SecureScoreControlsClientListBySecureScoreOptions struct { - // OData expand. Optional. - Expand *ExpandControlsEnum -} - -// SecureScoreControlsClientListOptions contains the optional parameters for the SecureScoreControlsClient.NewListPager method. -type SecureScoreControlsClientListOptions struct { - // OData expand. Optional. - Expand *ExpandControlsEnum -} - -// SecureScoresClientGetOptions contains the optional parameters for the SecureScoresClient.Get method. -type SecureScoresClientGetOptions struct { - // placeholder for future optional parameters -} - -// SecureScoresClientListOptions contains the optional parameters for the SecureScoresClient.NewListPager method. -type SecureScoresClientListOptions struct { - // placeholder for future optional parameters -} - -// SensitivitySettingsClientCreateOrUpdateOptions contains the optional parameters for the SensitivitySettingsClient.CreateOrUpdate -// method. -type SensitivitySettingsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// SensitivitySettingsClientGetOptions contains the optional parameters for the SensitivitySettingsClient.Get method. -type SensitivitySettingsClientGetOptions struct { - // placeholder for future optional parameters -} - -// SensitivitySettingsClientListOptions contains the optional parameters for the SensitivitySettingsClient.List method. -type SensitivitySettingsClientListOptions struct { - // placeholder for future optional parameters -} - -// ServerVulnerabilityAssessmentClientBeginDeleteOptions contains the optional parameters for the ServerVulnerabilityAssessmentClient.BeginDelete -// method. -type ServerVulnerabilityAssessmentClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServerVulnerabilityAssessmentClientCreateOrUpdateOptions contains the optional parameters for the ServerVulnerabilityAssessmentClient.CreateOrUpdate -// method. -type ServerVulnerabilityAssessmentClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// ServerVulnerabilityAssessmentClientGetOptions contains the optional parameters for the ServerVulnerabilityAssessmentClient.Get -// method. -type ServerVulnerabilityAssessmentClientGetOptions struct { - // placeholder for future optional parameters -} - -// ServerVulnerabilityAssessmentClientListByExtendedResourceOptions contains the optional parameters for the ServerVulnerabilityAssessmentClient.ListByExtendedResource -// method. -type ServerVulnerabilityAssessmentClientListByExtendedResourceOptions struct { - // placeholder for future optional parameters -} - -// ServerVulnerabilityAssessmentsSettingsClientCreateOrUpdateOptions contains the optional parameters for the ServerVulnerabilityAssessmentsSettingsClient.CreateOrUpdate -// method. -type ServerVulnerabilityAssessmentsSettingsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// ServerVulnerabilityAssessmentsSettingsClientDeleteOptions contains the optional parameters for the ServerVulnerabilityAssessmentsSettingsClient.Delete -// method. -type ServerVulnerabilityAssessmentsSettingsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ServerVulnerabilityAssessmentsSettingsClientGetOptions contains the optional parameters for the ServerVulnerabilityAssessmentsSettingsClient.Get -// method. -type ServerVulnerabilityAssessmentsSettingsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ServerVulnerabilityAssessmentsSettingsClientListBySubscriptionOptions contains the optional parameters for the ServerVulnerabilityAssessmentsSettingsClient.NewListBySubscriptionPager -// method. -type ServerVulnerabilityAssessmentsSettingsClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// SettingsClientGetOptions contains the optional parameters for the SettingsClient.Get method. -type SettingsClientGetOptions struct { - // placeholder for future optional parameters -} - -// SettingsClientListOptions contains the optional parameters for the SettingsClient.NewListPager method. -type SettingsClientListOptions struct { - // placeholder for future optional parameters -} - -// SettingsClientUpdateOptions contains the optional parameters for the SettingsClient.Update method. -type SettingsClientUpdateOptions struct { - // placeholder for future optional parameters -} - -// SoftwareInventoriesClientGetOptions contains the optional parameters for the SoftwareInventoriesClient.Get method. -type SoftwareInventoriesClientGetOptions struct { - // placeholder for future optional parameters -} - -// SoftwareInventoriesClientListByExtendedResourceOptions contains the optional parameters for the SoftwareInventoriesClient.NewListByExtendedResourcePager -// method. -type SoftwareInventoriesClientListByExtendedResourceOptions struct { - // placeholder for future optional parameters -} - -// SoftwareInventoriesClientListBySubscriptionOptions contains the optional parameters for the SoftwareInventoriesClient.NewListBySubscriptionPager -// method. -type SoftwareInventoriesClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// SolutionsClientGetOptions contains the optional parameters for the SolutionsClient.Get method. -type SolutionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// SolutionsClientListOptions contains the optional parameters for the SolutionsClient.NewListPager method. -type SolutionsClientListOptions struct { - // placeholder for future optional parameters -} - -// SolutionsReferenceDataClientListByHomeRegionOptions contains the optional parameters for the SolutionsReferenceDataClient.ListByHomeRegion -// method. -type SolutionsReferenceDataClientListByHomeRegionOptions struct { - // placeholder for future optional parameters -} - -// SolutionsReferenceDataClientListOptions contains the optional parameters for the SolutionsReferenceDataClient.List method. -type SolutionsReferenceDataClientListOptions struct { - // placeholder for future optional parameters -} - -// SubAssessmentsClientGetOptions contains the optional parameters for the SubAssessmentsClient.Get method. -type SubAssessmentsClientGetOptions struct { - // placeholder for future optional parameters -} - -// SubAssessmentsClientListAllOptions contains the optional parameters for the SubAssessmentsClient.NewListAllPager method. -type SubAssessmentsClientListAllOptions struct { - // placeholder for future optional parameters -} - -// SubAssessmentsClientListOptions contains the optional parameters for the SubAssessmentsClient.NewListPager method. -type SubAssessmentsClientListOptions struct { - // placeholder for future optional parameters -} - -// TasksClientGetResourceGroupLevelTaskOptions contains the optional parameters for the TasksClient.GetResourceGroupLevelTask -// method. -type TasksClientGetResourceGroupLevelTaskOptions struct { - // placeholder for future optional parameters -} - -// TasksClientGetSubscriptionLevelTaskOptions contains the optional parameters for the TasksClient.GetSubscriptionLevelTask -// method. -type TasksClientGetSubscriptionLevelTaskOptions struct { - // placeholder for future optional parameters -} - -// TasksClientListByHomeRegionOptions contains the optional parameters for the TasksClient.NewListByHomeRegionPager method. -type TasksClientListByHomeRegionOptions struct { - // OData filter. Optional. - Filter *string -} - -// TasksClientListByResourceGroupOptions contains the optional parameters for the TasksClient.NewListByResourceGroupPager -// method. -type TasksClientListByResourceGroupOptions struct { - // OData filter. Optional. - Filter *string -} - -// TasksClientListOptions contains the optional parameters for the TasksClient.NewListPager method. -type TasksClientListOptions struct { - // OData filter. Optional. - Filter *string -} - -// TasksClientUpdateResourceGroupLevelTaskStateOptions contains the optional parameters for the TasksClient.UpdateResourceGroupLevelTaskState -// method. -type TasksClientUpdateResourceGroupLevelTaskStateOptions struct { +// DefenderForStorageClientCreateOptions contains the optional parameters for the DefenderForStorageClient.Create method. +type DefenderForStorageClientCreateOptions struct { // placeholder for future optional parameters } -// TasksClientUpdateSubscriptionLevelTaskStateOptions contains the optional parameters for the TasksClient.UpdateSubscriptionLevelTaskState +// DefenderForStorageClientGetMalwareScanOptions contains the optional parameters for the DefenderForStorageClient.GetMalwareScan // method. -type TasksClientUpdateSubscriptionLevelTaskStateOptions struct { +type DefenderForStorageClientGetMalwareScanOptions struct { // placeholder for future optional parameters } -// TopologyClientGetOptions contains the optional parameters for the TopologyClient.Get method. -type TopologyClientGetOptions struct { +// DefenderForStorageClientGetOptions contains the optional parameters for the DefenderForStorageClient.Get method. +type DefenderForStorageClientGetOptions struct { // placeholder for future optional parameters } -// TopologyClientListByHomeRegionOptions contains the optional parameters for the TopologyClient.NewListByHomeRegionPager +// DefenderForStorageClientStartMalwareScanOptions contains the optional parameters for the DefenderForStorageClient.StartMalwareScan // method. -type TopologyClientListByHomeRegionOptions struct { - // placeholder for future optional parameters -} - -// TopologyClientListOptions contains the optional parameters for the TopologyClient.NewListPager method. -type TopologyClientListOptions struct { - // placeholder for future optional parameters -} - -// WorkspaceSettingsClientCreateOptions contains the optional parameters for the WorkspaceSettingsClient.Create method. -type WorkspaceSettingsClientCreateOptions struct { - // placeholder for future optional parameters -} - -// WorkspaceSettingsClientDeleteOptions contains the optional parameters for the WorkspaceSettingsClient.Delete method. -type WorkspaceSettingsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// WorkspaceSettingsClientGetOptions contains the optional parameters for the WorkspaceSettingsClient.Get method. -type WorkspaceSettingsClientGetOptions struct { - // placeholder for future optional parameters -} - -// WorkspaceSettingsClientListOptions contains the optional parameters for the WorkspaceSettingsClient.NewListPager method. -type WorkspaceSettingsClientListOptions struct { - // placeholder for future optional parameters -} - -// WorkspaceSettingsClientUpdateOptions contains the optional parameters for the WorkspaceSettingsClient.Update method. -type WorkspaceSettingsClientUpdateOptions struct { +type DefenderForStorageClientStartMalwareScanOptions struct { // placeholder for future optional parameters } diff --git a/sdk/resourcemanager/security/armsecurity/polymorphic_helpers.go b/sdk/resourcemanager/security/armsecurity/polymorphic_helpers.go deleted file mode 100644 index 065369e837a0..000000000000 --- a/sdk/resourcemanager/security/armsecurity/polymorphic_helpers.go +++ /dev/null @@ -1,688 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armsecurity - -import "encoding/json" - -func unmarshalAdditionalDataClassification(rawMsg json.RawMessage) (AdditionalDataClassification, 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 AdditionalDataClassification - switch m["assessedResourceType"] { - case "ServerVulnerabilityAssessment": - b = &ServerVulnerabilityProperties{} - case string(AssessedResourceTypeContainerRegistryVulnerability): - b = &ContainerRegistryVulnerabilityProperties{} - case string(AssessedResourceTypeSQLServerVulnerability): - b = &SQLServerVulnerabilityProperties{} - default: - b = &AdditionalData{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalAlertSimulatorRequestPropertiesClassification(rawMsg json.RawMessage) (AlertSimulatorRequestPropertiesClassification, 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 AlertSimulatorRequestPropertiesClassification - switch m["kind"] { - case string(KindBundles): - b = &AlertSimulatorBundlesRequestProperties{} - default: - b = &AlertSimulatorRequestProperties{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalAllowlistCustomAlertRuleClassification(rawMsg json.RawMessage) (AllowlistCustomAlertRuleClassification, 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 AllowlistCustomAlertRuleClassification - switch m["ruleType"] { - case "ConnectionFromIpNotAllowed": - b = &ConnectionFromIPNotAllowed{} - case "ConnectionToIpNotAllowed": - b = &ConnectionToIPNotAllowed{} - case "LocalUserNotAllowed": - b = &LocalUserNotAllowed{} - case "ProcessNotAllowed": - b = &ProcessNotAllowed{} - default: - b = &AllowlistCustomAlertRule{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalAllowlistCustomAlertRuleClassificationArray(rawMsg json.RawMessage) ([]AllowlistCustomAlertRuleClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var rawMessages []json.RawMessage - if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { - return nil, err - } - fArray := make([]AllowlistCustomAlertRuleClassification, len(rawMessages)) - for index, rawMessage := range rawMessages { - f, err := unmarshalAllowlistCustomAlertRuleClassification(rawMessage) - if err != nil { - return nil, err - } - fArray[index] = f - } - return fArray, nil -} - -func unmarshalAuthenticationDetailsPropertiesClassification(rawMsg json.RawMessage) (AuthenticationDetailsPropertiesClassification, 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 AuthenticationDetailsPropertiesClassification - switch m["authenticationType"] { - case string(AuthenticationTypeAwsAssumeRole): - b = &AwAssumeRoleAuthenticationDetailsProperties{} - case string(AuthenticationTypeAwsCreds): - b = &AwsCredsAuthenticationDetailsProperties{} - case string(AuthenticationTypeGcpCredentials): - b = &GcpCredentialsDetailsProperties{} - default: - b = &AuthenticationDetailsProperties{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalAutomationActionClassification(rawMsg json.RawMessage) (AutomationActionClassification, 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 AutomationActionClassification - switch m["actionType"] { - case string(ActionTypeEventHub): - b = &AutomationActionEventHub{} - case string(ActionTypeLogicApp): - b = &AutomationActionLogicApp{} - case string(ActionTypeWorkspace): - b = &AutomationActionWorkspace{} - default: - b = &AutomationAction{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalAutomationActionClassificationArray(rawMsg json.RawMessage) ([]AutomationActionClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var rawMessages []json.RawMessage - if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { - return nil, err - } - fArray := make([]AutomationActionClassification, len(rawMessages)) - for index, rawMessage := range rawMessages { - f, err := unmarshalAutomationActionClassification(rawMessage) - if err != nil { - return nil, err - } - fArray[index] = f - } - return fArray, nil -} - -func unmarshalAwsOrganizationalDataClassification(rawMsg json.RawMessage) (AwsOrganizationalDataClassification, 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 AwsOrganizationalDataClassification - switch m["organizationMembershipType"] { - case string(OrganizationMembershipTypeMember): - b = &AwsOrganizationalDataMember{} - case string(OrganizationMembershipTypeOrganization): - b = &AwsOrganizationalDataMaster{} - default: - b = &AwsOrganizationalData{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalCloudOfferingClassification(rawMsg json.RawMessage) (CloudOfferingClassification, 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 CloudOfferingClassification - switch m["offeringType"] { - case string(OfferingTypeCspmMonitorAws): - b = &CspmMonitorAwsOffering{} - case string(OfferingTypeCspmMonitorAzureDevOps): - b = &CspmMonitorAzureDevOpsOffering{} - case string(OfferingTypeCspmMonitorGcp): - b = &CspmMonitorGcpOffering{} - case string(OfferingTypeCspmMonitorGitLab): - b = &CspmMonitorGitLabOffering{} - case string(OfferingTypeCspmMonitorGithub): - b = &CspmMonitorGithubOffering{} - 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{} - default: - b = &CloudOffering{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalCloudOfferingClassificationArray(rawMsg json.RawMessage) ([]CloudOfferingClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var rawMessages []json.RawMessage - if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { - return nil, err - } - fArray := make([]CloudOfferingClassification, len(rawMessages)) - for index, rawMessage := range rawMessages { - f, err := unmarshalCloudOfferingClassification(rawMessage) - if err != nil { - return nil, err - } - fArray[index] = f - } - return fArray, nil -} - -func unmarshalEnvironmentDataClassification(rawMsg json.RawMessage) (EnvironmentDataClassification, 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 EnvironmentDataClassification - 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(EnvironmentTypeGitlabScope): - b = &GitlabScopeEnvironmentData{} - default: - b = &EnvironmentData{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalExternalSecuritySolutionClassification(rawMsg json.RawMessage) (ExternalSecuritySolutionClassification, 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 ExternalSecuritySolutionClassification - switch m["kind"] { - case string(ExternalSecuritySolutionKindAAD): - b = &AADExternalSecuritySolution{} - case string(ExternalSecuritySolutionKindATA): - b = &AtaExternalSecuritySolution{} - case string(ExternalSecuritySolutionKindCEF): - b = &CefExternalSecuritySolution{} - default: - b = &ExternalSecuritySolution{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalExternalSecuritySolutionClassificationArray(rawMsg json.RawMessage) ([]ExternalSecuritySolutionClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var rawMessages []json.RawMessage - if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { - return nil, err - } - fArray := make([]ExternalSecuritySolutionClassification, len(rawMessages)) - for index, rawMessage := range rawMessages { - f, err := unmarshalExternalSecuritySolutionClassification(rawMessage) - if err != nil { - return nil, err - } - fArray[index] = f - } - return fArray, nil -} - -func unmarshalGcpOrganizationalDataClassification(rawMsg json.RawMessage) (GcpOrganizationalDataClassification, 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 GcpOrganizationalDataClassification - switch m["organizationMembershipType"] { - case string(OrganizationMembershipTypeMember): - b = &GcpOrganizationalDataMember{} - case string(OrganizationMembershipTypeOrganization): - b = &GcpOrganizationalDataOrganization{} - default: - b = &GcpOrganizationalData{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalNotificationsSourceClassification(rawMsg json.RawMessage) (NotificationsSourceClassification, 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 NotificationsSourceClassification - switch m["sourceType"] { - case string(SourceTypeAlert): - b = &NotificationsSourceAlert{} - case string(SourceTypeAttackPath): - b = &NotificationsSourceAttackPath{} - default: - b = &NotificationsSource{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalNotificationsSourceClassificationArray(rawMsg json.RawMessage) ([]NotificationsSourceClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var rawMessages []json.RawMessage - if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { - return nil, err - } - fArray := make([]NotificationsSourceClassification, len(rawMessages)) - for index, rawMessage := range rawMessages { - f, err := unmarshalNotificationsSourceClassification(rawMessage) - if err != nil { - return nil, err - } - fArray[index] = f - } - 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(SourceOnPremise): - 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 - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b ResourceIdentifierClassification - switch m["type"] { - case string(ResourceIdentifierTypeAzureResource): - b = &AzureResourceIdentifier{} - case string(ResourceIdentifierTypeLogAnalytics): - b = &LogAnalyticsIdentifier{} - default: - b = &ResourceIdentifier{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalResourceIdentifierClassificationArray(rawMsg json.RawMessage) ([]ResourceIdentifierClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var rawMessages []json.RawMessage - if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { - return nil, err - } - fArray := make([]ResourceIdentifierClassification, len(rawMessages)) - for index, rawMessage := range rawMessages { - f, err := unmarshalResourceIdentifierClassification(rawMessage) - if err != nil { - return nil, err - } - fArray[index] = f - } - return fArray, nil -} - -func unmarshalServerVulnerabilityAssessmentsSettingClassification(rawMsg json.RawMessage) (ServerVulnerabilityAssessmentsSettingClassification, 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 ServerVulnerabilityAssessmentsSettingClassification - switch m["kind"] { - case string(ServerVulnerabilityAssessmentsSettingKindAzureServersSetting): - b = &AzureServersSetting{} - default: - b = &ServerVulnerabilityAssessmentsSetting{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalServerVulnerabilityAssessmentsSettingClassificationArray(rawMsg json.RawMessage) ([]ServerVulnerabilityAssessmentsSettingClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var rawMessages []json.RawMessage - if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { - return nil, err - } - fArray := make([]ServerVulnerabilityAssessmentsSettingClassification, len(rawMessages)) - for index, rawMessage := range rawMessages { - f, err := unmarshalServerVulnerabilityAssessmentsSettingClassification(rawMessage) - if err != nil { - return nil, err - } - fArray[index] = f - } - return fArray, nil -} - -func unmarshalSettingClassification(rawMsg json.RawMessage) (SettingClassification, 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 SettingClassification - switch m["kind"] { - case string(SettingKindAlertSyncSettings): - b = &AlertSyncSettings{} - case string(SettingKindDataExportSettings): - b = &DataExportSettings{} - default: - b = &Setting{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalSettingClassificationArray(rawMsg json.RawMessage) ([]SettingClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var rawMessages []json.RawMessage - if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { - return nil, err - } - fArray := make([]SettingClassification, len(rawMessages)) - for index, rawMessage := range rawMessages { - f, err := unmarshalSettingClassification(rawMessage) - if err != nil { - return nil, err - } - fArray[index] = f - } - return fArray, nil -} - -func unmarshalThresholdCustomAlertRuleClassification(rawMsg json.RawMessage) (ThresholdCustomAlertRuleClassification, 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 ThresholdCustomAlertRuleClassification - switch m["ruleType"] { - case "ActiveConnectionsNotInAllowedRange": - b = &ActiveConnectionsNotInAllowedRange{} - case "AmqpC2DMessagesNotInAllowedRange": - b = &AmqpC2DMessagesNotInAllowedRange{} - case "AmqpC2DRejectedMessagesNotInAllowedRange": - b = &AmqpC2DRejectedMessagesNotInAllowedRange{} - case "AmqpD2CMessagesNotInAllowedRange": - b = &AmqpD2CMessagesNotInAllowedRange{} - case "DirectMethodInvokesNotInAllowedRange": - b = &DirectMethodInvokesNotInAllowedRange{} - case "FailedLocalLoginsNotInAllowedRange": - b = &FailedLocalLoginsNotInAllowedRange{} - case "FileUploadsNotInAllowedRange": - b = &FileUploadsNotInAllowedRange{} - case "HttpC2DMessagesNotInAllowedRange": - b = &HTTPC2DMessagesNotInAllowedRange{} - case "HttpC2DRejectedMessagesNotInAllowedRange": - b = &HTTPC2DRejectedMessagesNotInAllowedRange{} - case "HttpD2CMessagesNotInAllowedRange": - b = &HTTPD2CMessagesNotInAllowedRange{} - case "MqttC2DMessagesNotInAllowedRange": - b = &MqttC2DMessagesNotInAllowedRange{} - case "MqttC2DRejectedMessagesNotInAllowedRange": - b = &MqttC2DRejectedMessagesNotInAllowedRange{} - case "MqttD2CMessagesNotInAllowedRange": - b = &MqttD2CMessagesNotInAllowedRange{} - case "QueuePurgesNotInAllowedRange": - b = &QueuePurgesNotInAllowedRange{} - case "TimeWindowCustomAlertRule": - b = &TimeWindowCustomAlertRule{} - case "TwinUpdatesNotInAllowedRange": - b = &TwinUpdatesNotInAllowedRange{} - case "UnauthorizedOperationsNotInAllowedRange": - b = &UnauthorizedOperationsNotInAllowedRange{} - default: - b = &ThresholdCustomAlertRule{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalThresholdCustomAlertRuleClassificationArray(rawMsg json.RawMessage) ([]ThresholdCustomAlertRuleClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var rawMessages []json.RawMessage - if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { - return nil, err - } - fArray := make([]ThresholdCustomAlertRuleClassification, len(rawMessages)) - for index, rawMessage := range rawMessages { - f, err := unmarshalThresholdCustomAlertRuleClassification(rawMessage) - if err != nil { - return nil, err - } - fArray[index] = f - } - return fArray, nil -} - -func unmarshalTimeWindowCustomAlertRuleClassification(rawMsg json.RawMessage) (TimeWindowCustomAlertRuleClassification, 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 TimeWindowCustomAlertRuleClassification - switch m["ruleType"] { - case "ActiveConnectionsNotInAllowedRange": - b = &ActiveConnectionsNotInAllowedRange{} - case "AmqpC2DMessagesNotInAllowedRange": - b = &AmqpC2DMessagesNotInAllowedRange{} - case "AmqpC2DRejectedMessagesNotInAllowedRange": - b = &AmqpC2DRejectedMessagesNotInAllowedRange{} - case "AmqpD2CMessagesNotInAllowedRange": - b = &AmqpD2CMessagesNotInAllowedRange{} - case "DirectMethodInvokesNotInAllowedRange": - b = &DirectMethodInvokesNotInAllowedRange{} - case "FailedLocalLoginsNotInAllowedRange": - b = &FailedLocalLoginsNotInAllowedRange{} - case "FileUploadsNotInAllowedRange": - b = &FileUploadsNotInAllowedRange{} - case "HttpC2DMessagesNotInAllowedRange": - b = &HTTPC2DMessagesNotInAllowedRange{} - case "HttpC2DRejectedMessagesNotInAllowedRange": - b = &HTTPC2DRejectedMessagesNotInAllowedRange{} - case "HttpD2CMessagesNotInAllowedRange": - b = &HTTPD2CMessagesNotInAllowedRange{} - case "MqttC2DMessagesNotInAllowedRange": - b = &MqttC2DMessagesNotInAllowedRange{} - case "MqttC2DRejectedMessagesNotInAllowedRange": - b = &MqttC2DRejectedMessagesNotInAllowedRange{} - case "MqttD2CMessagesNotInAllowedRange": - b = &MqttD2CMessagesNotInAllowedRange{} - case "QueuePurgesNotInAllowedRange": - b = &QueuePurgesNotInAllowedRange{} - case "TwinUpdatesNotInAllowedRange": - b = &TwinUpdatesNotInAllowedRange{} - case "UnauthorizedOperationsNotInAllowedRange": - b = &UnauthorizedOperationsNotInAllowedRange{} - default: - b = &TimeWindowCustomAlertRule{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalTimeWindowCustomAlertRuleClassificationArray(rawMsg json.RawMessage) ([]TimeWindowCustomAlertRuleClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var rawMessages []json.RawMessage - if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { - return nil, err - } - fArray := make([]TimeWindowCustomAlertRuleClassification, len(rawMessages)) - for index, rawMessage := range rawMessages { - f, err := unmarshalTimeWindowCustomAlertRuleClassification(rawMessage) - if err != nil { - return nil, err - } - fArray[index] = f - } - return fArray, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/pricings_client.go b/sdk/resourcemanager/security/armsecurity/pricings_client.go deleted file mode 100644 index 04992092a284..000000000000 --- a/sdk/resourcemanager/security/armsecurity/pricings_client.go +++ /dev/null @@ -1,279 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// PricingsClient contains the methods for the Pricings group. -// Don't use this type directly, use NewPricingsClient() instead. -type PricingsClient struct { - internal *arm.Client -} - -// 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. -func NewPricingsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*PricingsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &PricingsClient{ - internal: cl, - } - return client, nil -} - -// 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'). -// 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}) -// - 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) { - var err error - const operationName = "PricingsClient.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, scopeID, pricingName, options) - if err != nil { - return PricingsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PricingsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return PricingsClientDeleteResponse{}, err - } - return PricingsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *PricingsClient) deleteCreateRequest(ctx context.Context, scopeID string, pricingName string, options *PricingsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/{scopeId}/providers/Microsoft.Security/pricings/{pricingName}" - urlPath = strings.ReplaceAll(urlPath, "{scopeId}", scopeID) - if pricingName == "" { - return nil, errors.New("parameter pricingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{pricingName}", url.PathEscape(pricingName)) - 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-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'. -// 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) -// - 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) { - var err error - const operationName = "PricingsClient.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, scopeID, pricingName, options) - if err != nil { - return PricingsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PricingsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PricingsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *PricingsClient) getCreateRequest(ctx context.Context, scopeID string, pricingName string, options *PricingsClientGetOptions) (*policy.Request, error) { - urlPath := "/{scopeId}/providers/Microsoft.Security/pricings/{pricingName}" - urlPath = strings.ReplaceAll(urlPath, "{scopeId}", scopeID) - if pricingName == "" { - return nil, errors.New("parameter pricingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{pricingName}", url.PathEscape(pricingName)) - 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-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 *PricingsClient) getHandleResponse(resp *http.Response) (PricingsClientGetResponse, error) { - result := PricingsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Pricing); err != nil { - return PricingsClientGetResponse{}, err - } - return result, nil -} - -// 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. -// 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) -// - 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 - const operationName = "PricingsClient.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, scopeID, options) - if err != nil { - return PricingsClientListResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PricingsClientListResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PricingsClientListResponse{}, err - } - resp, err := client.listHandleResponse(httpResp) - return resp, err -} - -// 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" - urlPath = strings.ReplaceAll(urlPath, "{scopeId}", scopeID) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2024-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 *PricingsClient) listHandleResponse(resp *http.Response) (PricingsClientListResponse, error) { - result := PricingsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PricingList); err != nil { - return PricingsClientListResponse{}, err - } - return result, nil -} - -// 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'). -// 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) -// - pricingName - name of the pricing configuration -// - pricing - Pricing object -// - options - PricingsClientUpdateOptions contains the optional parameters for the PricingsClient.Update method. -func (client *PricingsClient) Update(ctx context.Context, scopeID string, pricingName string, pricing Pricing, options *PricingsClientUpdateOptions) (PricingsClientUpdateResponse, error) { - var err error - const operationName = "PricingsClient.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, scopeID, pricingName, pricing, options) - if err != nil { - return PricingsClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PricingsClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return PricingsClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *PricingsClient) updateCreateRequest(ctx context.Context, scopeID string, pricingName string, pricing Pricing, options *PricingsClientUpdateOptions) (*policy.Request, error) { - urlPath := "/{scopeId}/providers/Microsoft.Security/pricings/{pricingName}" - urlPath = strings.ReplaceAll(urlPath, "{scopeId}", scopeID) - if pricingName == "" { - return nil, errors.New("parameter pricingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{pricingName}", url.PathEscape(pricingName)) - 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-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, pricing); err != nil { - return nil, err - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *PricingsClient) updateHandleResponse(resp *http.Response) (PricingsClientUpdateResponse, error) { - result := PricingsClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Pricing); err != nil { - return PricingsClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/pricings_client_example_test.go b/sdk/resourcemanager/security/armsecurity/pricings_client_example_test.go deleted file mode 100644 index 2cf9b1cb5b6e..000000000000 --- a/sdk/resourcemanager/security/armsecurity/pricings_client_example_test.go +++ /dev/null @@ -1,926 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/2024-01-01/examples/Pricings/GetResourcePricingByNameVirtualMachines_example.json -func ExamplePricingsClient_Get_getPricingsOnResourceVirtualMachinesPlan() { - 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.NewPricingsClient().Get(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/DEMO/providers/Microsoft.Compute/virtualMachines/VM-1", "VirtualMachines", 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.Pricing = armsecurity.Pricing{ - // Name: to.Ptr("VirtualMachines"), - // Type: to.Ptr("Microsoft.Security/pricings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/DEMO/providers/Microsoft.Compute/virtualMachines/VM-1/providers/Microsoft.Security/pricings/VirtualMachines"), - // Properties: &armsecurity.PricingProperties{ - // EnablementTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T12:42:42.192Z"); return t}()), - // FreeTrialRemainingTime: to.Ptr("PT0S"), - // Inherited: to.Ptr(armsecurity.InheritedTrue), - // InheritedFrom: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23"), - // PricingTier: to.Ptr(armsecurity.PricingTierStandard), - // SubPlan: to.Ptr("P2"), - // Extensions: []*armsecurity.Extension{ - // { - // Name: to.Ptr("AgentlessVmScanning"), - // AdditionalExtensionProperties: map[string]any{ - // "ExclusionTags": "[{\"Key\":\"TestKey1\",\"Value\":\"TestValue1\"},{\"Key\":\"TestKey2\",\"Value\":\"TestValue2\"}]", - // }, - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // }, - // { - // Name: to.Ptr("MdeDesignatedSubscription"), - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/GetPricingByNameCloudPosture_example.json -func ExamplePricingsClient_Get_getPricingsOnSubscriptionCloudPosturePlan() { - 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.NewPricingsClient().Get(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "CloudPosture", 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.Pricing = armsecurity.Pricing{ - // Name: to.Ptr("CloudPosture"), - // Type: to.Ptr("Microsoft.Security/pricings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/pricings/CloudPosture"), - // Properties: &armsecurity.PricingProperties{ - // EnablementTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T12:42:42.192Z"); return t}()), - // Enforce: to.Ptr(armsecurity.EnforceFalse), - // FreeTrialRemainingTime: to.Ptr("PT0S"), - // PricingTier: to.Ptr(armsecurity.PricingTierStandard), - // ResourcesCoverageStatus: to.Ptr(armsecurity.ResourcesCoverageStatusFullyCovered), - // Extensions: []*armsecurity.Extension{ - // { - // Name: to.Ptr("AgentlessVmScanning"), - // AdditionalExtensionProperties: map[string]any{ - // "ExclusionTags": "[]", - // }, - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // }, - // { - // Name: to.Ptr("AgentlessDiscoveryForKubernetes"), - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // }, - // { - // Name: to.Ptr("SensitiveDataDiscovery"), - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // }, - // { - // Name: to.Ptr("ContainerRegistriesVulnerabilityAssessments"), - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // }, - // { - // Name: to.Ptr("EntraPermissionsManagement"), - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/GetPricingByNameContainers_example.json -func ExamplePricingsClient_Get_getPricingsOnSubscriptionContainersPlan() { - 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.NewPricingsClient().Get(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "Containers", 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.Pricing = armsecurity.Pricing{ - // Name: to.Ptr("Containers"), - // Type: to.Ptr("Microsoft.Security/pricings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/pricings/Containers"), - // Properties: &armsecurity.PricingProperties{ - // EnablementTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T12:42:42.192Z"); return t}()), - // Enforce: to.Ptr(armsecurity.EnforceFalse), - // FreeTrialRemainingTime: to.Ptr("PT0S"), - // PricingTier: to.Ptr(armsecurity.PricingTierStandard), - // ResourcesCoverageStatus: to.Ptr(armsecurity.ResourcesCoverageStatusFullyCovered), - // Extensions: []*armsecurity.Extension{ - // { - // Name: to.Ptr("ContainerRegistriesVulnerabilityAssessments"), - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/GetPricingByNameDns_example.json -func ExamplePricingsClient_Get_getPricingsOnSubscriptionDnsPlan() { - 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.NewPricingsClient().Get(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "Dns", 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.Pricing = armsecurity.Pricing{ - // Name: to.Ptr("Dns"), - // Type: to.Ptr("Microsoft.Security/pricings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/pricings/Dns"), - // Properties: &armsecurity.PricingProperties{ - // Deprecated: to.Ptr(true), - // EnablementTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T12:42:42.192Z"); return t}()), - // Enforce: to.Ptr(armsecurity.EnforceFalse), - // FreeTrialRemainingTime: to.Ptr("PT0S"), - // PricingTier: to.Ptr(armsecurity.PricingTierStandard), - // ReplacedBy: []*string{ - // to.Ptr("VirtualMachines")}, - // ResourcesCoverageStatus: to.Ptr(armsecurity.ResourcesCoverageStatusFullyCovered), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/GetPricingByNameStorageAccounts_example.json -func ExamplePricingsClient_Get_getPricingsOnSubscriptionStorageAccountsPlan() { - 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.NewPricingsClient().Get(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "StorageAccounts", 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.Pricing = armsecurity.Pricing{ - // Name: to.Ptr("StorageAccounts"), - // Type: to.Ptr("Microsoft.Security/pricings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/pricings/StorageAccounts"), - // Properties: &armsecurity.PricingProperties{ - // EnablementTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T12:42:42.192Z"); return t}()), - // Enforce: to.Ptr(armsecurity.EnforceFalse), - // FreeTrialRemainingTime: to.Ptr("PT0S"), - // PricingTier: to.Ptr(armsecurity.PricingTierStandard), - // ResourcesCoverageStatus: to.Ptr(armsecurity.ResourcesCoverageStatusFullyCovered), - // SubPlan: to.Ptr("PerStorageAccount"), - // Extensions: []*armsecurity.Extension{ - // { - // Name: to.Ptr("OnUploadMalwareScanning"), - // AdditionalExtensionProperties: map[string]any{ - // "capGBPerMonthPerStorageAccount": float64(10), - // }, - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // }, - // { - // Name: to.Ptr("SensitiveDataDiscovery"), - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/GetPricingByNameVirtualMachines_example.json -func ExamplePricingsClient_Get_getPricingsOnSubscriptionVirtualMachinesPlan() { - 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.NewPricingsClient().Get(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "VirtualMachines", 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.Pricing = armsecurity.Pricing{ - // Name: to.Ptr("VirtualMachines"), - // Type: to.Ptr("Microsoft.Security/pricings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/pricings/VirtualMachines"), - // Properties: &armsecurity.PricingProperties{ - // EnablementTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T12:42:42.192Z"); return t}()), - // Enforce: to.Ptr(armsecurity.EnforceFalse), - // FreeTrialRemainingTime: to.Ptr("PT0S"), - // PricingTier: to.Ptr(armsecurity.PricingTierStandard), - // ResourcesCoverageStatus: to.Ptr(armsecurity.ResourcesCoverageStatusPartiallyCovered), - // SubPlan: to.Ptr("P2"), - // Extensions: []*armsecurity.Extension{ - // { - // Name: to.Ptr("AgentlessVmScanning"), - // AdditionalExtensionProperties: map[string]any{ - // "ExclusionTags": "[{\"Key\":\"TestKey1\",\"Value\":\"TestValue1\"},{\"Key\":\"TestKey2\",\"Value\":\"TestValue2\"}]", - // }, - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // }, - // { - // Name: to.Ptr("MdeDesignatedSubscription"), - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/PutResourcePricingByNameVirtualMachines_example.json -func ExamplePricingsClient_Update_updatePricingOnResourceExampleForVirtualMachinesPlan() { - 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.NewPricingsClient().Update(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/DEMO/providers/Microsoft.Compute/virtualMachines/VM-1", "virtualMachines", armsecurity.Pricing{ - Properties: &armsecurity.PricingProperties{ - PricingTier: to.Ptr(armsecurity.PricingTierStandard), - SubPlan: to.Ptr("P1"), - }, - }, 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.Pricing = armsecurity.Pricing{ - // Name: to.Ptr("virtualMachines"), - // Type: to.Ptr("Microsoft.Security/pricings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/DEMO/providers/Microsoft.Compute/virtualMachines/VM-1/providers/Microsoft.Security/pricings/virtualMachines"), - // Properties: &armsecurity.PricingProperties{ - // EnablementTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T12:42:42.192Z"); return t}()), - // FreeTrialRemainingTime: to.Ptr("PT0S"), - // Inherited: to.Ptr(armsecurity.InheritedFalse), - // PricingTier: to.Ptr(armsecurity.PricingTierStandard), - // SubPlan: to.Ptr("P1"), - // Extensions: []*armsecurity.Extension{ - // { - // Name: to.Ptr("MdeDesignatedSubscription"), - // IsEnabled: to.Ptr(armsecurity.IsEnabledFalse), - // }, - // { - // Name: to.Ptr("AgentlessVmScanning"), - // AdditionalExtensionProperties: map[string]any{ - // "ExclusionTags": "[{\"Key\":\"TestKey1\",\"Value\":\"TestValue1\"},{\"Key\":\"TestKey2\",\"Value\":\"TestValue2\"}]", - // }, - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/PutPricingByName_example.json -func ExamplePricingsClient_Update_updatePricingOnSubscriptionExampleForCloudPosturePlan() { - 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.NewPricingsClient().Update(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "CloudPosture", armsecurity.Pricing{ - Properties: &armsecurity.PricingProperties{ - PricingTier: to.Ptr(armsecurity.PricingTierStandard), - }, - }, 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.Pricing = armsecurity.Pricing{ - // Name: to.Ptr("CloudPosture"), - // Type: to.Ptr("Microsoft.Security/pricings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/pricings/CloudPosture"), - // Properties: &armsecurity.PricingProperties{ - // EnablementTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T12:42:42.192Z"); return t}()), - // Enforce: to.Ptr(armsecurity.EnforceFalse), - // FreeTrialRemainingTime: to.Ptr("PT0S"), - // PricingTier: to.Ptr(armsecurity.PricingTierStandard), - // ResourcesCoverageStatus: to.Ptr(armsecurity.ResourcesCoverageStatusFullyCovered), - // Extensions: []*armsecurity.Extension{ - // { - // Name: to.Ptr("AgentlessVmScanning"), - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // OperationStatus: &armsecurity.OperationStatusAutoGenerated{ - // Code: to.Ptr(armsecurity.CodeSucceeded), - // Message: to.Ptr("Successfully enabled extension"), - // }, - // }, - // { - // Name: to.Ptr("AgentlessDiscoveryForKubernetes"), - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // OperationStatus: &armsecurity.OperationStatusAutoGenerated{ - // Code: to.Ptr(armsecurity.CodeSucceeded), - // Message: to.Ptr("Successfully enabled extension"), - // }, - // }, - // { - // Name: to.Ptr("SensitiveDataDiscovery"), - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // OperationStatus: &armsecurity.OperationStatusAutoGenerated{ - // Code: to.Ptr(armsecurity.CodeSucceeded), - // Message: to.Ptr("Successfully enabled extension"), - // }, - // }, - // { - // Name: to.Ptr("ContainerRegistriesVulnerabilityAssessments"), - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // OperationStatus: &armsecurity.OperationStatusAutoGenerated{ - // Code: to.Ptr(armsecurity.CodeSucceeded), - // Message: to.Ptr("Successfully enabled extension"), - // }, - // }, - // { - // Name: to.Ptr("EntraPermissionsManagement"), - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // OperationStatus: &armsecurity.OperationStatusAutoGenerated{ - // Code: to.Ptr(armsecurity.CodeSucceeded), - // Message: to.Ptr("Successfully enabled extension"), - // }, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/PutPricingByNamePartialSuccess_example.json -func ExamplePricingsClient_Update_updatePricingOnSubscriptionExampleForCloudPosturePlanPartialSuccess() { - 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.NewPricingsClient().Update(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "CloudPosture", armsecurity.Pricing{ - Properties: &armsecurity.PricingProperties{ - PricingTier: to.Ptr(armsecurity.PricingTierStandard), - }, - }, 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.Pricing = armsecurity.Pricing{ - // Name: to.Ptr("CloudPosture"), - // Type: to.Ptr("Microsoft.Security/pricings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/pricings/CloudPosture"), - // Properties: &armsecurity.PricingProperties{ - // EnablementTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T12:42:42.192Z"); return t}()), - // Enforce: to.Ptr(armsecurity.EnforceFalse), - // FreeTrialRemainingTime: to.Ptr("PT0S"), - // PricingTier: to.Ptr(armsecurity.PricingTierStandard), - // ResourcesCoverageStatus: to.Ptr(armsecurity.ResourcesCoverageStatusFullyCovered), - // Extensions: []*armsecurity.Extension{ - // { - // Name: to.Ptr("AgentlessVmScanning"), - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // OperationStatus: &armsecurity.OperationStatusAutoGenerated{ - // Code: to.Ptr(armsecurity.CodeFailed), - // Message: to.Ptr("Failed find dedicated first party application client ID for extension"), - // }, - // }, - // { - // Name: to.Ptr("AgentlessDiscoveryForKubernetes"), - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // OperationStatus: &armsecurity.OperationStatusAutoGenerated{ - // Code: to.Ptr(armsecurity.CodeFailed), - // Message: to.Ptr("Failed assigning roles {d5a2ae44-610b-4500-93be-660a0c5f5ca6} to {identityName} for plan"), - // }, - // }, - // { - // Name: to.Ptr("SensitiveDataDiscovery"), - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // OperationStatus: &armsecurity.OperationStatusAutoGenerated{ - // Code: to.Ptr(armsecurity.CodeFailed), - // Message: to.Ptr("Failed assigning roles {f58310d9-a9f6-439a-9e8d-f62e7b41a168} to {identityName} for plan"), - // }, - // }, - // { - // Name: to.Ptr("ContainerRegistriesVulnerabilityAssessments"), - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // OperationStatus: &armsecurity.OperationStatusAutoGenerated{ - // Code: to.Ptr(armsecurity.CodeSucceeded), - // Message: to.Ptr("Successfully enabled extension"), - // }, - // }, - // { - // Name: to.Ptr("EntraPermissionsManagement"), - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // OperationStatus: &armsecurity.OperationStatusAutoGenerated{ - // Code: to.Ptr(armsecurity.CodeSucceeded), - // Message: to.Ptr("Successfully enabled extension"), - // }, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/PutPricingVMsByName_example.json -func ExamplePricingsClient_Update_updatePricingOnSubscriptionExampleForVirtualMachinesPlan() { - 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.NewPricingsClient().Update(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "VirtualMachines", armsecurity.Pricing{ - Properties: &armsecurity.PricingProperties{ - Enforce: to.Ptr(armsecurity.EnforceTrue), - PricingTier: to.Ptr(armsecurity.PricingTierStandard), - SubPlan: to.Ptr("P2"), - }, - }, 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.Pricing = armsecurity.Pricing{ - // Name: to.Ptr("VirtualMachines"), - // Type: to.Ptr("Microsoft.Security/pricings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/pricings/VirtualMachines"), - // Properties: &armsecurity.PricingProperties{ - // EnablementTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T12:42:42.192Z"); return t}()), - // Enforce: to.Ptr(armsecurity.EnforceTrue), - // FreeTrialRemainingTime: to.Ptr("PT0S"), - // PricingTier: to.Ptr(armsecurity.PricingTierStandard), - // ResourcesCoverageStatus: to.Ptr(armsecurity.ResourcesCoverageStatusFullyCovered), - // SubPlan: to.Ptr("P2"), - // Extensions: []*armsecurity.Extension{ - // { - // Name: to.Ptr("MdeDesignatedSubscription"), - // IsEnabled: to.Ptr(armsecurity.IsEnabledFalse), - // }, - // { - // Name: to.Ptr("AgentlessVmScanning"), - // AdditionalExtensionProperties: map[string]any{ - // "ExclusionTags": "[{\"Key\":\"TestKey1\",\"Value\":\"TestValue1\"},{\"Key\":\"TestKey2\",\"Value\":\"TestValue2\"}]", - // }, - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // OperationStatus: &armsecurity.OperationStatusAutoGenerated{ - // Code: to.Ptr(armsecurity.CodeSucceeded), - // Message: to.Ptr("Successfully enabled extension"), - // }, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/DeleteResourcePricing_example.json -func ExamplePricingsClient_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.NewPricingsClient().Delete(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/DEMO/providers/Microsoft.Compute/virtualMachines/VM-1", "VirtualMachines", 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/stable/2024-01-01/examples/Pricings/ListResourcePricings_example.json -func ExamplePricingsClient_List_getPricingsOnResource() { - 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.NewPricingsClient().List(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/DEMO/providers/Microsoft.Compute/virtualMachines/VM-1", &armsecurity.PricingsClientListOptions{Filter: 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.PricingList = armsecurity.PricingList{ - // Value: []*armsecurity.Pricing{ - // { - // Name: to.Ptr("VirtualMachines"), - // Type: to.Ptr("Microsoft.Security/pricings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/DEMO/providers/Microsoft.Compute/virtualMachines/VM-1/providers/Microsoft.Security/pricings/VirtualMachines"), - // Properties: &armsecurity.PricingProperties{ - // EnablementTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T12:42:42.192Z"); return t}()), - // FreeTrialRemainingTime: to.Ptr("PT0S"), - // Inherited: to.Ptr(armsecurity.InheritedTrue), - // InheritedFrom: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23"), - // PricingTier: to.Ptr(armsecurity.PricingTierStandard), - // SubPlan: to.Ptr("P2"), - // Extensions: []*armsecurity.Extension{ - // { - // Name: to.Ptr("AgentlessVmScanning"), - // AdditionalExtensionProperties: map[string]any{ - // "ExclusionTags": "[{\"Key\":\"TestKey1\",\"Value\":\"TestValue1\"},{\"Key\":\"TestKey2\",\"Value\":\"TestValue2\"}]", - // }, - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // }, - // { - // Name: to.Ptr("MdeDesignatedSubscription"), - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // }}, - // }, - // }, - // { - // Name: to.Ptr("CloudPosture"), - // Type: to.Ptr("Microsoft.Security/pricings"), - // ID: to.Ptr("/subscriptions/d34fd44c-ebfa-4a9c-bceb-9eeafe72ac15/resourceGroups/DEMO/providers/Microsoft.Compute/virtualMachines/VM-1/providers/Microsoft.Security/pricings/CloudPosture"), - // Properties: &armsecurity.PricingProperties{ - // Inherited: to.Ptr(armsecurity.InheritedFalse), - // PricingTier: to.Ptr(armsecurity.PricingTierFree), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ListPricings_example.json -func ExamplePricingsClient_List_getPricingsOnSubscription() { - 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.NewPricingsClient().List(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", &armsecurity.PricingsClientListOptions{Filter: 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.PricingList = armsecurity.PricingList{ - // Value: []*armsecurity.Pricing{ - // { - // Name: to.Ptr("VirtualMachines"), - // Type: to.Ptr("Microsoft.Security/pricings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/pricings/VirtualMachines"), - // Properties: &armsecurity.PricingProperties{ - // EnablementTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T12:42:42.192Z"); return t}()), - // Enforce: to.Ptr(armsecurity.EnforceFalse), - // FreeTrialRemainingTime: to.Ptr("PT0S"), - // PricingTier: to.Ptr(armsecurity.PricingTierStandard), - // ResourcesCoverageStatus: to.Ptr(armsecurity.ResourcesCoverageStatusPartiallyCovered), - // SubPlan: to.Ptr("P2"), - // Extensions: []*armsecurity.Extension{ - // { - // Name: to.Ptr("AgentlessVmScanning"), - // AdditionalExtensionProperties: map[string]any{ - // "ExclusionTags": "[{\"Key\":\"TestKey1\",\"Value\":\"TestValue1\"},{\"Key\":\"TestKey2\",\"Value\":\"TestValue2\"}]", - // }, - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // }, - // { - // Name: to.Ptr("MdeDesignatedSubscription"), - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // }}, - // }, - // }, - // { - // Name: to.Ptr("SqlServers"), - // Type: to.Ptr("Microsoft.Security/pricings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/pricings/SqlServers"), - // Properties: &armsecurity.PricingProperties{ - // EnablementTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T12:42:42.192Z"); return t}()), - // Enforce: to.Ptr(armsecurity.EnforceFalse), - // FreeTrialRemainingTime: to.Ptr("PT0S"), - // PricingTier: to.Ptr(armsecurity.PricingTierStandard), - // ResourcesCoverageStatus: to.Ptr(armsecurity.ResourcesCoverageStatusFullyCovered), - // }, - // }, - // { - // Name: to.Ptr("AppServices"), - // Type: to.Ptr("Microsoft.Security/pricings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/pricings/AppServices"), - // Properties: &armsecurity.PricingProperties{ - // Enforce: to.Ptr(armsecurity.EnforceFalse), - // FreeTrialRemainingTime: to.Ptr("PT0S"), - // PricingTier: to.Ptr(armsecurity.PricingTierFree), - // ResourcesCoverageStatus: to.Ptr(armsecurity.ResourcesCoverageStatusNotCovered), - // }, - // }, - // { - // Name: to.Ptr("StorageAccounts"), - // Type: to.Ptr("Microsoft.Security/pricings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/pricings/StorageAccounts"), - // Properties: &armsecurity.PricingProperties{ - // EnablementTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T12:42:42.192Z"); return t}()), - // Enforce: to.Ptr(armsecurity.EnforceFalse), - // FreeTrialRemainingTime: to.Ptr("PT0S"), - // PricingTier: to.Ptr(armsecurity.PricingTierStandard), - // ResourcesCoverageStatus: to.Ptr(armsecurity.ResourcesCoverageStatusFullyCovered), - // SubPlan: to.Ptr("DefenderForStorageV2"), - // Extensions: []*armsecurity.Extension{ - // { - // Name: to.Ptr("OnUploadMalwareScanning"), - // AdditionalExtensionProperties: map[string]any{ - // "capGBPerMonthPerStorageAccount": float64(10), - // }, - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // }, - // { - // Name: to.Ptr("SensitiveDataDiscovery"), - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // }}, - // }, - // }, - // { - // Name: to.Ptr("SqlServerVirtualMachines"), - // Type: to.Ptr("Microsoft.Security/pricings"), - // ID: to.Ptr("/subscriptions/d34fd44c-ebfa-4a9c-bceb-9eeafe72ac15/providers/Microsoft.Security/pricings/SqlServerVirtualMachines"), - // Properties: &armsecurity.PricingProperties{ - // EnablementTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T12:42:42.192Z"); return t}()), - // Enforce: to.Ptr(armsecurity.EnforceFalse), - // FreeTrialRemainingTime: to.Ptr("PT0S"), - // PricingTier: to.Ptr(armsecurity.PricingTierStandard), - // ResourcesCoverageStatus: to.Ptr(armsecurity.ResourcesCoverageStatusFullyCovered), - // }, - // }, - // { - // Name: to.Ptr("KubernetesService"), - // Type: to.Ptr("Microsoft.Security/pricings"), - // ID: to.Ptr("/subscriptions/d34fd44c-ebfa-4a9c-bceb-9eeafe72ac15/providers/Microsoft.Security/pricings/KubernetesService"), - // Properties: &armsecurity.PricingProperties{ - // Deprecated: to.Ptr(true), - // Enforce: to.Ptr(armsecurity.EnforceFalse), - // FreeTrialRemainingTime: to.Ptr("PT0S"), - // PricingTier: to.Ptr(armsecurity.PricingTierFree), - // ReplacedBy: []*string{ - // to.Ptr("Containers")}, - // ResourcesCoverageStatus: to.Ptr(armsecurity.ResourcesCoverageStatusNotCovered), - // }, - // }, - // { - // Name: to.Ptr("ContainerRegistry"), - // Type: to.Ptr("Microsoft.Security/pricings"), - // ID: to.Ptr("/subscriptions/d34fd44c-ebfa-4a9c-bceb-9eeafe72ac15/providers/Microsoft.Security/pricings/ContainerRegistry"), - // Properties: &armsecurity.PricingProperties{ - // Deprecated: to.Ptr(true), - // Enforce: to.Ptr(armsecurity.EnforceFalse), - // FreeTrialRemainingTime: to.Ptr("PT0S"), - // PricingTier: to.Ptr(armsecurity.PricingTierFree), - // ReplacedBy: []*string{ - // to.Ptr("Containers")}, - // ResourcesCoverageStatus: to.Ptr(armsecurity.ResourcesCoverageStatusNotCovered), - // }, - // }, - // { - // Name: to.Ptr("KeyVaults"), - // Type: to.Ptr("Microsoft.Security/pricings"), - // ID: to.Ptr("/subscriptions/d34fd44c-ebfa-4a9c-bceb-9eeafe72ac15/providers/Microsoft.Security/pricings/KeyVaults"), - // Properties: &armsecurity.PricingProperties{ - // EnablementTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T12:42:42.192Z"); return t}()), - // Enforce: to.Ptr(armsecurity.EnforceFalse), - // FreeTrialRemainingTime: to.Ptr("PT0S"), - // PricingTier: to.Ptr(armsecurity.PricingTierStandard), - // ResourcesCoverageStatus: to.Ptr(armsecurity.ResourcesCoverageStatusFullyCovered), - // SubPlan: to.Ptr("PerKeyVault"), - // }, - // }, - // { - // Name: to.Ptr("Dns"), - // Type: to.Ptr("Microsoft.Security/pricings"), - // ID: to.Ptr("/subscriptions/d34fd44c-ebfa-4a9c-bceb-9eeafe72ac15/providers/Microsoft.Security/pricings/Dns"), - // Properties: &armsecurity.PricingProperties{ - // Deprecated: to.Ptr(true), - // EnablementTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T12:42:42.192Z"); return t}()), - // Enforce: to.Ptr(armsecurity.EnforceFalse), - // FreeTrialRemainingTime: to.Ptr("PT0S"), - // PricingTier: to.Ptr(armsecurity.PricingTierStandard), - // ReplacedBy: []*string{ - // to.Ptr("VirtualMachines")}, - // ResourcesCoverageStatus: to.Ptr(armsecurity.ResourcesCoverageStatusFullyCovered), - // }, - // }, - // { - // Name: to.Ptr("Arm"), - // Type: to.Ptr("Microsoft.Security/pricings"), - // ID: to.Ptr("/subscriptions/d34fd44c-ebfa-4a9c-bceb-9eeafe72ac15/providers/Microsoft.Security/pricings/Arm"), - // Properties: &armsecurity.PricingProperties{ - // EnablementTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T12:42:42.192Z"); return t}()), - // Enforce: to.Ptr(armsecurity.EnforceFalse), - // FreeTrialRemainingTime: to.Ptr("PT0S"), - // PricingTier: to.Ptr(armsecurity.PricingTierStandard), - // ResourcesCoverageStatus: to.Ptr(armsecurity.ResourcesCoverageStatusFullyCovered), - // SubPlan: to.Ptr("PerSubscription"), - // }, - // }, - // { - // Name: to.Ptr("OpenSourceRelationalDatabases"), - // Type: to.Ptr("Microsoft.Security/pricings"), - // ID: to.Ptr("/subscriptions/d34fd44c-ebfa-4a9c-bceb-9eeafe72ac15/providers/Microsoft.Security/pricings/OpenSourceRelationalDatabases"), - // Properties: &armsecurity.PricingProperties{ - // Enforce: to.Ptr(armsecurity.EnforceFalse), - // FreeTrialRemainingTime: to.Ptr("PT0S"), - // PricingTier: to.Ptr(armsecurity.PricingTierStandard), - // ResourcesCoverageStatus: to.Ptr(armsecurity.ResourcesCoverageStatusFullyCovered), - // }, - // }, - // { - // Name: to.Ptr("Containers"), - // Type: to.Ptr("Microsoft.Security/pricings"), - // ID: to.Ptr("/subscriptions/d34fd44c-ebfa-4a9c-bceb-9eeafe72ac15/providers/Microsoft.Security/pricings/Containers"), - // Properties: &armsecurity.PricingProperties{ - // EnablementTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T12:42:42.192Z"); return t}()), - // Enforce: to.Ptr(armsecurity.EnforceFalse), - // FreeTrialRemainingTime: to.Ptr("PT0S"), - // PricingTier: to.Ptr(armsecurity.PricingTierStandard), - // ResourcesCoverageStatus: to.Ptr(armsecurity.ResourcesCoverageStatusFullyCovered), - // Extensions: []*armsecurity.Extension{ - // { - // Name: to.Ptr("ContainerRegistriesVulnerabilityAssessments"), - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // }}, - // }, - // }, - // { - // Name: to.Ptr("CloudPosture"), - // Type: to.Ptr("Microsoft.Security/pricings"), - // ID: to.Ptr("/subscriptions/d34fd44c-ebfa-4a9c-bceb-9eeafe72ac15/providers/Microsoft.Security/pricings/CloudPosture"), - // Properties: &armsecurity.PricingProperties{ - // EnablementTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T12:42:42.192Z"); return t}()), - // Enforce: to.Ptr(armsecurity.EnforceFalse), - // FreeTrialRemainingTime: to.Ptr("PT0S"), - // PricingTier: to.Ptr(armsecurity.PricingTierStandard), - // ResourcesCoverageStatus: to.Ptr(armsecurity.ResourcesCoverageStatusFullyCovered), - // Extensions: []*armsecurity.Extension{ - // { - // Name: to.Ptr("AgentlessVmScanning"), - // AdditionalExtensionProperties: map[string]any{ - // "ExclusionTags": "[]", - // }, - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // }, - // { - // Name: to.Ptr("AgentlessDiscoveryForKubernetes"), - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // }, - // { - // Name: to.Ptr("SensitiveDataDiscovery"), - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // }, - // { - // Name: to.Ptr("ContainerRegistriesVulnerabilityAssessments"), - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // }, - // { - // Name: to.Ptr("EntraPermissionsManagement"), - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // }}, - // }, - // }, - // { - // Name: to.Ptr("Api"), - // Type: to.Ptr("Microsoft.Security/pricings"), - // ID: to.Ptr("subscriptions/d34fd44c-ebfa-4a9c-bceb-9eeafe72ac15/providers/Microsoft.Security/pricings/Api"), - // Properties: &armsecurity.PricingProperties{ - // FreeTrialRemainingTime: to.Ptr("PT0S"), - // PricingTier: to.Ptr(armsecurity.PricingTierStandard), - // SubPlan: to.Ptr("P1"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ListPricingsWithPlanFilter_example.json -func ExamplePricingsClient_List_getPricingsOnSubscriptionWithPlansFilter() { - 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.NewPricingsClient().List(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", &armsecurity.PricingsClientListOptions{Filter: 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.PricingList = armsecurity.PricingList{ - // Value: []*armsecurity.Pricing{ - // { - // Name: to.Ptr("VirtualMachines"), - // Type: to.Ptr("Microsoft.Security/pricings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/pricings/VirtualMachines"), - // Properties: &armsecurity.PricingProperties{ - // EnablementTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T12:42:42.192Z"); return t}()), - // Enforce: to.Ptr(armsecurity.EnforceFalse), - // FreeTrialRemainingTime: to.Ptr("PT0S"), - // PricingTier: to.Ptr(armsecurity.PricingTierStandard), - // ResourcesCoverageStatus: to.Ptr(armsecurity.ResourcesCoverageStatusPartiallyCovered), - // SubPlan: to.Ptr("P2"), - // Extensions: []*armsecurity.Extension{ - // { - // Name: to.Ptr("AgentlessVmScanning"), - // AdditionalExtensionProperties: map[string]any{ - // "ExclusionTags": "[{\"Key\":\"TestKey1\",\"Value\":\"TestValue1\"},{\"Key\":\"TestKey2\",\"Value\":\"TestValue2\"}]", - // }, - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // }, - // { - // Name: to.Ptr("MdeDesignatedSubscription"), - // IsEnabled: to.Ptr(armsecurity.IsEnabledTrue), - // }}, - // }, - // }, - // { - // Name: to.Ptr("KeyVaults"), - // Type: to.Ptr("Microsoft.Security/pricings"), - // ID: to.Ptr("/subscriptions/d34fd44c-ebfa-4a9c-bceb-9eeafe72ac15/providers/Microsoft.Security/pricings/KeyVaults"), - // Properties: &armsecurity.PricingProperties{ - // EnablementTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T12:42:42.192Z"); return t}()), - // Enforce: to.Ptr(armsecurity.EnforceFalse), - // FreeTrialRemainingTime: to.Ptr("PT0S"), - // PricingTier: to.Ptr(armsecurity.PricingTierStandard), - // ResourcesCoverageStatus: to.Ptr(armsecurity.ResourcesCoverageStatusFullyCovered), - // SubPlan: to.Ptr("PerKeyVault"), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/regulatorycomplianceassessments_client.go b/sdk/resourcemanager/security/armsecurity/regulatorycomplianceassessments_client.go deleted file mode 100644 index 8bb8018bee24..000000000000 --- a/sdk/resourcemanager/security/armsecurity/regulatorycomplianceassessments_client.go +++ /dev/null @@ -1,182 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// RegulatoryComplianceAssessmentsClient contains the methods for the RegulatoryComplianceAssessments group. -// Don't use this type directly, use NewRegulatoryComplianceAssessmentsClient() instead. -type RegulatoryComplianceAssessmentsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewRegulatoryComplianceAssessmentsClient creates a new instance of RegulatoryComplianceAssessmentsClient 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 NewRegulatoryComplianceAssessmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RegulatoryComplianceAssessmentsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &RegulatoryComplianceAssessmentsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Supported regulatory compliance details and state for selected assessment -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-01-01-preview -// - regulatoryComplianceStandardName - Name of the regulatory compliance standard object -// - regulatoryComplianceControlName - Name of the regulatory compliance control object -// - regulatoryComplianceAssessmentName - Name of the regulatory compliance assessment object -// - options - RegulatoryComplianceAssessmentsClientGetOptions contains the optional parameters for the RegulatoryComplianceAssessmentsClient.Get -// method. -func (client *RegulatoryComplianceAssessmentsClient) Get(ctx context.Context, regulatoryComplianceStandardName string, regulatoryComplianceControlName string, regulatoryComplianceAssessmentName string, options *RegulatoryComplianceAssessmentsClientGetOptions) (RegulatoryComplianceAssessmentsClientGetResponse, error) { - var err error - const operationName = "RegulatoryComplianceAssessmentsClient.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, regulatoryComplianceStandardName, regulatoryComplianceControlName, regulatoryComplianceAssessmentName, options) - if err != nil { - return RegulatoryComplianceAssessmentsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RegulatoryComplianceAssessmentsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return RegulatoryComplianceAssessmentsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *RegulatoryComplianceAssessmentsClient) getCreateRequest(ctx context.Context, regulatoryComplianceStandardName string, regulatoryComplianceControlName string, regulatoryComplianceAssessmentName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if regulatoryComplianceStandardName == "" { - return nil, errors.New("parameter regulatoryComplianceStandardName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{regulatoryComplianceStandardName}", url.PathEscape(regulatoryComplianceStandardName)) - if regulatoryComplianceControlName == "" { - return nil, errors.New("parameter regulatoryComplianceControlName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{regulatoryComplianceControlName}", url.PathEscape(regulatoryComplianceControlName)) - if regulatoryComplianceAssessmentName == "" { - return nil, errors.New("parameter regulatoryComplianceAssessmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{regulatoryComplianceAssessmentName}", url.PathEscape(regulatoryComplianceAssessmentName)) - 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", "2019-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 *RegulatoryComplianceAssessmentsClient) getHandleResponse(resp *http.Response) (RegulatoryComplianceAssessmentsClientGetResponse, error) { - result := RegulatoryComplianceAssessmentsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RegulatoryComplianceAssessment); err != nil { - return RegulatoryComplianceAssessmentsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Details and state of assessments mapped to selected regulatory compliance control -// -// Generated from API version 2019-01-01-preview -// - regulatoryComplianceStandardName - Name of the regulatory compliance standard object -// - regulatoryComplianceControlName - Name of the regulatory compliance control object -// - options - RegulatoryComplianceAssessmentsClientListOptions contains the optional parameters for the RegulatoryComplianceAssessmentsClient.NewListPager -// method. -func (client *RegulatoryComplianceAssessmentsClient) NewListPager(regulatoryComplianceStandardName string, regulatoryComplianceControlName string, options *RegulatoryComplianceAssessmentsClientListOptions) *runtime.Pager[RegulatoryComplianceAssessmentsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[RegulatoryComplianceAssessmentsClientListResponse]{ - More: func(page RegulatoryComplianceAssessmentsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RegulatoryComplianceAssessmentsClientListResponse) (RegulatoryComplianceAssessmentsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RegulatoryComplianceAssessmentsClient.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, regulatoryComplianceStandardName, regulatoryComplianceControlName, options) - }, nil) - if err != nil { - return RegulatoryComplianceAssessmentsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *RegulatoryComplianceAssessmentsClient) listCreateRequest(ctx context.Context, regulatoryComplianceStandardName string, regulatoryComplianceControlName string, options *RegulatoryComplianceAssessmentsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}/regulatoryComplianceAssessments" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if regulatoryComplianceStandardName == "" { - return nil, errors.New("parameter regulatoryComplianceStandardName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{regulatoryComplianceStandardName}", url.PathEscape(regulatoryComplianceStandardName)) - if regulatoryComplianceControlName == "" { - return nil, errors.New("parameter regulatoryComplianceControlName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{regulatoryComplianceControlName}", url.PathEscape(regulatoryComplianceControlName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2019-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 *RegulatoryComplianceAssessmentsClient) listHandleResponse(resp *http.Response) (RegulatoryComplianceAssessmentsClientListResponse, error) { - result := RegulatoryComplianceAssessmentsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RegulatoryComplianceAssessmentList); err != nil { - return RegulatoryComplianceAssessmentsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/regulatorycomplianceassessments_client_example_test.go b/sdk/resourcemanager/security/armsecurity/regulatorycomplianceassessments_client_example_test.go deleted file mode 100644 index ffb7e2026e4e..000000000000 --- a/sdk/resourcemanager/security/armsecurity/regulatorycomplianceassessments_client_example_test.go +++ /dev/null @@ -1,122 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/RegulatoryCompliance/getRegulatoryComplianceAssessmentList_example.json -func ExampleRegulatoryComplianceAssessmentsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRegulatoryComplianceAssessmentsClient().NewListPager("PCI-DSS-3.2", "1.1", &armsecurity.RegulatoryComplianceAssessmentsClientListOptions{Filter: 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.RegulatoryComplianceAssessmentList = armsecurity.RegulatoryComplianceAssessmentList{ - // Value: []*armsecurity.RegulatoryComplianceAssessment{ - // { - // Name: to.Ptr("968548cb-02b3-8cd2-11f8-0cf64ab1a347"), - // Type: to.Ptr("Microsoft.Security/regulatoryComplianceAssessment"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/regulatoryComplianceStandards/PCI-DSS-3.2/regulatoryComplianceControls/1.1/regulatoryComplianceAssessments/968548cb-02b3-8cd2-11f8-0cf64ab1a347"), - // Properties: &armsecurity.RegulatoryComplianceAssessmentProperties{ - // Description: to.Ptr("Troubleshoot missing scan data on your machines"), - // AssessmentDetailsLink: to.Ptr("https://management.azure.com/subscriptions/a27e854a-8578-4395-8eaf-6fc7849f3050/providers/Microsoft.Security/securityStatuses/968548cb-02b3-8cd2-11f8-0cf64ab1a347"), - // AssessmentType: to.Ptr("Assessment"), - // FailedResources: to.Ptr[int32](4), - // PassedResources: to.Ptr[int32](7), - // SkippedResources: to.Ptr[int32](0), - // State: to.Ptr(armsecurity.StateFailed), - // }, - // }, - // { - // Name: to.Ptr("3bcd234d-c9c7-c2a2-89e0-c01f419c1a8a"), - // Type: to.Ptr("Microsoft.Security/regulatoryComplianceAssessment"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/regulatoryComplianceStandards/PCI-DSS-3.2/regulatoryComplianceControls/2/regulatoryComplianceAssessments/3bcd234d-c9c7-c2a2-89e0-c01f419c1a8a"), - // Properties: &armsecurity.RegulatoryComplianceAssessmentProperties{ - // Description: to.Ptr("Resolve endpoint protection health issues on your machines"), - // AssessmentDetailsLink: to.Ptr("https://management.azure.com/subscriptions/a27e854a-8578-4395-8eaf-6fc7849f3050/providers/Microsoft.Security/securityStatuses/3bcd234d-c9c7-c2a2-89e0-c01f419c1a8a"), - // AssessmentType: to.Ptr("Assessment"), - // FailedResources: to.Ptr[int32](0), - // PassedResources: to.Ptr[int32](0), - // SkippedResources: to.Ptr[int32](10), - // State: to.Ptr(armsecurity.StateSkipped), - // }, - // }, - // { - // Name: to.Ptr("d1db3318-01ff-16de-29eb-28b344515626"), - // Type: to.Ptr("Microsoft.Security/regulatoryComplianceAssessment"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/regulatoryComplianceStandards/PCI-DSS-3.2/regulatoryComplianceControls/2.1/regulatoryComplianceAssessments/d1db3318-01ff-16de-29eb-28b344515626"), - // Properties: &armsecurity.RegulatoryComplianceAssessmentProperties{ - // Description: to.Ptr("Install monitoring agent on your machines"), - // AssessmentDetailsLink: to.Ptr("https://management.azure.com/subscriptions/a27e854a-8578-4395-8eaf-6fc7849f3050/providers/Microsoft.Security/securityStatuses/d1db3318-01ff-16de-29eb-28b344515626"), - // AssessmentType: to.Ptr("Assessment"), - // FailedResources: to.Ptr[int32](0), - // PassedResources: to.Ptr[int32](8), - // SkippedResources: to.Ptr[int32](0), - // State: to.Ptr(armsecurity.StatePassed), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/RegulatoryCompliance/getRegulatoryComplianceAssessment_example.json -func ExampleRegulatoryComplianceAssessmentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRegulatoryComplianceAssessmentsClient().Get(ctx, "PCI-DSS-3.2", "1.1", "968548cb-02b3-8cd2-11f8-0cf64ab1a347", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.RegulatoryComplianceAssessment = armsecurity.RegulatoryComplianceAssessment{ - // Name: to.Ptr("968548cb-02b3-8cd2-11f8-0cf64ab1a347"), - // Type: to.Ptr("Microsoft.Security/regulatoryComplianceAssessment"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/regulatoryComplianceStandards/PCI-DSS-3.2/regulatoryComplianceControls/1.1/regulatoryComplianceAssessments/968548cb-02b3-8cd2-11f8-0cf64ab1a347"), - // Properties: &armsecurity.RegulatoryComplianceAssessmentProperties{ - // Description: to.Ptr("Troubleshoot missing scan data on your machines"), - // AssessmentDetailsLink: to.Ptr("https://management.azure.com/subscriptions/a27e854a-8578-4395-8eaf-6fc7849f3050/providers/Microsoft.Security/securityStatuses/968548cb-02b3-8cd2-11f8-0cf64ab1a347"), - // AssessmentType: to.Ptr("Assessment"), - // FailedResources: to.Ptr[int32](4), - // PassedResources: to.Ptr[int32](7), - // SkippedResources: to.Ptr[int32](0), - // State: to.Ptr(armsecurity.StateFailed), - // }, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/regulatorycompliancecontrols_client.go b/sdk/resourcemanager/security/armsecurity/regulatorycompliancecontrols_client.go deleted file mode 100644 index cdc70102cd59..000000000000 --- a/sdk/resourcemanager/security/armsecurity/regulatorycompliancecontrols_client.go +++ /dev/null @@ -1,172 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// RegulatoryComplianceControlsClient contains the methods for the RegulatoryComplianceControls group. -// Don't use this type directly, use NewRegulatoryComplianceControlsClient() instead. -type RegulatoryComplianceControlsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewRegulatoryComplianceControlsClient creates a new instance of RegulatoryComplianceControlsClient 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 NewRegulatoryComplianceControlsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RegulatoryComplianceControlsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &RegulatoryComplianceControlsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Selected regulatory compliance control details and state -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-01-01-preview -// - regulatoryComplianceStandardName - Name of the regulatory compliance standard object -// - regulatoryComplianceControlName - Name of the regulatory compliance control object -// - options - RegulatoryComplianceControlsClientGetOptions contains the optional parameters for the RegulatoryComplianceControlsClient.Get -// method. -func (client *RegulatoryComplianceControlsClient) Get(ctx context.Context, regulatoryComplianceStandardName string, regulatoryComplianceControlName string, options *RegulatoryComplianceControlsClientGetOptions) (RegulatoryComplianceControlsClientGetResponse, error) { - var err error - const operationName = "RegulatoryComplianceControlsClient.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, regulatoryComplianceStandardName, regulatoryComplianceControlName, options) - if err != nil { - return RegulatoryComplianceControlsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RegulatoryComplianceControlsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return RegulatoryComplianceControlsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *RegulatoryComplianceControlsClient) getCreateRequest(ctx context.Context, regulatoryComplianceStandardName string, regulatoryComplianceControlName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if regulatoryComplianceStandardName == "" { - return nil, errors.New("parameter regulatoryComplianceStandardName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{regulatoryComplianceStandardName}", url.PathEscape(regulatoryComplianceStandardName)) - if regulatoryComplianceControlName == "" { - return nil, errors.New("parameter regulatoryComplianceControlName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{regulatoryComplianceControlName}", url.PathEscape(regulatoryComplianceControlName)) - 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", "2019-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 *RegulatoryComplianceControlsClient) getHandleResponse(resp *http.Response) (RegulatoryComplianceControlsClientGetResponse, error) { - result := RegulatoryComplianceControlsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RegulatoryComplianceControl); err != nil { - return RegulatoryComplianceControlsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - All supported regulatory compliance controls details and state for selected standard -// -// Generated from API version 2019-01-01-preview -// - regulatoryComplianceStandardName - Name of the regulatory compliance standard object -// - options - RegulatoryComplianceControlsClientListOptions contains the optional parameters for the RegulatoryComplianceControlsClient.NewListPager -// method. -func (client *RegulatoryComplianceControlsClient) NewListPager(regulatoryComplianceStandardName string, options *RegulatoryComplianceControlsClientListOptions) *runtime.Pager[RegulatoryComplianceControlsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[RegulatoryComplianceControlsClientListResponse]{ - More: func(page RegulatoryComplianceControlsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RegulatoryComplianceControlsClientListResponse) (RegulatoryComplianceControlsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RegulatoryComplianceControlsClient.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, regulatoryComplianceStandardName, options) - }, nil) - if err != nil { - return RegulatoryComplianceControlsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *RegulatoryComplianceControlsClient) listCreateRequest(ctx context.Context, regulatoryComplianceStandardName string, options *RegulatoryComplianceControlsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if regulatoryComplianceStandardName == "" { - return nil, errors.New("parameter regulatoryComplianceStandardName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{regulatoryComplianceStandardName}", url.PathEscape(regulatoryComplianceStandardName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2019-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 *RegulatoryComplianceControlsClient) listHandleResponse(resp *http.Response) (RegulatoryComplianceControlsClientListResponse, error) { - result := RegulatoryComplianceControlsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RegulatoryComplianceControlList); err != nil { - return RegulatoryComplianceControlsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/regulatorycompliancecontrols_client_example_test.go b/sdk/resourcemanager/security/armsecurity/regulatorycompliancecontrols_client_example_test.go deleted file mode 100644 index 61a3988d349d..000000000000 --- a/sdk/resourcemanager/security/armsecurity/regulatorycompliancecontrols_client_example_test.go +++ /dev/null @@ -1,114 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/RegulatoryCompliance/getRegulatoryComplianceControlList_example.json -func ExampleRegulatoryComplianceControlsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRegulatoryComplianceControlsClient().NewListPager("PCI-DSS-3.2", &armsecurity.RegulatoryComplianceControlsClientListOptions{Filter: 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.RegulatoryComplianceControlList = armsecurity.RegulatoryComplianceControlList{ - // Value: []*armsecurity.RegulatoryComplianceControl{ - // { - // Name: to.Ptr("1.1"), - // Type: to.Ptr("Microsoft.Security/regulatoryComplianceControl"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/regulatoryComplianceStandards/PCI-DSS-3.2/regulatoryComplianceControls/1.1"), - // Properties: &armsecurity.RegulatoryComplianceControlProperties{ - // Description: to.Ptr("Common Criteria Related to Organization and Management."), - // FailedAssessments: to.Ptr[int32](4), - // PassedAssessments: to.Ptr[int32](7), - // SkippedAssessments: to.Ptr[int32](0), - // State: to.Ptr(armsecurity.StateFailed), - // }, - // }, - // { - // Name: to.Ptr("2"), - // Type: to.Ptr("Microsoft.Security/regulatoryComplianceControl"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/regulatoryComplianceStandards/PCI-DSS-3.2/regulatoryComplianceControls/2"), - // Properties: &armsecurity.RegulatoryComplianceControlProperties{ - // Description: to.Ptr("Confidential information is protected during the system design, development, testing, implementation, and change processes in accordance with confidentiality commitments and requirements."), - // FailedAssessments: to.Ptr[int32](0), - // PassedAssessments: to.Ptr[int32](0), - // SkippedAssessments: to.Ptr[int32](10), - // State: to.Ptr(armsecurity.StateSkipped), - // }, - // }, - // { - // Name: to.Ptr("2.1"), - // Type: to.Ptr("Microsoft.Security/regulatoryComplianceControl"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/regulatoryComplianceStandards/PCI-DSS-3.2/regulatoryComplianceControls/2.1"), - // Properties: &armsecurity.RegulatoryComplianceControlProperties{ - // Description: to.Ptr("Changes to confidentiality commitments and requirements are communicated to internal and external users, vendors, and other third parties whose products and services are included in the system."), - // FailedAssessments: to.Ptr[int32](0), - // PassedAssessments: to.Ptr[int32](0), - // SkippedAssessments: to.Ptr[int32](0), - // State: to.Ptr(armsecurity.StateUnsupported), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/RegulatoryCompliance/getRegulatoryComplianceControl_example.json -func ExampleRegulatoryComplianceControlsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRegulatoryComplianceControlsClient().Get(ctx, "PCI-DSS-3.2", "1.1", 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.RegulatoryComplianceControl = armsecurity.RegulatoryComplianceControl{ - // Name: to.Ptr("1.1"), - // Type: to.Ptr("Microsoft.Security/regulatoryComplianceControl"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/regulatoryComplianceStandards/PCI-DSS-3.2/regulatoryComplianceControls/1.1"), - // Properties: &armsecurity.RegulatoryComplianceControlProperties{ - // Description: to.Ptr("Common Criteria Related to Organization and Management"), - // FailedAssessments: to.Ptr[int32](4), - // PassedAssessments: to.Ptr[int32](7), - // SkippedAssessments: to.Ptr[int32](0), - // State: to.Ptr(armsecurity.StateFailed), - // }, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/regulatorycompliancestandards_client.go b/sdk/resourcemanager/security/armsecurity/regulatorycompliancestandards_client.go deleted file mode 100644 index 57854003c17a..000000000000 --- a/sdk/resourcemanager/security/armsecurity/regulatorycompliancestandards_client.go +++ /dev/null @@ -1,162 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// RegulatoryComplianceStandardsClient contains the methods for the RegulatoryComplianceStandards group. -// Don't use this type directly, use NewRegulatoryComplianceStandardsClient() instead. -type RegulatoryComplianceStandardsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewRegulatoryComplianceStandardsClient creates a new instance of RegulatoryComplianceStandardsClient 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 NewRegulatoryComplianceStandardsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RegulatoryComplianceStandardsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &RegulatoryComplianceStandardsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Supported regulatory compliance details state for selected standard -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-01-01-preview -// - regulatoryComplianceStandardName - Name of the regulatory compliance standard object -// - options - RegulatoryComplianceStandardsClientGetOptions contains the optional parameters for the RegulatoryComplianceStandardsClient.Get -// method. -func (client *RegulatoryComplianceStandardsClient) Get(ctx context.Context, regulatoryComplianceStandardName string, options *RegulatoryComplianceStandardsClientGetOptions) (RegulatoryComplianceStandardsClientGetResponse, error) { - var err error - const operationName = "RegulatoryComplianceStandardsClient.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, regulatoryComplianceStandardName, options) - if err != nil { - return RegulatoryComplianceStandardsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RegulatoryComplianceStandardsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return RegulatoryComplianceStandardsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *RegulatoryComplianceStandardsClient) getCreateRequest(ctx context.Context, regulatoryComplianceStandardName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if regulatoryComplianceStandardName == "" { - return nil, errors.New("parameter regulatoryComplianceStandardName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{regulatoryComplianceStandardName}", url.PathEscape(regulatoryComplianceStandardName)) - 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", "2019-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 *RegulatoryComplianceStandardsClient) getHandleResponse(resp *http.Response) (RegulatoryComplianceStandardsClientGetResponse, error) { - result := RegulatoryComplianceStandardsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RegulatoryComplianceStandard); err != nil { - return RegulatoryComplianceStandardsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Supported regulatory compliance standards details and state -// -// Generated from API version 2019-01-01-preview -// - options - RegulatoryComplianceStandardsClientListOptions contains the optional parameters for the RegulatoryComplianceStandardsClient.NewListPager -// method. -func (client *RegulatoryComplianceStandardsClient) NewListPager(options *RegulatoryComplianceStandardsClientListOptions) *runtime.Pager[RegulatoryComplianceStandardsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[RegulatoryComplianceStandardsClientListResponse]{ - More: func(page RegulatoryComplianceStandardsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RegulatoryComplianceStandardsClientListResponse) (RegulatoryComplianceStandardsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RegulatoryComplianceStandardsClient.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 RegulatoryComplianceStandardsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *RegulatoryComplianceStandardsClient) listCreateRequest(ctx context.Context, options *RegulatoryComplianceStandardsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards" - 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() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2019-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 *RegulatoryComplianceStandardsClient) listHandleResponse(resp *http.Response) (RegulatoryComplianceStandardsClientListResponse, error) { - result := RegulatoryComplianceStandardsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RegulatoryComplianceStandardList); err != nil { - return RegulatoryComplianceStandardsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/regulatorycompliancestandards_client_example_test.go b/sdk/resourcemanager/security/armsecurity/regulatorycompliancestandards_client_example_test.go deleted file mode 100644 index 5055a0c669cf..000000000000 --- a/sdk/resourcemanager/security/armsecurity/regulatorycompliancestandards_client_example_test.go +++ /dev/null @@ -1,126 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/RegulatoryCompliance/getRegulatoryComplianceStandardList_example.json -func ExampleRegulatoryComplianceStandardsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRegulatoryComplianceStandardsClient().NewListPager(&armsecurity.RegulatoryComplianceStandardsClientListOptions{Filter: 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.RegulatoryComplianceStandardList = armsecurity.RegulatoryComplianceStandardList{ - // Value: []*armsecurity.RegulatoryComplianceStandard{ - // { - // Name: to.Ptr("PCI-DSS-3.2"), - // Type: to.Ptr("Microsoft.Security/regulatoryComplianceStandard"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/regulatoryComplianceStandards/PCI-DSS-3.2"), - // Properties: &armsecurity.RegulatoryComplianceStandardProperties{ - // FailedControls: to.Ptr[int32](4), - // PassedControls: to.Ptr[int32](7), - // SkippedControls: to.Ptr[int32](0), - // State: to.Ptr(armsecurity.StateFailed), - // UnsupportedControls: to.Ptr[int32](0), - // }, - // }, - // { - // Name: to.Ptr("ISO-27001"), - // Type: to.Ptr("Microsoft.Security/regulatoryComplianceStandard"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/regulatoryComplianceStandards/ISO-27001"), - // Properties: &armsecurity.RegulatoryComplianceStandardProperties{ - // FailedControls: to.Ptr[int32](0), - // PassedControls: to.Ptr[int32](0), - // SkippedControls: to.Ptr[int32](10), - // State: to.Ptr(armsecurity.StateSkipped), - // UnsupportedControls: to.Ptr[int32](0), - // }, - // }, - // { - // Name: to.Ptr("AZURE-CIS"), - // Type: to.Ptr("Microsoft.Security/regulatoryComplianceStandard"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/regulatoryComplianceStandards/AZURE-CIS"), - // Properties: &armsecurity.RegulatoryComplianceStandardProperties{ - // FailedControls: to.Ptr[int32](0), - // PassedControls: to.Ptr[int32](0), - // SkippedControls: to.Ptr[int32](0), - // State: to.Ptr(armsecurity.StateUnsupported), - // UnsupportedControls: to.Ptr[int32](0), - // }, - // }, - // { - // Name: to.Ptr("SOC-TSP"), - // Type: to.Ptr("Microsoft.Security/regulatoryComplianceStandard"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/regulatoryComplianceStandards/SOC-TSP"), - // Properties: &armsecurity.RegulatoryComplianceStandardProperties{ - // FailedControls: to.Ptr[int32](0), - // PassedControls: to.Ptr[int32](15), - // SkippedControls: to.Ptr[int32](0), - // State: to.Ptr(armsecurity.StatePassed), - // UnsupportedControls: to.Ptr[int32](0), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/RegulatoryCompliance/getRegulatoryComplianceStandard_example.json -func ExampleRegulatoryComplianceStandardsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRegulatoryComplianceStandardsClient().Get(ctx, "PCI-DSS-3.2", 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.RegulatoryComplianceStandard = armsecurity.RegulatoryComplianceStandard{ - // Name: to.Ptr("PCI-DSS-3.2"), - // Type: to.Ptr("Microsoft.Security/regulatoryComplianceStandard"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/regulatoryComplianceStandards/PCI-DSS-3.2"), - // Properties: &armsecurity.RegulatoryComplianceStandardProperties{ - // FailedControls: to.Ptr[int32](4), - // PassedControls: to.Ptr[int32](7), - // SkippedControls: to.Ptr[int32](0), - // State: to.Ptr(armsecurity.StateFailed), - // UnsupportedControls: to.Ptr[int32](0), - // }, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/responses.go b/sdk/resourcemanager/security/armsecurity/responses.go index 8c6fdebc961f..21dacc8f5024 100644 --- a/sdk/resourcemanager/security/armsecurity/responses.go +++ b/sdk/resourcemanager/security/armsecurity/responses.go @@ -8,615 +8,10 @@ package armsecurity -// APICollectionsClientGetByAzureAPIManagementServiceResponse contains the response from method APICollectionsClient.GetByAzureAPIManagementService. -type APICollectionsClientGetByAzureAPIManagementServiceResponse struct { - // An API collection as represented by Microsoft Defender for APIs. - APICollection -} - -// APICollectionsClientListByAzureAPIManagementServiceResponse contains the response from method APICollectionsClient.NewListByAzureAPIManagementServicePager. -type APICollectionsClientListByAzureAPIManagementServiceResponse struct { - // Page of a list of API collections as represented by Microsoft Defender for APIs. - APICollectionList -} - -// APICollectionsClientListByResourceGroupResponse contains the response from method APICollectionsClient.NewListByResourceGroupPager. -type APICollectionsClientListByResourceGroupResponse struct { - // Page of a list of API collections as represented by Microsoft Defender for APIs. - APICollectionList -} - -// APICollectionsClientListBySubscriptionResponse contains the response from method APICollectionsClient.NewListBySubscriptionPager. -type APICollectionsClientListBySubscriptionResponse struct { - // Page of a list of API collections as represented by Microsoft Defender for APIs. - APICollectionList -} - -// APICollectionsClientOffboardAzureAPIManagementAPIResponse contains the response from method APICollectionsClient.OffboardAzureAPIManagementAPI. -type APICollectionsClientOffboardAzureAPIManagementAPIResponse struct { - // placeholder for future response values -} - -// APICollectionsClientOnboardAzureAPIManagementAPIResponse contains the response from method APICollectionsClient.BeginOnboardAzureAPIManagementAPI. -type APICollectionsClientOnboardAzureAPIManagementAPIResponse struct { - // An API collection as represented by Microsoft Defender for APIs. - 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. - AdvancedThreatProtectionSetting -} - -// AdvancedThreatProtectionClientGetResponse contains the response from method AdvancedThreatProtectionClient.Get. -type AdvancedThreatProtectionClientGetResponse struct { - // The Advanced Threat Protection resource. - AdvancedThreatProtectionSetting -} - -// AlertsClientGetResourceGroupLevelResponse contains the response from method AlertsClient.GetResourceGroupLevel. -type AlertsClientGetResourceGroupLevelResponse struct { - // Security alert - Alert -} - -// AlertsClientGetSubscriptionLevelResponse contains the response from method AlertsClient.GetSubscriptionLevel. -type AlertsClientGetSubscriptionLevelResponse struct { - // Security alert - Alert -} - -// AlertsClientListByResourceGroupResponse contains the response from method AlertsClient.NewListByResourceGroupPager. -type AlertsClientListByResourceGroupResponse struct { - // List of security alerts - AlertList -} - -// AlertsClientListResourceGroupLevelByRegionResponse contains the response from method AlertsClient.NewListResourceGroupLevelByRegionPager. -type AlertsClientListResourceGroupLevelByRegionResponse struct { - // List of security alerts - AlertList -} - -// AlertsClientListResponse contains the response from method AlertsClient.NewListPager. -type AlertsClientListResponse struct { - // List of security alerts - AlertList -} - -// AlertsClientListSubscriptionLevelByRegionResponse contains the response from method AlertsClient.NewListSubscriptionLevelByRegionPager. -type AlertsClientListSubscriptionLevelByRegionResponse struct { - // List of security alerts - AlertList -} - -// AlertsClientSimulateResponse contains the response from method AlertsClient.BeginSimulate. -type AlertsClientSimulateResponse struct { - // placeholder for future response values -} - -// AlertsClientUpdateResourceGroupLevelStateToActivateResponse contains the response from method AlertsClient.UpdateResourceGroupLevelStateToActivate. -type AlertsClientUpdateResourceGroupLevelStateToActivateResponse struct { - // placeholder for future response values -} - -// AlertsClientUpdateResourceGroupLevelStateToDismissResponse contains the response from method AlertsClient.UpdateResourceGroupLevelStateToDismiss. -type AlertsClientUpdateResourceGroupLevelStateToDismissResponse struct { - // placeholder for future response values -} - -// AlertsClientUpdateResourceGroupLevelStateToInProgressResponse contains the response from method AlertsClient.UpdateResourceGroupLevelStateToInProgress. -type AlertsClientUpdateResourceGroupLevelStateToInProgressResponse struct { - // placeholder for future response values -} - -// AlertsClientUpdateResourceGroupLevelStateToResolveResponse contains the response from method AlertsClient.UpdateResourceGroupLevelStateToResolve. -type AlertsClientUpdateResourceGroupLevelStateToResolveResponse struct { - // placeholder for future response values -} - -// AlertsClientUpdateSubscriptionLevelStateToActivateResponse contains the response from method AlertsClient.UpdateSubscriptionLevelStateToActivate. -type AlertsClientUpdateSubscriptionLevelStateToActivateResponse struct { - // placeholder for future response values -} - -// AlertsClientUpdateSubscriptionLevelStateToDismissResponse contains the response from method AlertsClient.UpdateSubscriptionLevelStateToDismiss. -type AlertsClientUpdateSubscriptionLevelStateToDismissResponse struct { - // placeholder for future response values -} - -// AlertsClientUpdateSubscriptionLevelStateToInProgressResponse contains the response from method AlertsClient.UpdateSubscriptionLevelStateToInProgress. -type AlertsClientUpdateSubscriptionLevelStateToInProgressResponse struct { - // placeholder for future response values -} - -// AlertsClientUpdateSubscriptionLevelStateToResolveResponse contains the response from method AlertsClient.UpdateSubscriptionLevelStateToResolve. -type AlertsClientUpdateSubscriptionLevelStateToResolveResponse struct { - // placeholder for future response values -} - -// AlertsSuppressionRulesClientDeleteResponse contains the response from method AlertsSuppressionRulesClient.Delete. -type AlertsSuppressionRulesClientDeleteResponse struct { - // placeholder for future response values -} - -// AlertsSuppressionRulesClientGetResponse contains the response from method AlertsSuppressionRulesClient.Get. -type AlertsSuppressionRulesClientGetResponse struct { - // Describes the suppression rule - AlertsSuppressionRule -} - -// AlertsSuppressionRulesClientListResponse contains the response from method AlertsSuppressionRulesClient.NewListPager. -type AlertsSuppressionRulesClientListResponse struct { - // Suppression rules list for subscription. - AlertsSuppressionRulesList -} - -// AlertsSuppressionRulesClientUpdateResponse contains the response from method AlertsSuppressionRulesClient.Update. -type AlertsSuppressionRulesClientUpdateResponse struct { - // Describes the suppression rule - AlertsSuppressionRule -} - -// AllowedConnectionsClientGetResponse contains the response from method AllowedConnectionsClient.Get. -type AllowedConnectionsClientGetResponse struct { - // The resource whose properties describes the allowed traffic between Azure resources - AllowedConnectionsResource -} - -// AllowedConnectionsClientListByHomeRegionResponse contains the response from method AllowedConnectionsClient.NewListByHomeRegionPager. -type AllowedConnectionsClientListByHomeRegionResponse struct { - // List of all possible traffic between Azure resources - AllowedConnectionsList -} - -// AllowedConnectionsClientListResponse contains the response from method AllowedConnectionsClient.NewListPager. -type AllowedConnectionsClientListResponse struct { - // List of all possible traffic between Azure resources - AllowedConnectionsList -} - -// ApplicationClientCreateOrUpdateResponse contains the response from method ApplicationClient.CreateOrUpdate. -type ApplicationClientCreateOrUpdateResponse struct { - // Security Application over a given scope - Application -} - -// ApplicationClientDeleteResponse contains the response from method ApplicationClient.Delete. -type ApplicationClientDeleteResponse struct { - // placeholder for future response values -} - -// ApplicationClientGetResponse contains the response from method ApplicationClient.Get. -type ApplicationClientGetResponse struct { - // Security Application over a given scope - Application -} - -// ApplicationsClientListResponse contains the response from method ApplicationsClient.NewListPager. -type ApplicationsClientListResponse struct { - // Page of a security applications list - ApplicationsList -} - -// AssessmentsClientCreateOrUpdateResponse contains the response from method AssessmentsClient.CreateOrUpdate. -type AssessmentsClientCreateOrUpdateResponse struct { - // Security assessment on a resource - response format - AssessmentResponse -} - -// AssessmentsClientDeleteResponse contains the response from method AssessmentsClient.Delete. -type AssessmentsClientDeleteResponse struct { - // placeholder for future response values -} - -// AssessmentsClientGetResponse contains the response from method AssessmentsClient.Get. -type AssessmentsClientGetResponse struct { - // Security assessment on a resource - response format - AssessmentResponse -} - -// AssessmentsClientListResponse contains the response from method AssessmentsClient.NewListPager. -type AssessmentsClientListResponse struct { - // Page of a security assessments list - AssessmentList -} - -// AssessmentsMetadataClientCreateInSubscriptionResponse contains the response from method AssessmentsMetadataClient.CreateInSubscription. -type AssessmentsMetadataClientCreateInSubscriptionResponse struct { - // Security assessment metadata response - AssessmentMetadataResponse -} - -// AssessmentsMetadataClientDeleteInSubscriptionResponse contains the response from method AssessmentsMetadataClient.DeleteInSubscription. -type AssessmentsMetadataClientDeleteInSubscriptionResponse struct { - // placeholder for future response values -} - -// AssessmentsMetadataClientGetInSubscriptionResponse contains the response from method AssessmentsMetadataClient.GetInSubscription. -type AssessmentsMetadataClientGetInSubscriptionResponse struct { - // Security assessment metadata response - AssessmentMetadataResponse -} - -// AssessmentsMetadataClientGetResponse contains the response from method AssessmentsMetadataClient.Get. -type AssessmentsMetadataClientGetResponse struct { - // Security assessment metadata response - AssessmentMetadataResponse -} - -// AssessmentsMetadataClientListBySubscriptionResponse contains the response from method AssessmentsMetadataClient.NewListBySubscriptionPager. -type AssessmentsMetadataClientListBySubscriptionResponse struct { - // List of security assessment metadata - AssessmentMetadataResponseList -} - -// AssessmentsMetadataClientListResponse contains the response from method AssessmentsMetadataClient.NewListPager. -type AssessmentsMetadataClientListResponse struct { - // List of security assessment metadata - AssessmentMetadataResponseList -} - -// AutoProvisioningSettingsClientCreateResponse contains the response from method AutoProvisioningSettingsClient.Create. -type AutoProvisioningSettingsClientCreateResponse struct { - // Auto provisioning setting - AutoProvisioningSetting -} - -// AutoProvisioningSettingsClientGetResponse contains the response from method AutoProvisioningSettingsClient.Get. -type AutoProvisioningSettingsClientGetResponse struct { - // Auto provisioning setting - AutoProvisioningSetting -} - -// AutoProvisioningSettingsClientListResponse contains the response from method AutoProvisioningSettingsClient.NewListPager. -type AutoProvisioningSettingsClientListResponse struct { - // List of all the auto provisioning settings response - AutoProvisioningSettingList -} - -// AutomationsClientCreateOrUpdateResponse contains the response from method AutomationsClient.CreateOrUpdate. -type AutomationsClientCreateOrUpdateResponse struct { - // The security automation resource. - Automation -} - -// AutomationsClientDeleteResponse contains the response from method AutomationsClient.Delete. -type AutomationsClientDeleteResponse struct { - // placeholder for future response values -} - -// AutomationsClientGetResponse contains the response from method AutomationsClient.Get. -type AutomationsClientGetResponse struct { - // The security automation resource. - Automation -} - -// AutomationsClientListByResourceGroupResponse contains the response from method AutomationsClient.NewListByResourceGroupPager. -type AutomationsClientListByResourceGroupResponse struct { - // List of security automations response. - AutomationList -} - -// AutomationsClientListResponse contains the response from method AutomationsClient.NewListPager. -type AutomationsClientListResponse struct { - // List of security automations response. - AutomationList -} - -// AutomationsClientUpdateResponse contains the response from method AutomationsClient.Update. -type AutomationsClientUpdateResponse struct { - // The security automation resource. - Automation -} - -// AutomationsClientValidateResponse contains the response from method AutomationsClient.Validate. -type AutomationsClientValidateResponse struct { - // The security automation model state property bag. - AutomationValidationStatus -} - -// AzureDevOpsOrgsClientCreateOrUpdateResponse contains the response from method AzureDevOpsOrgsClient.BeginCreateOrUpdate. -type AzureDevOpsOrgsClientCreateOrUpdateResponse struct { - // Azure DevOps Organization resource. - AzureDevOpsOrg -} - -// AzureDevOpsOrgsClientGetResponse contains the response from method AzureDevOpsOrgsClient.Get. -type AzureDevOpsOrgsClientGetResponse struct { - // Azure DevOps Organization resource. - AzureDevOpsOrg -} - -// AzureDevOpsOrgsClientListAvailableResponse contains the response from method AzureDevOpsOrgsClient.ListAvailable. -type AzureDevOpsOrgsClientListAvailableResponse struct { - // List of RP resources which supports pagination. - AzureDevOpsOrgListResponse -} - -// AzureDevOpsOrgsClientListResponse contains the response from method AzureDevOpsOrgsClient.NewListPager. -type AzureDevOpsOrgsClientListResponse struct { - // List of RP resources which supports pagination. - AzureDevOpsOrgListResponse -} - -// AzureDevOpsOrgsClientUpdateResponse contains the response from method AzureDevOpsOrgsClient.BeginUpdate. -type AzureDevOpsOrgsClientUpdateResponse struct { - // Azure DevOps Organization resource. - AzureDevOpsOrg -} - -// AzureDevOpsProjectsClientCreateOrUpdateResponse contains the response from method AzureDevOpsProjectsClient.BeginCreateOrUpdate. -type AzureDevOpsProjectsClientCreateOrUpdateResponse struct { - // Azure DevOps Project resource. - AzureDevOpsProject -} - -// AzureDevOpsProjectsClientGetResponse contains the response from method AzureDevOpsProjectsClient.Get. -type AzureDevOpsProjectsClientGetResponse struct { - // Azure DevOps Project resource. - AzureDevOpsProject -} - -// AzureDevOpsProjectsClientListResponse contains the response from method AzureDevOpsProjectsClient.NewListPager. -type AzureDevOpsProjectsClientListResponse struct { - // List of RP resources which supports pagination. - AzureDevOpsProjectListResponse -} - -// AzureDevOpsProjectsClientUpdateResponse contains the response from method AzureDevOpsProjectsClient.BeginUpdate. -type AzureDevOpsProjectsClientUpdateResponse struct { - // Azure DevOps Project resource. - AzureDevOpsProject -} - -// AzureDevOpsReposClientCreateOrUpdateResponse contains the response from method AzureDevOpsReposClient.BeginCreateOrUpdate. -type AzureDevOpsReposClientCreateOrUpdateResponse struct { - // Azure DevOps Repository resource. - AzureDevOpsRepository -} - -// AzureDevOpsReposClientGetResponse contains the response from method AzureDevOpsReposClient.Get. -type AzureDevOpsReposClientGetResponse struct { - // Azure DevOps Repository resource. - AzureDevOpsRepository -} - -// AzureDevOpsReposClientListResponse contains the response from method AzureDevOpsReposClient.NewListPager. -type AzureDevOpsReposClientListResponse struct { - // List of RP resources which supports pagination. - AzureDevOpsRepositoryListResponse -} - -// AzureDevOpsReposClientUpdateResponse contains the response from method AzureDevOpsReposClient.BeginUpdate. -type AzureDevOpsReposClientUpdateResponse struct { - // Azure DevOps Repository resource. - AzureDevOpsRepository -} - -// ComplianceResultsClientGetResponse contains the response from method ComplianceResultsClient.Get. -type ComplianceResultsClientGetResponse struct { - // a compliance result - ComplianceResult -} - -// ComplianceResultsClientListResponse contains the response from method ComplianceResultsClient.NewListPager. -type ComplianceResultsClientListResponse struct { - // List of compliance results response - ComplianceResultList -} - -// CompliancesClientGetResponse contains the response from method CompliancesClient.Get. -type CompliancesClientGetResponse struct { - // Compliance of a scope - Compliance -} - -// CompliancesClientListResponse contains the response from method CompliancesClient.NewListPager. -type CompliancesClientListResponse struct { - // List of Compliance objects response - ComplianceList -} - -// ConnectorApplicationClientCreateOrUpdateResponse contains the response from method ConnectorApplicationClient.CreateOrUpdate. -type ConnectorApplicationClientCreateOrUpdateResponse struct { - // Security Application over a given scope - Application -} - -// ConnectorApplicationClientDeleteResponse contains the response from method ConnectorApplicationClient.Delete. -type ConnectorApplicationClientDeleteResponse struct { - // placeholder for future response values -} - -// ConnectorApplicationClientGetResponse contains the response from method ConnectorApplicationClient.Get. -type ConnectorApplicationClientGetResponse struct { - // Security Application over a given scope - Application -} - -// ConnectorApplicationsClientListResponse contains the response from method ConnectorApplicationsClient.NewListPager. -type ConnectorApplicationsClientListResponse struct { - // Page of a security applications list - ApplicationsList -} - -// ConnectorsClientCreateOrUpdateResponse contains the response from method ConnectorsClient.CreateOrUpdate. -type ConnectorsClientCreateOrUpdateResponse struct { - // The security connector resource. - Connector -} - -// ConnectorsClientDeleteResponse contains the response from method ConnectorsClient.Delete. -type ConnectorsClientDeleteResponse struct { - // placeholder for future response values -} - -// ConnectorsClientGetResponse contains the response from method ConnectorsClient.Get. -type ConnectorsClientGetResponse struct { - // The security connector resource. - Connector -} - -// ConnectorsClientListByResourceGroupResponse contains the response from method ConnectorsClient.NewListByResourceGroupPager. -type ConnectorsClientListByResourceGroupResponse struct { - // List of security connectors response. - ConnectorsList -} - -// ConnectorsClientListResponse contains the response from method ConnectorsClient.NewListPager. -type ConnectorsClientListResponse struct { - // List of security connectors response. - ConnectorsList -} - -// ConnectorsClientUpdateResponse contains the response from method ConnectorsClient.Update. -type ConnectorsClientUpdateResponse struct { - // The security connector resource. - Connector -} - -// ContactsClientCreateResponse contains the response from method ContactsClient.Create. -type ContactsClientCreateResponse struct { - // Contact details and configurations for notifications coming from Microsoft Defender for Cloud. - Contact -} - -// ContactsClientDeleteResponse contains the response from method ContactsClient.Delete. -type ContactsClientDeleteResponse struct { - // placeholder for future response values -} - -// ContactsClientGetResponse contains the response from method ContactsClient.Get. -type ContactsClientGetResponse struct { - // Contact details and configurations for notifications coming from Microsoft Defender for Cloud. - Contact -} - -// ContactsClientListResponse contains the response from method ContactsClient.NewListPager. -type ContactsClientListResponse struct { - // List of security contacts response - 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 -} - -// CustomEntityStoreAssignmentsClientDeleteResponse contains the response from method CustomEntityStoreAssignmentsClient.Delete. -type CustomEntityStoreAssignmentsClientDeleteResponse struct { - // placeholder for future response values -} - -// CustomEntityStoreAssignmentsClientGetResponse contains the response from method CustomEntityStoreAssignmentsClient.Get. -type CustomEntityStoreAssignmentsClientGetResponse struct { - // Custom entity store assignment - CustomEntityStoreAssignment -} - -// CustomEntityStoreAssignmentsClientListByResourceGroupResponse contains the response from method CustomEntityStoreAssignmentsClient.NewListByResourceGroupPager. -type CustomEntityStoreAssignmentsClientListByResourceGroupResponse struct { - // A list of custom entity store assignments - CustomEntityStoreAssignmentsListResult -} - -// 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. @@ -625,845 +20,20 @@ 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 } -// DevOpsConfigurationsClientCreateOrUpdateResponse contains the response from method DevOpsConfigurationsClient.BeginCreateOrUpdate. -type DevOpsConfigurationsClientCreateOrUpdateResponse struct { - // DevOps Configuration resource. - DevOpsConfiguration -} - -// DevOpsConfigurationsClientDeleteResponse contains the response from method DevOpsConfigurationsClient.BeginDelete. -type DevOpsConfigurationsClientDeleteResponse struct { - // placeholder for future response values -} - -// DevOpsConfigurationsClientGetResponse contains the response from method DevOpsConfigurationsClient.Get. -type DevOpsConfigurationsClientGetResponse struct { - // DevOps Configuration resource. - DevOpsConfiguration -} - -// DevOpsConfigurationsClientListResponse contains the response from method DevOpsConfigurationsClient.NewListPager. -type DevOpsConfigurationsClientListResponse struct { - // List of RP resources which supports pagination. - DevOpsConfigurationListResponse -} - -// DevOpsConfigurationsClientUpdateResponse contains the response from method DevOpsConfigurationsClient.BeginUpdate. -type DevOpsConfigurationsClientUpdateResponse struct { - // DevOps Configuration resource. - DevOpsConfiguration -} - -// DevOpsOperationResultsClientGetResponse contains the response from method DevOpsOperationResultsClient.Get. -type DevOpsOperationResultsClientGetResponse struct { - // The current status of an async operation. - OperationStatusResult -} - -// DeviceSecurityGroupsClientCreateOrUpdateResponse contains the response from method DeviceSecurityGroupsClient.CreateOrUpdate. -type DeviceSecurityGroupsClientCreateOrUpdateResponse struct { - // The device security group resource - DeviceSecurityGroup -} - -// DeviceSecurityGroupsClientDeleteResponse contains the response from method DeviceSecurityGroupsClient.Delete. -type DeviceSecurityGroupsClientDeleteResponse struct { - // placeholder for future response values -} - -// DeviceSecurityGroupsClientGetResponse contains the response from method DeviceSecurityGroupsClient.Get. -type DeviceSecurityGroupsClientGetResponse struct { - // The device security group resource - DeviceSecurityGroup -} - -// DeviceSecurityGroupsClientListResponse contains the response from method DeviceSecurityGroupsClient.NewListPager. -type DeviceSecurityGroupsClientListResponse struct { - // List of device security groups - DeviceSecurityGroupList -} - -// DiscoveredSecuritySolutionsClientGetResponse contains the response from method DiscoveredSecuritySolutionsClient.Get. -type DiscoveredSecuritySolutionsClientGetResponse struct { - DiscoveredSecuritySolution -} - -// DiscoveredSecuritySolutionsClientListByHomeRegionResponse contains the response from method DiscoveredSecuritySolutionsClient.NewListByHomeRegionPager. -type DiscoveredSecuritySolutionsClientListByHomeRegionResponse struct { - DiscoveredSecuritySolutionList -} - -// DiscoveredSecuritySolutionsClientListResponse contains the response from method DiscoveredSecuritySolutionsClient.NewListPager. -type DiscoveredSecuritySolutionsClientListResponse struct { - DiscoveredSecuritySolutionList -} - -// ExternalSecuritySolutionsClientGetResponse contains the response from method ExternalSecuritySolutionsClient.Get. -type ExternalSecuritySolutionsClientGetResponse struct { - // 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. - 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 -} - -// ExternalSecuritySolutionsClientListResponse contains the response from method ExternalSecuritySolutionsClient.NewListPager. -type ExternalSecuritySolutionsClientListResponse struct { - ExternalSecuritySolutionList -} - -// GitHubOwnersClientGetResponse contains the response from method GitHubOwnersClient.Get. -type GitHubOwnersClientGetResponse struct { - // GitHub Owner resource. - GitHubOwner -} - -// GitHubOwnersClientListAvailableResponse contains the response from method GitHubOwnersClient.ListAvailable. -type GitHubOwnersClientListAvailableResponse struct { - // List of RP resources which supports pagination. - GitHubOwnerListResponse -} - -// GitHubOwnersClientListResponse contains the response from method GitHubOwnersClient.NewListPager. -type GitHubOwnersClientListResponse struct { - // List of RP resources which supports pagination. - GitHubOwnerListResponse -} - -// GitHubReposClientGetResponse contains the response from method GitHubReposClient.Get. -type GitHubReposClientGetResponse struct { - // GitHub Repository resource. - GitHubRepository -} - -// GitHubReposClientListResponse contains the response from method GitHubReposClient.NewListPager. -type GitHubReposClientListResponse struct { - // List of RP resources which supports pagination. - GitHubRepositoryListResponse -} - -// GitLabGroupsClientGetResponse contains the response from method GitLabGroupsClient.Get. -type GitLabGroupsClientGetResponse struct { - // GitLab Group resource. - GitLabGroup -} - -// GitLabGroupsClientListAvailableResponse contains the response from method GitLabGroupsClient.ListAvailable. -type GitLabGroupsClientListAvailableResponse struct { - // List of RP resources which supports pagination. - GitLabGroupListResponse -} - -// GitLabGroupsClientListResponse contains the response from method GitLabGroupsClient.NewListPager. -type GitLabGroupsClientListResponse struct { - // List of RP resources which supports pagination. - GitLabGroupListResponse -} - -// GitLabProjectsClientGetResponse contains the response from method GitLabProjectsClient.Get. -type GitLabProjectsClientGetResponse struct { - // GitLab Project resource. - GitLabProject -} - -// GitLabProjectsClientListResponse contains the response from method GitLabProjectsClient.NewListPager. -type GitLabProjectsClientListResponse struct { - // List of RP resources which supports pagination. - GitLabProjectListResponse -} - -// GitLabSubgroupsClientListResponse contains the response from method GitLabSubgroupsClient.List. -type GitLabSubgroupsClientListResponse struct { - // List of RP resources which supports pagination. - GitLabGroupListResponse -} - -// GovernanceAssignmentsClientCreateOrUpdateResponse contains the response from method GovernanceAssignmentsClient.CreateOrUpdate. -type GovernanceAssignmentsClientCreateOrUpdateResponse struct { - // Governance assignment over a given scope - GovernanceAssignment -} - -// GovernanceAssignmentsClientDeleteResponse contains the response from method GovernanceAssignmentsClient.Delete. -type GovernanceAssignmentsClientDeleteResponse struct { - // placeholder for future response values -} - -// GovernanceAssignmentsClientGetResponse contains the response from method GovernanceAssignmentsClient.Get. -type GovernanceAssignmentsClientGetResponse struct { - // Governance assignment over a given scope - GovernanceAssignment -} - -// GovernanceAssignmentsClientListResponse contains the response from method GovernanceAssignmentsClient.NewListPager. -type GovernanceAssignmentsClientListResponse struct { - // Page of a governance assignments list - GovernanceAssignmentsList -} - -// GovernanceRulesClientCreateOrUpdateResponse contains the response from method GovernanceRulesClient.CreateOrUpdate. -type GovernanceRulesClientCreateOrUpdateResponse struct { - // Governance rule over a given scope - GovernanceRule -} - -// GovernanceRulesClientDeleteResponse contains the response from method GovernanceRulesClient.BeginDelete. -type GovernanceRulesClientDeleteResponse struct { - // placeholder for future response values -} - -// GovernanceRulesClientExecuteResponse contains the response from method GovernanceRulesClient.BeginExecute. -type GovernanceRulesClientExecuteResponse struct { - // placeholder for future response values -} - -// GovernanceRulesClientGetResponse contains the response from method GovernanceRulesClient.Get. -type GovernanceRulesClientGetResponse struct { - // Governance rule over a given scope - GovernanceRule -} - -// GovernanceRulesClientListResponse contains the response from method GovernanceRulesClient.NewListPager. -type GovernanceRulesClientListResponse struct { - // Page of a governance rules list - GovernanceRuleList -} - -// GovernanceRulesClientOperationResultsResponse contains the response from method GovernanceRulesClient.OperationResults. -type GovernanceRulesClientOperationResultsResponse struct { - // Long run operation status of governance rule over a given scope - OperationResultAutoGenerated - - // Location contains the information returned from the location header response. - Location *string -} - -// HealthReportsClientGetResponse contains the response from method HealthReportsClient.Get. -type HealthReportsClientGetResponse struct { - // The health report resource - HealthReport -} - -// HealthReportsClientListResponse contains the response from method HealthReportsClient.NewListPager. -type HealthReportsClientListResponse struct { - // Page of health reports list - HealthReportsList -} - -// InformationProtectionPoliciesClientCreateOrUpdateResponse contains the response from method InformationProtectionPoliciesClient.CreateOrUpdate. -type InformationProtectionPoliciesClientCreateOrUpdateResponse struct { - // Information protection policy. - InformationProtectionPolicy -} - -// InformationProtectionPoliciesClientGetResponse contains the response from method InformationProtectionPoliciesClient.Get. -type InformationProtectionPoliciesClientGetResponse struct { - // Information protection policy. - InformationProtectionPolicy -} - -// InformationProtectionPoliciesClientListResponse contains the response from method InformationProtectionPoliciesClient.NewListPager. -type InformationProtectionPoliciesClientListResponse struct { - // Information protection policies response. - InformationProtectionPolicyList -} - -// IotSecuritySolutionAnalyticsClientGetResponse contains the response from method IotSecuritySolutionAnalyticsClient.Get. -type IotSecuritySolutionAnalyticsClientGetResponse struct { - // Security analytics of your IoT Security solution - IoTSecuritySolutionAnalyticsModel -} - -// IotSecuritySolutionAnalyticsClientListResponse contains the response from method IotSecuritySolutionAnalyticsClient.List. -type IotSecuritySolutionAnalyticsClientListResponse struct { - // List of Security analytics of your IoT Security solution - IoTSecuritySolutionAnalyticsModelList -} - -// IotSecuritySolutionClientCreateOrUpdateResponse contains the response from method IotSecuritySolutionClient.CreateOrUpdate. -type IotSecuritySolutionClientCreateOrUpdateResponse struct { - // IoT Security solution configuration and resource information. - IoTSecuritySolutionModel -} - -// IotSecuritySolutionClientDeleteResponse contains the response from method IotSecuritySolutionClient.Delete. -type IotSecuritySolutionClientDeleteResponse struct { - // placeholder for future response values -} - -// IotSecuritySolutionClientGetResponse contains the response from method IotSecuritySolutionClient.Get. -type IotSecuritySolutionClientGetResponse struct { - // IoT Security solution configuration and resource information. - IoTSecuritySolutionModel -} - -// IotSecuritySolutionClientListByResourceGroupResponse contains the response from method IotSecuritySolutionClient.NewListByResourceGroupPager. -type IotSecuritySolutionClientListByResourceGroupResponse struct { - // List of IoT Security solutions. - IoTSecuritySolutionsList -} - -// IotSecuritySolutionClientListBySubscriptionResponse contains the response from method IotSecuritySolutionClient.NewListBySubscriptionPager. -type IotSecuritySolutionClientListBySubscriptionResponse struct { - // List of IoT Security solutions. - IoTSecuritySolutionsList -} - -// IotSecuritySolutionClientUpdateResponse contains the response from method IotSecuritySolutionClient.Update. -type IotSecuritySolutionClientUpdateResponse struct { - // IoT Security solution configuration and resource information. - IoTSecuritySolutionModel -} - -// IotSecuritySolutionsAnalyticsAggregatedAlertClientDismissResponse contains the response from method IotSecuritySolutionsAnalyticsAggregatedAlertClient.Dismiss. -type IotSecuritySolutionsAnalyticsAggregatedAlertClientDismissResponse struct { - // placeholder for future response values -} - -// IotSecuritySolutionsAnalyticsAggregatedAlertClientGetResponse contains the response from method IotSecuritySolutionsAnalyticsAggregatedAlertClient.Get. -type IotSecuritySolutionsAnalyticsAggregatedAlertClientGetResponse struct { - // Security Solution Aggregated Alert information - IoTSecurityAggregatedAlert -} - -// IotSecuritySolutionsAnalyticsAggregatedAlertClientListResponse contains the response from method IotSecuritySolutionsAnalyticsAggregatedAlertClient.NewListPager. -type IotSecuritySolutionsAnalyticsAggregatedAlertClientListResponse struct { - // List of IoT Security solution aggregated alert data. - IoTSecurityAggregatedAlertList -} - -// IotSecuritySolutionsAnalyticsRecommendationClientGetResponse contains the response from method IotSecuritySolutionsAnalyticsRecommendationClient.Get. -type IotSecuritySolutionsAnalyticsRecommendationClientGetResponse struct { - // IoT Security solution recommendation information. - IoTSecurityAggregatedRecommendation -} - -// IotSecuritySolutionsAnalyticsRecommendationClientListResponse contains the response from method IotSecuritySolutionsAnalyticsRecommendationClient.NewListPager. -type IotSecuritySolutionsAnalyticsRecommendationClientListResponse struct { - // List of IoT Security solution aggregated recommendations. - IoTSecurityAggregatedRecommendationList -} - -// JitNetworkAccessPoliciesClientCreateOrUpdateResponse contains the response from method JitNetworkAccessPoliciesClient.CreateOrUpdate. -type JitNetworkAccessPoliciesClientCreateOrUpdateResponse struct { - JitNetworkAccessPolicy -} - -// JitNetworkAccessPoliciesClientDeleteResponse contains the response from method JitNetworkAccessPoliciesClient.Delete. -type JitNetworkAccessPoliciesClientDeleteResponse struct { - // placeholder for future response values -} - -// JitNetworkAccessPoliciesClientGetResponse contains the response from method JitNetworkAccessPoliciesClient.Get. -type JitNetworkAccessPoliciesClientGetResponse struct { - JitNetworkAccessPolicy -} - -// JitNetworkAccessPoliciesClientInitiateResponse contains the response from method JitNetworkAccessPoliciesClient.Initiate. -type JitNetworkAccessPoliciesClientInitiateResponse struct { - JitNetworkAccessRequest -} - -// JitNetworkAccessPoliciesClientListByRegionResponse contains the response from method JitNetworkAccessPoliciesClient.NewListByRegionPager. -type JitNetworkAccessPoliciesClientListByRegionResponse struct { - JitNetworkAccessPoliciesList -} - -// JitNetworkAccessPoliciesClientListByResourceGroupAndRegionResponse contains the response from method JitNetworkAccessPoliciesClient.NewListByResourceGroupAndRegionPager. -type JitNetworkAccessPoliciesClientListByResourceGroupAndRegionResponse struct { - JitNetworkAccessPoliciesList -} - -// JitNetworkAccessPoliciesClientListByResourceGroupResponse contains the response from method JitNetworkAccessPoliciesClient.NewListByResourceGroupPager. -type JitNetworkAccessPoliciesClientListByResourceGroupResponse struct { - JitNetworkAccessPoliciesList -} - -// JitNetworkAccessPoliciesClientListResponse contains the response from method JitNetworkAccessPoliciesClient.NewListPager. -type JitNetworkAccessPoliciesClientListResponse struct { - JitNetworkAccessPoliciesList -} - -// LocationsClientGetResponse contains the response from method LocationsClient.Get. -type LocationsClientGetResponse struct { - // The ASC location of the subscription is in the "name" field - AscLocation -} - -// LocationsClientListResponse contains the response from method LocationsClient.NewListPager. -type LocationsClientListResponse struct { - // List of locations where ASC saves your data - AscLocationList -} - -// MdeOnboardingsClientGetResponse contains the response from method MdeOnboardingsClient.Get. -type MdeOnboardingsClientGetResponse struct { - // The resource of the configuration or data needed to onboard the machine to MDE - MdeOnboardingData -} - -// MdeOnboardingsClientListResponse contains the response from method MdeOnboardingsClient.List. -type MdeOnboardingsClientListResponse struct { - // List of all MDE onboarding data resources - MdeOnboardingDataList -} - -// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. -type OperationsClientListResponse struct { - // List of possible operations for Microsoft.Security resource provider - OperationList -} - -// OperatorsClientCreateOrUpdateResponse contains the response from method OperatorsClient.CreateOrUpdate. -type OperatorsClientCreateOrUpdateResponse struct { - // Security operator under a given subscription and pricing - OperatorResource -} - -// OperatorsClientDeleteResponse contains the response from method OperatorsClient.Delete. -type OperatorsClientDeleteResponse struct { - // placeholder for future response values -} - -// OperatorsClientGetResponse contains the response from method OperatorsClient.Get. -type OperatorsClientGetResponse struct { - // Security operator under a given subscription and pricing - OperatorResource -} - -// OperatorsClientListResponse contains the response from method OperatorsClient.List. -type OperatorsClientListResponse struct { - // List of SecurityOperator response. - OperatorList -} - -// PricingsClientDeleteResponse contains the response from method PricingsClient.Delete. -type PricingsClientDeleteResponse struct { - // placeholder for future response values -} - -// PricingsClientGetResponse contains the response from method PricingsClient.Get. -type PricingsClientGetResponse struct { - // 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. - Pricing -} - -// PricingsClientListResponse contains the response from method PricingsClient.List. -type PricingsClientListResponse struct { - // List of pricing configurations response. - PricingList -} - -// PricingsClientUpdateResponse contains the response from method PricingsClient.Update. -type PricingsClientUpdateResponse struct { - // 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. - Pricing -} - -// RegulatoryComplianceAssessmentsClientGetResponse contains the response from method RegulatoryComplianceAssessmentsClient.Get. -type RegulatoryComplianceAssessmentsClientGetResponse struct { - // Regulatory compliance assessment details and state - RegulatoryComplianceAssessment -} - -// RegulatoryComplianceAssessmentsClientListResponse contains the response from method RegulatoryComplianceAssessmentsClient.NewListPager. -type RegulatoryComplianceAssessmentsClientListResponse struct { - // List of regulatory compliance assessment response - RegulatoryComplianceAssessmentList -} - -// RegulatoryComplianceControlsClientGetResponse contains the response from method RegulatoryComplianceControlsClient.Get. -type RegulatoryComplianceControlsClientGetResponse struct { - // Regulatory compliance control details and state - RegulatoryComplianceControl -} - -// RegulatoryComplianceControlsClientListResponse contains the response from method RegulatoryComplianceControlsClient.NewListPager. -type RegulatoryComplianceControlsClientListResponse struct { - // List of regulatory compliance controls response - RegulatoryComplianceControlList -} - -// RegulatoryComplianceStandardsClientGetResponse contains the response from method RegulatoryComplianceStandardsClient.Get. -type RegulatoryComplianceStandardsClientGetResponse struct { - // Regulatory compliance standard details and state - RegulatoryComplianceStandard -} - -// RegulatoryComplianceStandardsClientListResponse contains the response from method RegulatoryComplianceStandardsClient.NewListPager. -type RegulatoryComplianceStandardsClientListResponse struct { - // List of regulatory compliance standards response - RegulatoryComplianceStandardList -} - -// SQLVulnerabilityAssessmentBaselineRulesClientAddResponse contains the response from method SQLVulnerabilityAssessmentBaselineRulesClient.Add. -type SQLVulnerabilityAssessmentBaselineRulesClientAddResponse struct { - // A list of rules results. - RulesResults -} - -// SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateResponse contains the response from method SQLVulnerabilityAssessmentBaselineRulesClient.CreateOrUpdate. -type SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateResponse struct { - // Rule results. - RuleResults -} - -// SQLVulnerabilityAssessmentBaselineRulesClientDeleteResponse contains the response from method SQLVulnerabilityAssessmentBaselineRulesClient.Delete. -type SQLVulnerabilityAssessmentBaselineRulesClientDeleteResponse struct { - // placeholder for future response values -} - -// SQLVulnerabilityAssessmentBaselineRulesClientGetResponse contains the response from method SQLVulnerabilityAssessmentBaselineRulesClient.Get. -type SQLVulnerabilityAssessmentBaselineRulesClientGetResponse struct { - // Rule results. - RuleResults -} - -// SQLVulnerabilityAssessmentBaselineRulesClientListResponse contains the response from method SQLVulnerabilityAssessmentBaselineRulesClient.List. -type SQLVulnerabilityAssessmentBaselineRulesClientListResponse struct { - // A list of rules results. - RulesResults -} - -// SQLVulnerabilityAssessmentScanResultsClientGetResponse contains the response from method SQLVulnerabilityAssessmentScanResultsClient.Get. -type SQLVulnerabilityAssessmentScanResultsClientGetResponse struct { - // A vulnerability assessment scan result for a single rule. - ScanResult -} - -// SQLVulnerabilityAssessmentScanResultsClientListResponse contains the response from method SQLVulnerabilityAssessmentScanResultsClient.List. -type SQLVulnerabilityAssessmentScanResultsClientListResponse struct { - // A list of vulnerability assessment scan results. - ScanResults -} - -// SQLVulnerabilityAssessmentScansClientGetResponse contains the response from method SQLVulnerabilityAssessmentScansClient.Get. -type SQLVulnerabilityAssessmentScansClientGetResponse struct { - // A vulnerability assessment scan record. - Scan -} - -// SQLVulnerabilityAssessmentScansClientListResponse contains the response from method SQLVulnerabilityAssessmentScansClient.List. -type SQLVulnerabilityAssessmentScansClientListResponse struct { - // A list of vulnerability assessment scan records. - Scans -} - -// SecureScoreControlDefinitionsClientListBySubscriptionResponse contains the response from method SecureScoreControlDefinitionsClient.NewListBySubscriptionPager. -type SecureScoreControlDefinitionsClientListBySubscriptionResponse struct { - // List of security controls definition - SecureScoreControlDefinitionList -} - -// SecureScoreControlDefinitionsClientListResponse contains the response from method SecureScoreControlDefinitionsClient.NewListPager. -type SecureScoreControlDefinitionsClientListResponse struct { - // List of security controls definition - SecureScoreControlDefinitionList -} - -// SecureScoreControlsClientListBySecureScoreResponse contains the response from method SecureScoreControlsClient.NewListBySecureScorePager. -type SecureScoreControlsClientListBySecureScoreResponse struct { - // List of security controls - SecureScoreControlList -} - -// SecureScoreControlsClientListResponse contains the response from method SecureScoreControlsClient.NewListPager. -type SecureScoreControlsClientListResponse struct { - // List of security controls - SecureScoreControlList -} - -// SecureScoresClientGetResponse contains the response from method SecureScoresClient.Get. -type SecureScoresClientGetResponse struct { - // Secure score item data model - SecureScoreItem -} - -// SecureScoresClientListResponse contains the response from method SecureScoresClient.NewListPager. -type SecureScoresClientListResponse struct { - // List of secure scores - SecureScoresList -} - -// SensitivitySettingsClientCreateOrUpdateResponse contains the response from method SensitivitySettingsClient.CreateOrUpdate. -type SensitivitySettingsClientCreateOrUpdateResponse struct { - // Data sensitivity settings for sensitive data discovery - GetSensitivitySettingsResponse -} - -// SensitivitySettingsClientGetResponse contains the response from method SensitivitySettingsClient.Get. -type SensitivitySettingsClientGetResponse struct { - // Data sensitivity settings for sensitive data discovery - GetSensitivitySettingsResponse -} - -// SensitivitySettingsClientListResponse contains the response from method SensitivitySettingsClient.List. -type SensitivitySettingsClientListResponse struct { - // A list with a single sensitivity settings resource - GetSensitivitySettingsListResponse -} - -// ServerVulnerabilityAssessmentClientCreateOrUpdateResponse contains the response from method ServerVulnerabilityAssessmentClient.CreateOrUpdate. -type ServerVulnerabilityAssessmentClientCreateOrUpdateResponse struct { - // Describes the server vulnerability assessment details on a resource - ServerVulnerabilityAssessment -} - -// ServerVulnerabilityAssessmentClientDeleteResponse contains the response from method ServerVulnerabilityAssessmentClient.BeginDelete. -type ServerVulnerabilityAssessmentClientDeleteResponse struct { - // placeholder for future response values -} - -// ServerVulnerabilityAssessmentClientGetResponse contains the response from method ServerVulnerabilityAssessmentClient.Get. -type ServerVulnerabilityAssessmentClientGetResponse struct { - // Describes the server vulnerability assessment details on a resource - ServerVulnerabilityAssessment -} - -// ServerVulnerabilityAssessmentClientListByExtendedResourceResponse contains the response from method ServerVulnerabilityAssessmentClient.ListByExtendedResource. -type ServerVulnerabilityAssessmentClientListByExtendedResourceResponse struct { - // List of server vulnerability assessments - ServerVulnerabilityAssessmentsList -} - -// ServerVulnerabilityAssessmentsSettingsClientCreateOrUpdateResponse contains the response from method ServerVulnerabilityAssessmentsSettingsClient.CreateOrUpdate. -type ServerVulnerabilityAssessmentsSettingsClientCreateOrUpdateResponse struct { - // A base vulnerability assessments setting on servers in the defined scope. - 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 -} - -// ServerVulnerabilityAssessmentsSettingsClientGetResponse contains the response from method ServerVulnerabilityAssessmentsSettingsClient.Get. -type ServerVulnerabilityAssessmentsSettingsClientGetResponse struct { - // A base vulnerability assessments setting on servers in the defined scope. - 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 - ServerVulnerabilityAssessmentsSettingsList -} - -// SettingsClientGetResponse contains the response from method SettingsClient.Get. -type SettingsClientGetResponse struct { - // The kind of the security setting - 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. - SettingsList -} - -// SettingsClientUpdateResponse contains the response from method SettingsClient.Update. -type SettingsClientUpdateResponse struct { - // The kind of the security setting - 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 { - Solution -} - -// SolutionsClientListResponse contains the response from method SolutionsClient.NewListPager. -type SolutionsClientListResponse struct { - SolutionList -} - -// SolutionsReferenceDataClientListByHomeRegionResponse contains the response from method SolutionsReferenceDataClient.ListByHomeRegion. -type SolutionsReferenceDataClientListByHomeRegionResponse struct { - SolutionsReferenceDataList -} - -// SolutionsReferenceDataClientListResponse contains the response from method SolutionsReferenceDataClient.List. -type SolutionsReferenceDataClientListResponse struct { - SolutionsReferenceDataList -} - -// SubAssessmentsClientGetResponse contains the response from method SubAssessmentsClient.Get. -type SubAssessmentsClientGetResponse struct { - // Security sub-assessment on a resource - SubAssessment -} - -// SubAssessmentsClientListAllResponse contains the response from method SubAssessmentsClient.NewListAllPager. -type SubAssessmentsClientListAllResponse struct { - // List of security sub-assessments - SubAssessmentList -} - -// SubAssessmentsClientListResponse contains the response from method SubAssessmentsClient.NewListPager. -type SubAssessmentsClientListResponse struct { - // List of security sub-assessments - SubAssessmentList -} - -// TasksClientGetResourceGroupLevelTaskResponse contains the response from method TasksClient.GetResourceGroupLevelTask. -type TasksClientGetResourceGroupLevelTaskResponse struct { - // Security task that we recommend to do in order to strengthen security - Task -} - -// TasksClientGetSubscriptionLevelTaskResponse contains the response from method TasksClient.GetSubscriptionLevelTask. -type TasksClientGetSubscriptionLevelTaskResponse struct { - // Security task that we recommend to do in order to strengthen security - Task -} - -// TasksClientListByHomeRegionResponse contains the response from method TasksClient.NewListByHomeRegionPager. -type TasksClientListByHomeRegionResponse struct { - // List of security task recommendations - TaskList -} - -// TasksClientListByResourceGroupResponse contains the response from method TasksClient.NewListByResourceGroupPager. -type TasksClientListByResourceGroupResponse struct { - // List of security task recommendations - TaskList -} - -// TasksClientListResponse contains the response from method TasksClient.NewListPager. -type TasksClientListResponse struct { - // List of security task recommendations - TaskList -} - -// TasksClientUpdateResourceGroupLevelTaskStateResponse contains the response from method TasksClient.UpdateResourceGroupLevelTaskState. -type TasksClientUpdateResourceGroupLevelTaskStateResponse struct { - // placeholder for future response values -} - -// TasksClientUpdateSubscriptionLevelTaskStateResponse contains the response from method TasksClient.UpdateSubscriptionLevelTaskState. -type TasksClientUpdateSubscriptionLevelTaskStateResponse struct { - // placeholder for future response values -} - -// TopologyClientGetResponse contains the response from method TopologyClient.Get. -type TopologyClientGetResponse struct { - TopologyResource -} - -// TopologyClientListByHomeRegionResponse contains the response from method TopologyClient.NewListByHomeRegionPager. -type TopologyClientListByHomeRegionResponse struct { - TopologyList -} - -// TopologyClientListResponse contains the response from method TopologyClient.NewListPager. -type TopologyClientListResponse struct { - TopologyList -} - -// WorkspaceSettingsClientCreateResponse contains the response from method WorkspaceSettingsClient.Create. -type WorkspaceSettingsClientCreateResponse struct { - // Configures where to store the OMS agent data for workspaces under a scope - WorkspaceSetting -} - -// WorkspaceSettingsClientDeleteResponse contains the response from method WorkspaceSettingsClient.Delete. -type WorkspaceSettingsClientDeleteResponse struct { - // placeholder for future response values -} - -// WorkspaceSettingsClientGetResponse contains the response from method WorkspaceSettingsClient.Get. -type WorkspaceSettingsClientGetResponse struct { - // Configures where to store the OMS agent data for workspaces under a scope - WorkspaceSetting -} - -// WorkspaceSettingsClientListResponse contains the response from method WorkspaceSettingsClient.NewListPager. -type WorkspaceSettingsClientListResponse struct { - // List of workspace settings response - WorkspaceSettingList -} - -// WorkspaceSettingsClientUpdateResponse contains the response from method WorkspaceSettingsClient.Update. -type WorkspaceSettingsClientUpdateResponse struct { - // Configures where to store the OMS agent data for workspaces under a scope - WorkspaceSetting +// DefenderForStorageClientStartMalwareScanResponse contains the response from method DefenderForStorageClient.StartMalwareScan. +type DefenderForStorageClientStartMalwareScanResponse struct { + // Describes the state of a malware scan operation. + MalwareScan } diff --git a/sdk/resourcemanager/security/armsecurity/securescorecontroldefinitions_client.go b/sdk/resourcemanager/security/armsecurity/securescorecontroldefinitions_client.go deleted file mode 100644 index b29daaf9de0c..000000000000 --- a/sdk/resourcemanager/security/armsecurity/securescorecontroldefinitions_client.go +++ /dev/null @@ -1,151 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// SecureScoreControlDefinitionsClient contains the methods for the SecureScoreControlDefinitions group. -// Don't use this type directly, use NewSecureScoreControlDefinitionsClient() instead. -type SecureScoreControlDefinitionsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewSecureScoreControlDefinitionsClient creates a new instance of SecureScoreControlDefinitionsClient 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 NewSecureScoreControlDefinitionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SecureScoreControlDefinitionsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &SecureScoreControlDefinitionsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// NewListPager - List the available security controls, their assessments, and the max score -// -// Generated from API version 2020-01-01 -// - options - SecureScoreControlDefinitionsClientListOptions contains the optional parameters for the SecureScoreControlDefinitionsClient.NewListPager -// method. -func (client *SecureScoreControlDefinitionsClient) NewListPager(options *SecureScoreControlDefinitionsClientListOptions) *runtime.Pager[SecureScoreControlDefinitionsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[SecureScoreControlDefinitionsClientListResponse]{ - More: func(page SecureScoreControlDefinitionsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *SecureScoreControlDefinitionsClientListResponse) (SecureScoreControlDefinitionsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SecureScoreControlDefinitionsClient.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 SecureScoreControlDefinitionsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *SecureScoreControlDefinitionsClient) listCreateRequest(ctx context.Context, options *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 { - 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 -} - -// listHandleResponse handles the List response. -func (client *SecureScoreControlDefinitionsClient) listHandleResponse(resp *http.Response) (SecureScoreControlDefinitionsClientListResponse, error) { - result := SecureScoreControlDefinitionsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SecureScoreControlDefinitionList); err != nil { - return SecureScoreControlDefinitionsClientListResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionPager - For a specified subscription, list the available security controls, their assessments, and -// the max score -// -// Generated from API version 2020-01-01 -// - options - SecureScoreControlDefinitionsClientListBySubscriptionOptions contains the optional parameters for the SecureScoreControlDefinitionsClient.NewListBySubscriptionPager -// method. -func (client *SecureScoreControlDefinitionsClient) NewListBySubscriptionPager(options *SecureScoreControlDefinitionsClientListBySubscriptionOptions) *runtime.Pager[SecureScoreControlDefinitionsClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[SecureScoreControlDefinitionsClientListBySubscriptionResponse]{ - More: func(page SecureScoreControlDefinitionsClientListBySubscriptionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *SecureScoreControlDefinitionsClientListBySubscriptionResponse) (SecureScoreControlDefinitionsClientListBySubscriptionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SecureScoreControlDefinitionsClient.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 SecureScoreControlDefinitionsClientListBySubscriptionResponse{}, err - } - return client.listBySubscriptionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *SecureScoreControlDefinitionsClient) listBySubscriptionCreateRequest(ctx context.Context, options *SecureScoreControlDefinitionsClientListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControlDefinitions" - 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") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *SecureScoreControlDefinitionsClient) listBySubscriptionHandleResponse(resp *http.Response) (SecureScoreControlDefinitionsClientListBySubscriptionResponse, error) { - result := SecureScoreControlDefinitionsClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SecureScoreControlDefinitionList); err != nil { - return SecureScoreControlDefinitionsClientListBySubscriptionResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/securescorecontroldefinitions_client_example_test.go b/sdk/resourcemanager/security/armsecurity/securescorecontroldefinitions_client_example_test.go deleted file mode 100644 index 5fc826c6b71e..000000000000 --- a/sdk/resourcemanager/security/armsecurity/securescorecontroldefinitions_client_example_test.go +++ /dev/null @@ -1,183 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/secureScoreControlDefinitions/ListSecureScoreControlDefinitions_example.json -func ExampleSecureScoreControlDefinitionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSecureScoreControlDefinitionsClient().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.SecureScoreControlDefinitionList = armsecurity.SecureScoreControlDefinitionList{ - // Value: []*armsecurity.SecureScoreControlDefinitionItem{ - // { - // Name: to.Ptr("a9909064-42b4-4d34-8143-275477afe18b"), - // Type: to.Ptr("Microsoft.Security/SecureScoreControlDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Security/SecureScoreControlDefinitions/a9909064-42b4-4d34-8143-275477afe18b"), - // Properties: &armsecurity.SecureScoreControlDefinitionItemProperties{ - // Description: to.Ptr("This control contains recommendations regarding DDoS attack prevention"), - // AssessmentDefinitions: []*armsecurity.AzureResourceLink{ - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/e3de1cc0-f4dd-3b34-e496-8b5381ba2d70"), - // }}, - // DisplayName: to.Ptr("Protect applications against DDoS attacks"), - // MaxScore: to.Ptr[int32](2), - // Source: &armsecurity.SecureScoreControlDefinitionSource{ - // SourceType: to.Ptr(armsecurity.ControlTypeBuiltIn), - // }, - // }, - // }, - // { - // Name: to.Ptr("a000c66f-6da2-4f9d-826d-2364347d2588"), - // Type: to.Ptr("Microsoft.Security/SecureScoreControlDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Security/SecureScoreControlDefinitions/a000c66f-6da2-4f9d-826d-2364347d2588"), - // Properties: &armsecurity.SecureScoreControlDefinitionItemProperties{ - // Description: to.Ptr("This control contains recommendations regarding enabling adaptive application control"), - // AssessmentDefinitions: []*armsecurity.AzureResourceLink{ - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/35f45c95-27cf-4e52-891f-8390d1de5828"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/d1db3318-01ff-16de-29eb-28b344515626"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/e7ee30c4-bac9-2966-54bd-2023a4282872"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/8e2b96ff-3de2-289b-b5c1-3b9921a3441e"), - // }}, - // DisplayName: to.Ptr("Apply adaptive application control"), - // MaxScore: to.Ptr[int32](3), - // Source: &armsecurity.SecureScoreControlDefinitionSource{ - // SourceType: to.Ptr(armsecurity.ControlTypeBuiltIn), - // }, - // }, - // }}, - // } - } -} - -// 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/secureScoreControlDefinitions/ListSecureScoreControlDefinitions_subscription_example.json -func ExampleSecureScoreControlDefinitionsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSecureScoreControlDefinitionsClient().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.SecureScoreControlDefinitionList = armsecurity.SecureScoreControlDefinitionList{ - // Value: []*armsecurity.SecureScoreControlDefinitionItem{ - // { - // Name: to.Ptr("a9909064-42b4-4d34-8143-275477afe18b"), - // Type: to.Ptr("Microsoft.Security/SecureScoreControlDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Security/SecureScoreControlDefinitions/a9909064-42b4-4d34-8143-275477afe18b"), - // Properties: &armsecurity.SecureScoreControlDefinitionItemProperties{ - // Description: to.Ptr("This control contains recommendations regarding DDoS attack prevention"), - // AssessmentDefinitions: []*armsecurity.AzureResourceLink{ - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/e3de1cc0-f4dd-3b34-e496-8b5381ba2d70"), - // }}, - // DisplayName: to.Ptr("Protect applications against DDoS attacks"), - // MaxScore: to.Ptr[int32](2), - // Source: &armsecurity.SecureScoreControlDefinitionSource{ - // SourceType: to.Ptr(armsecurity.ControlTypeBuiltIn), - // }, - // }, - // }, - // { - // Name: to.Ptr("34a42fb3-e6db-409c-b56b-7b1db6b8aee0"), - // Type: to.Ptr("Microsoft.Security/SecureScoreControlDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Security/SecureScoreControlDefinitions/34a42fb3-e6db-409c-b56b-7b1db6b8aee0"), - // Properties: &armsecurity.SecureScoreControlDefinitionItemProperties{ - // Description: to.Ptr("This control contains recommendations regarding MFA"), - // AssessmentDefinitions: []*armsecurity.AzureResourceLink{ - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/151e82c5-5341-a74b-1eb0-bc38d2c84bb5"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/57e98606-6b1e-6193-0e3d-fe621387c16b"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/94290b00-4d0c-d7b4-7cea-064a9554e681"), - // }}, - // DisplayName: to.Ptr("Enable MFA"), - // MaxScore: to.Ptr[int32](10), - // Source: &armsecurity.SecureScoreControlDefinitionSource{ - // SourceType: to.Ptr(armsecurity.ControlTypeBuiltIn), - // }, - // }, - // }, - // { - // Name: to.Ptr("a000c66f-6da2-4f9d-826d-2364347d2588"), - // Type: to.Ptr("Microsoft.Security/SecureScoreControlDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Security/SecureScoreControlDefinitions/a000c66f-6da2-4f9d-826d-2364347d2588"), - // Properties: &armsecurity.SecureScoreControlDefinitionItemProperties{ - // Description: to.Ptr("This control contains recommendations regarding enabling adaptive application control"), - // AssessmentDefinitions: []*armsecurity.AzureResourceLink{ - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/35f45c95-27cf-4e52-891f-8390d1de5828"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/d1db3318-01ff-16de-29eb-28b344515626"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/e7ee30c4-bac9-2966-54bd-2023a4282872"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/8e2b96ff-3de2-289b-b5c1-3b9921a3441e"), - // }}, - // DisplayName: to.Ptr("Apply adaptive application control"), - // MaxScore: to.Ptr[int32](3), - // Source: &armsecurity.SecureScoreControlDefinitionSource{ - // SourceType: to.Ptr(armsecurity.ControlTypeBuiltIn), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/security/armsecurity/securescorecontrols_client.go b/sdk/resourcemanager/security/armsecurity/securescorecontrols_client.go deleted file mode 100644 index 0809a182e19a..000000000000 --- a/sdk/resourcemanager/security/armsecurity/securescorecontrols_client.go +++ /dev/null @@ -1,165 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// SecureScoreControlsClient contains the methods for the SecureScoreControls group. -// Don't use this type directly, use NewSecureScoreControlsClient() instead. -type SecureScoreControlsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewSecureScoreControlsClient creates a new instance of SecureScoreControlsClient 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 NewSecureScoreControlsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SecureScoreControlsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &SecureScoreControlsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// NewListPager - Get all security controls within a scope -// -// Generated from API version 2020-01-01 -// - options - SecureScoreControlsClientListOptions contains the optional parameters for the SecureScoreControlsClient.NewListPager -// method. -func (client *SecureScoreControlsClient) NewListPager(options *SecureScoreControlsClientListOptions) *runtime.Pager[SecureScoreControlsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[SecureScoreControlsClientListResponse]{ - More: func(page SecureScoreControlsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *SecureScoreControlsClientListResponse) (SecureScoreControlsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SecureScoreControlsClient.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 SecureScoreControlsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *SecureScoreControlsClient) listCreateRequest(ctx context.Context, options *SecureScoreControlsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControls" - 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() - if options != nil && options.Expand != nil { - reqQP.Set("$expand", string(*options.Expand)) - } - reqQP.Set("api-version", "2020-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 *SecureScoreControlsClient) listHandleResponse(resp *http.Response) (SecureScoreControlsClientListResponse, error) { - result := SecureScoreControlsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SecureScoreControlList); err != nil { - return SecureScoreControlsClientListResponse{}, err - } - return result, nil -} - -// NewListBySecureScorePager - Get all security controls for a specific initiative within a scope -// -// Generated from API version 2020-01-01 -// - secureScoreName - The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample request below. -// - options - SecureScoreControlsClientListBySecureScoreOptions contains the optional parameters for the SecureScoreControlsClient.NewListBySecureScorePager -// method. -func (client *SecureScoreControlsClient) NewListBySecureScorePager(secureScoreName string, options *SecureScoreControlsClientListBySecureScoreOptions) *runtime.Pager[SecureScoreControlsClientListBySecureScoreResponse] { - return runtime.NewPager(runtime.PagingHandler[SecureScoreControlsClientListBySecureScoreResponse]{ - More: func(page SecureScoreControlsClientListBySecureScoreResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *SecureScoreControlsClientListBySecureScoreResponse) (SecureScoreControlsClientListBySecureScoreResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SecureScoreControlsClient.NewListBySecureScorePager") - 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.listBySecureScoreCreateRequest(ctx, secureScoreName, options) - }, nil) - if err != nil { - return SecureScoreControlsClientListBySecureScoreResponse{}, err - } - return client.listBySecureScoreHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listBySecureScoreCreateRequest creates the ListBySecureScore request. -func (client *SecureScoreControlsClient) listBySecureScoreCreateRequest(ctx context.Context, secureScoreName string, options *SecureScoreControlsClientListBySecureScoreOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}/secureScoreControls" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if secureScoreName == "" { - return nil, errors.New("parameter secureScoreName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{secureScoreName}", url.PathEscape(secureScoreName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Expand != nil { - reqQP.Set("$expand", string(*options.Expand)) - } - reqQP.Set("api-version", "2020-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySecureScoreHandleResponse handles the ListBySecureScore response. -func (client *SecureScoreControlsClient) listBySecureScoreHandleResponse(resp *http.Response) (SecureScoreControlsClientListBySecureScoreResponse, error) { - result := SecureScoreControlsClientListBySecureScoreResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SecureScoreControlList); err != nil { - return SecureScoreControlsClientListBySecureScoreResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/securescorecontrols_client_example_test.go b/sdk/resourcemanager/security/armsecurity/securescorecontrols_client_example_test.go deleted file mode 100644 index 42bad37f9c87..000000000000 --- a/sdk/resourcemanager/security/armsecurity/securescorecontrols_client_example_test.go +++ /dev/null @@ -1,1594 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/secureScores/ListSecureScoreControlsForName_builtin_example.json -func ExampleSecureScoreControlsClient_NewListBySecureScorePager_getSecurityControlsAndTheirCurrentScoreForTheSpecifiedInitiative() { - 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.NewSecureScoreControlsClient().NewListBySecureScorePager("ascScore", &armsecurity.SecureScoreControlsClientListBySecureScoreOptions{Expand: 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.SecureScoreControlList = armsecurity.SecureScoreControlList{ - // Value: []*armsecurity.SecureScoreControlDetails{ - // { - // Name: to.Ptr("a9909064-42b4-4d34-8143-275477afe18b"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/a9909064-42b4-4d34-8143-275477afe18b"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // DisplayName: to.Ptr("Protect applications against DDoS attacks"), - // HealthyResourceCount: to.Ptr[int32](0), - // NotApplicableResourceCount: to.Ptr[int32](1), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](0), - // Max: to.Ptr[int32](0), - // Percentage: to.Ptr[float64](0), - // }, - // UnhealthyResourceCount: to.Ptr[int32](0), - // Weight: to.Ptr[int64](0), - // }, - // }, - // { - // Name: to.Ptr("34a42fb3-e6db-409c-b56b-7b1db6b8aee0"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/34a42fb3-e6db-409c-b56b-7b1db6b8aee0"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // DisplayName: to.Ptr("Enable MFA"), - // HealthyResourceCount: to.Ptr[int32](1), - // NotApplicableResourceCount: to.Ptr[int32](0), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](10), - // Max: to.Ptr[int32](10), - // Percentage: to.Ptr[float64](1), - // }, - // UnhealthyResourceCount: to.Ptr[int32](0), - // Weight: to.Ptr[int64](1), - // }, - // }, - // { - // Name: to.Ptr("76763537-9feb-42d3-b4f4-78c01117be80"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/76763537-9feb-42d3-b4f4-78c01117be80"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // DisplayName: to.Ptr("Implement security best practices"), - // HealthyResourceCount: to.Ptr[int32](7), - // NotApplicableResourceCount: to.Ptr[int32](1), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](0), - // Max: to.Ptr[int32](0), - // Percentage: to.Ptr[float64](0), - // }, - // UnhealthyResourceCount: to.Ptr[int32](0), - // Weight: to.Ptr[int64](7), - // }, - // }, - // { - // Name: to.Ptr("4db8d6cf-075b-4149-a813-da09ca2ae120"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/4db8d6cf-075b-4149-a813-da09ca2ae120"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // DisplayName: to.Ptr("Enable Advanced Threat Protection"), - // HealthyResourceCount: to.Ptr[int32](0), - // NotApplicableResourceCount: to.Ptr[int32](0), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](0), - // Max: to.Ptr[int32](0), - // Percentage: to.Ptr[float64](0), - // }, - // UnhealthyResourceCount: to.Ptr[int32](1), - // Weight: to.Ptr[int64](1), - // }, - // }, - // { - // Name: to.Ptr("27b24961-75ba-4fe4-8909-97286d5dd5ee"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/27b24961-75ba-4fe4-8909-97286d5dd5ee"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // DisplayName: to.Ptr("Enable auditing and logging"), - // HealthyResourceCount: to.Ptr[int32](1), - // NotApplicableResourceCount: to.Ptr[int32](0), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](0.2), - // Max: to.Ptr[int32](1), - // Percentage: to.Ptr[float64](0.2), - // }, - // UnhealthyResourceCount: to.Ptr[int32](4), - // Weight: to.Ptr[int64](5), - // }, - // }, - // { - // Name: to.Ptr("2d85f639-0bea-4a4a-b6c6-608952a1414a"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/2d85f639-0bea-4a4a-b6c6-608952a1414a"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // DisplayName: to.Ptr("Manage access and permissions"), - // HealthyResourceCount: to.Ptr[int32](1), - // NotApplicableResourceCount: to.Ptr[int32](0), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](2), - // Max: to.Ptr[int32](4), - // Percentage: to.Ptr[float64](0.5), - // }, - // UnhealthyResourceCount: to.Ptr[int32](1), - // Weight: to.Ptr[int64](2), - // }, - // }, - // { - // Name: to.Ptr("99fc8df2-e0f5-40f8-9415-a7f7ca948b5a"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/99fc8df2-e0f5-40f8-9415-a7f7ca948b5a"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // DisplayName: to.Ptr("Remediate security configurations"), - // HealthyResourceCount: to.Ptr[int32](0), - // NotApplicableResourceCount: to.Ptr[int32](0), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](0), - // Max: to.Ptr[int32](4), - // Percentage: to.Ptr[float64](0), - // }, - // UnhealthyResourceCount: to.Ptr[int32](1), - // Weight: to.Ptr[int64](1), - // }, - // }, - // { - // Name: to.Ptr("12136bd9-dc24-44f2-9587-7be3af6aac14"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/12136bd9-dc24-44f2-9587-7be3af6aac14"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // DisplayName: to.Ptr("Enable endpoint protection"), - // HealthyResourceCount: to.Ptr[int32](0), - // NotApplicableResourceCount: to.Ptr[int32](0), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](0), - // Max: to.Ptr[int32](2), - // Percentage: to.Ptr[float64](0), - // }, - // UnhealthyResourceCount: to.Ptr[int32](1), - // Weight: to.Ptr[int64](1), - // }, - // }, - // { - // Name: to.Ptr("61702b76-1fab-41f2-bcbc-50b7870dcf38"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/61702b76-1fab-41f2-bcbc-50b7870dcf38"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // DisplayName: to.Ptr("Apply system updates"), - // HealthyResourceCount: to.Ptr[int32](0), - // NotApplicableResourceCount: to.Ptr[int32](0), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](0), - // Max: to.Ptr[int32](6), - // Percentage: to.Ptr[float64](0), - // }, - // UnhealthyResourceCount: to.Ptr[int32](1), - // Weight: to.Ptr[int64](1), - // }, - // }, - // { - // Name: to.Ptr("0e55495e-034f-4abc-8293-767229250176"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/0e55495e-034f-4abc-8293-767229250176"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // DisplayName: to.Ptr("Encrypt data in transit"), - // HealthyResourceCount: to.Ptr[int32](5), - // NotApplicableResourceCount: to.Ptr[int32](0), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](3.33), - // Max: to.Ptr[int32](4), - // Percentage: to.Ptr[float64](0.8325), - // }, - // UnhealthyResourceCount: to.Ptr[int32](1), - // Weight: to.Ptr[int64](6), - // }, - // }, - // { - // Name: to.Ptr("f9d5432b-8f7b-45e9-b90c-e214a30f6a02"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/f9d5432b-8f7b-45e9-b90c-e214a30f6a02"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // DisplayName: to.Ptr("Restrict unauthorized network access"), - // HealthyResourceCount: to.Ptr[int32](1), - // NotApplicableResourceCount: to.Ptr[int32](0), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](4), - // Max: to.Ptr[int32](4), - // Percentage: to.Ptr[float64](1), - // }, - // UnhealthyResourceCount: to.Ptr[int32](0), - // Weight: to.Ptr[int64](1), - // }, - // }, - // { - // Name: to.Ptr("8fd574ec-43cf-426e-a439-a67cbaf2d564"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/8fd574ec-43cf-426e-a439-a67cbaf2d564"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // DisplayName: to.Ptr("Enable encryption at rest"), - // HealthyResourceCount: to.Ptr[int32](1), - // NotApplicableResourceCount: to.Ptr[int32](0), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](4), - // Max: to.Ptr[int32](4), - // Percentage: to.Ptr[float64](1), - // }, - // UnhealthyResourceCount: to.Ptr[int32](0), - // Weight: to.Ptr[int64](1), - // }, - // }}, - // } - } -} - -// 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/secureScores/ListSecureScoreControlsForNameWithExpand_builtin_example.json -func ExampleSecureScoreControlsClient_NewListBySecureScorePager_getSecurityControlsAndTheirCurrentScoreForTheSpecifiedInitiativeWithTheExpandParameter() { - 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.NewSecureScoreControlsClient().NewListBySecureScorePager("ascScore", &armsecurity.SecureScoreControlsClientListBySecureScoreOptions{Expand: to.Ptr(armsecurity.ExpandControlsEnumDefinition)}) - 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.SecureScoreControlList = armsecurity.SecureScoreControlList{ - // Value: []*armsecurity.SecureScoreControlDetails{ - // { - // Name: to.Ptr("a9909064-42b4-4d34-8143-275477afe18b"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/a9909064-42b4-4d34-8143-275477afe18b"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // Definition: &armsecurity.SecureScoreControlDefinitionItem{ - // Name: to.Ptr("a9909064-42b4-4d34-8143-275477afe18b"), - // Type: to.Ptr("Microsoft.Security/secureScoreControlDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Security/secureScoreControlDefinitions/a9909064-42b4-4d34-8143-275477afe18b"), - // Properties: &armsecurity.SecureScoreControlDefinitionItemProperties{ - // AssessmentDefinitions: []*armsecurity.AzureResourceLink{ - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/e3de1cc0-f4dd-3b34-e496-8b5381ba2d70"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/08e628db-e2ed-4793-bc91-d13e684401c3"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/405c9ae6-49f9-46c4-8873-a86690f27818"), - // }}, - // DisplayName: to.Ptr("Protect applications against DDoS attacks"), - // MaxScore: to.Ptr[int32](2), - // Source: &armsecurity.SecureScoreControlDefinitionSource{ - // SourceType: to.Ptr(armsecurity.ControlTypeBuiltIn), - // }, - // }, - // }, - // DisplayName: to.Ptr("Protect applications against DDoS attacks"), - // HealthyResourceCount: to.Ptr[int32](0), - // NotApplicableResourceCount: to.Ptr[int32](1), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](0), - // Max: to.Ptr[int32](0), - // Percentage: to.Ptr[float64](0), - // }, - // UnhealthyResourceCount: to.Ptr[int32](0), - // Weight: to.Ptr[int64](0), - // }, - // }, - // { - // Name: to.Ptr("34a42fb3-e6db-409c-b56b-7b1db6b8aee0"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/34a42fb3-e6db-409c-b56b-7b1db6b8aee0"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // Definition: &armsecurity.SecureScoreControlDefinitionItem{ - // Name: to.Ptr("34a42fb3-e6db-409c-b56b-7b1db6b8aee0"), - // Type: to.Ptr("Microsoft.Security/secureScoreControlDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Security/secureScoreControlDefinitions/34a42fb3-e6db-409c-b56b-7b1db6b8aee0"), - // Properties: &armsecurity.SecureScoreControlDefinitionItemProperties{ - // AssessmentDefinitions: []*armsecurity.AzureResourceLink{ - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/94290b00-4d0c-d7b4-7cea-064a9554e681"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/57e98606-6b1e-6193-0e3d-fe621387c16b"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/1f24d55a-df0f-4772-9090-4629c2d6bfff"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/8e3d9ac0-a248-4276-a437-304c6cd1443b"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/8d7a6128-c8f2-43df-b422-7877346f9ddb"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/dbfc99e3-e648-4c3b-bd32-995e6268430d"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/4a946e22-47e8-443d-8761-b25620b4a1e1"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/a7c8fa46-526d-4bf6-b8b3-17fa01310fd8"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/20f6c761-4dd7-4f27-9e37-6db8471486ef"), - // }}, - // DisplayName: to.Ptr("Enable MFA"), - // MaxScore: to.Ptr[int32](10), - // Source: &armsecurity.SecureScoreControlDefinitionSource{ - // SourceType: to.Ptr(armsecurity.ControlTypeBuiltIn), - // }, - // }, - // }, - // DisplayName: to.Ptr("Enable MFA"), - // HealthyResourceCount: to.Ptr[int32](1), - // NotApplicableResourceCount: to.Ptr[int32](0), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](10), - // Max: to.Ptr[int32](10), - // Percentage: to.Ptr[float64](1), - // }, - // UnhealthyResourceCount: to.Ptr[int32](0), - // Weight: to.Ptr[int64](1), - // }, - // }, - // { - // Name: to.Ptr("76763537-9feb-42d3-b4f4-78c01117be80"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/76763537-9feb-42d3-b4f4-78c01117be80"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // Definition: &armsecurity.SecureScoreControlDefinitionItem{ - // Name: to.Ptr("76763537-9feb-42d3-b4f4-78c01117be80"), - // Type: to.Ptr("Microsoft.Security/secureScoreControlDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Security/secureScoreControlDefinitions/76763537-9feb-42d3-b4f4-78c01117be80"), - // Properties: &armsecurity.SecureScoreControlDefinitionItemProperties{ - // AssessmentDefinitions: []*armsecurity.AzureResourceLink{ - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/151e82c5-5341-a74b-1eb0-bc38d2c84bb5"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/a8c6a4ad-d51e-88fe-2979-d3ee3c864f8b"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/6f90a6d6-d4d6-0794-0ec1-98fa77878c2e"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/a9341235-9389-42f0-a0bf-9bfb57960d44"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/45d313c3-3fca-5040-035f-d61928366d31"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/f0553104-cfdb-65e6-759c-002812e38500"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/47bb383c-8e25-95f0-c2aa-437add1d87d3"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/12018f4f-3d10-999b-e4c4-86ec25be08a1"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/eade5b56-eefd-444f-95c8-23f29e5d93cb"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/ebe970fe-9c27-4dd7-a165-1e943d565e10"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/f7010359-8d21-4598-a9f2-c3e81a17141e"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/24d8af06-d441-40b4-a49c-311421aa9f58"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/8c3e93d3-0276-4d06-b20a-9a9f3012742c"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/9172da4e-9571-6e33-2b5b-d742847f3be7"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/093c685b-56dd-13a3-8ed5-887a001837a2"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/64b8637e-4e1d-76a9-0fc9-c1e487a97ed8"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/fe02b3b7-a722-d4d6-6731-6493776203a6"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/57f36d21-69e3-4b0f-a66c-18629d1b736d"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/6c99f570-2ce7-46bc-8175-cde013df43bc"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/22489c48-27d1-4e40-9420-4303ad9cffef"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/fc84abc0-eee6-4758-8372-a7681965ca44"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/726cde3e-02f8-4041-8935-727f2be19ba7"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/a2bb3a1b-4a09-4cf7-9e79-c438687e2c2f"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/664c6a0b-5cd2-4140-aaff-a94241c07afd"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/3af5de46-fda8-4b6e-90f1-6565187d7c48"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/a9a59ebb-5d6f-42f5-92a1-036fd0fd1879"), - // }}, - // DisplayName: to.Ptr("Implement security best practices"), - // MaxScore: to.Ptr[int32](0), - // Source: &armsecurity.SecureScoreControlDefinitionSource{ - // SourceType: to.Ptr(armsecurity.ControlTypeBuiltIn), - // }, - // }, - // }, - // DisplayName: to.Ptr("Implement security best practices"), - // HealthyResourceCount: to.Ptr[int32](7), - // NotApplicableResourceCount: to.Ptr[int32](1), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](0), - // Max: to.Ptr[int32](0), - // Percentage: to.Ptr[float64](0), - // }, - // UnhealthyResourceCount: to.Ptr[int32](0), - // Weight: to.Ptr[int64](7), - // }, - // }, - // { - // Name: to.Ptr("4db8d6cf-075b-4149-a813-da09ca2ae120"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/4db8d6cf-075b-4149-a813-da09ca2ae120"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // Definition: &armsecurity.SecureScoreControlDefinitionItem{ - // Name: to.Ptr("4db8d6cf-075b-4149-a813-da09ca2ae120"), - // Type: to.Ptr("Microsoft.Security/secureScoreControlDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Security/secureScoreControlDefinitions/4db8d6cf-075b-4149-a813-da09ca2ae120"), - // Properties: &armsecurity.SecureScoreControlDefinitionItemProperties{ - // AssessmentDefinitions: []*armsecurity.AzureResourceLink{ - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/56a6e81f-7413-4f72-9a1b-aaeeaa87c872"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/0876ef51-fee7-449d-ba1e-f2662c7e43c6"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/58d72d9d-0310-4792-9a3b-6dd111093cdb"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/6ac66a74-761f-4a59-928a-d373eea3f028"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/1be22853-8ed1-4005-9907-ddad64cb1417"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/86ea1a79-29d3-4eac-a9f4-3541ace4e718"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/53572822-d3fc-4363-bfb9-248645841612"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/b1af52e4-e968-4e2b-b6d0-6736c9651f0a"), - // }}, - // DisplayName: to.Ptr("Enable Advanced Threat Protection"), - // MaxScore: to.Ptr[int32](0), - // Source: &armsecurity.SecureScoreControlDefinitionSource{ - // SourceType: to.Ptr(armsecurity.ControlTypeBuiltIn), - // }, - // }, - // }, - // DisplayName: to.Ptr("Enable Advanced Threat Protection"), - // HealthyResourceCount: to.Ptr[int32](0), - // NotApplicableResourceCount: to.Ptr[int32](0), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](0), - // Max: to.Ptr[int32](0), - // Percentage: to.Ptr[float64](0), - // }, - // UnhealthyResourceCount: to.Ptr[int32](1), - // Weight: to.Ptr[int64](1), - // }, - // }, - // { - // Name: to.Ptr("27b24961-75ba-4fe4-8909-97286d5dd5ee"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/27b24961-75ba-4fe4-8909-97286d5dd5ee"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // Definition: &armsecurity.SecureScoreControlDefinitionItem{ - // Name: to.Ptr("27b24961-75ba-4fe4-8909-97286d5dd5ee"), - // Type: to.Ptr("Microsoft.Security/secureScoreControlDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Security/secureScoreControlDefinitions/27b24961-75ba-4fe4-8909-97286d5dd5ee"), - // Properties: &armsecurity.SecureScoreControlDefinitionItemProperties{ - // AssessmentDefinitions: []*armsecurity.AzureResourceLink{ - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/94208a8b-16e8-4e5b-abbd-4e81c9d02bee"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/c6dad669-efd7-cd72-61c5-289935607791"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/77785808-ce86-4e40-b45f-19110a547397"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/32771b45-220c-1a8b-584e-fdd5a2584a66"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/f11b27f2-8c49-5bb4-eff5-e1e5384bf95e"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/f19ab7d9-5ff2-f8fd-ab3b-0bf95dcb6889"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/ad5bbaeb-7632-5edf-f1c2-752075831ce8"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/dea5192e-1bb3-101b-b70c-4646546f5e1e"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/1597605a-0faf-5860-eb74-462ae2e9fc21"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/91387f44-7e43-4ecc-55f0-46f5adee3dd5"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/961eb649-3ea9-f8c2-6595-88e9a3aeedeb"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/88bbc99c-e5af-ddd7-6105-6150b2bfa519"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/22438e3c-73c8-40af-a083-10c980c63aa2"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/5720f1a6-6061-4768-9c0d-2000a6041744"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/dbfc99e3-e648-4c3b-bd32-995e6268430d"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/30c69b23-a9a2-4729-aca6-f21adacfff66"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/a9ac48d8-8dd7-42b9-9752-b1fa70ea5dd9"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/00261067-76a8-4ebb-b5fc-becc81067bee"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/83ca4867-58c1-45d6-b6b6-dbf226512891"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/a269cbdb-86e8-431c-9ff2-f0ea491174d8"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/5ea59e47-093b-446f-9765-5b0ec4c9da61"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/011397ca-1366-4bcc-b85a-7a5e3df2e80b"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/c62371bc-f6a7-4915-b5b5-14288682cf79"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/293ba336-7312-42fc-a59d-836e4e678b17"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/0b547a38-2c0d-47e1-b9a2-a59fccc140db"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/7d0ad86f-f43b-4889-b2f7-09d91bd1407b"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/b20558b6-de31-480c-8aa0-e920d62b9764"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/022efc2d-5119-480b-a203-e151b6b2645c"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/3ee7608e-f0e7-4c26-8921-5ae46c4e99df"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/33765629-073d-49eb-bab4-64bdf8ac90da"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/9c054f50-823f-45ab-839e-9df4eb7c2f11"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/f61e15f3-4bcf-4d2e-8f06-32237cabe0a0"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/cdb3af55-2abf-476b-aac7-5cfec366a4dd"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/bc26b0d4-a1d7-4665-9d44-efc205ae73f0"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/3812e247-34f2-4f06-a312-89a8fe51fa37"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/f0f8405a-5ecc-4314-808e-083e030d6163"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/c23e0eec-eee4-4632-b1c2-6c884c3c963b"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/7ce5a01f-e94b-438a-8b72-fa02c076f11a"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/46e4e0ed-106d-405e-b1a9-ca34c8f7d31f"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/b1294b0d-9b2e-4e1b-9f67-77a75fb10a65"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/0b86a67f-bde5-4c91-b10c-4102033b8692"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/3d55e4b1-ecdb-4eaf-9e3f-b00a764182bd"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/a7c8fa46-526d-4bf6-b8b3-17fa01310fd8"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/20f6c761-4dd7-4f27-9e37-6db8471486ef"), - // }}, - // DisplayName: to.Ptr("Enable auditing and logging"), - // MaxScore: to.Ptr[int32](1), - // Source: &armsecurity.SecureScoreControlDefinitionSource{ - // SourceType: to.Ptr(armsecurity.ControlTypeBuiltIn), - // }, - // }, - // }, - // DisplayName: to.Ptr("Enable auditing and logging"), - // HealthyResourceCount: to.Ptr[int32](1), - // NotApplicableResourceCount: to.Ptr[int32](0), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](0.2), - // Max: to.Ptr[int32](1), - // Percentage: to.Ptr[float64](0.2), - // }, - // UnhealthyResourceCount: to.Ptr[int32](4), - // Weight: to.Ptr[int64](5), - // }, - // }, - // { - // Name: to.Ptr("2d85f639-0bea-4a4a-b6c6-608952a1414a"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/2d85f639-0bea-4a4a-b6c6-608952a1414a"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // Definition: &armsecurity.SecureScoreControlDefinitionItem{ - // Name: to.Ptr("2d85f639-0bea-4a4a-b6c6-608952a1414a"), - // Type: to.Ptr("Microsoft.Security/secureScoreControlDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Security/secureScoreControlDefinitions/2d85f639-0bea-4a4a-b6c6-608952a1414a"), - // Properties: &armsecurity.SecureScoreControlDefinitionItemProperties{ - // AssessmentDefinitions: []*armsecurity.AzureResourceLink{ - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/c3b6ae71-f1f0-31b4-e6c1-d5951285d03d"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/04e7147b-0deb-9796-2e5c-0336343ceb3d"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/e52064aa-6853-e252-a11e-dffc675689c2"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/00c6d40b-e990-6acf-d4f3-471e747a27c4"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/2c79b4af-f830-b61e-92b9-63dfa30f16e4"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/b0fdc63a-38e7-4bab-a7c4-2c2665abbaa9"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/03afeb6f-7634-adb3-0a01-803b0b9cb611"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/9d07b7e6-2986-4964-a76c-b2689604e212"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/08e628db-e2ed-4793-bc91-d13e684401c3"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/5d90913f-a1c5-4429-ad54-2c6c17fb3c73"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/582c14e9-48c1-4b25-ab93-91bdeaf9120c"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/8a10942a-02ca-483f-81ae-2260ea7808cc"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/9b8eac17-6b11-4b94-9bb4-18c81aee7123"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/554ba13c-d7d4-4530-88ce-94cf11a670ce"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/66a1d478-4d24-42d4-8eca-dcdab6532a18"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/b396f112-a462-4813-a93f-80bc90041e4d"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/5425052d-cc0d-4424-af71-050311f99634"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/09cb7d54-db05-4d31-97f3-9bbfe1dff610"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/01fb1ad4-303b-4789-abf2-c024c4a76523"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/0de072b9-6515-4985-842e-0318047bb85b"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/8c3f474a-234e-442f-92b3-2a45e37f7eee"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/c55461af-4923-4fbb-b270-40d5e5f4c0ff"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/bbdc4999-1462-4d46-853b-2f8c6ca1c682"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/9e1f12d0-cb3d-4e1c-a468-6bc3d934c99d"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/fd5d38f6-340e-4bd2-88f2-e1314c3c07a9"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/0384d5b7-5def-4130-b7b5-db7da7e63276"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/dbfc99e3-e648-4c3b-bd32-995e6268430d"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/0ad39832-f031-4fdd-885e-c6cce85ac77c"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/90191798-da1b-40dd-aa9c-1c0eafb1ba87"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/ddced3c8-a5e2-4dc4-b0fe-1331c77fc9c4"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/52f83ea2-6871-45c3-8b26-13566e966638"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/79b4eb34-c06e-49bf-883d-5352a21a962f"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/5723400d-5b2a-45f1-99ee-837986866318"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/76e8881d-f18e-4e1b-b01d-376d0260e066"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/0eaf40a8-5673-4b33-8457-a31d85882233"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/5a235918-41a2-4bd0-8ab0-00a596e9d6a8"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/3ff38dcd-92e2-4b67-8765-35bb0174a4c7"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/1ff4501b-2109-4ef6-ba9d-e824a96d63d0"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/f493084a-d3c4-4886-8cf2-3c815aeef901"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/a7c8fa46-526d-4bf6-b8b3-17fa01310fd8"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/20f6c761-4dd7-4f27-9e37-6db8471486ef"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/11c95609-3553-430d-b788-fd41cde8b2db"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/27d6f0e9-b4d5-468b-ae7e-03d5473fd864"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/f0debc84-981c-4a0d-924d-aa4bd7d55fef"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/9b795646-9130-41a4-90b7-df9eae2437c8"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/802c0637-5a8c-4c98-abd7-7c96d89d6010"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/43dc2a2e-ce69-4d42-923e-ab7d136f2cfe"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/2acd365d-e8b5-4094-bce4-244b7c51d67c"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/51fd8bb1-0db4-bbf1-7e2b-cfcba7eb66a6"), - // }}, - // DisplayName: to.Ptr("Manage access and permissions"), - // MaxScore: to.Ptr[int32](4), - // Source: &armsecurity.SecureScoreControlDefinitionSource{ - // SourceType: to.Ptr(armsecurity.ControlTypeBuiltIn), - // }, - // }, - // }, - // DisplayName: to.Ptr("Manage access and permissions"), - // HealthyResourceCount: to.Ptr[int32](1), - // NotApplicableResourceCount: to.Ptr[int32](0), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](2), - // Max: to.Ptr[int32](4), - // Percentage: to.Ptr[float64](0.5), - // }, - // UnhealthyResourceCount: to.Ptr[int32](1), - // Weight: to.Ptr[int64](2), - // }, - // }, - // { - // Name: to.Ptr("99fc8df2-e0f5-40f8-9415-a7f7ca948b5a"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/99fc8df2-e0f5-40f8-9415-a7f7ca948b5a"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // Definition: &armsecurity.SecureScoreControlDefinitionItem{ - // Name: to.Ptr("99fc8df2-e0f5-40f8-9415-a7f7ca948b5a"), - // Type: to.Ptr("Microsoft.Security/secureScoreControlDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Security/secureScoreControlDefinitions/99fc8df2-e0f5-40f8-9415-a7f7ca948b5a"), - // Properties: &armsecurity.SecureScoreControlDefinitionItemProperties{ - // AssessmentDefinitions: []*armsecurity.AzureResourceLink{ - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/d1db3318-01ff-16de-29eb-28b344515626"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/e7ee30c4-bac9-2966-54bd-2023a4282872"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/27ac71b1-75c5-41c2-adc2-858f5db45b08"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/720a3e77-0b9a-4fa9-98b6-ddf0fd7e32c1"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/8e2b96ff-3de2-289b-b5c1-3b9921a3441e"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/181ac480-f7c4-544b-9865-11b8ffe87f47"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/8c3d9ad0-3639-4686-9cd2-2b2ab2609bda"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/0677209d-e675-2c6f-e91a-54cef2878663"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/a3eee263-aa01-4b52-a7c0-0094578ef48f"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/45cfe080-ceb1-a91e-9743-71551ed24e94"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/8941d121-f740-35f6-952c-6561d2b38d36"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/0396b18c-41aa-489c-affd-4ee5d1714a59"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/fa924a53-0837-4296-9bf7-18ce7dd68593"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/9e1789cd-7b61-42db-ba12-7268283ba466"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/233da9cd-11bf-463a-8aa7-4c81b9e788d1"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/c4131c22-1ecc-4beb-9961-d90108bd975f"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/d74d2738-2485-4103-9919-69c7e63776ec"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/5f65e47f-7a00-4bf3-acae-90ee441ee876"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/bc85a7ee-7f43-47ab-8736-4faaec9346b5"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/08e628db-e2ed-4793-bc91-d13e684401c3"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/86f91051-9d6a-47c3-a07f-bd14cb214b45"), - // }}, - // DisplayName: to.Ptr("Remediate security configurations"), - // MaxScore: to.Ptr[int32](4), - // Source: &armsecurity.SecureScoreControlDefinitionSource{ - // SourceType: to.Ptr(armsecurity.ControlTypeBuiltIn), - // }, - // }, - // }, - // DisplayName: to.Ptr("Remediate security configurations"), - // HealthyResourceCount: to.Ptr[int32](0), - // NotApplicableResourceCount: to.Ptr[int32](0), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](0), - // Max: to.Ptr[int32](4), - // Percentage: to.Ptr[float64](0), - // }, - // UnhealthyResourceCount: to.Ptr[int32](1), - // Weight: to.Ptr[int64](1), - // }, - // }, - // { - // Name: to.Ptr("12136bd9-dc24-44f2-9587-7be3af6aac14"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/12136bd9-dc24-44f2-9587-7be3af6aac14"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // Definition: &armsecurity.SecureScoreControlDefinitionItem{ - // Name: to.Ptr("12136bd9-dc24-44f2-9587-7be3af6aac14"), - // Type: to.Ptr("Microsoft.Security/secureScoreControlDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Security/secureScoreControlDefinitions/12136bd9-dc24-44f2-9587-7be3af6aac14"), - // Properties: &armsecurity.SecureScoreControlDefinitionItemProperties{ - // AssessmentDefinitions: []*armsecurity.AzureResourceLink{ - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/d1db3318-01ff-16de-29eb-28b344515626"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/e7ee30c4-bac9-2966-54bd-2023a4282872"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/27ac71b1-75c5-41c2-adc2-858f5db45b08"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/720a3e77-0b9a-4fa9-98b6-ddf0fd7e32c1"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/8e2b96ff-3de2-289b-b5c1-3b9921a3441e"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/83f577bd-a1b6-b7e1-0891-12ca19d1e6df"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/4fb67663-9ab9-475d-b026-8c544cced439"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/383cf3bc-fdf9-4a02-120a-3e7e36c6bfee"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/3bcd234d-c9c7-c2a2-89e0-c01f419c1a8a"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/37a3689a-818e-4a0e-82ac-b1392b9bb000"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/45cfe080-ceb1-a91e-9743-71551ed24e94"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/21300918-b2e3-0346-785f-c77ff57d243b"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/e71020c2-860c-3235-cd39-04f3f8c936d2"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/bc85a7ee-7f43-47ab-8736-4faaec9346b5"), - // }}, - // DisplayName: to.Ptr("Enable endpoint protection"), - // MaxScore: to.Ptr[int32](2), - // Source: &armsecurity.SecureScoreControlDefinitionSource{ - // SourceType: to.Ptr(armsecurity.ControlTypeBuiltIn), - // }, - // }, - // }, - // DisplayName: to.Ptr("Enable endpoint protection"), - // HealthyResourceCount: to.Ptr[int32](0), - // NotApplicableResourceCount: to.Ptr[int32](0), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](0), - // Max: to.Ptr[int32](2), - // Percentage: to.Ptr[float64](0), - // }, - // UnhealthyResourceCount: to.Ptr[int32](1), - // Weight: to.Ptr[int64](1), - // }, - // }, - // { - // Name: to.Ptr("61702b76-1fab-41f2-bcbc-50b7870dcf38"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/61702b76-1fab-41f2-bcbc-50b7870dcf38"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // Definition: &armsecurity.SecureScoreControlDefinitionItem{ - // Name: to.Ptr("61702b76-1fab-41f2-bcbc-50b7870dcf38"), - // Type: to.Ptr("Microsoft.Security/secureScoreControlDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Security/secureScoreControlDefinitions/61702b76-1fab-41f2-bcbc-50b7870dcf38"), - // Properties: &armsecurity.SecureScoreControlDefinitionItemProperties{ - // AssessmentDefinitions: []*armsecurity.AzureResourceLink{ - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/d1db3318-01ff-16de-29eb-28b344515626"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/e7ee30c4-bac9-2966-54bd-2023a4282872"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/27ac71b1-75c5-41c2-adc2-858f5db45b08"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/720a3e77-0b9a-4fa9-98b6-ddf0fd7e32c1"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/8e2b96ff-3de2-289b-b5c1-3b9921a3441e"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/4ab6e3c5-74dd-8b35-9ab9-f61b30875b27"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/f2805ebc-abc2-4aac-a8d6-35664c479971"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/c0f5316d-5ac5-9218-b77a-b96e16ccfd66"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/45cfe080-ceb1-a91e-9743-71551ed24e94"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/bd20bd91-aaf1-7f14-b6e4-866de2f43146"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/8bc390da-9eb6-938d-25ed-44a35d9bcc9d"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/22e18b64-4576-41e6-8972-0eb28c9af0c8"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/bc85a7ee-7f43-47ab-8736-4faaec9346b5"), - // }}, - // DisplayName: to.Ptr("Apply system updates"), - // MaxScore: to.Ptr[int32](6), - // Source: &armsecurity.SecureScoreControlDefinitionSource{ - // SourceType: to.Ptr(armsecurity.ControlTypeBuiltIn), - // }, - // }, - // }, - // DisplayName: to.Ptr("Apply system updates"), - // HealthyResourceCount: to.Ptr[int32](0), - // NotApplicableResourceCount: to.Ptr[int32](0), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](0), - // Max: to.Ptr[int32](6), - // Percentage: to.Ptr[float64](0), - // }, - // UnhealthyResourceCount: to.Ptr[int32](1), - // Weight: to.Ptr[int64](1), - // }, - // }, - // { - // Name: to.Ptr("0e55495e-034f-4abc-8293-767229250176"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/0e55495e-034f-4abc-8293-767229250176"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // Definition: &armsecurity.SecureScoreControlDefinitionItem{ - // Name: to.Ptr("0e55495e-034f-4abc-8293-767229250176"), - // Type: to.Ptr("Microsoft.Security/secureScoreControlDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Security/secureScoreControlDefinitions/0e55495e-034f-4abc-8293-767229250176"), - // Properties: &armsecurity.SecureScoreControlDefinitionItemProperties{ - // AssessmentDefinitions: []*armsecurity.AzureResourceLink{ - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/1b351b29-41ca-6df5-946c-c190a56be5fe"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/cb0acdc6-0846-fd48-debe-9905af151b6d"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/bf82a334-13b6-ca57-ea75-096fc2ffce50"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/35b25be2-d08a-e340-45ed-f08a95d804fc"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/1c5de8e1-f68d-6a17-e0d2-ec259c42768c"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/a3ebc80a-847b-46d5-a37d-8dca5e6947df"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/c28a89d9-7cf4-439b-a8c4-ad4e769f68ee"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/2acc27c6-5fdb-405e-9080-cb66b850c8f5"), - // }}, - // DisplayName: to.Ptr("Encrypt data in transit"), - // MaxScore: to.Ptr[int32](4), - // Source: &armsecurity.SecureScoreControlDefinitionSource{ - // SourceType: to.Ptr(armsecurity.ControlTypeBuiltIn), - // }, - // }, - // }, - // DisplayName: to.Ptr("Encrypt data in transit"), - // HealthyResourceCount: to.Ptr[int32](5), - // NotApplicableResourceCount: to.Ptr[int32](0), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](3.33), - // Max: to.Ptr[int32](4), - // Percentage: to.Ptr[float64](0.8325), - // }, - // UnhealthyResourceCount: to.Ptr[int32](1), - // Weight: to.Ptr[int64](6), - // }, - // }, - // { - // Name: to.Ptr("f9d5432b-8f7b-45e9-b90c-e214a30f6a02"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/f9d5432b-8f7b-45e9-b90c-e214a30f6a02"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // Definition: &armsecurity.SecureScoreControlDefinitionItem{ - // Name: to.Ptr("f9d5432b-8f7b-45e9-b90c-e214a30f6a02"), - // Type: to.Ptr("Microsoft.Security/secureScoreControlDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Security/secureScoreControlDefinitions/f9d5432b-8f7b-45e9-b90c-e214a30f6a02"), - // Properties: &armsecurity.SecureScoreControlDefinitionItemProperties{ - // AssessmentDefinitions: []*armsecurity.AzureResourceLink{ - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/483f12ed-ae23-447e-a2de-a67a10db4353"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/3b20e985-f71f-483b-b078-f30d73936d43"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/f9f0eed0-f143-47bf-b856-671ea2eeed62"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/1a2b5b4c-f80d-46e7-ac81-b51a9fb363de"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/c3b51c94-588b-426b-a892-24696f9e54cc"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/e40df93c-7a7c-1b0a-c787-9987ceb98e54"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/7b3d4796-9400-2904-692b-4a5ede7f0a1e"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/df4d1739-47f0-60c7-1706-3731fea6ab03"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/1a36f14a-8bd8-45f5-abe5-eef88d76ab5b"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/beb62be3-5e78-49bd-ac5f-099250ef3c7c"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/ba975338-f956-41e7-a9f2-7614832d382d"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/d5a8d84a-9ad0-42e2-80e0-d38e3d46028a"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/5a3d6cdd-8eb3-46d2-ba11-d24a0d47fe65"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/d8326952-60bb-40fb-b33f-51e662708a88"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/08e628db-e2ed-4793-bc91-d13e684401c3"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/5f88450f-9546-4b78-a181-a2d9162bb441"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/add45209-73f6-4fa5-a5a5-74a451b07fbe"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/dbfc99e3-e648-4c3b-bd32-995e6268430d"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/b3473ed6-78c0-40d5-b5f0-674e98924952"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/9dd55566-33b9-4c07-a959-14794ce02355"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/ad0b04b9-eaf9-49f8-b85e-724f9520e760"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/ece6ec5d-a862-4e22-a8db-271661216018"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/e40b679a-f44e-4366-87dd-7693e16a2128"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/0bdcd23c-4ff2-4077-aa14-eb6950bfbdd8"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/1f386f4e-449e-41e8-b829-a2fe01086ae1"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/2f6c8a5a-9407-467c-8082-0ad4ab915d77"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/3b1713ec-feb3-4b32-b5b0-251acff0a84a"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/049f1551-438b-444e-8904-a3c3afbcb43e"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/684307e9-62a8-4f2a-887a-4b90de5e4b98"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/0327f9da-f758-4d69-8903-55448b8cf70e"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/cc637123-c11e-40ee-adf8-93c0876481f4"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/a7c8fa46-526d-4bf6-b8b3-17fa01310fd8"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/20f6c761-4dd7-4f27-9e37-6db8471486ef"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/ebc68898-5c0f-4353-a426-4a5f1e737b12"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/f67fb4ed-d481-44d7-91e5-efadf504f74a"), - // }}, - // DisplayName: to.Ptr("Restrict unauthorized network access"), - // MaxScore: to.Ptr[int32](4), - // Source: &armsecurity.SecureScoreControlDefinitionSource{ - // SourceType: to.Ptr(armsecurity.ControlTypeBuiltIn), - // }, - // }, - // }, - // DisplayName: to.Ptr("Restrict unauthorized network access"), - // HealthyResourceCount: to.Ptr[int32](1), - // NotApplicableResourceCount: to.Ptr[int32](0), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](4), - // Max: to.Ptr[int32](4), - // Percentage: to.Ptr[float64](1), - // }, - // UnhealthyResourceCount: to.Ptr[int32](0), - // Weight: to.Ptr[int64](1), - // }, - // }, - // { - // Name: to.Ptr("8fd574ec-43cf-426e-a439-a67cbaf2d564"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/8fd574ec-43cf-426e-a439-a67cbaf2d564"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // Definition: &armsecurity.SecureScoreControlDefinitionItem{ - // Name: to.Ptr("8fd574ec-43cf-426e-a439-a67cbaf2d564"), - // Type: to.Ptr("Microsoft.Security/secureScoreControlDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Security/secureScoreControlDefinitions/8fd574ec-43cf-426e-a439-a67cbaf2d564"), - // Properties: &armsecurity.SecureScoreControlDefinitionItemProperties{ - // AssessmentDefinitions: []*armsecurity.AzureResourceLink{ - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/d57a4221-a804-52ca-3dea-768284f06bb7"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/651967bf-044e-4bde-8376-3e08e0600105"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/b12bc79e-4f12-44db-acda-571820191ddc"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/7f04fc0c-4a3d-5c7e-ce19-666cb871b510"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/dbfc99e3-e648-4c3b-bd32-995e6268430d"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/c01fab9f-bde1-4ba5-9d35-7de51f31c2d3"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/23b514bd-2afc-4a3e-8d3d-f4327118eee9"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/3053474d-4fab-4603-8d18-2a6dfd09f782"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/6be98232-0100-474a-b33d-ba9c1a747f70"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/a7c8fa46-526d-4bf6-b8b3-17fa01310fd8"), - // }, - // { - // ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/20f6c761-4dd7-4f27-9e37-6db8471486ef"), - // }}, - // DisplayName: to.Ptr("Enable encryption at rest"), - // MaxScore: to.Ptr[int32](4), - // Source: &armsecurity.SecureScoreControlDefinitionSource{ - // SourceType: to.Ptr(armsecurity.ControlTypeBuiltIn), - // }, - // }, - // }, - // DisplayName: to.Ptr("Enable encryption at rest"), - // HealthyResourceCount: to.Ptr[int32](1), - // NotApplicableResourceCount: to.Ptr[int32](0), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](4), - // Max: to.Ptr[int32](4), - // Percentage: to.Ptr[float64](1), - // }, - // UnhealthyResourceCount: to.Ptr[int32](0), - // Weight: to.Ptr[int64](1), - // }, - // }}, - // } - } -} - -// 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/secureScores/ListSecureScoreControls_example.json -func ExampleSecureScoreControlsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSecureScoreControlsClient().NewListPager(&armsecurity.SecureScoreControlsClientListOptions{Expand: 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.SecureScoreControlList = armsecurity.SecureScoreControlList{ - // Value: []*armsecurity.SecureScoreControlDetails{ - // { - // Name: to.Ptr("a9909064-42b4-4d34-8143-275477afe18b"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/a9909064-42b4-4d34-8143-275477afe18b"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // DisplayName: to.Ptr("Protect applications against DDoS attacks"), - // HealthyResourceCount: to.Ptr[int32](0), - // NotApplicableResourceCount: to.Ptr[int32](1), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](0), - // Max: to.Ptr[int32](0), - // Percentage: to.Ptr[float64](0), - // }, - // UnhealthyResourceCount: to.Ptr[int32](0), - // Weight: to.Ptr[int64](0), - // }, - // }, - // { - // Name: to.Ptr("34a42fb3-e6db-409c-b56b-7b1db6b8aee0"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/34a42fb3-e6db-409c-b56b-7b1db6b8aee0"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // DisplayName: to.Ptr("Enable MFA"), - // HealthyResourceCount: to.Ptr[int32](1), - // NotApplicableResourceCount: to.Ptr[int32](0), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](10), - // Max: to.Ptr[int32](10), - // Percentage: to.Ptr[float64](1), - // }, - // UnhealthyResourceCount: to.Ptr[int32](0), - // Weight: to.Ptr[int64](1), - // }, - // }, - // { - // Name: to.Ptr("76763537-9feb-42d3-b4f4-78c01117be80"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/76763537-9feb-42d3-b4f4-78c01117be80"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // DisplayName: to.Ptr("Implement security best practices"), - // HealthyResourceCount: to.Ptr[int32](7), - // NotApplicableResourceCount: to.Ptr[int32](1), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](0), - // Max: to.Ptr[int32](0), - // Percentage: to.Ptr[float64](0), - // }, - // UnhealthyResourceCount: to.Ptr[int32](0), - // Weight: to.Ptr[int64](7), - // }, - // }, - // { - // Name: to.Ptr("4db8d6cf-075b-4149-a813-da09ca2ae120"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/4db8d6cf-075b-4149-a813-da09ca2ae120"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // DisplayName: to.Ptr("Enable Advanced Threat Protection"), - // HealthyResourceCount: to.Ptr[int32](0), - // NotApplicableResourceCount: to.Ptr[int32](0), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](0), - // Max: to.Ptr[int32](0), - // Percentage: to.Ptr[float64](0), - // }, - // UnhealthyResourceCount: to.Ptr[int32](1), - // Weight: to.Ptr[int64](1), - // }, - // }, - // { - // Name: to.Ptr("27b24961-75ba-4fe4-8909-97286d5dd5ee"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/27b24961-75ba-4fe4-8909-97286d5dd5ee"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // DisplayName: to.Ptr("Enable auditing and logging"), - // HealthyResourceCount: to.Ptr[int32](1), - // NotApplicableResourceCount: to.Ptr[int32](0), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](0.2), - // Max: to.Ptr[int32](1), - // Percentage: to.Ptr[float64](0.2), - // }, - // UnhealthyResourceCount: to.Ptr[int32](4), - // Weight: to.Ptr[int64](5), - // }, - // }, - // { - // Name: to.Ptr("2d85f639-0bea-4a4a-b6c6-608952a1414a"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/2d85f639-0bea-4a4a-b6c6-608952a1414a"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // DisplayName: to.Ptr("Manage access and permissions"), - // HealthyResourceCount: to.Ptr[int32](1), - // NotApplicableResourceCount: to.Ptr[int32](0), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](2), - // Max: to.Ptr[int32](4), - // Percentage: to.Ptr[float64](0.5), - // }, - // UnhealthyResourceCount: to.Ptr[int32](1), - // Weight: to.Ptr[int64](2), - // }, - // }, - // { - // Name: to.Ptr("99fc8df2-e0f5-40f8-9415-a7f7ca948b5a"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/99fc8df2-e0f5-40f8-9415-a7f7ca948b5a"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // DisplayName: to.Ptr("Remediate security configurations"), - // HealthyResourceCount: to.Ptr[int32](0), - // NotApplicableResourceCount: to.Ptr[int32](0), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](0), - // Max: to.Ptr[int32](4), - // Percentage: to.Ptr[float64](0), - // }, - // UnhealthyResourceCount: to.Ptr[int32](1), - // Weight: to.Ptr[int64](1), - // }, - // }, - // { - // Name: to.Ptr("12136bd9-dc24-44f2-9587-7be3af6aac14"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/12136bd9-dc24-44f2-9587-7be3af6aac14"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // DisplayName: to.Ptr("Enable endpoint protection"), - // HealthyResourceCount: to.Ptr[int32](0), - // NotApplicableResourceCount: to.Ptr[int32](0), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](0), - // Max: to.Ptr[int32](2), - // Percentage: to.Ptr[float64](0), - // }, - // UnhealthyResourceCount: to.Ptr[int32](1), - // Weight: to.Ptr[int64](1), - // }, - // }, - // { - // Name: to.Ptr("61702b76-1fab-41f2-bcbc-50b7870dcf38"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/61702b76-1fab-41f2-bcbc-50b7870dcf38"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // DisplayName: to.Ptr("Apply system updates"), - // HealthyResourceCount: to.Ptr[int32](0), - // NotApplicableResourceCount: to.Ptr[int32](0), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](0), - // Max: to.Ptr[int32](6), - // Percentage: to.Ptr[float64](0), - // }, - // UnhealthyResourceCount: to.Ptr[int32](1), - // Weight: to.Ptr[int64](1), - // }, - // }, - // { - // Name: to.Ptr("0e55495e-034f-4abc-8293-767229250176"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/0e55495e-034f-4abc-8293-767229250176"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // DisplayName: to.Ptr("Encrypt data in transit"), - // HealthyResourceCount: to.Ptr[int32](5), - // NotApplicableResourceCount: to.Ptr[int32](0), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](3.33), - // Max: to.Ptr[int32](4), - // Percentage: to.Ptr[float64](0.8325), - // }, - // UnhealthyResourceCount: to.Ptr[int32](1), - // Weight: to.Ptr[int64](6), - // }, - // }, - // { - // Name: to.Ptr("f9d5432b-8f7b-45e9-b90c-e214a30f6a02"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/f9d5432b-8f7b-45e9-b90c-e214a30f6a02"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // DisplayName: to.Ptr("Restrict unauthorized network access"), - // HealthyResourceCount: to.Ptr[int32](1), - // NotApplicableResourceCount: to.Ptr[int32](0), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](4), - // Max: to.Ptr[int32](4), - // Percentage: to.Ptr[float64](1), - // }, - // UnhealthyResourceCount: to.Ptr[int32](0), - // Weight: to.Ptr[int64](1), - // }, - // }, - // { - // Name: to.Ptr("8fd574ec-43cf-426e-a439-a67cbaf2d564"), - // Type: to.Ptr("Microsoft.Security/secureScores/secureScoreControls"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore/secureScoreControls/8fd574ec-43cf-426e-a439-a67cbaf2d564"), - // Properties: &armsecurity.SecureScoreControlScoreDetails{ - // DisplayName: to.Ptr("Enable encryption at rest"), - // HealthyResourceCount: to.Ptr[int32](1), - // NotApplicableResourceCount: to.Ptr[int32](0), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](4), - // Max: to.Ptr[int32](4), - // Percentage: to.Ptr[float64](1), - // }, - // UnhealthyResourceCount: to.Ptr[int32](0), - // Weight: to.Ptr[int64](1), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/security/armsecurity/securescores_client.go b/sdk/resourcemanager/security/armsecurity/securescores_client.go deleted file mode 100644 index 26172b8625ee..000000000000 --- a/sdk/resourcemanager/security/armsecurity/securescores_client.go +++ /dev/null @@ -1,158 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// SecureScoresClient contains the methods for the SecureScores group. -// Don't use this type directly, use NewSecureScoresClient() instead. -type SecureScoresClient struct { - internal *arm.Client - subscriptionID string -} - -// NewSecureScoresClient creates a new instance of SecureScoresClient 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 NewSecureScoresClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SecureScoresClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &SecureScoresClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Get secure score for a specific Microsoft Defender for Cloud initiative within your current scope. For the ASC Default -// initiative, use 'ascScore'. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-01-01 -// - secureScoreName - The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample request below. -// - options - SecureScoresClientGetOptions contains the optional parameters for the SecureScoresClient.Get method. -func (client *SecureScoresClient) Get(ctx context.Context, secureScoreName string, options *SecureScoresClientGetOptions) (SecureScoresClientGetResponse, error) { - var err error - const operationName = "SecureScoresClient.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, secureScoreName, options) - if err != nil { - return SecureScoresClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return SecureScoresClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return SecureScoresClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *SecureScoresClient) getCreateRequest(ctx context.Context, secureScoreName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if secureScoreName == "" { - return nil, errors.New("parameter secureScoreName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{secureScoreName}", url.PathEscape(secureScoreName)) - 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 *SecureScoresClient) getHandleResponse(resp *http.Response) (SecureScoresClientGetResponse, error) { - result := SecureScoresClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SecureScoreItem); err != nil { - return SecureScoresClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - List secure scores for all your Microsoft Defender for Cloud initiatives within your current scope. -// -// Generated from API version 2020-01-01 -// - options - SecureScoresClientListOptions contains the optional parameters for the SecureScoresClient.NewListPager method. -func (client *SecureScoresClient) NewListPager(options *SecureScoresClientListOptions) *runtime.Pager[SecureScoresClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[SecureScoresClientListResponse]{ - More: func(page SecureScoresClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *SecureScoresClientListResponse) (SecureScoresClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SecureScoresClient.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 SecureScoresClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *SecureScoresClient) listCreateRequest(ctx context.Context, options *SecureScoresClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores" - 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") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *SecureScoresClient) listHandleResponse(resp *http.Response) (SecureScoresClientListResponse, error) { - result := SecureScoresClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SecureScoresList); err != nil { - return SecureScoresClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/securescores_client_example_test.go b/sdk/resourcemanager/security/armsecurity/securescores_client_example_test.go deleted file mode 100644 index 3ad3bf6b6f19..000000000000 --- a/sdk/resourcemanager/security/armsecurity/securescores_client_example_test.go +++ /dev/null @@ -1,94 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/secureScores/ListSecureScores_example.json -func ExampleSecureScoresClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSecureScoresClient().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.SecureScoresList = armsecurity.SecureScoresList{ - // Value: []*armsecurity.SecureScoreItem{ - // { - // Name: to.Ptr("ascScore"), - // Type: to.Ptr("Microsoft.Security/secureScores"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore"), - // Properties: &armsecurity.SecureScoreItemProperties{ - // DisplayName: to.Ptr("ASC score"), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](23.53), - // Max: to.Ptr[int32](39), - // Percentage: to.Ptr[float64](0.6033), - // }, - // Weight: to.Ptr[int64](67), - // }, - // }}, - // } - } -} - -// 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/secureScores/GetSecureScoresSingle_example.json -func ExampleSecureScoresClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSecureScoresClient().Get(ctx, "ascScore", 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.SecureScoreItem = armsecurity.SecureScoreItem{ - // Name: to.Ptr("ascScore"), - // Type: to.Ptr("Microsoft.Security/secureScores"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/secureScores/ascScore"), - // Properties: &armsecurity.SecureScoreItemProperties{ - // DisplayName: to.Ptr("ASC score"), - // Score: &armsecurity.ScoreDetails{ - // Current: to.Ptr[float64](23.53), - // Max: to.Ptr[int32](39), - // Percentage: to.Ptr[float64](0.6033), - // }, - // Weight: to.Ptr[int64](67), - // }, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/sensitivitysettings_client.go b/sdk/resourcemanager/security/armsecurity/sensitivitysettings_client.go deleted file mode 100644 index cbb7e55ab982..000000000000 --- a/sdk/resourcemanager/security/armsecurity/sensitivitysettings_client.go +++ /dev/null @@ -1,194 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armsecurity - -import ( - "context" - "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" -) - -// SensitivitySettingsClient contains the methods for the SensitivitySettings group. -// Don't use this type directly, use NewSensitivitySettingsClient() instead. -type SensitivitySettingsClient struct { - internal *arm.Client -} - -// 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. -func NewSensitivitySettingsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*SensitivitySettingsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &SensitivitySettingsClient{ - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Create or update data sensitivity settings for sensitive data discovery -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-02-15-preview -// - sensitivitySettings - The data sensitivity settings to update -// - options - SensitivitySettingsClientCreateOrUpdateOptions contains the optional parameters for the SensitivitySettingsClient.CreateOrUpdate -// method. -func (client *SensitivitySettingsClient) CreateOrUpdate(ctx context.Context, sensitivitySettings UpdateSensitivitySettingsRequest, options *SensitivitySettingsClientCreateOrUpdateOptions) (SensitivitySettingsClientCreateOrUpdateResponse, error) { - var err error - const operationName = "SensitivitySettingsClient.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, sensitivitySettings, options) - if err != nil { - return SensitivitySettingsClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return SensitivitySettingsClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return SensitivitySettingsClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *SensitivitySettingsClient) createOrUpdateCreateRequest(ctx context.Context, sensitivitySettings UpdateSensitivitySettingsRequest, options *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 { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, sensitivitySettings); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *SensitivitySettingsClient) createOrUpdateHandleResponse(resp *http.Response) (SensitivitySettingsClientCreateOrUpdateResponse, error) { - result := SensitivitySettingsClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.GetSensitivitySettingsResponse); err != nil { - return SensitivitySettingsClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Get - Gets data sensitivity settings for sensitive data discovery -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-02-15-preview -// - options - SensitivitySettingsClientGetOptions contains the optional parameters for the SensitivitySettingsClient.Get method. -func (client *SensitivitySettingsClient) Get(ctx context.Context, options *SensitivitySettingsClientGetOptions) (SensitivitySettingsClientGetResponse, error) { - var err error - const operationName = "SensitivitySettingsClient.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, options) - if err != nil { - return SensitivitySettingsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return SensitivitySettingsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return SensitivitySettingsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *SensitivitySettingsClient) getCreateRequest(ctx context.Context, options *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 { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *SensitivitySettingsClient) getHandleResponse(resp *http.Response) (SensitivitySettingsClientGetResponse, error) { - result := SensitivitySettingsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.GetSensitivitySettingsResponse); err != nil { - return SensitivitySettingsClientGetResponse{}, err - } - return result, nil -} - -// List - Gets a list with a single sensitivity settings resource -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-02-15-preview -// - options - SensitivitySettingsClientListOptions contains the optional parameters for the SensitivitySettingsClient.List -// method. -func (client *SensitivitySettingsClient) List(ctx context.Context, options *SensitivitySettingsClientListOptions) (SensitivitySettingsClientListResponse, error) { - var err error - const operationName = "SensitivitySettingsClient.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 SensitivitySettingsClientListResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return SensitivitySettingsClientListResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return SensitivitySettingsClientListResponse{}, err - } - resp, err := client.listHandleResponse(httpResp) - return resp, err -} - -// listCreateRequest creates the List request. -func (client *SensitivitySettingsClient) listCreateRequest(ctx context.Context, options *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 { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *SensitivitySettingsClient) listHandleResponse(resp *http.Response) (SensitivitySettingsClientListResponse, error) { - result := SensitivitySettingsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.GetSensitivitySettingsListResponse); err != nil { - return SensitivitySettingsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/sensitivitysettings_client_example_test.go b/sdk/resourcemanager/security/armsecurity/sensitivitysettings_client_example_test.go deleted file mode 100644 index d38b7fd92c47..000000000000 --- a/sdk/resourcemanager/security/armsecurity/sensitivitysettings_client_example_test.go +++ /dev/null @@ -1,296 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/2023-02-15-preview/examples/SensitivitySettings/PutSensitivitySettings_example.json -func ExampleSensitivitySettingsClient_CreateOrUpdate() { - 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.NewSensitivitySettingsClient().CreateOrUpdate(ctx, armsecurity.UpdateSensitivitySettingsRequest{ - SensitiveInfoTypesIDs: []*string{ - to.Ptr("f2f8a7a1-28c0-404b-9ab4-30a0a7af18cb"), - to.Ptr("b452f22b-f87d-4f48-8490-ecf0873325b5"), - to.Ptr("d59ee8b6-2618-404b-a5e7-aa377cd67543")}, - SensitivityThresholdLabelID: to.Ptr("f2f8a7a1-28c0-404b-9ab4-30a0a7af18cb"), - SensitivityThresholdLabelOrder: to.Ptr[float32](2), - }, 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.GetSensitivitySettingsResponse = armsecurity.GetSensitivitySettingsResponse{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Security/sensitivitySettings"), - // ID: to.Ptr("/providers/Microsoft.Security/sensitivitySettings"), - // Properties: &armsecurity.GetSensitivitySettingsResponseProperties{ - // MipInformation: &armsecurity.GetSensitivitySettingsResponsePropertiesMipInformation{ - // BuiltInInfoTypes: []*armsecurity.BuiltInInfoType{ - // { - // Name: to.Ptr("Http Authorization Header"), - // Type: to.Ptr("Credentials"), - // ID: to.Ptr("4d0d3eb6-619f-4c8c-810c-c16150c95278"), - // }, - // { - // Name: to.Ptr("User Login Credentials"), - // Type: to.Ptr("Credentials"), - // ID: to.Ptr("a98fde82-45b6-4b2c-afd0-ad579cd9f826"), - // }, - // { - // Name: to.Ptr("Credit card number"), - // Type: to.Ptr("Finance"), - // ID: to.Ptr("50842eb7-edc8-4019-85dd-5a5c1f2bb085"), - // }, - // { - // Name: to.Ptr("EU debit card number"), - // Type: to.Ptr("Finance"), - // ID: to.Ptr("0e9b3178-9678-47dd-a509-37222ca96b42"), - // }}, - // CustomInfoTypes: []*armsecurity.InfoType{ - // { - // Name: to.Ptr("User created custom info type 1"), - // Description: to.Ptr("Custom info type description"), - // ID: to.Ptr("c5f9b9a1-2b9a-4a3a-8c5b-1f3d1d9d9c9b"), - // }, - // { - // Name: to.Ptr("User created custom info type 2"), - // Description: to.Ptr("Custom info type description"), - // ID: to.Ptr("a4fee2b6-5618-404b-a5e7-aa377cd67543"), - // }, - // { - // Name: to.Ptr("User created custom info type 3"), - // Description: to.Ptr("Custom info type description"), - // ID: to.Ptr("a355f11e-f87d-4f48-8490-ecf0873325b5"), - // }}, - // Labels: []*armsecurity.Label{ - // { - // Name: to.Ptr("Public"), - // ID: to.Ptr("fdfb5435-124d-4651-a889-a4210fec6a77"), - // Order: to.Ptr[float32](0), - // }, - // { - // Name: to.Ptr("Confidential"), - // ID: to.Ptr("4c5447ec-f7f3-4345-a160-6a5850f2bf0c"), - // Order: to.Ptr[float32](1), - // }, - // { - // Name: to.Ptr("Highly Confidential"), - // ID: to.Ptr("f38ac75c-f42a-4c89-aa37-9c4e74101414"), - // Order: to.Ptr[float32](2), - // }}, - // MipIntegrationStatus: to.Ptr(armsecurity.MipIntegrationStatusOk), - // }, - // SensitiveInfoTypesIDs: []*string{ - // to.Ptr("a98fde82-45b6-4b2c-afd0-ad579cd9f826"), - // to.Ptr("4d0d3eb6-619f-4c8c-810c-c16150c95278"), - // to.Ptr("0e9b3178-9678-47dd-a509-37222ca96b42"), - // to.Ptr("c5f9b9a1-2b9a-4a3a-8c5b-1f3d1d9d9c9b")}, - // SensitivityThresholdLabelOrder: to.Ptr[float32](2), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-02-15-preview/examples/SensitivitySettings/GetSensitivitySettings_example.json -func ExampleSensitivitySettingsClient_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.NewSensitivitySettingsClient().Get(ctx, 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.GetSensitivitySettingsResponse = armsecurity.GetSensitivitySettingsResponse{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Security/sensitivitySettings"), - // ID: to.Ptr("/providers/Microsoft.Security/sensitivitySettings"), - // Properties: &armsecurity.GetSensitivitySettingsResponseProperties{ - // MipInformation: &armsecurity.GetSensitivitySettingsResponsePropertiesMipInformation{ - // BuiltInInfoTypes: []*armsecurity.BuiltInInfoType{ - // { - // Name: to.Ptr("Http Authorization Header"), - // Type: to.Ptr("Credentials"), - // ID: to.Ptr("4d0d3eb6-619f-4c8c-810c-c16150c95278"), - // }, - // { - // Name: to.Ptr("User Login Credentials"), - // Type: to.Ptr("Credentials"), - // ID: to.Ptr("a98fde82-45b6-4b2c-afd0-ad579cd9f826"), - // }, - // { - // Name: to.Ptr("Credit card number"), - // Type: to.Ptr("Finance"), - // ID: to.Ptr("50842eb7-edc8-4019-85dd-5a5c1f2bb085"), - // }, - // { - // Name: to.Ptr("EU debit card number"), - // Type: to.Ptr("Finance"), - // ID: to.Ptr("0e9b3178-9678-47dd-a509-37222ca96b42"), - // }}, - // CustomInfoTypes: []*armsecurity.InfoType{ - // { - // Name: to.Ptr("User created custom info type 1"), - // Description: to.Ptr("Custom info type description"), - // ID: to.Ptr("c5f9b9a1-2b9a-4a3a-8c5b-1f3d1d9d9c9b"), - // }, - // { - // Name: to.Ptr("User created custom info type 2"), - // Description: to.Ptr("Custom info type description"), - // ID: to.Ptr("a4fee2b6-5618-404b-a5e7-aa377cd67543"), - // }, - // { - // Name: to.Ptr("User created custom info type 3"), - // Description: to.Ptr("Custom info type description"), - // ID: to.Ptr("a355f11e-f87d-4f48-8490-ecf0873325b5"), - // }}, - // Labels: []*armsecurity.Label{ - // { - // Name: to.Ptr("Public"), - // ID: to.Ptr("fdfb5435-124d-4651-a889-a4210fec6a77"), - // Order: to.Ptr[float32](0), - // }, - // { - // Name: to.Ptr("Confidential"), - // ID: to.Ptr("4c5447ec-f7f3-4345-a160-6a5850f2bf0c"), - // Order: to.Ptr[float32](1), - // }, - // { - // Name: to.Ptr("Highly Confidential"), - // ID: to.Ptr("f38ac75c-f42a-4c89-aa37-9c4e74101414"), - // Order: to.Ptr[float32](2), - // }}, - // MipIntegrationStatus: to.Ptr(armsecurity.MipIntegrationStatusOk), - // }, - // SensitiveInfoTypesIDs: []*string{ - // to.Ptr("a98fde82-45b6-4b2c-afd0-ad579cd9f826"), - // to.Ptr("4d0d3eb6-619f-4c8c-810c-c16150c95278"), - // to.Ptr("0e9b3178-9678-47dd-a509-37222ca96b42"), - // to.Ptr("c5f9b9a1-2b9a-4a3a-8c5b-1f3d1d9d9c9b")}, - // SensitivityThresholdLabelOrder: to.Ptr[float32](1), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-02-15-preview/examples/SensitivitySettings/GetSensitivitySettingsList_example.json -func ExampleSensitivitySettingsClient_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.NewSensitivitySettingsClient().List(ctx, 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.GetSensitivitySettingsListResponse = armsecurity.GetSensitivitySettingsListResponse{ - // Value: []*armsecurity.GetSensitivitySettingsResponse{ - // { - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Security/sensitivitySettings"), - // ID: to.Ptr("/providers/Microsoft.Security/sensitivitySettings"), - // Properties: &armsecurity.GetSensitivitySettingsResponseProperties{ - // MipInformation: &armsecurity.GetSensitivitySettingsResponsePropertiesMipInformation{ - // BuiltInInfoTypes: []*armsecurity.BuiltInInfoType{ - // { - // Name: to.Ptr("Http Authorization Header"), - // Type: to.Ptr("Credentials"), - // ID: to.Ptr("4d0d3eb6-619f-4c8c-810c-c16150c95278"), - // }, - // { - // Name: to.Ptr("User Login Credentials"), - // Type: to.Ptr("Credentials"), - // ID: to.Ptr("a98fde82-45b6-4b2c-afd0-ad579cd9f826"), - // }, - // { - // Name: to.Ptr("Credit card number"), - // Type: to.Ptr("Finance"), - // ID: to.Ptr("50842eb7-edc8-4019-85dd-5a5c1f2bb085"), - // }, - // { - // Name: to.Ptr("EU debit card number"), - // Type: to.Ptr("Finance"), - // ID: to.Ptr("0e9b3178-9678-47dd-a509-37222ca96b42"), - // }}, - // CustomInfoTypes: []*armsecurity.InfoType{ - // { - // Name: to.Ptr("User created custom info type 1"), - // Description: to.Ptr("Custom info type description"), - // ID: to.Ptr("c5f9b9a1-2b9a-4a3a-8c5b-1f3d1d9d9c9b"), - // }, - // { - // Name: to.Ptr("User created custom info type 2"), - // Description: to.Ptr("Custom info type description"), - // ID: to.Ptr("a4fee2b6-5618-404b-a5e7-aa377cd67543"), - // }, - // { - // Name: to.Ptr("User created custom info type 3"), - // Description: to.Ptr("Custom info type description"), - // ID: to.Ptr("a355f11e-f87d-4f48-8490-ecf0873325b5"), - // }}, - // Labels: []*armsecurity.Label{ - // { - // Name: to.Ptr("Public"), - // ID: to.Ptr("fdfb5435-124d-4651-a889-a4210fec6a77"), - // Order: to.Ptr[float32](0), - // }, - // { - // Name: to.Ptr("Confidential"), - // ID: to.Ptr("4c5447ec-f7f3-4345-a160-6a5850f2bf0c"), - // Order: to.Ptr[float32](1), - // }, - // { - // Name: to.Ptr("Highly Confidential"), - // ID: to.Ptr("f38ac75c-f42a-4c89-aa37-9c4e74101414"), - // Order: to.Ptr[float32](2), - // }}, - // MipIntegrationStatus: to.Ptr(armsecurity.MipIntegrationStatusOk), - // }, - // SensitiveInfoTypesIDs: []*string{ - // to.Ptr("a98fde82-45b6-4b2c-afd0-ad579cd9f826"), - // to.Ptr("4d0d3eb6-619f-4c8c-810c-c16150c95278"), - // to.Ptr("0e9b3178-9678-47dd-a509-37222ca96b42"), - // to.Ptr("c5f9b9a1-2b9a-4a3a-8c5b-1f3d1d9d9c9b")}, - // SensitivityThresholdLabelOrder: to.Ptr[float32](1), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/servervulnerabilityassessment_client.go b/sdk/resourcemanager/security/armsecurity/servervulnerabilityassessment_client.go deleted file mode 100644 index b23b9f96eca6..000000000000 --- a/sdk/resourcemanager/security/armsecurity/servervulnerabilityassessment_client.go +++ /dev/null @@ -1,360 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// ServerVulnerabilityAssessmentClient contains the methods for the ServerVulnerabilityAssessment group. -// Don't use this type directly, use NewServerVulnerabilityAssessmentClient() instead. -type ServerVulnerabilityAssessmentClient struct { - internal *arm.Client - subscriptionID string -} - -// NewServerVulnerabilityAssessmentClient creates a new instance of ServerVulnerabilityAssessmentClient 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 NewServerVulnerabilityAssessmentClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServerVulnerabilityAssessmentClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ServerVulnerabilityAssessmentClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Creating a server vulnerability assessment on a resource, which will onboard a resource for having a vulnerability -// assessment on it -// 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. -// - 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) { - var err error - const operationName = "ServerVulnerabilityAssessmentClient.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, resourceNamespace, resourceType, resourceName, options) - if err != nil { - return ServerVulnerabilityAssessmentClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ServerVulnerabilityAssessmentClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return ServerVulnerabilityAssessmentClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// 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) { - 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") - } - 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)) - urlPath = strings.ReplaceAll(urlPath, "{serverVulnerabilityAssessment}", url.PathEscape("default")) - 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"} - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *ServerVulnerabilityAssessmentClient) createOrUpdateHandleResponse(resp *http.Response) (ServerVulnerabilityAssessmentClientCreateOrUpdateResponse, error) { - result := ServerVulnerabilityAssessmentClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ServerVulnerabilityAssessment); err != nil { - return ServerVulnerabilityAssessmentClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// BeginDelete - Removing server vulnerability assessment from a 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. -// - 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) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, resourceNamespace, resourceType, resourceName, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServerVulnerabilityAssessmentClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ServerVulnerabilityAssessmentClientDeleteResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Delete - Removing server vulnerability assessment from a resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-01-01 -func (client *ServerVulnerabilityAssessmentClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, options *ServerVulnerabilityAssessmentClientBeginDeleteOptions) (*http.Response, error) { - var err error - const operationName = "ServerVulnerabilityAssessmentClient.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, resourceNamespace, resourceType, resourceName, 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, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// 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) { - 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") - } - 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)) - urlPath = strings.ReplaceAll(urlPath, "{serverVulnerabilityAssessment}", url.PathEscape("default")) - 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 a server vulnerability assessment onboarding statuses on a given 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. -// - 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) { - var err error - const operationName = "ServerVulnerabilityAssessmentClient.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, options) - if err != nil { - return ServerVulnerabilityAssessmentClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ServerVulnerabilityAssessmentClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ServerVulnerabilityAssessmentClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// 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) { - 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") - } - 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)) - urlPath = strings.ReplaceAll(urlPath, "{serverVulnerabilityAssessment}", url.PathEscape("default")) - 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 *ServerVulnerabilityAssessmentClient) getHandleResponse(resp *http.Response) (ServerVulnerabilityAssessmentClientGetResponse, error) { - result := ServerVulnerabilityAssessmentClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ServerVulnerabilityAssessment); err != nil { - return ServerVulnerabilityAssessmentClientGetResponse{}, err - } - return result, nil -} - -// ListByExtendedResource - Gets a list of server vulnerability assessment onboarding statuses on a given 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. -// - 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) { - var err error - const operationName = "ServerVulnerabilityAssessmentClient.ListByExtendedResource" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listByExtendedResourceCreateRequest(ctx, resourceGroupName, resourceNamespace, resourceType, resourceName, options) - if err != nil { - return ServerVulnerabilityAssessmentClientListByExtendedResourceResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ServerVulnerabilityAssessmentClientListByExtendedResourceResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ServerVulnerabilityAssessmentClientListByExtendedResourceResponse{}, err - } - resp, err := client.listByExtendedResourceHandleResponse(httpResp) - return resp, err -} - -// 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) { - 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") - } - 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 *ServerVulnerabilityAssessmentClient) listByExtendedResourceHandleResponse(resp *http.Response) (ServerVulnerabilityAssessmentClientListByExtendedResourceResponse, error) { - result := ServerVulnerabilityAssessmentClientListByExtendedResourceResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ServerVulnerabilityAssessmentsList); err != nil { - return ServerVulnerabilityAssessmentClientListByExtendedResourceResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/servervulnerabilityassessment_client_example_test.go b/sdk/resourcemanager/security/armsecurity/servervulnerabilityassessment_client_example_test.go deleted file mode 100644 index 68943081aa4a..000000000000 --- a/sdk/resourcemanager/security/armsecurity/servervulnerabilityassessment_client_example_test.go +++ /dev/null @@ -1,115 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ServerVulnerabilityAssessments/ListByExtendedResourceServerVulnerabilityAssessments_example.json -func ExampleServerVulnerabilityAssessmentClient_ListByExtendedResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerVulnerabilityAssessmentClient().ListByExtendedResource(ctx, "rg1", "Microsoft.Compute", "virtualMachines", "vm1", 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.ServerVulnerabilityAssessmentsList = armsecurity.ServerVulnerabilityAssessmentsList{ - // Value: []*armsecurity.ServerVulnerabilityAssessment{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/serverVulnerabilityAssessments"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/rg1/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.Security/serverVulnerabilityAssessments/default"), - // Properties: &armsecurity.ServerVulnerabilityAssessmentProperties{ - // ProvisioningState: to.Ptr(armsecurity.ServerVulnerabilityAssessmentPropertiesProvisioningStateSucceeded), - // }, - // }}, - // } -} - -// 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/ServerVulnerabilityAssessments/GetServerVulnerabilityAssessments_example.json -func ExampleServerVulnerabilityAssessmentClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerVulnerabilityAssessmentClient().Get(ctx, "rg1", "Microsoft.Compute", "virtualMachines", "vm1", 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.ServerVulnerabilityAssessment = armsecurity.ServerVulnerabilityAssessment{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/serverVulnerabilityAssessments"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/rg1/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.Security/serverVulnerabilityAssessments/default"), - // Properties: &armsecurity.ServerVulnerabilityAssessmentProperties{ - // ProvisioningState: to.Ptr(armsecurity.ServerVulnerabilityAssessmentPropertiesProvisioningStateSucceeded), - // }, - // } -} - -// 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/ServerVulnerabilityAssessments/CreateServerVulnerabilityAssessments_example.json -func ExampleServerVulnerabilityAssessmentClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewServerVulnerabilityAssessmentClient().CreateOrUpdate(ctx, "rg1", "Microsoft.Compute", "virtualMachines", "vm1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ServerVulnerabilityAssessments/DeleteServerVulnerabilityAssessments_example.json -func ExampleServerVulnerabilityAssessmentClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerVulnerabilityAssessmentClient().BeginDelete(ctx, "rg1", "Microsoft.Compute", "virtualMachines", "vm1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/servervulnerabilityassessmentssettings_client.go b/sdk/resourcemanager/security/armsecurity/servervulnerabilityassessmentssettings_client.go deleted file mode 100644 index 64e0e83334c8..000000000000 --- a/sdk/resourcemanager/security/armsecurity/servervulnerabilityassessmentssettings_client.go +++ /dev/null @@ -1,274 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// ServerVulnerabilityAssessmentsSettingsClient contains the methods for the ServerVulnerabilityAssessmentsSettings group. -// Don't use this type directly, use NewServerVulnerabilityAssessmentsSettingsClient() instead. -type ServerVulnerabilityAssessmentsSettingsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewServerVulnerabilityAssessmentsSettingsClient creates a new instance of ServerVulnerabilityAssessmentsSettingsClient 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 NewServerVulnerabilityAssessmentsSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServerVulnerabilityAssessmentsSettingsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ServerVulnerabilityAssessmentsSettingsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Create or update a server vulnerability assessments setting of the requested kind on the subscription -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-05-01 -// - settingKind - The kind of the server vulnerability assessments setting -// - serverVulnerabilityAssessmentsSetting - A server vulnerability assessments setting over a predefined scope -// - options - ServerVulnerabilityAssessmentsSettingsClientCreateOrUpdateOptions contains the optional parameters for the ServerVulnerabilityAssessmentsSettingsClient.CreateOrUpdate -// method. -func (client *ServerVulnerabilityAssessmentsSettingsClient) CreateOrUpdate(ctx context.Context, settingKind ServerVulnerabilityAssessmentsSettingKindName, serverVulnerabilityAssessmentsSetting ServerVulnerabilityAssessmentsSettingClassification, options *ServerVulnerabilityAssessmentsSettingsClientCreateOrUpdateOptions) (ServerVulnerabilityAssessmentsSettingsClientCreateOrUpdateResponse, error) { - var err error - const operationName = "ServerVulnerabilityAssessmentsSettingsClient.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, settingKind, serverVulnerabilityAssessmentsSetting, options) - if err != nil { - return ServerVulnerabilityAssessmentsSettingsClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ServerVulnerabilityAssessmentsSettingsClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return ServerVulnerabilityAssessmentsSettingsClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ServerVulnerabilityAssessmentsSettingsClient) createOrUpdateCreateRequest(ctx context.Context, settingKind ServerVulnerabilityAssessmentsSettingKindName, serverVulnerabilityAssessmentsSetting ServerVulnerabilityAssessmentsSettingClassification, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if settingKind == "" { - return nil, errors.New("parameter settingKind cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{settingKind}", url.PathEscape(string(settingKind))) - 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-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, serverVulnerabilityAssessmentsSetting); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *ServerVulnerabilityAssessmentsSettingsClient) createOrUpdateHandleResponse(resp *http.Response) (ServerVulnerabilityAssessmentsSettingsClientCreateOrUpdateResponse, error) { - result := ServerVulnerabilityAssessmentsSettingsClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result); err != nil { - return ServerVulnerabilityAssessmentsSettingsClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Delete the server vulnerability assessments setting of the requested kind from the subscription -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-05-01 -// - settingKind - The kind of the server vulnerability assessments setting -// - options - ServerVulnerabilityAssessmentsSettingsClientDeleteOptions contains the optional parameters for the ServerVulnerabilityAssessmentsSettingsClient.Delete -// method. -func (client *ServerVulnerabilityAssessmentsSettingsClient) Delete(ctx context.Context, settingKind ServerVulnerabilityAssessmentsSettingKindName, options *ServerVulnerabilityAssessmentsSettingsClientDeleteOptions) (ServerVulnerabilityAssessmentsSettingsClientDeleteResponse, error) { - var err error - const operationName = "ServerVulnerabilityAssessmentsSettingsClient.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, settingKind, options) - if err != nil { - return ServerVulnerabilityAssessmentsSettingsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ServerVulnerabilityAssessmentsSettingsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return ServerVulnerabilityAssessmentsSettingsClientDeleteResponse{}, err - } - return ServerVulnerabilityAssessmentsSettingsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *ServerVulnerabilityAssessmentsSettingsClient) deleteCreateRequest(ctx context.Context, settingKind ServerVulnerabilityAssessmentsSettingKindName, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if settingKind == "" { - return nil, errors.New("parameter settingKind cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{settingKind}", url.PathEscape(string(settingKind))) - 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-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get a server vulnerability assessments setting of the requested kind, that is set on the subscription -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-05-01 -// - settingKind - The kind of the server vulnerability assessments setting -// - options - ServerVulnerabilityAssessmentsSettingsClientGetOptions contains the optional parameters for the ServerVulnerabilityAssessmentsSettingsClient.Get -// method. -func (client *ServerVulnerabilityAssessmentsSettingsClient) Get(ctx context.Context, settingKind ServerVulnerabilityAssessmentsSettingKindName, options *ServerVulnerabilityAssessmentsSettingsClientGetOptions) (ServerVulnerabilityAssessmentsSettingsClientGetResponse, error) { - var err error - const operationName = "ServerVulnerabilityAssessmentsSettingsClient.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, settingKind, options) - if err != nil { - return ServerVulnerabilityAssessmentsSettingsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ServerVulnerabilityAssessmentsSettingsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ServerVulnerabilityAssessmentsSettingsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ServerVulnerabilityAssessmentsSettingsClient) getCreateRequest(ctx context.Context, settingKind ServerVulnerabilityAssessmentsSettingKindName, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if settingKind == "" { - return nil, errors.New("parameter settingKind cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{settingKind}", url.PathEscape(string(settingKind))) - 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-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ServerVulnerabilityAssessmentsSettingsClient) getHandleResponse(resp *http.Response) (ServerVulnerabilityAssessmentsSettingsClientGetResponse, error) { - result := ServerVulnerabilityAssessmentsSettingsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result); err != nil { - return ServerVulnerabilityAssessmentsSettingsClientGetResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionPager - Get a list of all the server vulnerability assessments settings over a subscription level -// scope -// -// Generated from API version 2023-05-01 -// - options - ServerVulnerabilityAssessmentsSettingsClientListBySubscriptionOptions contains the optional parameters for the -// ServerVulnerabilityAssessmentsSettingsClient.NewListBySubscriptionPager method. -func (client *ServerVulnerabilityAssessmentsSettingsClient) NewListBySubscriptionPager(options *ServerVulnerabilityAssessmentsSettingsClientListBySubscriptionOptions) *runtime.Pager[ServerVulnerabilityAssessmentsSettingsClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[ServerVulnerabilityAssessmentsSettingsClientListBySubscriptionResponse]{ - More: func(page ServerVulnerabilityAssessmentsSettingsClientListBySubscriptionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ServerVulnerabilityAssessmentsSettingsClientListBySubscriptionResponse) (ServerVulnerabilityAssessmentsSettingsClientListBySubscriptionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ServerVulnerabilityAssessmentsSettingsClient.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 ServerVulnerabilityAssessmentsSettingsClientListBySubscriptionResponse{}, err - } - return client.listBySubscriptionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *ServerVulnerabilityAssessmentsSettingsClient) listBySubscriptionCreateRequest(ctx context.Context, options *ServerVulnerabilityAssessmentsSettingsClientListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/serverVulnerabilityAssessmentsSettings" - 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", "2023-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *ServerVulnerabilityAssessmentsSettingsClient) listBySubscriptionHandleResponse(resp *http.Response) (ServerVulnerabilityAssessmentsSettingsClientListBySubscriptionResponse, error) { - result := ServerVulnerabilityAssessmentsSettingsClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ServerVulnerabilityAssessmentsSettingsList); err != nil { - return ServerVulnerabilityAssessmentsSettingsClientListBySubscriptionResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/servervulnerabilityassessmentssettings_client_example_test.go b/sdk/resourcemanager/security/armsecurity/servervulnerabilityassessmentssettings_client_example_test.go deleted file mode 100644 index 12885cf6bf2b..000000000000 --- a/sdk/resourcemanager/security/armsecurity/servervulnerabilityassessmentssettings_client_example_test.go +++ /dev/null @@ -1,164 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/2023-05-01/examples/ServerVulnerabilityAssessmentsSettings/ListServerVulnerabilityAssessmentsSettings_example.json -func ExampleServerVulnerabilityAssessmentsSettingsClient_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.NewServerVulnerabilityAssessmentsSettingsClient().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.ServerVulnerabilityAssessmentsSettingsList = armsecurity.ServerVulnerabilityAssessmentsSettingsList{ - // Value: []armsecurity.ServerVulnerabilityAssessmentsSettingClassification{ - // &armsecurity.AzureServersSetting{ - // Name: to.Ptr("azureServersSetting"), - // Type: to.Ptr("Microsoft.Security/serverVulnerabilityAssessmentsSettings"), - // ID: to.Ptr("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/serverVulnerabilityAssessmentsSettings/azureServersSetting"), - // SystemData: &armsecurity.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-12T13: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, "2023-05-12T13:47:50.328Z"); return t}()), - // LastModifiedBy: to.Ptr("user@contoso.com"), - // LastModifiedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // }, - // Kind: to.Ptr(armsecurity.ServerVulnerabilityAssessmentsSettingKindAzureServersSetting), - // Properties: &armsecurity.ServerVulnerabilityAssessmentsAzureSettingProperties{ - // SelectedProvider: to.Ptr(armsecurity.ServerVulnerabilityAssessmentsAzureSettingSelectedProviderMdeTvm), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2023-05-01/examples/ServerVulnerabilityAssessmentsSettings/GetServerVulnerabilityAssessmentsSetting_example.json -func ExampleServerVulnerabilityAssessmentsSettingsClient_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.NewServerVulnerabilityAssessmentsSettingsClient().Get(ctx, armsecurity.ServerVulnerabilityAssessmentsSettingKindNameAzureServersSetting, 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 = armsecurity.ServerVulnerabilityAssessmentsSettingsClientGetResponse{ - // ServerVulnerabilityAssessmentsSettingClassification: &armsecurity.AzureServersSetting{ - // Name: to.Ptr("azureServersSetting"), - // Type: to.Ptr("Microsoft.Security/serverVulnerabilityAssessmentsSettings"), - // ID: to.Ptr("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/serverVulnerabilityAssessmentsSettings/azureServersSetting"), - // SystemData: &armsecurity.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-12T13: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, "2023-05-12T13:47:50.328Z"); return t}()), - // LastModifiedBy: to.Ptr("user@contoso.com"), - // LastModifiedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // }, - // Kind: to.Ptr(armsecurity.ServerVulnerabilityAssessmentsSettingKindAzureServersSetting), - // Properties: &armsecurity.ServerVulnerabilityAssessmentsAzureSettingProperties{ - // SelectedProvider: to.Ptr(armsecurity.ServerVulnerabilityAssessmentsAzureSettingSelectedProviderMdeTvm), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2023-05-01/examples/ServerVulnerabilityAssessmentsSettings/PutServerVulnerabilityAssessmentsSetting_example.json -func ExampleServerVulnerabilityAssessmentsSettingsClient_CreateOrUpdate() { - 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.NewServerVulnerabilityAssessmentsSettingsClient().CreateOrUpdate(ctx, armsecurity.ServerVulnerabilityAssessmentsSettingKindNameAzureServersSetting, &armsecurity.AzureServersSetting{ - Kind: to.Ptr(armsecurity.ServerVulnerabilityAssessmentsSettingKindAzureServersSetting), - Properties: &armsecurity.ServerVulnerabilityAssessmentsAzureSettingProperties{ - SelectedProvider: to.Ptr(armsecurity.ServerVulnerabilityAssessmentsAzureSettingSelectedProviderMdeTvm), - }, - }, 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 = armsecurity.ServerVulnerabilityAssessmentsSettingsClientCreateOrUpdateResponse{ - // ServerVulnerabilityAssessmentsSettingClassification: &armsecurity.AzureServersSetting{ - // Name: to.Ptr("azureServersSetting"), - // Type: to.Ptr("Microsoft.Security/serverVulnerabilityAssessmentsSettings"), - // ID: to.Ptr("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/serverVulnerabilityAssessmentsSettings/azureServersSetting"), - // SystemData: &armsecurity.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-12T13: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, "2022-01-12T13:47:50.328Z"); return t}()), - // LastModifiedBy: to.Ptr("user@contoso.com"), - // LastModifiedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // }, - // Kind: to.Ptr(armsecurity.ServerVulnerabilityAssessmentsSettingKindAzureServersSetting), - // Properties: &armsecurity.ServerVulnerabilityAssessmentsAzureSettingProperties{ - // SelectedProvider: to.Ptr(armsecurity.ServerVulnerabilityAssessmentsAzureSettingSelectedProviderMdeTvm), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2023-05-01/examples/ServerVulnerabilityAssessmentsSettings/DeleteServerVulnerabilityAssessmentsSetting_example.json -func ExampleServerVulnerabilityAssessmentsSettingsClient_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.NewServerVulnerabilityAssessmentsSettingsClient().Delete(ctx, armsecurity.ServerVulnerabilityAssessmentsSettingKindNameAzureServersSetting, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/settings_client.go b/sdk/resourcemanager/security/armsecurity/settings_client.go deleted file mode 100644 index 28d96e72c844..000000000000 --- a/sdk/resourcemanager/security/armsecurity/settings_client.go +++ /dev/null @@ -1,220 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// SettingsClient contains the methods for the Settings group. -// Don't use this type directly, use NewSettingsClient() instead. -type SettingsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewSettingsClient creates a new instance of SettingsClient 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 NewSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SettingsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &SettingsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Settings of different configurations in Microsoft Defender for Cloud -// If the operation fails it returns an *azcore.ResponseError type. -// -// 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) { - var err error - const operationName = "SettingsClient.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, settingName, options) - if err != nil { - return SettingsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return SettingsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return SettingsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *SettingsClient) getCreateRequest(ctx context.Context, settingName SettingNameAutoGenerated, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - 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.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *SettingsClient) getHandleResponse(resp *http.Response) (SettingsClientGetResponse, error) { - result := SettingsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result); err != nil { - return SettingsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Settings about different configurations in Microsoft Defender for Cloud -// -// Generated from API version 2022-05-01 -// - options - SettingsClientListOptions contains the optional parameters for the SettingsClient.NewListPager method. -func (client *SettingsClient) NewListPager(options *SettingsClientListOptions) *runtime.Pager[SettingsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[SettingsClientListResponse]{ - More: func(page SettingsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *SettingsClientListResponse) (SettingsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SettingsClient.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 SettingsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *SettingsClient) listCreateRequest(ctx context.Context, options *SettingsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings" - 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", "2022-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *SettingsClient) listHandleResponse(resp *http.Response) (SettingsClientListResponse, error) { - result := SettingsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SettingsList); err != nil { - return SettingsClientListResponse{}, err - } - return result, nil -} - -// Update - updating settings about different configurations in Microsoft Defender for Cloud -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-05-01 -// - 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) { - var err error - const operationName = "SettingsClient.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, settingName, setting, options) - if err != nil { - return SettingsClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return SettingsClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return SettingsClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *SettingsClient) updateCreateRequest(ctx context.Context, settingName SettingNameAutoGenerated, setting SettingClassification, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, setting); err != nil { - return nil, err - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *SettingsClient) updateHandleResponse(resp *http.Response) (SettingsClientUpdateResponse, error) { - result := SettingsClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result); err != nil { - return SettingsClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/settings_client_example_test.go b/sdk/resourcemanager/security/armsecurity/settings_client_example_test.go deleted file mode 100644 index 18086b262b66..000000000000 --- a/sdk/resourcemanager/security/armsecurity/settings_client_example_test.go +++ /dev/null @@ -1,150 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/2022-05-01/examples/Settings/GetSettings_example.json -func ExampleSettingsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSettingsClient().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.SettingsList = armsecurity.SettingsList{ - // Value: []armsecurity.SettingClassification{ - // &armsecurity.DataExportSettings{ - // Name: to.Ptr("WDATP"), - // Type: to.Ptr("Microsoft.Security/settings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/settings/WDATP"), - // Kind: to.Ptr(armsecurity.SettingKindDataExportSettings), - // Properties: &armsecurity.DataExportSettingProperties{ - // Enabled: to.Ptr(false), - // }, - // }, - // &armsecurity.DataExportSettings{ - // Name: to.Ptr("WDATP_EXCLUDE_LINUX_PUBLIC_PREVIEW"), - // Type: to.Ptr("Microsoft.Security/settings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/settings/WDATP_EXCLUDE_LINUX_PUBLIC_PREVIEW"), - // Kind: to.Ptr(armsecurity.SettingKindDataExportSettings), - // Properties: &armsecurity.DataExportSettingProperties{ - // Enabled: to.Ptr(false), - // }, - // }, - // &armsecurity.DataExportSettings{ - // Name: to.Ptr("WDATP_UNIFIED_SOLUTION"), - // Type: to.Ptr("Microsoft.Security/settings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/settings/WDATP_UNIFIED_SOLUTION"), - // Kind: to.Ptr(armsecurity.SettingKindDataExportSettings), - // Properties: &armsecurity.DataExportSettingProperties{ - // Enabled: to.Ptr(false), - // }, - // }, - // &armsecurity.AlertSyncSettings{ - // Name: to.Ptr("Sentinel"), - // Type: to.Ptr("Microsoft.Security/settings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/settings/Sentinel"), - // Kind: to.Ptr(armsecurity.SettingKindAlertSyncSettings), - // Properties: &armsecurity.AlertSyncSettingProperties{ - // Enabled: to.Ptr(false), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2022-05-01/examples/Settings/GetSetting_example.json -func ExampleSettingsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSettingsClient().Get(ctx, armsecurity.SettingNameAutoGeneratedWDATP, 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 = armsecurity.SettingsClientGetResponse{ - // SettingClassification: &armsecurity.DataExportSettings{ - // Name: to.Ptr("WDATP"), - // Type: to.Ptr("Microsoft.Security/settings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/settings/WDATP"), - // Kind: to.Ptr(armsecurity.SettingKindDataExportSettings), - // Properties: &armsecurity.DataExportSettingProperties{ - // Enabled: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2022-05-01/examples/Settings/UpdateSetting_example.json -func ExampleSettingsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSettingsClient().Update(ctx, armsecurity.SettingNameAutoGeneratedWDATP, &armsecurity.DataExportSettings{ - Kind: to.Ptr(armsecurity.SettingKindDataExportSettings), - Properties: &armsecurity.DataExportSettingProperties{ - Enabled: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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 = armsecurity.SettingsClientUpdateResponse{ - // SettingClassification: &armsecurity.DataExportSettings{ - // Name: to.Ptr("WDATP"), - // Type: to.Ptr("Microsoft.Security/settings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/settings/WDATP"), - // Kind: to.Ptr(armsecurity.SettingKindDataExportSettings), - // Properties: &armsecurity.DataExportSettingProperties{ - // Enabled: to.Ptr(true), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/softwareinventories_client.go b/sdk/resourcemanager/security/armsecurity/softwareinventories_client.go deleted file mode 100644 index e133a5de3694..000000000000 --- a/sdk/resourcemanager/security/armsecurity/softwareinventories_client.go +++ /dev/null @@ -1,253 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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/softwareinventories_client_example_test.go b/sdk/resourcemanager/security/armsecurity/softwareinventories_client_example_test.go deleted file mode 100644 index 5491ccff095e..000000000000 --- a/sdk/resourcemanager/security/armsecurity/softwareinventories_client_example_test.go +++ /dev/null @@ -1,169 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2021-05-01-preview/examples/SoftwareInventories/ListByExtendedResourceSoftwareInventories_example.json -func ExampleSoftwareInventoriesClient_NewListByExtendedResourcePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSoftwareInventoriesClient().NewListByExtendedResourcePager("EITAN-TESTS", "Microsoft.Compute", "virtualMachines", "Eitan-Test1", 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.SoftwaresList = armsecurity.SoftwaresList{ - // Value: []*armsecurity.Software{ - // { - // Name: to.Ptr("outlook_16.0.10371.20060"), - // Type: to.Ptr("Microsoft.Security/softwareInventories"), - // ID: to.Ptr("/subscriptions/e5d1b86c-3051-44d5-8802-aa65d45a279b/resourcegroups/EITAN-TESTS/providers/Microsoft.Compute/virtualMachines/Eitan-Test1/providers/Microsoft.Security/softwareInventories/outlook_16.0.10371.20060"), - // Properties: &armsecurity.SoftwareProperties{ - // DeviceID: to.Ptr("7bd19ed6b07553e52a2844451bcec68d25963a53"), - // EndOfSupportStatus: to.Ptr(armsecurity.EndOfSupportStatusNone), - // FirstSeenAt: to.Ptr("2021-01-26 15:48:56"), - // NumberOfKnownVulnerabilities: to.Ptr[int32](0), - // OSPlatform: to.Ptr("Windows10"), - // SoftwareName: to.Ptr("outlook"), - // Vendor: to.Ptr("microsoft"), - // Version: to.Ptr("16.0.10371.20060"), - // }, - // }, - // { - // Name: to.Ptr("windows_10_10.0.19042.746"), - // Type: to.Ptr("Microsoft.Security/softwareInventories"), - // ID: to.Ptr("/subscriptions/e5d1b86c-3051-44d5-8802-aa65d45a279b/resourcegroups/EITAN-TESTS/providers/Microsoft.Compute/virtualMachines/Eitan-Test1/providers/Microsoft.Security/softwareInventories/windows_10_10.0.19042.746"), - // Properties: &armsecurity.SoftwareProperties{ - // DeviceID: to.Ptr("7bd19ed6b07553e52a2844451bcec68d25963a53"), - // EndOfSupportStatus: to.Ptr(armsecurity.EndOfSupportStatusNone), - // FirstSeenAt: to.Ptr("2021-01-26 15:51:19"), - // NumberOfKnownVulnerabilities: to.Ptr[int32](26), - // OSPlatform: to.Ptr("Windows10"), - // SoftwareName: to.Ptr("windows_10"), - // Vendor: to.Ptr("microsoft"), - // Version: to.Ptr("10.0.19042.746"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2021-05-01-preview/examples/SoftwareInventories/ListBySubscriptionSoftwareInventories_example.json -func ExampleSoftwareInventoriesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSoftwareInventoriesClient().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.SoftwaresList = armsecurity.SoftwaresList{ - // Value: []*armsecurity.Software{ - // { - // Name: to.Ptr("outlook_16.0.10371.20060"), - // Type: to.Ptr("Microsoft.Security/softwareInventories"), - // ID: to.Ptr("/subscriptions/e5d1b86c-3051-44d5-8802-aa65d45a279b/resourcegroups/EITAN-TESTS/providers/Microsoft.Compute/virtualMachines/Eitan-Test1/providers/Microsoft.Security/softwareInventories/outlook_16.0.10371.20060"), - // Properties: &armsecurity.SoftwareProperties{ - // DeviceID: to.Ptr("7bd19ed6b07553e52a2844451bcec68d25963a53"), - // EndOfSupportStatus: to.Ptr(armsecurity.EndOfSupportStatusNone), - // FirstSeenAt: to.Ptr("2021-01-26 15:48:56"), - // NumberOfKnownVulnerabilities: to.Ptr[int32](0), - // OSPlatform: to.Ptr("Windows10"), - // SoftwareName: to.Ptr("outlook"), - // Vendor: to.Ptr("microsoft"), - // Version: to.Ptr("16.0.10371.20060"), - // }, - // }, - // { - // Name: to.Ptr("windows_10_10.0.19042.746"), - // Type: to.Ptr("Microsoft.Security/softwareInventories"), - // ID: to.Ptr("/subscriptions/e5d1b86c-3051-44d5-8802-aa65d45a279b/resourcegroups/EITAN-TESTS/providers/Microsoft.Compute/virtualMachines/Eitan-Test2/providers/Microsoft.Security/softwareInventories/windows_10_10.0.19042.746"), - // Properties: &armsecurity.SoftwareProperties{ - // DeviceID: to.Ptr("7bd19ed6b07553e52a2844451bcec68d25963a53"), - // EndOfSupportStatus: to.Ptr(armsecurity.EndOfSupportStatusNone), - // FirstSeenAt: to.Ptr("2021-01-26 15:51:19"), - // NumberOfKnownVulnerabilities: to.Ptr[int32](26), - // OSPlatform: to.Ptr("Windows10"), - // SoftwareName: to.Ptr("windows_10"), - // Vendor: to.Ptr("microsoft"), - // Version: to.Ptr("10.0.19042.746"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2021-05-01-preview/examples/SoftwareInventories/GetSoftware_example.json -func ExampleSoftwareInventoriesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSoftwareInventoriesClient().Get(ctx, "EITAN-TESTS", "Microsoft.Compute", "virtualMachines", "Eitan-Test1", "outlook_16.0.10371.20060", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.Software = armsecurity.Software{ - // Name: to.Ptr("outlook_16.0.10371.20060"), - // Type: to.Ptr("Microsoft.Security/softwareInventories"), - // ID: to.Ptr("/subscriptions/e5d1b86c-3051-44d5-8802-aa65d45a279b/resourcegroups/EITAN-TESTS/providers/Microsoft.Compute/virtualMachines/Eitan-Test1/providers/Microsoft.Security/softwareInventories/outlook_16.0.10371.20060"), - // Properties: &armsecurity.SoftwareProperties{ - // DeviceID: to.Ptr("7bd19ed6b07553e52a2844451bcec68d25963a53"), - // EndOfSupportStatus: to.Ptr(armsecurity.EndOfSupportStatusNone), - // FirstSeenAt: to.Ptr("2021-01-26 15:48:56"), - // NumberOfKnownVulnerabilities: to.Ptr[int32](0), - // OSPlatform: to.Ptr("Windows10"), - // SoftwareName: to.Ptr("outlook"), - // Vendor: to.Ptr("microsoft"), - // Version: to.Ptr("16.0.10371.20060"), - // }, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/solutions_client.go b/sdk/resourcemanager/security/armsecurity/solutions_client.go deleted file mode 100644 index 29e5951b88a5..000000000000 --- a/sdk/resourcemanager/security/armsecurity/solutions_client.go +++ /dev/null @@ -1,167 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// SolutionsClient contains the methods for the SecuritySolutions group. -// Don't use this type directly, use NewSolutionsClient() instead. -type SolutionsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewSolutionsClient creates a new instance of SolutionsClient 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 NewSolutionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SolutionsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &SolutionsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Gets a specific Security Solution. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-01-01 -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - securitySolutionName - Name of security solution. -// - options - SolutionsClientGetOptions contains the optional parameters for the SolutionsClient.Get method. -func (client *SolutionsClient) Get(ctx context.Context, resourceGroupName string, ascLocation string, securitySolutionName string, options *SolutionsClientGetOptions) (SolutionsClientGetResponse, error) { - var err error - const operationName = "SolutionsClient.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, ascLocation, securitySolutionName, options) - if err != nil { - return SolutionsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return SolutionsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return SolutionsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *SolutionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, securitySolutionName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ascLocation == "" { - return nil, errors.New("parameter ascLocation cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ascLocation}", url.PathEscape(ascLocation)) - if securitySolutionName == "" { - return nil, errors.New("parameter securitySolutionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{securitySolutionName}", url.PathEscape(securitySolutionName)) - 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 *SolutionsClient) getHandleResponse(resp *http.Response) (SolutionsClientGetResponse, error) { - result := SolutionsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Solution); err != nil { - return SolutionsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Gets a list of Security Solutions for the subscription. -// -// Generated from API version 2020-01-01 -// - options - SolutionsClientListOptions contains the optional parameters for the SolutionsClient.NewListPager method. -func (client *SolutionsClient) NewListPager(options *SolutionsClientListOptions) *runtime.Pager[SolutionsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[SolutionsClientListResponse]{ - More: func(page SolutionsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *SolutionsClientListResponse) (SolutionsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SolutionsClient.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 SolutionsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *SolutionsClient) listCreateRequest(ctx context.Context, options *SolutionsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutions" - 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") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *SolutionsClient) listHandleResponse(resp *http.Response) (SolutionsClientListResponse, error) { - result := SolutionsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SolutionList); err != nil { - return SolutionsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/solutions_client_example_test.go b/sdk/resourcemanager/security/armsecurity/solutions_client_example_test.go deleted file mode 100644 index f974bebb65ba..000000000000 --- a/sdk/resourcemanager/security/armsecurity/solutions_client_example_test.go +++ /dev/null @@ -1,102 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/SecuritySolutions/GetSecuritySolutionsSubscription_example.json -func ExampleSolutionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSolutionsClient().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.SolutionList = armsecurity.SolutionList{ - // Value: []*armsecurity.Solution{ - // { - // Location: to.Ptr("eastus"), - // Name: to.Ptr("MySaasWaf"), - // Type: to.Ptr("Microsoft.Security/locations/securitySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Security/locations/centralus/securitySolutions/SaasWaf"), - // Properties: &armsecurity.SolutionProperties{ - // ProtectionStatus: to.Ptr("Good"), - // ProvisioningState: to.Ptr(armsecurity.ProvisioningStateSucceeded), - // SecurityFamily: to.Ptr(armsecurity.SecurityFamilySaasWaf), - // Template: to.Ptr("microsoft/ApplicationGateway-ARM"), - // }, - // }, - // { - // Location: to.Ptr("eastus2"), - // Name: to.Ptr("MyVA"), - // Type: to.Ptr("Microsoft.Security/locations/securitySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg2/providers/Microsoft.Security/locations/centralus/securitySolutions/MyVA"), - // Properties: &armsecurity.SolutionProperties{ - // ProtectionStatus: to.Ptr("Good"), - // ProvisioningState: to.Ptr(armsecurity.ProvisioningStateSucceeded), - // SecurityFamily: to.Ptr(armsecurity.SecurityFamilyVa), - // Template: to.Ptr("qualys.qualysAgent"), - // }, - // }}, - // } - } -} - -// 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/SecuritySolutions/GetSecuritySolutionsResourceGroupLocation_example.json -func ExampleSolutionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSolutionsClient().Get(ctx, "myRg2", "centralus", "paloalto7", 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.Solution = armsecurity.Solution{ - // Location: to.Ptr("eastus2"), - // Name: to.Ptr("MyVA"), - // Type: to.Ptr("Microsoft.Security/locations/securitySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg2/providers/Microsoft.Security/locations/centralus/securitySolutions/paloalto7"), - // Properties: &armsecurity.SolutionProperties{ - // ProtectionStatus: to.Ptr("Good"), - // ProvisioningState: to.Ptr(armsecurity.ProvisioningStateSucceeded), - // SecurityFamily: to.Ptr(armsecurity.SecurityFamilyNgfw), - // Template: to.Ptr("paloalto.paloaltofw"), - // }, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/solutionsreferencedata_client.go b/sdk/resourcemanager/security/armsecurity/solutionsreferencedata_client.go deleted file mode 100644 index 207169c0d204..000000000000 --- a/sdk/resourcemanager/security/armsecurity/solutionsreferencedata_client.go +++ /dev/null @@ -1,159 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// SolutionsReferenceDataClient contains the methods for the SecuritySolutionsReferenceData group. -// Don't use this type directly, use NewSolutionsReferenceDataClient() instead. -type SolutionsReferenceDataClient struct { - internal *arm.Client - subscriptionID string -} - -// NewSolutionsReferenceDataClient creates a new instance of SolutionsReferenceDataClient 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 NewSolutionsReferenceDataClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SolutionsReferenceDataClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &SolutionsReferenceDataClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// List - Gets a list of all supported Security Solutions for the subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-01-01 -// - options - SolutionsReferenceDataClientListOptions contains the optional parameters for the SolutionsReferenceDataClient.List -// method. -func (client *SolutionsReferenceDataClient) List(ctx context.Context, options *SolutionsReferenceDataClientListOptions) (SolutionsReferenceDataClientListResponse, error) { - var err error - const operationName = "SolutionsReferenceDataClient.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 SolutionsReferenceDataClientListResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return SolutionsReferenceDataClientListResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return SolutionsReferenceDataClientListResponse{}, err - } - resp, err := client.listHandleResponse(httpResp) - return resp, err -} - -// listCreateRequest creates the List request. -func (client *SolutionsReferenceDataClient) listCreateRequest(ctx context.Context, options *SolutionsReferenceDataClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutionsReferenceData" - 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") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *SolutionsReferenceDataClient) listHandleResponse(resp *http.Response) (SolutionsReferenceDataClientListResponse, error) { - result := SolutionsReferenceDataClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SolutionsReferenceDataList); err != nil { - return SolutionsReferenceDataClientListResponse{}, err - } - return result, nil -} - -// ListByHomeRegion - Gets list of all supported Security Solutions for subscription and location. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-01-01 -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - options - SolutionsReferenceDataClientListByHomeRegionOptions contains the optional parameters for the SolutionsReferenceDataClient.ListByHomeRegion -// method. -func (client *SolutionsReferenceDataClient) ListByHomeRegion(ctx context.Context, ascLocation string, options *SolutionsReferenceDataClientListByHomeRegionOptions) (SolutionsReferenceDataClientListByHomeRegionResponse, error) { - var err error - const operationName = "SolutionsReferenceDataClient.ListByHomeRegion" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listByHomeRegionCreateRequest(ctx, ascLocation, options) - if err != nil { - return SolutionsReferenceDataClientListByHomeRegionResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return SolutionsReferenceDataClientListByHomeRegionResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return SolutionsReferenceDataClientListByHomeRegionResponse{}, err - } - resp, err := client.listByHomeRegionHandleResponse(httpResp) - return resp, err -} - -// listByHomeRegionCreateRequest creates the ListByHomeRegion request. -func (client *SolutionsReferenceDataClient) listByHomeRegionCreateRequest(ctx context.Context, ascLocation string, options *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") - } - 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)) - 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 -} - -// listByHomeRegionHandleResponse handles the ListByHomeRegion response. -func (client *SolutionsReferenceDataClient) listByHomeRegionHandleResponse(resp *http.Response) (SolutionsReferenceDataClientListByHomeRegionResponse, error) { - result := SolutionsReferenceDataClientListByHomeRegionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SolutionsReferenceDataList); err != nil { - return SolutionsReferenceDataClientListByHomeRegionResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/solutionsreferencedata_client_example_test.go b/sdk/resourcemanager/security/armsecurity/solutionsreferencedata_client_example_test.go deleted file mode 100644 index bd28952b8540..000000000000 --- a/sdk/resourcemanager/security/armsecurity/solutionsreferencedata_client_example_test.go +++ /dev/null @@ -1,120 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/SecuritySolutionsReferenceData/GetSecuritySolutionsReferenceDataSubscription_example.json -func ExampleSolutionsReferenceDataClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSolutionsReferenceDataClient().List(ctx, 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.SolutionsReferenceDataList = armsecurity.SolutionsReferenceDataList{ - // Value: []*armsecurity.SolutionsReferenceData{ - // { - // Name: to.Ptr("microsoft.ApplicationGateway-ARM"), - // Type: to.Ptr("Microsoft.Security/locations/securitySolutionsReferenceData"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/locations/westcentralus/securitySolutionsReferenceData/microsoft.ApplicationGateway-ARM"), - // Properties: &armsecurity.SolutionsReferenceDataProperties{ - // AlertVendorName: to.Ptr("Microsoft"), - // PackageInfoURL: to.Ptr("www.azure.com"), - // ProductName: to.Ptr("Web Application Firewall"), - // Publisher: to.Ptr("microsoft"), - // PublisherDisplayName: to.Ptr("Microsoft Inc."), - // SecurityFamily: to.Ptr(armsecurity.SecurityFamilySaasWaf), - // Template: to.Ptr("microsoft/ApplicationGateway-ARM"), - // }, - // }, - // { - // Name: to.Ptr("qualys.qualysAgent"), - // Type: to.Ptr("Microsoft.Security/locations/SecuritySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/locations/westcentralus/securitySolutionsReferenceData/qualys.qualysAgent"), - // Properties: &armsecurity.SolutionsReferenceDataProperties{ - // AlertVendorName: to.Ptr("Qualys VA"), - // PackageInfoURL: to.Ptr("http://www.qualys.com/"), - // ProductName: to.Ptr("Vulnerability Assessment"), - // Publisher: to.Ptr("qualys"), - // PublisherDisplayName: to.Ptr("Qualys, Inc."), - // SecurityFamily: to.Ptr(armsecurity.SecurityFamilyVa), - // Template: to.Ptr("qualys/qualysAgent"), - // }, - // }}, - // } -} - -// 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/SecuritySolutionsReferenceData/GetSecuritySolutionsReferenceDataSubscriptionLocation_example.json -func ExampleSolutionsReferenceDataClient_ListByHomeRegion() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSolutionsReferenceDataClient().ListByHomeRegion(ctx, "westcentralus", 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.SolutionsReferenceDataList = armsecurity.SolutionsReferenceDataList{ - // Value: []*armsecurity.SolutionsReferenceData{ - // { - // Name: to.Ptr("microsoft.ApplicationGateway-ARM"), - // Type: to.Ptr("Microsoft.Security/locations/securitySolutionsReferenceData"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/locations/westcentralus/securitySolutionsReferenceData/microsoft.ApplicationGateway-ARM"), - // Properties: &armsecurity.SolutionsReferenceDataProperties{ - // AlertVendorName: to.Ptr("Microsoft"), - // PackageInfoURL: to.Ptr("www.azure.com"), - // ProductName: to.Ptr("Web Application Firewall"), - // Publisher: to.Ptr("microsoft"), - // PublisherDisplayName: to.Ptr("Microsoft Inc."), - // SecurityFamily: to.Ptr(armsecurity.SecurityFamilySaasWaf), - // Template: to.Ptr("microsoft/ApplicationGateway-ARM"), - // }, - // }, - // { - // Name: to.Ptr("qualys.qualysAgent"), - // Type: to.Ptr("Microsoft.Security/locations/SecuritySolutions"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/locations/westcentralus/securitySolutionsReferenceData/qualys.qualysAgent"), - // Properties: &armsecurity.SolutionsReferenceDataProperties{ - // AlertVendorName: to.Ptr("Qualys VA"), - // PackageInfoURL: to.Ptr("http://www.qualys.com/"), - // ProductName: to.Ptr("Vulnerability Assessment"), - // Publisher: to.Ptr("qualys"), - // PublisherDisplayName: to.Ptr("Qualys, Inc."), - // SecurityFamily: to.Ptr(armsecurity.SecurityFamilyVa), - // Template: to.Ptr("qualys/qualysAgent"), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentbaselinerules_client.go b/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentbaselinerules_client.go deleted file mode 100644 index 9c569607a7c7..000000000000 --- a/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentbaselinerules_client.go +++ /dev/null @@ -1,333 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// SQLVulnerabilityAssessmentBaselineRulesClient contains the methods for the SQLVulnerabilityAssessmentBaselineRules group. -// Don't use this type directly, use NewSQLVulnerabilityAssessmentBaselineRulesClient() instead. -type SQLVulnerabilityAssessmentBaselineRulesClient struct { - internal *arm.Client -} - -// 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. -func NewSQLVulnerabilityAssessmentBaselineRulesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*SQLVulnerabilityAssessmentBaselineRulesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &SQLVulnerabilityAssessmentBaselineRulesClient{ - internal: cl, - } - return client, nil -} - -// Add - Add 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. -// - 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) { - 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) - if err != nil { - return SQLVulnerabilityAssessmentBaselineRulesClientAddResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return SQLVulnerabilityAssessmentBaselineRulesClientAddResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return SQLVulnerabilityAssessmentBaselineRulesClientAddResponse{}, err - } - resp, err := client.addHandleResponse(httpResp) - return resp, err -} - -// addCreateRequest creates the Add request. -func (client *SQLVulnerabilityAssessmentBaselineRulesClient) addCreateRequest(ctx context.Context, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesClientAddOptions) (*policy.Request, error) { - urlPath := "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules" - 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) - 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 - } - return req, nil -} - -// addHandleResponse handles the Add response. -func (client *SQLVulnerabilityAssessmentBaselineRulesClient) addHandleResponse(resp *http.Response) (SQLVulnerabilityAssessmentBaselineRulesClientAddResponse, error) { - result := SQLVulnerabilityAssessmentBaselineRulesClientAddResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RulesResults); err != nil { - return SQLVulnerabilityAssessmentBaselineRulesClientAddResponse{}, err - } - return result, nil -} - -// CreateOrUpdate - 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 -// - ruleID - The rule Id. -// - workspaceID - The workspace Id. -// - resourceID - The identifier of the resource. -// - 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) { - 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) - if err != nil { - return SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *SQLVulnerabilityAssessmentBaselineRulesClient) createOrUpdateCreateRequest(ctx context.Context, ruleID string, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}" - 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) - 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 - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *SQLVulnerabilityAssessmentBaselineRulesClient) createOrUpdateHandleResponse(resp *http.Response) (SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateResponse, error) { - result := SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RuleResults); err != nil { - return SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - 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 -// - 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) { - 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) - if err != nil { - return SQLVulnerabilityAssessmentBaselineRulesClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return SQLVulnerabilityAssessmentBaselineRulesClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return SQLVulnerabilityAssessmentBaselineRulesClientDeleteResponse{}, err - } - return SQLVulnerabilityAssessmentBaselineRulesClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *SQLVulnerabilityAssessmentBaselineRulesClient) deleteCreateRequest(ctx context.Context, ruleID string, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesClientDeleteOptions) (*policy.Request, error) { - urlPath := "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}" - 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) - 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. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-02-01-preview -// - 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) { - 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) - if err != nil { - return SQLVulnerabilityAssessmentBaselineRulesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return SQLVulnerabilityAssessmentBaselineRulesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return SQLVulnerabilityAssessmentBaselineRulesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *SQLVulnerabilityAssessmentBaselineRulesClient) getCreateRequest(ctx context.Context, ruleID string, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesClientGetOptions) (*policy.Request, error) { - urlPath := "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}" - 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) - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *SQLVulnerabilityAssessmentBaselineRulesClient) getHandleResponse(resp *http.Response) (SQLVulnerabilityAssessmentBaselineRulesClientGetResponse, error) { - result := SQLVulnerabilityAssessmentBaselineRulesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RuleResults); err != nil { - return SQLVulnerabilityAssessmentBaselineRulesClientGetResponse{}, err - } - return result, nil -} - -// List - Gets the results for all rules in the Baseline. -// 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 - SQLVulnerabilityAssessmentBaselineRulesClientListOptions contains the optional parameters for the SQLVulnerabilityAssessmentBaselineRulesClient.List -// 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 -} - -// listCreateRequest creates the List request. -func (client *SQLVulnerabilityAssessmentBaselineRulesClient) listCreateRequest(ctx context.Context, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesClientListOptions) (*policy.Request, error) { - urlPath := "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules" - 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) - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *SQLVulnerabilityAssessmentBaselineRulesClient) listHandleResponse(resp *http.Response) (SQLVulnerabilityAssessmentBaselineRulesClientListResponse, error) { - result := SQLVulnerabilityAssessmentBaselineRulesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RulesResults); err != nil { - return SQLVulnerabilityAssessmentBaselineRulesClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentbaselinerules_client_example_test.go b/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentbaselinerules_client_example_test.go deleted file mode 100644 index 195dae3dd56f..000000000000 --- a/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentbaselinerules_client_example_test.go +++ /dev/null @@ -1,320 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/2023-02-01-preview/examples/sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_Put.json -func ExampleSQLVulnerabilityAssessmentBaselineRulesClient_CreateOrUpdate_createABaseline() { - 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.NewSQLVulnerabilityAssessmentBaselineRulesClient().CreateOrUpdate(ctx, "VA1234", "55555555-6666-7777-8888-999999999999", "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", &armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateOptions{Body: &armsecurity.RuleResultsInput{ - LatestScan: to.Ptr(false), - Results: [][]*string{ - { - to.Ptr("userA"), - to.Ptr("SELECT")}, - { - to.Ptr("userB"), - to.Ptr("SELECT")}}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.RuleResults = armsecurity.RuleResults{ - // Name: to.Ptr("VA1234"), - // Type: to.Ptr("Microsoft.Security/sqlVulnerabilityAssessments/baselineRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/VA1234"), - // Properties: &armsecurity.RuleResultsProperties{ - // Results: [][]*string{ - // []*string{ - // to.Ptr("userA"), - // to.Ptr("SELECT")}, - // []*string{ - // to.Ptr("userB"), - // to.Ptr("SELECT")}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_PutLatest.json -func ExampleSQLVulnerabilityAssessmentBaselineRulesClient_CreateOrUpdate_createABaselineUsingTheLatestScanResults() { - 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.NewSQLVulnerabilityAssessmentBaselineRulesClient().CreateOrUpdate(ctx, "VA1234", "55555555-6666-7777-8888-999999999999", "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", &armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateOptions{Body: &armsecurity.RuleResultsInput{ - LatestScan: to.Ptr(true), - Results: [][]*string{}, - }, - }) - 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.RuleResults = armsecurity.RuleResults{ - // Name: to.Ptr("VA1234"), - // Type: to.Ptr("Microsoft.Security/sqlVulnerabilityAssessments/baselineRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/VA1234"), - // Properties: &armsecurity.RuleResultsProperties{ - // Results: [][]*string{ - // []*string{ - // to.Ptr("userA"), - // to.Ptr("SELECT")}, - // []*string{ - // to.Ptr("userB"), - // to.Ptr("SELECT")}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_Get.json -func ExampleSQLVulnerabilityAssessmentBaselineRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSQLVulnerabilityAssessmentBaselineRulesClient().Get(ctx, "VA1234", "55555555-6666-7777-8888-999999999999", "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.RuleResults = armsecurity.RuleResults{ - // Name: to.Ptr("VA1234"), - // Type: to.Ptr("Microsoft.Security/sqlVulnerabilityAssessments/baselineRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/VA1234"), - // Properties: &armsecurity.RuleResultsProperties{ - // Results: [][]*string{ - // []*string{ - // to.Ptr("userA"), - // to.Ptr("SELECT")}, - // []*string{ - // to.Ptr("userB"), - // to.Ptr("SELECT")}}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_Delete.json -func ExampleSQLVulnerabilityAssessmentBaselineRulesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewSQLVulnerabilityAssessmentBaselineRulesClient().Delete(ctx, "VA1234", "55555555-6666-7777-8888-999999999999", "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_List.json -func ExampleSQLVulnerabilityAssessmentBaselineRulesClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSQLVulnerabilityAssessmentBaselineRulesClient().List(ctx, "55555555-6666-7777-8888-999999999999", "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.RulesResults = armsecurity.RulesResults{ - // Value: []*armsecurity.RuleResults{ - // { - // Name: to.Ptr("VA1234"), - // Type: to.Ptr("Microsoft.Security/sqlVulnerabilityAssessments/baselineRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/VA1234"), - // Properties: &armsecurity.RuleResultsProperties{ - // Results: [][]*string{ - // []*string{ - // to.Ptr("userA"), - // to.Ptr("SELECT")}, - // []*string{ - // to.Ptr("userB"), - // to.Ptr("SELECT")}}, - // }, - // }, - // { - // Name: to.Ptr("VA5678"), - // Type: to.Ptr("Microsoft.Security/sqlVulnerabilityAssessments/baselineRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/VA5678"), - // Properties: &armsecurity.RuleResultsProperties{ - // Results: [][]*string{ - // []*string{ - // to.Ptr("Test"), - // to.Ptr("0.0.0.0"), - // to.Ptr("125.125.125.125")}}, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_Add.json -func ExampleSQLVulnerabilityAssessmentBaselineRulesClient_Add_createABaselineForAllRules() { - 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.NewSQLVulnerabilityAssessmentBaselineRulesClient().Add(ctx, "55555555-6666-7777-8888-999999999999", "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", &armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientAddOptions{Body: &armsecurity.RulesResultsInput{ - LatestScan: to.Ptr(false), - Results: map[string][][]*string{ - "VA1234": { - { - to.Ptr("userA"), - to.Ptr("SELECT")}, - { - to.Ptr("userB"), - to.Ptr("SELECT")}}, - "VA5678": { - { - to.Ptr("Test"), - to.Ptr("0.0.0.0"), - to.Ptr("125.125.125.125")}}, - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.RulesResults = armsecurity.RulesResults{ - // Value: []*armsecurity.RuleResults{ - // { - // Name: to.Ptr("VA1234"), - // Type: to.Ptr("Microsoft.Security/sqlVulnerabilityAssessments/baselineRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/VA1234"), - // Properties: &armsecurity.RuleResultsProperties{ - // Results: [][]*string{ - // []*string{ - // to.Ptr("userA"), - // to.Ptr("SELECT")}, - // []*string{ - // to.Ptr("userB"), - // to.Ptr("SELECT")}}, - // }, - // }, - // { - // Name: to.Ptr("VA5678"), - // Type: to.Ptr("Microsoft.Security/sqlVulnerabilityAssessments/baselineRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/VA5678"), - // Properties: &armsecurity.RuleResultsProperties{ - // Results: [][]*string{ - // []*string{ - // to.Ptr("Test"), - // to.Ptr("0.0.0.0"), - // to.Ptr("125.125.125.125")}}, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_AddLatest.json -func ExampleSQLVulnerabilityAssessmentBaselineRulesClient_Add_createABaselineForAllRulesUsingTheLatestScanResults() { - 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.NewSQLVulnerabilityAssessmentBaselineRulesClient().Add(ctx, "55555555-6666-7777-8888-999999999999", "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", &armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientAddOptions{Body: &armsecurity.RulesResultsInput{ - LatestScan: to.Ptr(true), - Results: map[string][][]*string{}, - }, - }) - 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.RulesResults = armsecurity.RulesResults{ - // Value: []*armsecurity.RuleResults{ - // { - // Name: to.Ptr("VA1234"), - // Type: to.Ptr("Microsoft.Security/sqlVulnerabilityAssessments/baselineRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/VA1234"), - // Properties: &armsecurity.RuleResultsProperties{ - // Results: [][]*string{ - // []*string{ - // to.Ptr("userA"), - // to.Ptr("SELECT")}, - // []*string{ - // to.Ptr("userB"), - // to.Ptr("SELECT")}}, - // }, - // }, - // { - // Name: to.Ptr("VA5678"), - // Type: to.Ptr("Microsoft.Security/sqlVulnerabilityAssessments/baselineRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/VA5678"), - // Properties: &armsecurity.RuleResultsProperties{ - // Results: [][]*string{ - // []*string{ - // to.Ptr("Test"), - // to.Ptr("0.0.0.0"), - // to.Ptr("125.125.125.125")}}, - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentscanresults_client.go b/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentscanresults_client.go deleted file mode 100644 index b9913510f888..000000000000 --- a/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentscanresults_client.go +++ /dev/null @@ -1,166 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// SQLVulnerabilityAssessmentScanResultsClient contains the methods for the SQLVulnerabilityAssessmentScanResults group. -// Don't use this type directly, use NewSQLVulnerabilityAssessmentScanResultsClient() instead. -type SQLVulnerabilityAssessmentScanResultsClient struct { - internal *arm.Client -} - -// 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. -func NewSQLVulnerabilityAssessmentScanResultsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*SQLVulnerabilityAssessmentScanResultsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &SQLVulnerabilityAssessmentScanResultsClient{ - internal: cl, - } - return client, nil -} - -// Get - 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. -// - 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) { - 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) - if err != nil { - return SQLVulnerabilityAssessmentScanResultsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return SQLVulnerabilityAssessmentScanResultsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return SQLVulnerabilityAssessmentScanResultsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// 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) { - urlPath := "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}/scanResults/{scanResultId}" - if scanID == "" { - return nil, errors.New("parameter scanID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scanId}", url.PathEscape(scanID)) - if scanResultID == "" { - return nil, errors.New("parameter scanResultID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scanResultId}", url.PathEscape(scanResultID)) - 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) - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *SQLVulnerabilityAssessmentScanResultsClient) getHandleResponse(resp *http.Response) (SQLVulnerabilityAssessmentScanResultsClientGetResponse, error) { - result := SQLVulnerabilityAssessmentScanResultsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ScanResult); err != nil { - return SQLVulnerabilityAssessmentScanResultsClientGetResponse{}, err - } - 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. -// -// 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 -// 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 -} - -// listCreateRequest creates the List request. -func (client *SQLVulnerabilityAssessmentScanResultsClient) listCreateRequest(ctx context.Context, scanID string, workspaceID 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)) - 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) - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *SQLVulnerabilityAssessmentScanResultsClient) listHandleResponse(resp *http.Response) (SQLVulnerabilityAssessmentScanResultsClientListResponse, error) { - result := SQLVulnerabilityAssessmentScanResultsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ScanResults); err != nil { - return SQLVulnerabilityAssessmentScanResultsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentscanresults_client_example_test.go b/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentscanresults_client_example_test.go deleted file mode 100644 index 27ff7f0bdbec..000000000000 --- a/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentscanresults_client_example_test.go +++ /dev/null @@ -1,410 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/sqlVulnerabilityAssessmentsScanResultsOperations/ArcMachineScanResults_Get.json -func ExampleSQLVulnerabilityAssessmentScanResultsClient_Get_getScanDetailsOfAScanRecord() { - 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.NewSQLVulnerabilityAssessmentScanResultsClient().Get(ctx, "Scheduled-20200623", "VA2063", "55555555-6666-7777-8888-999999999999", "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.ScanResult = armsecurity.ScanResult{ - // Name: to.Ptr("VA2063"), - // Type: to.Ptr("Microsoft.Security/sqlVulnerabilityAssessments/scans/scanResults"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/Scheduled-20200623/scanResults/VA2063"), - // Properties: &armsecurity.ScanResultProperties{ - // BaselineAdjustedResult: &armsecurity.BaselineAdjustedResult{ - // Baseline: &armsecurity.Baseline{ - // ExpectedResults: [][]*string{ - // []*string{ - // to.Ptr("Test"), - // to.Ptr("0.0.0.0"), - // to.Ptr("125.125.125.125")}}, - // UpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-04T12:49:41.027Z"); return t}()), - // }, - // ResultsNotInBaseline: [][]*string{ - // }, - // ResultsOnlyInBaseline: [][]*string{ - // }, - // Status: to.Ptr(armsecurity.RuleStatusNonFinding), - // }, - // IsTrimmed: to.Ptr(false), - // QueryResults: [][]*string{ - // []*string{ - // to.Ptr("Test"), - // to.Ptr("0.0.0.0"), - // to.Ptr("125.125.125.125")}}, - // Remediation: &armsecurity.Remediation{ - // Description: to.Ptr("Remove server firewall rules that grant excessive access"), - // Automated: to.Ptr(false), - // PortalLink: to.Ptr("ReviewServerFirewallRules"), - // Scripts: []*string{ - // to.Ptr("EXECUTE sp_delete_firewall_rule N'Test';")}, - // }, - // RuleID: to.Ptr("VA2063"), - // RuleMetadata: &armsecurity.VaRule{ - // Description: to.Ptr("The Azure SQL server-level firewall helps protect your server by preventing all access to your databases until you specify which IP addresses have permission. Server-level firewall rules grant access to all databases that belong to the server based on the originating IP address of each request.\n\nServer-level firewall rules can only be created and managed through Transact-SQL as well as through the Azure portal or PowerShell. For more details please see: https://docs.microsoft.com/en-us/azure/sql-database/sql-database-firewall-configure\n\nThis check verifies that server-level firewall rules do not grant excessive access."), - // BenchmarkReferences: []*armsecurity.BenchmarkReference{ - // }, - // Category: to.Ptr("SurfaceAreaReduction"), - // QueryCheck: &armsecurity.QueryCheck{ - // ColumnNames: []*string{ - // to.Ptr("Firewall Rule Name"), - // to.Ptr("Start Address"), - // to.Ptr("End Address")}, - // ExpectedResult: [][]*string{ - // }, - // Query: to.Ptr("SELECT name\n ,start_ip_address\n ,end_ip_address\nFROM sys.firewall_rules\nWHERE ( \n (CONVERT(bigint, parsename(end_ip_address, 1)) +\n CONVERT(bigint, parsename(end_ip_address, 2)) * 256 + \n CONVERT(bigint, parsename(end_ip_address, 3)) * 65536 + \n CONVERT(bigint, parsename(end_ip_address, 4)) * 16777216 ) \n - \n (CONVERT(bigint, parsename(start_ip_address, 1)) +\n CONVERT(bigint, parsename(start_ip_address, 2)) * 256 + \n CONVERT(bigint, parsename(start_ip_address, 3)) * 65536 + \n CONVERT(bigint, parsename(start_ip_address, 4)) * 16777216 )\n ) > 255;"), - // }, - // Rationale: to.Ptr("Often, administrators add rules that grant excessive access as part of a troubleshooting process � to eliminate the firewall as the source of a problem, they simply create a rule that allows all traffic to pass to the affected server.\n\nGranting excessive access using server firewall rules is a clear security concern, as it violates the principle of least privilege by allowing unnecessary access to your databases. In fact, it's the equivalent of placing the server outside of the firewall."), - // RuleID: to.Ptr("VA2063"), - // RuleType: to.Ptr(armsecurity.RuleTypeNegativeList), - // Severity: to.Ptr(armsecurity.RuleSeverityHigh), - // Title: to.Ptr("Server-level firewall rules should not grant excessive access"), - // }, - // Status: to.Ptr(armsecurity.RuleStatusFinding), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/sqlVulnerabilityAssessmentsScanResultsOperations/ArcMachineScanResults_GetLatest.json -func ExampleSQLVulnerabilityAssessmentScanResultsClient_Get_getScanDetailsOfTheLatestScanRecord() { - 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.NewSQLVulnerabilityAssessmentScanResultsClient().Get(ctx, "latest", "VA2063", "55555555-6666-7777-8888-999999999999", "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.ScanResult = armsecurity.ScanResult{ - // Name: to.Ptr("VA2063"), - // Type: to.Ptr("Microsoft.Security/sqlVulnerabilityAssessments/scans/scanResults"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/Scheduled-20200623/scanResults/VA2063"), - // Properties: &armsecurity.ScanResultProperties{ - // BaselineAdjustedResult: &armsecurity.BaselineAdjustedResult{ - // Baseline: &armsecurity.Baseline{ - // ExpectedResults: [][]*string{ - // []*string{ - // to.Ptr("Test"), - // to.Ptr("0.0.0.0"), - // to.Ptr("125.125.125.125")}}, - // UpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-04T12:49:41.027Z"); return t}()), - // }, - // ResultsNotInBaseline: [][]*string{ - // }, - // ResultsOnlyInBaseline: [][]*string{ - // }, - // Status: to.Ptr(armsecurity.RuleStatusNonFinding), - // }, - // IsTrimmed: to.Ptr(false), - // QueryResults: [][]*string{ - // []*string{ - // to.Ptr("Test"), - // to.Ptr("0.0.0.0"), - // to.Ptr("125.125.125.125")}}, - // Remediation: &armsecurity.Remediation{ - // Description: to.Ptr("Remove server firewall rules that grant excessive access"), - // Automated: to.Ptr(false), - // PortalLink: to.Ptr("ReviewServerFirewallRules"), - // Scripts: []*string{ - // to.Ptr("EXECUTE sp_delete_firewall_rule N'Test';")}, - // }, - // RuleID: to.Ptr("VA2063"), - // RuleMetadata: &armsecurity.VaRule{ - // Description: to.Ptr("The Azure SQL server-level firewall helps protect your server by preventing all access to your databases until you specify which IP addresses have permission. Server-level firewall rules grant access to all databases that belong to the server based on the originating IP address of each request.\n\nServer-level firewall rules can only be created and managed through Transact-SQL as well as through the Azure portal or PowerShell. For more details please see: https://docs.microsoft.com/en-us/azure/sql-database/sql-database-firewall-configure\n\nThis check verifies that server-level firewall rules do not grant excessive access."), - // BenchmarkReferences: []*armsecurity.BenchmarkReference{ - // }, - // Category: to.Ptr("SurfaceAreaReduction"), - // QueryCheck: &armsecurity.QueryCheck{ - // ColumnNames: []*string{ - // to.Ptr("Firewall Rule Name"), - // to.Ptr("Start Address"), - // to.Ptr("End Address")}, - // ExpectedResult: [][]*string{ - // }, - // Query: to.Ptr("SELECT name\n ,start_ip_address\n ,end_ip_address\nFROM sys.firewall_rules\nWHERE ( \n (CONVERT(bigint, parsename(end_ip_address, 1)) +\n CONVERT(bigint, parsename(end_ip_address, 2)) * 256 + \n CONVERT(bigint, parsename(end_ip_address, 3)) * 65536 + \n CONVERT(bigint, parsename(end_ip_address, 4)) * 16777216 ) \n - \n (CONVERT(bigint, parsename(start_ip_address, 1)) +\n CONVERT(bigint, parsename(start_ip_address, 2)) * 256 + \n CONVERT(bigint, parsename(start_ip_address, 3)) * 65536 + \n CONVERT(bigint, parsename(start_ip_address, 4)) * 16777216 )\n ) > 255;"), - // }, - // Rationale: to.Ptr("Often, administrators add rules that grant excessive access as part of a troubleshooting process � to eliminate the firewall as the source of a problem, they simply create a rule that allows all traffic to pass to the affected server.\n\nGranting excessive access using server firewall rules is a clear security concern, as it violates the principle of least privilege by allowing unnecessary access to your databases. In fact, it's the equivalent of placing the server outside of the firewall."), - // RuleID: to.Ptr("VA2063"), - // RuleType: to.Ptr(armsecurity.RuleTypeNegativeList), - // Severity: to.Ptr(armsecurity.RuleSeverityHigh), - // Title: to.Ptr("Server-level firewall rules should not grant excessive access"), - // }, - // Status: to.Ptr(armsecurity.RuleStatusFinding), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/sqlVulnerabilityAssessmentsScanResultsOperations/ArcMachineScanResults_List.json -func ExampleSQLVulnerabilityAssessmentScanResultsClient_List_listScanResults() { - 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.NewSQLVulnerabilityAssessmentScanResultsClient().List(ctx, "Scheduled-20200623", "55555555-6666-7777-8888-999999999999", "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.ScanResults = armsecurity.ScanResults{ - // Value: []*armsecurity.ScanResult{ - // { - // Name: to.Ptr("VA2062"), - // Type: to.Ptr("Microsoft.Security/sqlVulnerabilityAssessments/scans/scanResults"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/Scheduled-20200623/scanResults/VA2062"), - // Properties: &armsecurity.ScanResultProperties{ - // IsTrimmed: to.Ptr(false), - // QueryResults: [][]*string{ - // }, - // Remediation: &armsecurity.Remediation{ - // Description: to.Ptr("Remove database firewall rules that grant excessive access"), - // Automated: to.Ptr(false), - // PortalLink: to.Ptr(""), - // Scripts: []*string{ - // }, - // }, - // RuleID: to.Ptr("VA2062"), - // RuleMetadata: &armsecurity.VaRule{ - // Description: to.Ptr("The Azure SQL Database-level firewall helps protect your data by preventing all access to your database until you specify which IP addresses have permission. Database-level firewall rules grant access to the specific database based on the originating IP address of each request.\n\nDatabase-level firewall rules for master and user databases can only be created and managed through Transact-SQL (unlike server-level firewall rules which can also be created and managed using the Azure portal or PowerShell). For more details please see: https://docs.microsoft.com/en-us/azure/sql-database/sql-database-firewall-configure\n\nThis check verifies that database-level firewall rules do not grant excessive access."), - // BenchmarkReferences: []*armsecurity.BenchmarkReference{ - // }, - // Category: to.Ptr("SurfaceAreaReduction"), - // QueryCheck: &armsecurity.QueryCheck{ - // ColumnNames: []*string{ - // to.Ptr("Firewall Rule Name"), - // to.Ptr("Start Address"), - // to.Ptr("End Address")}, - // ExpectedResult: [][]*string{ - // }, - // Query: to.Ptr("SELECT name\n ,start_ip_address\n ,end_ip_address\nFROM sys.database_firewall_rules\nWHERE ( \n (CONVERT(bigint, parsename(end_ip_address, 1)) +\n CONVERT(bigint, parsename(end_ip_address, 2)) * 256 + \n CONVERT(bigint, parsename(end_ip_address, 3)) * 65536 + \n CONVERT(bigint, parsename(end_ip_address, 4)) * 16777216 ) \n - \n (CONVERT(bigint, parsename(start_ip_address, 1)) +\n CONVERT(bigint, parsename(start_ip_address, 2)) * 256 + \n CONVERT(bigint, parsename(start_ip_address, 3)) * 65536 + \n CONVERT(bigint, parsename(start_ip_address, 4)) * 16777216 )\n ) > 255;"), - // }, - // Rationale: to.Ptr("Often, administrators add rules that grant excessive access as part of a troubleshooting process - to eliminate the firewall as the source of a problem, they simply create a rule that allows all traffic to pass to the affected database.\n\nGranting excessive access using database firewall rules is a clear security concern, as it violates the principle of least privilege by allowing unnecessary access to your database. In fact, it's the equivalent of placing the database outside of the firewall."), - // RuleID: to.Ptr("VA2062"), - // RuleType: to.Ptr(armsecurity.RuleTypeNegativeList), - // Severity: to.Ptr(armsecurity.RuleSeverityHigh), - // Title: to.Ptr("Database-level firewall rules should not grant excessive access"), - // }, - // Status: to.Ptr(armsecurity.RuleStatusNonFinding), - // }, - // }, - // { - // Name: to.Ptr("VA2063"), - // Type: to.Ptr("Microsoft.Security/sqlVulnerabilityAssessments/scans/scanResults"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/Scheduled-20200623/scanResults/VA2063"), - // Properties: &armsecurity.ScanResultProperties{ - // BaselineAdjustedResult: &armsecurity.BaselineAdjustedResult{ - // Baseline: &armsecurity.Baseline{ - // ExpectedResults: [][]*string{ - // []*string{ - // to.Ptr("Test"), - // to.Ptr("0.0.0.0"), - // to.Ptr("125.125.125.125")}}, - // UpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-04T12:49:41.027Z"); return t}()), - // }, - // ResultsNotInBaseline: [][]*string{ - // }, - // ResultsOnlyInBaseline: [][]*string{ - // }, - // Status: to.Ptr(armsecurity.RuleStatusNonFinding), - // }, - // IsTrimmed: to.Ptr(false), - // QueryResults: [][]*string{ - // []*string{ - // to.Ptr("Test"), - // to.Ptr("0.0.0.0"), - // to.Ptr("125.125.125.125")}}, - // Remediation: &armsecurity.Remediation{ - // Description: to.Ptr("Remove server firewall rules that grant excessive access"), - // Automated: to.Ptr(false), - // PortalLink: to.Ptr("ReviewServerFirewallRules"), - // Scripts: []*string{ - // to.Ptr("EXECUTE sp_delete_firewall_rule N'Test';")}, - // }, - // RuleID: to.Ptr("VA2063"), - // RuleMetadata: &armsecurity.VaRule{ - // Description: to.Ptr("The Azure SQL server-level firewall helps protect your server by preventing all access to your databases until you specify which IP addresses have permission. Server-level firewall rules grant access to all databases that belong to the server based on the originating IP address of each request.\n\nServer-level firewall rules can only be created and managed through Transact-SQL as well as through the Azure portal or PowerShell. For more details please see: https://docs.microsoft.com/en-us/azure/sql-database/sql-database-firewall-configure\n\nThis check verifies that server-level firewall rules do not grant excessive access."), - // BenchmarkReferences: []*armsecurity.BenchmarkReference{ - // }, - // Category: to.Ptr("SurfaceAreaReduction"), - // QueryCheck: &armsecurity.QueryCheck{ - // ColumnNames: []*string{ - // to.Ptr("Firewall Rule Name"), - // to.Ptr("Start Address"), - // to.Ptr("End Address")}, - // ExpectedResult: [][]*string{ - // }, - // Query: to.Ptr("SELECT name\n ,start_ip_address\n ,end_ip_address\nFROM sys.firewall_rules\nWHERE ( \n (CONVERT(bigint, parsename(end_ip_address, 1)) +\n CONVERT(bigint, parsename(end_ip_address, 2)) * 256 + \n CONVERT(bigint, parsename(end_ip_address, 3)) * 65536 + \n CONVERT(bigint, parsename(end_ip_address, 4)) * 16777216 ) \n - \n (CONVERT(bigint, parsename(start_ip_address, 1)) +\n CONVERT(bigint, parsename(start_ip_address, 2)) * 256 + \n CONVERT(bigint, parsename(start_ip_address, 3)) * 65536 + \n CONVERT(bigint, parsename(start_ip_address, 4)) * 16777216 )\n ) > 255;"), - // }, - // Rationale: to.Ptr("Often, administrators add rules that grant excessive access as part of a troubleshooting process � to eliminate the firewall as the source of a problem, they simply create a rule that allows all traffic to pass to the affected server.\n\nGranting excessive access using server firewall rules is a clear security concern, as it violates the principle of least privilege by allowing unnecessary access to your databases. In fact, it's the equivalent of placing the server outside of the firewall."), - // RuleID: to.Ptr("VA2063"), - // RuleType: to.Ptr(armsecurity.RuleTypeNegativeList), - // Severity: to.Ptr(armsecurity.RuleSeverityHigh), - // Title: to.Ptr("Server-level firewall rules should not grant excessive access"), - // }, - // Status: to.Ptr(armsecurity.RuleStatusFinding), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/sqlVulnerabilityAssessmentsScanResultsOperations/ArcMachineScanResults_ListLatest.json -func ExampleSQLVulnerabilityAssessmentScanResultsClient_List_listScanResultsOfTheLatestScan() { - 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.NewSQLVulnerabilityAssessmentScanResultsClient().List(ctx, "latest", "55555555-6666-7777-8888-999999999999", "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.ScanResults = armsecurity.ScanResults{ - // Value: []*armsecurity.ScanResult{ - // { - // Name: to.Ptr("VA2062"), - // Type: to.Ptr("Microsoft.Security/sqlVulnerabilityAssessments/scans/scanResults"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/Scheduled-20200623/scanResults/VA2062"), - // Properties: &armsecurity.ScanResultProperties{ - // IsTrimmed: to.Ptr(false), - // QueryResults: [][]*string{ - // }, - // Remediation: &armsecurity.Remediation{ - // Description: to.Ptr("Remove database firewall rules that grant excessive access"), - // Automated: to.Ptr(false), - // PortalLink: to.Ptr(""), - // Scripts: []*string{ - // }, - // }, - // RuleID: to.Ptr("VA2062"), - // RuleMetadata: &armsecurity.VaRule{ - // Description: to.Ptr("The Azure SQL Database-level firewall helps protect your data by preventing all access to your database until you specify which IP addresses have permission. Database-level firewall rules grant access to the specific database based on the originating IP address of each request.\n\nDatabase-level firewall rules for master and user databases can only be created and managed through Transact-SQL (unlike server-level firewall rules which can also be created and managed using the Azure portal or PowerShell). For more details please see: https://docs.microsoft.com/en-us/azure/sql-database/sql-database-firewall-configure\n\nThis check verifies that database-level firewall rules do not grant excessive access."), - // BenchmarkReferences: []*armsecurity.BenchmarkReference{ - // }, - // Category: to.Ptr("SurfaceAreaReduction"), - // QueryCheck: &armsecurity.QueryCheck{ - // ColumnNames: []*string{ - // to.Ptr("Firewall Rule Name"), - // to.Ptr("Start Address"), - // to.Ptr("End Address")}, - // ExpectedResult: [][]*string{ - // }, - // Query: to.Ptr("SELECT name\n ,start_ip_address\n ,end_ip_address\nFROM sys.database_firewall_rules\nWHERE ( \n (CONVERT(bigint, parsename(end_ip_address, 1)) +\n CONVERT(bigint, parsename(end_ip_address, 2)) * 256 + \n CONVERT(bigint, parsename(end_ip_address, 3)) * 65536 + \n CONVERT(bigint, parsename(end_ip_address, 4)) * 16777216 ) \n - \n (CONVERT(bigint, parsename(start_ip_address, 1)) +\n CONVERT(bigint, parsename(start_ip_address, 2)) * 256 + \n CONVERT(bigint, parsename(start_ip_address, 3)) * 65536 + \n CONVERT(bigint, parsename(start_ip_address, 4)) * 16777216 )\n ) > 255;"), - // }, - // Rationale: to.Ptr("Often, administrators add rules that grant excessive access as part of a troubleshooting process - to eliminate the firewall as the source of a problem, they simply create a rule that allows all traffic to pass to the affected database.\n\nGranting excessive access using database firewall rules is a clear security concern, as it violates the principle of least privilege by allowing unnecessary access to your database. In fact, it's the equivalent of placing the database outside of the firewall."), - // RuleID: to.Ptr("VA2062"), - // RuleType: to.Ptr(armsecurity.RuleTypeNegativeList), - // Severity: to.Ptr(armsecurity.RuleSeverityHigh), - // Title: to.Ptr("Database-level firewall rules should not grant excessive access"), - // }, - // Status: to.Ptr(armsecurity.RuleStatusNonFinding), - // }, - // }, - // { - // Name: to.Ptr("VA2063"), - // Type: to.Ptr("Microsoft.Security/sqlVulnerabilityAssessments/scans/scanResults"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/Scheduled-20200623/scanResults/VA2063"), - // Properties: &armsecurity.ScanResultProperties{ - // BaselineAdjustedResult: &armsecurity.BaselineAdjustedResult{ - // Baseline: &armsecurity.Baseline{ - // ExpectedResults: [][]*string{ - // []*string{ - // to.Ptr("Test"), - // to.Ptr("0.0.0.0"), - // to.Ptr("125.125.125.125")}}, - // UpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-04T12:49:41.027Z"); return t}()), - // }, - // ResultsNotInBaseline: [][]*string{ - // }, - // ResultsOnlyInBaseline: [][]*string{ - // }, - // Status: to.Ptr(armsecurity.RuleStatusNonFinding), - // }, - // IsTrimmed: to.Ptr(false), - // QueryResults: [][]*string{ - // []*string{ - // to.Ptr("Test"), - // to.Ptr("0.0.0.0"), - // to.Ptr("125.125.125.125")}}, - // Remediation: &armsecurity.Remediation{ - // Description: to.Ptr("Remove server firewall rules that grant excessive access"), - // Automated: to.Ptr(false), - // PortalLink: to.Ptr("ReviewServerFirewallRules"), - // Scripts: []*string{ - // to.Ptr("EXECUTE sp_delete_firewall_rule N'Test';")}, - // }, - // RuleID: to.Ptr("VA2063"), - // RuleMetadata: &armsecurity.VaRule{ - // Description: to.Ptr("The Azure SQL server-level firewall helps protect your server by preventing all access to your databases until you specify which IP addresses have permission. Server-level firewall rules grant access to all databases that belong to the server based on the originating IP address of each request.\n\nServer-level firewall rules can only be created and managed through Transact-SQL as well as through the Azure portal or PowerShell. For more details please see: https://docs.microsoft.com/en-us/azure/sql-database/sql-database-firewall-configure\n\nThis check verifies that server-level firewall rules do not grant excessive access."), - // BenchmarkReferences: []*armsecurity.BenchmarkReference{ - // }, - // Category: to.Ptr("SurfaceAreaReduction"), - // QueryCheck: &armsecurity.QueryCheck{ - // ColumnNames: []*string{ - // to.Ptr("Firewall Rule Name"), - // to.Ptr("Start Address"), - // to.Ptr("End Address")}, - // ExpectedResult: [][]*string{ - // }, - // Query: to.Ptr("SELECT name\n ,start_ip_address\n ,end_ip_address\nFROM sys.firewall_rules\nWHERE ( \n (CONVERT(bigint, parsename(end_ip_address, 1)) +\n CONVERT(bigint, parsename(end_ip_address, 2)) * 256 + \n CONVERT(bigint, parsename(end_ip_address, 3)) * 65536 + \n CONVERT(bigint, parsename(end_ip_address, 4)) * 16777216 ) \n - \n (CONVERT(bigint, parsename(start_ip_address, 1)) +\n CONVERT(bigint, parsename(start_ip_address, 2)) * 256 + \n CONVERT(bigint, parsename(start_ip_address, 3)) * 65536 + \n CONVERT(bigint, parsename(start_ip_address, 4)) * 16777216 )\n ) > 255;"), - // }, - // Rationale: to.Ptr("Often, administrators add rules that grant excessive access as part of a troubleshooting process � to eliminate the firewall as the source of a problem, they simply create a rule that allows all traffic to pass to the affected server.\n\nGranting excessive access using server firewall rules is a clear security concern, as it violates the principle of least privilege by allowing unnecessary access to your databases. In fact, it's the equivalent of placing the server outside of the firewall."), - // RuleID: to.Ptr("VA2063"), - // RuleType: to.Ptr(armsecurity.RuleTypeNegativeList), - // Severity: to.Ptr(armsecurity.RuleSeverityHigh), - // Title: to.Ptr("Server-level firewall rules should not grant excessive access"), - // }, - // Status: to.Ptr(armsecurity.RuleStatusFinding), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentscans_client.go b/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentscans_client.go deleted file mode 100644 index 39cdc0b37875..000000000000 --- a/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentscans_client.go +++ /dev/null @@ -1,156 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// SQLVulnerabilityAssessmentScansClient contains the methods for the SQLVulnerabilityAssessmentScans group. -// Don't use this type directly, use NewSQLVulnerabilityAssessmentScansClient() instead. -type SQLVulnerabilityAssessmentScansClient struct { - internal *arm.Client -} - -// 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. -func NewSQLVulnerabilityAssessmentScansClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*SQLVulnerabilityAssessmentScansClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &SQLVulnerabilityAssessmentScansClient{ - internal: cl, - } - return client, nil -} - -// Get - 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. -// - 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) { - 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) - if err != nil { - return SQLVulnerabilityAssessmentScansClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return SQLVulnerabilityAssessmentScansClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return SQLVulnerabilityAssessmentScansClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *SQLVulnerabilityAssessmentScansClient) getCreateRequest(ctx context.Context, scanID string, workspaceID 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)) - 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) - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// 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 { - return SQLVulnerabilityAssessmentScansClientGetResponse{}, err - } - return result, nil -} - -// List - Gets a list of scan records. -// 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 -// method. -func (client *SQLVulnerabilityAssessmentScansClient) List(ctx context.Context, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentScansClientListOptions) (SQLVulnerabilityAssessmentScansClientListResponse, error) { - var err error - const operationName = "SQLVulnerabilityAssessmentScansClient.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 SQLVulnerabilityAssessmentScansClientListResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return SQLVulnerabilityAssessmentScansClientListResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return SQLVulnerabilityAssessmentScansClientListResponse{}, err - } - resp, err := client.listHandleResponse(httpResp) - return resp, err -} - -// listCreateRequest creates the List request. -func (client *SQLVulnerabilityAssessmentScansClient) listCreateRequest(ctx context.Context, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentScansClientListOptions) (*policy.Request, error) { - urlPath := "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans" - 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) - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// 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 { - return SQLVulnerabilityAssessmentScansClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentscans_client_example_test.go b/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentscans_client_example_test.go deleted file mode 100644 index d1b8905c5756..000000000000 --- a/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentscans_client_example_test.go +++ /dev/null @@ -1,169 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/sqlVulnerabilityAssessmentScanOperations/ArcMachineScans_Get.json -func ExampleSQLVulnerabilityAssessmentScansClient_Get_getScanDetailsOfAScanRecord() { - 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.NewSQLVulnerabilityAssessmentScansClient().Get(ctx, "Scheduled-20200623", "55555555-6666-7777-8888-999999999999", "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.Scan = armsecurity.Scan{ - // Name: to.Ptr("Scheduled-20200623"), - // Type: to.Ptr("Microsoft.Security/sqlVulnerabilityAssessments/scans"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/Scheduled-20200623"), - // Properties: &armsecurity.ScanProperties{ - // Database: to.Ptr("master"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-23T06:49:00.723Z"); return t}()), - // HighSeverityFailedRulesCount: to.Ptr[int32](3), - // IsBaselineApplied: to.Ptr(false), - // LastScanTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-23T06:49:00.645Z"); return t}()), - // LowSeverityFailedRulesCount: to.Ptr[int32](1), - // MediumSeverityFailedRulesCount: to.Ptr[int32](2), - // Server: to.Ptr("server1"), - // SQLVersion: to.Ptr("15.0.2000"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-23T06:49:00.645Z"); return t}()), - // State: to.Ptr(armsecurity.ScanStateFailed), - // TotalFailedRulesCount: to.Ptr[int32](6), - // TotalPassedRulesCount: to.Ptr[int32](20), - // TotalRulesCount: to.Ptr[int32](26), - // TriggerType: to.Ptr(armsecurity.ScanTriggerTypeRecurring), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/sqlVulnerabilityAssessmentScanOperations/ArcMachineScans_GetLatest.json -func ExampleSQLVulnerabilityAssessmentScansClient_Get_getScanDetailsOfTheLatestScanRecord() { - 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.NewSQLVulnerabilityAssessmentScansClient().Get(ctx, "latest", "55555555-6666-7777-8888-999999999999", "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.Scan = armsecurity.Scan{ - // Name: to.Ptr("Scheduled-20200623"), - // Type: to.Ptr("Microsoft.Security/sqlVulnerabilityAssessments/scans"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/Scheduled-20200623"), - // Properties: &armsecurity.ScanProperties{ - // Database: to.Ptr("master"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-23T06:49:00.723Z"); return t}()), - // HighSeverityFailedRulesCount: to.Ptr[int32](3), - // IsBaselineApplied: to.Ptr(false), - // LastScanTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-23T06:49:00.645Z"); return t}()), - // LowSeverityFailedRulesCount: to.Ptr[int32](1), - // MediumSeverityFailedRulesCount: to.Ptr[int32](2), - // Server: to.Ptr("server1"), - // SQLVersion: to.Ptr("15.0.2000"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-23T06:49:00.645Z"); return t}()), - // State: to.Ptr(armsecurity.ScanStateFailed), - // TotalFailedRulesCount: to.Ptr[int32](6), - // TotalPassedRulesCount: to.Ptr[int32](20), - // TotalRulesCount: to.Ptr[int32](26), - // TriggerType: to.Ptr(armsecurity.ScanTriggerTypeRecurring), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/sqlVulnerabilityAssessmentScanOperations/ArcMachineScans_List.json -func ExampleSQLVulnerabilityAssessmentScansClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSQLVulnerabilityAssessmentScansClient().List(ctx, "55555555-6666-7777-8888-999999999999", "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.Scans = armsecurity.Scans{ - // Value: []*armsecurity.Scan{ - // { - // Name: to.Ptr("Scheduled-20200225"), - // Type: to.Ptr("Microsoft.Security/sqlVulnerabilityAssessments/scans"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/Scheduled-20200225"), - // Properties: &armsecurity.ScanProperties{ - // Database: to.Ptr("master"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-25T11:38:07.860Z"); return t}()), - // HighSeverityFailedRulesCount: to.Ptr[int32](3), - // IsBaselineApplied: to.Ptr(false), - // LastScanTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-23T06:49:00.645Z"); return t}()), - // LowSeverityFailedRulesCount: to.Ptr[int32](1), - // MediumSeverityFailedRulesCount: to.Ptr[int32](2), - // Server: to.Ptr("server1"), - // SQLVersion: to.Ptr("15.0.2000"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-25T11:34:29.139Z"); return t}()), - // State: to.Ptr(armsecurity.ScanStateFailed), - // TotalFailedRulesCount: to.Ptr[int32](6), - // TotalPassedRulesCount: to.Ptr[int32](20), - // TotalRulesCount: to.Ptr[int32](26), - // TriggerType: to.Ptr(armsecurity.ScanTriggerTypeRecurring), - // }, - // }, - // { - // Name: to.Ptr("scan_20200226_113429"), - // Type: to.Ptr("Microsoft.Security/sqlVulnerabilityAssessments/scans"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/scan_20200226_113429"), - // Properties: &armsecurity.ScanProperties{ - // Database: to.Ptr("master"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-26T11:38:07.860Z"); return t}()), - // HighSeverityFailedRulesCount: to.Ptr[int32](0), - // IsBaselineApplied: to.Ptr(true), - // LastScanTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-23T06:49:00.645Z"); return t}()), - // LowSeverityFailedRulesCount: to.Ptr[int32](0), - // MediumSeverityFailedRulesCount: to.Ptr[int32](0), - // Server: to.Ptr("server1"), - // SQLVersion: to.Ptr("15.0.2000"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-26T11:34:29.139Z"); return t}()), - // State: to.Ptr(armsecurity.ScanStatePassed), - // TotalFailedRulesCount: to.Ptr[int32](0), - // TotalPassedRulesCount: to.Ptr[int32](26), - // TotalRulesCount: to.Ptr[int32](26), - // TriggerType: to.Ptr(armsecurity.ScanTriggerTypeOnDemand), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/subassessments_client.go b/sdk/resourcemanager/security/armsecurity/subassessments_client.go deleted file mode 100644 index 5a16d2fd6900..000000000000 --- a/sdk/resourcemanager/security/armsecurity/subassessments_client.go +++ /dev/null @@ -1,216 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// SubAssessmentsClient contains the methods for the SubAssessments group. -// Don't use this type directly, use NewSubAssessmentsClient() instead. -type SubAssessmentsClient struct { - internal *arm.Client -} - -// 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. -func NewSubAssessmentsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*SubAssessmentsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &SubAssessmentsClient{ - internal: cl, - } - return client, nil -} - -// Get - Get a security sub-assessment on your scanned resource -// 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 -// - 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) { - var err error - const operationName = "SubAssessmentsClient.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, assessmentName, subAssessmentName, options) - if err != nil { - return SubAssessmentsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return SubAssessmentsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return SubAssessmentsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *SubAssessmentsClient) getCreateRequest(ctx context.Context, scope string, assessmentName string, subAssessmentName string, options *SubAssessmentsClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments/{subAssessmentName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if assessmentName == "" { - return nil, errors.New("parameter assessmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) - if subAssessmentName == "" { - return nil, errors.New("parameter subAssessmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subAssessmentName}", url.PathEscape(subAssessmentName)) - 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", "2019-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 *SubAssessmentsClient) getHandleResponse(resp *http.Response) (SubAssessmentsClientGetResponse, error) { - result := SubAssessmentsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SubAssessment); err != nil { - return SubAssessmentsClientGetResponse{}, err - } - return result, nil -} - -// 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 -// - 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]{ - More: func(page SubAssessmentsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *SubAssessmentsClientListResponse) (SubAssessmentsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SubAssessmentsClient.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, assessmentName, options) - }, nil) - if err != nil { - return SubAssessmentsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *SubAssessmentsClient) listCreateRequest(ctx context.Context, scope string, assessmentName string, options *SubAssessmentsClientListOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if assessmentName == "" { - return nil, errors.New("parameter assessmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - 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 -} - -// listHandleResponse handles the List response. -func (client *SubAssessmentsClient) listHandleResponse(resp *http.Response) (SubAssessmentsClientListResponse, error) { - result := SubAssessmentsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SubAssessmentList); err != nil { - return SubAssessmentsClientListResponse{}, err - } - return result, nil -} - -// 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). -// - options - SubAssessmentsClientListAllOptions contains the optional parameters for the SubAssessmentsClient.NewListAllPager -// method. -func (client *SubAssessmentsClient) NewListAllPager(scope string, options *SubAssessmentsClientListAllOptions) *runtime.Pager[SubAssessmentsClientListAllResponse] { - return runtime.NewPager(runtime.PagingHandler[SubAssessmentsClientListAllResponse]{ - More: func(page SubAssessmentsClientListAllResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *SubAssessmentsClientListAllResponse) (SubAssessmentsClientListAllResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SubAssessmentsClient.NewListAllPager") - 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.listAllCreateRequest(ctx, scope, options) - }, nil) - if err != nil { - return SubAssessmentsClientListAllResponse{}, err - } - return client.listAllHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listAllCreateRequest creates the ListAll request. -func (client *SubAssessmentsClient) listAllCreateRequest(ctx context.Context, scope string, options *SubAssessmentsClientListAllOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Security/subAssessments" - 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", "2019-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listAllHandleResponse handles the ListAll response. -func (client *SubAssessmentsClient) listAllHandleResponse(resp *http.Response) (SubAssessmentsClientListAllResponse, error) { - result := SubAssessmentsClientListAllResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SubAssessmentList); err != nil { - return SubAssessmentsClientListAllResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/subassessments_client_example_test.go b/sdk/resourcemanager/security/armsecurity/subassessments_client_example_test.go deleted file mode 100644 index b45a936ec3c2..000000000000 --- a/sdk/resourcemanager/security/armsecurity/subassessments_client_example_test.go +++ /dev/null @@ -1,225 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/SubAssessments/ListSubscriptionSubAssessments_example.json -func ExampleSubAssessmentsClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSubAssessmentsClient().NewListAllPager("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", 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.SubAssessmentList = armsecurity.SubAssessmentList{ - // Value: []*armsecurity.SubAssessment{ - // { - // Name: to.Ptr("8c98f353-8b41-4e77-979b-6adeecd5d168"), - // Type: to.Ptr("Microsoft.Security/assessments/subAssessments"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.ContainerRegistry/registries/myRegistry/providers/Microsoft.Security/assessments/dbd0cb49-b563-45e7-9724-889e799fa648/subAssessments/8c98f353-8b41-4e77-979b-6adeecd5d168"), - // Properties: &armsecurity.SubAssessmentProperties{ - // Description: to.Ptr("The backdoor 'Back Orifice' was detected on this system. The presence of this backdoor indicates that your system has already been compromised. Unauthorized users can access your host at any time. Unauthorized users can take complete control of the host and manipulate data. They can steal the data or even wipe out the host."), - // AdditionalData: &armsecurity.ContainerRegistryVulnerabilityProperties{ - // AssessedResourceType: to.Ptr(armsecurity.AssessedResourceTypeContainerRegistryVulnerability), - // Type: to.Ptr("Vulnerability"), - // Cve: []*armsecurity.CVE{ - // { - // Link: to.Ptr("http://contoso.com"), - // Title: to.Ptr("CVE-2019-12345"), - // }}, - // Cvss: map[string]*armsecurity.CVSS{ - // "2.0": &armsecurity.CVSS{ - // Base: to.Ptr[float32](10), - // }, - // "3.0": &armsecurity.CVSS{ - // Base: to.Ptr[float32](10), - // }, - // }, - // ImageDigest: to.Ptr("c186fc44-3154-4ce2-ba18-b719d895c3b0"), - // Patchable: to.Ptr(true), - // PublishedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()), - // RepositoryName: to.Ptr("myRepo"), - // VendorReferences: []*armsecurity.VendorReference{ - // { - // Link: to.Ptr("http://contoso.com"), - // Title: to.Ptr("Reference_1"), - // }}, - // }, - // Category: to.Ptr("Backdoors and trojan horses"), - // DisplayName: to.Ptr("'Back Orifice' Backdoor"), - // ID: to.Ptr("1001"), - // Impact: to.Ptr("3"), - // Remediation: to.Ptr("Use a recent anti-virus program to remove this backdoor and check your system regularly with anti-virus software."), - // ResourceDetails: &armsecurity.AzureResourceDetails{ - // Source: to.Ptr(armsecurity.SourceAzure), - // ID: to.Ptr("repositories/asc/msi-connector/images/sha256:877a6f2a212c44021281f80cb1f4c73a09dce4e99a8cb8efcc03f7ce3c877a6f"), - // }, - // Status: &armsecurity.SubAssessmentStatus{ - // Description: to.Ptr("The resource is unhealthy"), - // Cause: to.Ptr(""), - // Code: to.Ptr(armsecurity.SubAssessmentStatusCodeUnhealthy), - // Severity: to.Ptr(armsecurity.SeverityHigh), - // }, - // TimeGenerated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-23T12:20:08.764Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("8fbe5054-e97c-3a7a-fda7-c8308ca8d3cf"), - // Type: to.Ptr("Microsoft.Security/assessments/subAssessments"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/ascdemoRG/providers/Microsoft.Sql/servers/sqlserver1demo/providers/Microsoft.Security/assessments/82e20e14-edc5-4373-bfc4-f13121257c37/subassessments/8fbe5054-e97c-3a7a-fda7-c8308ca8d3cf"), - // Properties: &armsecurity.SubAssessmentProperties{ - // Description: to.Ptr("The Azure SQL Database-level firewall helps protect your data by preventing all access to your database until you specify which IP addresses have permission. Database-level firewall rules grant access to the specific database based on the originating IP address of each request.\n\nDatabase-level firewall rules for master"), - // AdditionalData: &armsecurity.SQLServerVulnerabilityProperties{ - // AssessedResourceType: to.Ptr(armsecurity.AssessedResourceTypeSQLServerVulnerability), - // Type: to.Ptr("AzureDatabase"), - // Query: to.Ptr("SELECT name\n ,start_ip_address\n ,end_ip_address\nFROM sys.database_firewall_rules"), - // }, - // Category: to.Ptr("SurfaceAreaReduction"), - // DisplayName: to.Ptr("Database-level firewall rules should be tracked and maintained at a strict minimum"), - // ID: to.Ptr("VA2064"), - // Impact: to.Ptr("Firewall rules should be strictly configured to allow access only to client computers that have a valid need to connect to the database. Any superfluous entries in the firewall may pose a threat by allowing an unauthorized source access to your database."), - // Remediation: to.Ptr("Evaluate each of the database-level firewall rules. Remove any rules that grant unnecessary access and set the rest as a baseline. Deviations from the baseline will be identified and brought to your attention in subsequent scans."), - // ResourceDetails: &armsecurity.AzureResourceDetails{ - // Source: to.Ptr(armsecurity.SourceAzure), - // ID: to.Ptr("/subscriptions/212f9889-769e-45ae-ab43-6da33674bd26/resourceGroups/ascdemoRG/providers/Microsoft.Sql/servers/sqlserver1demo/databases/database1"), - // }, - // Status: &armsecurity.SubAssessmentStatus{ - // Cause: to.Ptr("Unknown"), - // Code: to.Ptr(armsecurity.SubAssessmentStatusCodeHealthy), - // Severity: to.Ptr(armsecurity.SeverityHigh), - // }, - // TimeGenerated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-23T12:20:08.764Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/SubAssessments/ListSubAssessments_example.json -func ExampleSubAssessmentsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSubAssessmentsClient().NewListPager("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "82e20e14-edc5-4373-bfc4-f13121257c37", 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.SubAssessmentList = armsecurity.SubAssessmentList{ - // Value: []*armsecurity.SubAssessment{ - // { - // Name: to.Ptr("8fbe5054-e97c-3a7a-fda7-c8308ca8d3cf"), - // Type: to.Ptr("Microsoft.Security/assessments/subAssessments"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/ascdemoRG/providers/Microsoft.Sql/servers/sqlserver1demo/providers/Microsoft.Security/assessments/82e20e14-edc5-4373-bfc4-f13121257c37/subassessments/8fbe5054-e97c-3a7a-fda7-c8308ca8d3cf"), - // Properties: &armsecurity.SubAssessmentProperties{ - // Description: to.Ptr("The Azure SQL Database-level firewall helps protect your data by preventing all access to your database until you specify which IP addresses have permission. Database-level firewall rules grant access to the specific database based on the originating IP address of each request.\n\nDatabase-level firewall rules for master"), - // AdditionalData: &armsecurity.SQLServerVulnerabilityProperties{ - // AssessedResourceType: to.Ptr(armsecurity.AssessedResourceTypeSQLServerVulnerability), - // Type: to.Ptr("AzureDatabase"), - // Query: to.Ptr("SELECT name\n ,start_ip_address\n ,end_ip_address\nFROM sys.database_firewall_rules"), - // }, - // Category: to.Ptr("SurfaceAreaReduction"), - // DisplayName: to.Ptr("Database-level firewall rules should be tracked and maintained at a strict minimum"), - // ID: to.Ptr("VA2064"), - // Impact: to.Ptr("Firewall rules should be strictly configured to allow access only to client computers that have a valid need to connect to the database. Any superfluous entries in the firewall may pose a threat by allowing an unauthorized source access to your database."), - // Remediation: to.Ptr("Evaluate each of the database-level firewall rules. Remove any rules that grant unnecessary access and set the rest as a baseline. Deviations from the baseline will be identified and brought to your attention in subsequent scans."), - // ResourceDetails: &armsecurity.AzureResourceDetails{ - // Source: to.Ptr(armsecurity.SourceAzure), - // ID: to.Ptr("/subscriptions/212f9889-769e-45ae-ab43-6da33674bd26/resourceGroups/ascdemoRG/providers/Microsoft.Sql/servers/sqlserver1demo/databases/database1"), - // }, - // Status: &armsecurity.SubAssessmentStatus{ - // Cause: to.Ptr("Unknown"), - // Code: to.Ptr(armsecurity.SubAssessmentStatusCodeHealthy), - // Severity: to.Ptr(armsecurity.SeverityHigh), - // }, - // TimeGenerated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-23T12:20:08.764Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/SubAssessments/GetSubAssessment_example.json -func ExampleSubAssessmentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSubAssessmentsClient().Get(ctx, "subscriptions/212f9889-769e-45ae-ab43-6da33674bd26/resourceGroups/DEMORG/providers/Microsoft.Compute/virtualMachines/vm2", "1195afff-c881-495e-9bc5-1486211ae03f", "95f7da9c-a2a4-1322-0758-fcd24ef09b85", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.SubAssessment = armsecurity.SubAssessment{ - // Name: to.Ptr("95f7da9c-a2a4-1322-0758-fcd24ef09b85"), - // Type: to.Ptr("Microsoft.Security/assessments/subAssessments"), - // ID: to.Ptr("/subscriptions/212f9889-769e-45ae-ab43-6da33674bd26/resourceGroups/DEMORG/providers/Microsoft.Compute/virtualMachines/vm2/providers/Microsoft.Security/assessments/1195afff-c881-495e-9bc5-1486211ae03f/subassessments/95f7da9c-a2a4-1322-0758-fcd24ef09b85"), - // Properties: &armsecurity.SubAssessmentProperties{ - // Description: to.Ptr("PuTTY ssh_agent_channel_data Function Integer Overflow Vulnerability"), - // AdditionalData: &armsecurity.AdditionalData{ - // AssessedResourceType: to.Ptr(armsecurity.AssessedResourceTypeServerVulnerability), - // }, - // Category: to.Ptr("Local"), - // DisplayName: to.Ptr("PuTTY ssh_agent_channel_data Function Integer Overflow Vulnerability"), - // ID: to.Ptr("370361"), - // Impact: to.Ptr("Successful exploitation could allow remote attackers to have unspecified impact via a large length value in an agent protocol message."), - // Remediation: to.Ptr("Customers are advised to upgrade toPuTTY 0.68 or later version in order to remediate this vulnerability."), - // ResourceDetails: &armsecurity.AzureResourceDetails{ - // Source: to.Ptr(armsecurity.SourceAzure), - // ID: to.Ptr("/subscriptions/212f9889-769e-45ae-ab43-6da33674bd26/resourceGroups/DEMORG/providers/Microsoft.Compute/virtualMachines/vm2"), - // }, - // Status: &armsecurity.SubAssessmentStatus{ - // Code: to.Ptr(armsecurity.SubAssessmentStatusCodeUnhealthy), - // Severity: to.Ptr(armsecurity.SeverityMedium), - // }, - // TimeGenerated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-02-02T12:36:50.779Z"); return t}()), - // }, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/tasks_client.go b/sdk/resourcemanager/security/armsecurity/tasks_client.go deleted file mode 100644 index c23bbfbabc3d..000000000000 --- a/sdk/resourcemanager/security/armsecurity/tasks_client.go +++ /dev/null @@ -1,492 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// TasksClient contains the methods for the Tasks group. -// Don't use this type directly, use NewTasksClient() instead. -type TasksClient struct { - internal *arm.Client - subscriptionID string -} - -// NewTasksClient creates a new instance of TasksClient 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 NewTasksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TasksClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &TasksClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// GetResourceGroupLevelTask - Recommended tasks that will help improve the security of the subscription proactively -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2015-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - taskName - Name of the task object, will be a GUID -// - options - TasksClientGetResourceGroupLevelTaskOptions contains the optional parameters for the TasksClient.GetResourceGroupLevelTask -// method. -func (client *TasksClient) GetResourceGroupLevelTask(ctx context.Context, resourceGroupName string, ascLocation string, taskName string, options *TasksClientGetResourceGroupLevelTaskOptions) (TasksClientGetResourceGroupLevelTaskResponse, error) { - var err error - const operationName = "TasksClient.GetResourceGroupLevelTask" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getResourceGroupLevelTaskCreateRequest(ctx, resourceGroupName, ascLocation, taskName, options) - if err != nil { - return TasksClientGetResourceGroupLevelTaskResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return TasksClientGetResourceGroupLevelTaskResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return TasksClientGetResourceGroupLevelTaskResponse{}, err - } - resp, err := client.getResourceGroupLevelTaskHandleResponse(httpResp) - return resp, err -} - -// getResourceGroupLevelTaskCreateRequest creates the GetResourceGroupLevelTask request. -func (client *TasksClient) getResourceGroupLevelTaskCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, taskName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ascLocation == "" { - return nil, errors.New("parameter ascLocation cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ascLocation}", url.PathEscape(ascLocation)) - if taskName == "" { - return nil, errors.New("parameter taskName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{taskName}", url.PathEscape(taskName)) - 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") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getResourceGroupLevelTaskHandleResponse handles the GetResourceGroupLevelTask response. -func (client *TasksClient) getResourceGroupLevelTaskHandleResponse(resp *http.Response) (TasksClientGetResourceGroupLevelTaskResponse, error) { - result := TasksClientGetResourceGroupLevelTaskResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Task); err != nil { - return TasksClientGetResourceGroupLevelTaskResponse{}, err - } - return result, nil -} - -// GetSubscriptionLevelTask - Recommended tasks that will help improve the security of the subscription proactively -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2015-06-01-preview -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - taskName - Name of the task object, will be a GUID -// - options - TasksClientGetSubscriptionLevelTaskOptions contains the optional parameters for the TasksClient.GetSubscriptionLevelTask -// method. -func (client *TasksClient) GetSubscriptionLevelTask(ctx context.Context, ascLocation string, taskName string, options *TasksClientGetSubscriptionLevelTaskOptions) (TasksClientGetSubscriptionLevelTaskResponse, error) { - var err error - const operationName = "TasksClient.GetSubscriptionLevelTask" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getSubscriptionLevelTaskCreateRequest(ctx, ascLocation, taskName, options) - if err != nil { - return TasksClientGetSubscriptionLevelTaskResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return TasksClientGetSubscriptionLevelTaskResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return TasksClientGetSubscriptionLevelTaskResponse{}, err - } - resp, err := client.getSubscriptionLevelTaskHandleResponse(httpResp) - return resp, err -} - -// getSubscriptionLevelTaskCreateRequest creates the GetSubscriptionLevelTask request. -func (client *TasksClient) getSubscriptionLevelTaskCreateRequest(ctx context.Context, ascLocation string, taskName string, options *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") - } - 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 taskName == "" { - return nil, errors.New("parameter taskName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{taskName}", url.PathEscape(taskName)) - 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") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getSubscriptionLevelTaskHandleResponse handles the GetSubscriptionLevelTask response. -func (client *TasksClient) getSubscriptionLevelTaskHandleResponse(resp *http.Response) (TasksClientGetSubscriptionLevelTaskResponse, error) { - result := TasksClientGetSubscriptionLevelTaskResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Task); err != nil { - return TasksClientGetSubscriptionLevelTaskResponse{}, err - } - return result, nil -} - -// NewListPager - Recommended tasks that will help improve the security of the subscription proactively -// -// Generated from API version 2015-06-01-preview -// - options - TasksClientListOptions contains the optional parameters for the TasksClient.NewListPager method. -func (client *TasksClient) NewListPager(options *TasksClientListOptions) *runtime.Pager[TasksClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[TasksClientListResponse]{ - More: func(page TasksClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *TasksClientListResponse) (TasksClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TasksClient.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 TasksClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *TasksClient) listCreateRequest(ctx context.Context, options *TasksClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/tasks" - 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() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2015-06-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 *TasksClient) listHandleResponse(resp *http.Response) (TasksClientListResponse, error) { - result := TasksClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.TaskList); err != nil { - return TasksClientListResponse{}, err - } - return result, nil -} - -// NewListByHomeRegionPager - Recommended tasks that will help improve the security of the subscription proactively -// -// Generated from API version 2015-06-01-preview -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - options - TasksClientListByHomeRegionOptions contains the optional parameters for the TasksClient.NewListByHomeRegionPager -// method. -func (client *TasksClient) NewListByHomeRegionPager(ascLocation string, options *TasksClientListByHomeRegionOptions) *runtime.Pager[TasksClientListByHomeRegionResponse] { - return runtime.NewPager(runtime.PagingHandler[TasksClientListByHomeRegionResponse]{ - More: func(page TasksClientListByHomeRegionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *TasksClientListByHomeRegionResponse) (TasksClientListByHomeRegionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TasksClient.NewListByHomeRegionPager") - 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.listByHomeRegionCreateRequest(ctx, ascLocation, options) - }, nil) - if err != nil { - return TasksClientListByHomeRegionResponse{}, err - } - return client.listByHomeRegionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByHomeRegionCreateRequest creates the ListByHomeRegion request. -func (client *TasksClient) listByHomeRegionCreateRequest(ctx context.Context, ascLocation string, options *TasksClientListByHomeRegionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks" - 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)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2015-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByHomeRegionHandleResponse handles the ListByHomeRegion response. -func (client *TasksClient) listByHomeRegionHandleResponse(resp *http.Response) (TasksClientListByHomeRegionResponse, error) { - result := TasksClientListByHomeRegionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.TaskList); err != nil { - return TasksClientListByHomeRegionResponse{}, err - } - return result, nil -} - -// 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. -// - 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. -func (client *TasksClient) NewListByResourceGroupPager(resourceGroupName string, ascLocation string, options *TasksClientListByResourceGroupOptions) *runtime.Pager[TasksClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[TasksClientListByResourceGroupResponse]{ - More: func(page TasksClientListByResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *TasksClientListByResourceGroupResponse) (TasksClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TasksClient.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, ascLocation, options) - }, nil) - if err != nil { - return TasksClientListByResourceGroupResponse{}, err - } - return client.listByResourceGroupHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *TasksClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, options *TasksClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ascLocation == "" { - return nil, errors.New("parameter ascLocation cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ascLocation}", url.PathEscape(ascLocation)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2015-06-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 *TasksClient) listByResourceGroupHandleResponse(resp *http.Response) (TasksClientListByResourceGroupResponse, error) { - result := TasksClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.TaskList); err != nil { - return TasksClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// UpdateResourceGroupLevelTaskState - Recommended tasks that will help improve the security of the subscription proactively -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2015-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - taskName - Name of the task object, will be a GUID -// - taskUpdateActionType - Type of the action to do on the task -// - options - TasksClientUpdateResourceGroupLevelTaskStateOptions contains the optional parameters for the TasksClient.UpdateResourceGroupLevelTaskState -// method. -func (client *TasksClient) UpdateResourceGroupLevelTaskState(ctx context.Context, resourceGroupName string, ascLocation string, taskName string, taskUpdateActionType TaskUpdateActionType, options *TasksClientUpdateResourceGroupLevelTaskStateOptions) (TasksClientUpdateResourceGroupLevelTaskStateResponse, error) { - var err error - const operationName = "TasksClient.UpdateResourceGroupLevelTaskState" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateResourceGroupLevelTaskStateCreateRequest(ctx, resourceGroupName, ascLocation, taskName, taskUpdateActionType, options) - if err != nil { - return TasksClientUpdateResourceGroupLevelTaskStateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return TasksClientUpdateResourceGroupLevelTaskStateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return TasksClientUpdateResourceGroupLevelTaskStateResponse{}, err - } - return TasksClientUpdateResourceGroupLevelTaskStateResponse{}, nil -} - -// 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) { - 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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ascLocation == "" { - return nil, errors.New("parameter ascLocation cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ascLocation}", url.PathEscape(ascLocation)) - if taskName == "" { - return nil, errors.New("parameter taskName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{taskName}", url.PathEscape(taskName)) - if taskUpdateActionType == "" { - return nil, errors.New("parameter taskUpdateActionType cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{taskUpdateActionType}", url.PathEscape(string(taskUpdateActionType))) - 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", "2015-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// UpdateSubscriptionLevelTaskState - Recommended tasks that will help improve the security of the subscription proactively -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2015-06-01-preview -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - taskName - Name of the task object, will be a GUID -// - taskUpdateActionType - Type of the action to do on the task -// - options - TasksClientUpdateSubscriptionLevelTaskStateOptions contains the optional parameters for the TasksClient.UpdateSubscriptionLevelTaskState -// method. -func (client *TasksClient) UpdateSubscriptionLevelTaskState(ctx context.Context, ascLocation string, taskName string, taskUpdateActionType TaskUpdateActionType, options *TasksClientUpdateSubscriptionLevelTaskStateOptions) (TasksClientUpdateSubscriptionLevelTaskStateResponse, error) { - var err error - const operationName = "TasksClient.UpdateSubscriptionLevelTaskState" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateSubscriptionLevelTaskStateCreateRequest(ctx, ascLocation, taskName, taskUpdateActionType, options) - if err != nil { - return TasksClientUpdateSubscriptionLevelTaskStateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return TasksClientUpdateSubscriptionLevelTaskStateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return TasksClientUpdateSubscriptionLevelTaskStateResponse{}, err - } - return TasksClientUpdateSubscriptionLevelTaskStateResponse{}, nil -} - -// updateSubscriptionLevelTaskStateCreateRequest creates the UpdateSubscriptionLevelTaskState request. -func (client *TasksClient) updateSubscriptionLevelTaskStateCreateRequest(ctx context.Context, ascLocation string, taskName string, taskUpdateActionType TaskUpdateActionType, options *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") - } - 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 taskName == "" { - return nil, errors.New("parameter taskName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{taskName}", url.PathEscape(taskName)) - if taskUpdateActionType == "" { - return nil, errors.New("parameter taskUpdateActionType cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{taskUpdateActionType}", url.PathEscape(string(taskUpdateActionType))) - 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", "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/tasks_client_example_test.go b/sdk/resourcemanager/security/armsecurity/tasks_client_example_test.go deleted file mode 100644 index c50f7d59a377..000000000000 --- a/sdk/resourcemanager/security/armsecurity/tasks_client_example_test.go +++ /dev/null @@ -1,337 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/GetTasksSubscription_example.json -func ExampleTasksClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTasksClient().NewListPager(&armsecurity.TasksClientListOptions{Filter: 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.TaskList = armsecurity.TaskList{ - // Value: []*armsecurity.Task{ - // { - // Name: to.Ptr("62609ee7-d0a5-8616-9fe4-1df5cca7758d"), - // Type: to.Ptr("Microsoft.Security/locations/tasks"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/locations/westeurope/tasks/62609ee7-d0a5-8616-9fe4-1df5cca7758d"), - // Properties: &armsecurity.TaskProperties{ - // CreationTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-05T10:42:03.993Z"); return t}()), - // LastStateChangeTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-05T10:42:03.993Z"); return t}()), - // SecurityTaskParameters: &armsecurity.TaskParameters{ - // AdditionalProperties: map[string]any{ - // "location": "uksouth", - // "resourceGroup": "myRg", - // "resourceId": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/default", - // "resourceName": "default", - // "resourceParent": "vnet1", - // "resourceType": "Subnet", - // "uniqueKey": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/default", - // }, - // Name: to.Ptr("NetworkSecurityGroupMissingOnSubnet"), - // }, - // State: to.Ptr("Active"), - // SubState: to.Ptr("NA"), - // }, - // }, - // { - // Name: to.Ptr("d55b4dc0-779c-c66c-33e5-d7bce24c4222"), - // Type: to.Ptr("Microsoft.Security/locations/tasks"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Security/locations/westeurope/tasks/d55b4dc0-779c-c66c-33e5-d7bce24c4222"), - // Properties: &armsecurity.TaskProperties{ - // CreationTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-02T11:41:27.054Z"); return t}()), - // LastStateChangeTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-02T11:41:27.054Z"); return t}()), - // SecurityTaskParameters: &armsecurity.TaskParameters{ - // AdditionalProperties: map[string]any{ - // "isDataDiskEncrypted": false, - // "isOsDiskEncrypted": false, - // "resourceId": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachines/vm1", - // "severity": "High", - // "uniqueKey": "EncryptionOnVmTaskParameters_/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachines/vm1", - // "vmId": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachines/vm1", - // "vmName": "vm1", - // }, - // Name: to.Ptr("EncryptionOnVm"), - // }, - // State: to.Ptr("Active"), - // SubState: to.Ptr("NA"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/GetTasksSubscriptionLocation_example.json -func ExampleTasksClient_NewListByHomeRegionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTasksClient().NewListByHomeRegionPager("westeurope", &armsecurity.TasksClientListByHomeRegionOptions{Filter: 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.TaskList = armsecurity.TaskList{ - // Value: []*armsecurity.Task{ - // { - // Name: to.Ptr("62609ee7-d0a5-8616-9fe4-1df5cca7758d"), - // Type: to.Ptr("Microsoft.Security/locations/tasks"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/locations/westeurope/tasks/62609ee7-d0a5-8616-9fe4-1df5cca7758d"), - // Properties: &armsecurity.TaskProperties{ - // CreationTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-05T10:42:03.993Z"); return t}()), - // LastStateChangeTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-05T10:42:03.993Z"); return t}()), - // SecurityTaskParameters: &armsecurity.TaskParameters{ - // AdditionalProperties: map[string]any{ - // "location": "uksouth", - // "resourceGroup": "myRg", - // "resourceId": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/default", - // "resourceName": "default", - // "resourceParent": "vnet1", - // "resourceType": "Subnet", - // "uniqueKey": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/default", - // }, - // Name: to.Ptr("NetworkSecurityGroupMissingOnSubnet"), - // }, - // State: to.Ptr("Active"), - // SubState: to.Ptr("NA"), - // }, - // }, - // { - // Name: to.Ptr("d55b4dc0-779c-c66c-33e5-d7bce24c4222"), - // Type: to.Ptr("Microsoft.Security/locations/tasks"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Security/locations/westeurope/tasks/d55b4dc0-779c-c66c-33e5-d7bce24c4222"), - // Properties: &armsecurity.TaskProperties{ - // CreationTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-02T11:41:27.054Z"); return t}()), - // LastStateChangeTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-02T11:41:27.054Z"); return t}()), - // SecurityTaskParameters: &armsecurity.TaskParameters{ - // AdditionalProperties: map[string]any{ - // "isDataDiskEncrypted": false, - // "isOsDiskEncrypted": false, - // "resourceId": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachines/vm1", - // "severity": "High", - // "uniqueKey": "EncryptionOnVmTaskParameters_/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachines/vm1", - // "vmId": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachines/vm1", - // "vmName": "vm1", - // }, - // Name: to.Ptr("EncryptionOnVm"), - // }, - // State: to.Ptr("Active"), - // SubState: to.Ptr("NA"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/GetTaskSubscriptionLocation_example.json -func ExampleTasksClient_GetSubscriptionLevelTask() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTasksClient().GetSubscriptionLevelTask(ctx, "westeurope", "62609ee7-d0a5-8616-9fe4-1df5cca7758d", 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.Task = armsecurity.Task{ - // Name: to.Ptr("62609ee7-d0a5-8616-9fe4-1df5cca7758d"), - // Type: to.Ptr("Microsoft.Security/locations/tasks"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/locations/westeurope/tasks/62609ee7-d0a5-8616-9fe4-1df5cca7758d"), - // Properties: &armsecurity.TaskProperties{ - // CreationTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-05T10:42:03.993Z"); return t}()), - // LastStateChangeTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-05T10:42:03.993Z"); return t}()), - // SecurityTaskParameters: &armsecurity.TaskParameters{ - // AdditionalProperties: map[string]any{ - // "location": "uksouth", - // "resourceGroup": "myRg", - // "resourceId": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/default", - // "resourceName": "default", - // "resourceParent": "vnet1", - // "resourceType": "Subnet", - // "uniqueKey": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/default", - // }, - // Name: to.Ptr("NetworkSecurityGroupMissingOnSubnet"), - // }, - // State: to.Ptr("Active"), - // SubState: to.Ptr("NA"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/UpdateTaskSubscriptionLocation_example.json -func ExampleTasksClient_UpdateSubscriptionLevelTaskState() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewTasksClient().UpdateSubscriptionLevelTaskState(ctx, "westeurope", "62609ee7-d0a5-8616-9fe4-1df5cca7758d", armsecurity.TaskUpdateActionTypeDismiss, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/GetTasksResourceGroupLocation_example.json -func ExampleTasksClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTasksClient().NewListByResourceGroupPager("myRg", "westeurope", &armsecurity.TasksClientListByResourceGroupOptions{Filter: 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.TaskList = armsecurity.TaskList{ - // Value: []*armsecurity.Task{ - // { - // Name: to.Ptr("d55b4dc0-779c-c66c-33e5-d7bce24c4222"), - // Type: to.Ptr("Microsoft.Security/locations/tasks"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Security/locations/westeurope/tasks/d55b4dc0-779c-c66c-33e5-d7bce24c4222"), - // Properties: &armsecurity.TaskProperties{ - // CreationTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-02T11:41:27.054Z"); return t}()), - // LastStateChangeTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-02T11:41:27.054Z"); return t}()), - // SecurityTaskParameters: &armsecurity.TaskParameters{ - // AdditionalProperties: map[string]any{ - // "isDataDiskEncrypted": false, - // "isOsDiskEncrypted": false, - // "resourceId": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachines/vm1", - // "severity": "High", - // "uniqueKey": "EncryptionOnVmTaskParameters_/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachines/vm1", - // "vmId": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachines/vm1", - // "vmName": "vm1", - // }, - // Name: to.Ptr("EncryptionOnVm"), - // }, - // State: to.Ptr("Active"), - // SubState: to.Ptr("NA"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/GetTaskResourceGroupLocation_example.json -func ExampleTasksClient_GetResourceGroupLevelTask() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTasksClient().GetResourceGroupLevelTask(ctx, "myRg", "westeurope", "d55b4dc0-779c-c66c-33e5-d7bce24c4222", 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.Task = armsecurity.Task{ - // Name: to.Ptr("d55b4dc0-779c-c66c-33e5-d7bce24c4222"), - // Type: to.Ptr("Microsoft.Security/locations/tasks"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Security/locations/westeurope/tasks/d55b4dc0-779c-c66c-33e5-d7bce24c4222"), - // Properties: &armsecurity.TaskProperties{ - // CreationTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-02T11:41:27.054Z"); return t}()), - // LastStateChangeTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-02T11:41:27.054Z"); return t}()), - // SecurityTaskParameters: &armsecurity.TaskParameters{ - // AdditionalProperties: map[string]any{ - // "isDataDiskEncrypted": false, - // "isOsDiskEncrypted": false, - // "resourceId": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachines/vm1", - // "severity": "High", - // "uniqueKey": "EncryptionOnVmTaskParameters_/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachines/vm1", - // "vmId": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachines/vm1", - // "vmName": "vm1", - // }, - // Name: to.Ptr("EncryptionOnVm"), - // }, - // State: to.Ptr("Active"), - // SubState: to.Ptr("NA"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/UpdateTaskResourceGroupLocation_example.json -func ExampleTasksClient_UpdateResourceGroupLevelTaskState() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewTasksClient().UpdateResourceGroupLevelTaskState(ctx, "myRg", "westeurope", "d55b4dc0-779c-c66c-33e5-d7bce24c4222", armsecurity.TaskUpdateActionTypeDismiss, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/time_rfc3339.go b/sdk/resourcemanager/security/armsecurity/time_rfc3339.go deleted file mode 100644 index ab3e710b6b36..000000000000 --- a/sdk/resourcemanager/security/armsecurity/time_rfc3339.go +++ /dev/null @@ -1,110 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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 deleted file mode 100644 index e93c7eeebfe1..000000000000 --- a/sdk/resourcemanager/security/armsecurity/topology_client.go +++ /dev/null @@ -1,227 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// TopologyClient contains the methods for the Topology group. -// Don't use this type directly, use NewTopologyClient() instead. -type TopologyClient struct { - internal *arm.Client - subscriptionID string -} - -// NewTopologyClient creates a new instance of TopologyClient 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 NewTopologyClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TopologyClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &TopologyClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Gets a specific topology component. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-01-01 -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - topologyResourceName - Name of a topology resources collection. -// - options - TopologyClientGetOptions contains the optional parameters for the TopologyClient.Get method. -func (client *TopologyClient) Get(ctx context.Context, resourceGroupName string, ascLocation string, topologyResourceName string, options *TopologyClientGetOptions) (TopologyClientGetResponse, error) { - var err error - const operationName = "TopologyClient.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, ascLocation, topologyResourceName, options) - if err != nil { - return TopologyClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return TopologyClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return TopologyClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *TopologyClient) getCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, topologyResourceName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ascLocation == "" { - return nil, errors.New("parameter ascLocation cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ascLocation}", url.PathEscape(ascLocation)) - if topologyResourceName == "" { - return nil, errors.New("parameter topologyResourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{topologyResourceName}", url.PathEscape(topologyResourceName)) - 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 *TopologyClient) getHandleResponse(resp *http.Response) (TopologyClientGetResponse, error) { - result := TopologyClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.TopologyResource); err != nil { - return TopologyClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Gets a list that allows to build a topology view of a subscription. -// -// Generated from API version 2020-01-01 -// - options - TopologyClientListOptions contains the optional parameters for the TopologyClient.NewListPager method. -func (client *TopologyClient) NewListPager(options *TopologyClientListOptions) *runtime.Pager[TopologyClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[TopologyClientListResponse]{ - More: func(page TopologyClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *TopologyClientListResponse) (TopologyClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TopologyClient.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 TopologyClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *TopologyClient) listCreateRequest(ctx context.Context, options *TopologyClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/topologies" - 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") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *TopologyClient) listHandleResponse(resp *http.Response) (TopologyClientListResponse, error) { - result := TopologyClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.TopologyList); err != nil { - return TopologyClientListResponse{}, err - } - return result, nil -} - -// NewListByHomeRegionPager - Gets a list that allows to build a topology view of a subscription and location. -// -// Generated from API version 2020-01-01 -// - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations -// - options - TopologyClientListByHomeRegionOptions contains the optional parameters for the TopologyClient.NewListByHomeRegionPager -// method. -func (client *TopologyClient) NewListByHomeRegionPager(ascLocation string, options *TopologyClientListByHomeRegionOptions) *runtime.Pager[TopologyClientListByHomeRegionResponse] { - return runtime.NewPager(runtime.PagingHandler[TopologyClientListByHomeRegionResponse]{ - More: func(page TopologyClientListByHomeRegionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *TopologyClientListByHomeRegionResponse) (TopologyClientListByHomeRegionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TopologyClient.NewListByHomeRegionPager") - 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.listByHomeRegionCreateRequest(ctx, ascLocation, options) - }, nil) - if err != nil { - return TopologyClientListByHomeRegionResponse{}, err - } - return client.listByHomeRegionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByHomeRegionCreateRequest creates the ListByHomeRegion request. -func (client *TopologyClient) listByHomeRegionCreateRequest(ctx context.Context, ascLocation string, options *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") - } - 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)) - 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 -} - -// listByHomeRegionHandleResponse handles the ListByHomeRegion response. -func (client *TopologyClient) listByHomeRegionHandleResponse(resp *http.Response) (TopologyClientListByHomeRegionResponse, error) { - result := TopologyClientListByHomeRegionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.TopologyList); err != nil { - return TopologyClientListByHomeRegionResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/topology_client_example_test.go b/sdk/resourcemanager/security/armsecurity/topology_client_example_test.go deleted file mode 100644 index c0f5248bdf3a..000000000000 --- a/sdk/resourcemanager/security/armsecurity/topology_client_example_test.go +++ /dev/null @@ -1,204 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/Topology/GetTopologySubscription_example.json -func ExampleTopologyClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTopologyClient().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.TopologyList = armsecurity.TopologyList{ - // Value: []*armsecurity.TopologyResource{ - // { - // Location: to.Ptr("westus"), - // Name: to.Ptr("vnets"), - // Type: to.Ptr("Microsoft.Security/locations/topologies"), - // ID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154bad/resourceGroups/myservers/providers/Microsoft.Security/locations/centralus/topologies/vnets"), - // Properties: &armsecurity.TopologyResourceProperties{ - // CalculatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-07-10T13:56:10.575Z"); return t}()), - // TopologyResources: []*armsecurity.TopologySingleResource{ - // { - // Children: []*armsecurity.TopologySingleResourceChild{ - // { - // ResourceID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154bad/resourceGroups/myservers/providers/Microsoft.Network/virtualNetworks/myvnet/subnets/mysubnet"), - // }}, - // Location: to.Ptr("westus"), - // NetworkZones: to.Ptr("Internal"), - // RecommendationsExist: to.Ptr(false), - // ResourceID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154bad/resourceGroups/myservers/providers/Microsoft.Network/virtualNetworks/myvnet"), - // Severity: to.Ptr("Healthy"), - // TopologyScore: to.Ptr[int32](0), - // }}, - // }, - // }, - // { - // Location: to.Ptr("westus"), - // Name: to.Ptr("subnets"), - // Type: to.Ptr("Microsoft.Security/locations/topologies"), - // ID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154bad/resourceGroups/myservers/providers/Microsoft.Security/locations/centralus/topologies/subnets"), - // Properties: &armsecurity.TopologyResourceProperties{ - // CalculatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-07-10T13:56:10.575Z"); return t}()), - // TopologyResources: []*armsecurity.TopologySingleResource{ - // { - // Location: to.Ptr("westus"), - // NetworkZones: to.Ptr("Internal"), - // Parents: []*armsecurity.TopologySingleResourceParent{ - // { - // ResourceID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154bad/resourceGroups/myservers/providers/Microsoft.Network/virtualNetworks/myvnet"), - // }}, - // RecommendationsExist: to.Ptr(false), - // ResourceID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154bad/resourceGroups/myservers/providers/Microsoft.Network/virtualNetworks/myvnet/subnets/mysubnet"), - // Severity: to.Ptr("Healthy"), - // TopologyScore: to.Ptr[int32](5), - // }}, - // }, - // }}, - // } - } -} - -// 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/Topology/GetTopologySubscriptionLocation_example.json -func ExampleTopologyClient_NewListByHomeRegionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTopologyClient().NewListByHomeRegionPager("centralus", 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.TopologyList = armsecurity.TopologyList{ - // Value: []*armsecurity.TopologyResource{ - // { - // Location: to.Ptr("westus"), - // Name: to.Ptr("vnets"), - // Type: to.Ptr("Microsoft.Security/locations/topologies"), - // ID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154bad/resourceGroups/myservers/providers/Microsoft.Security/locations/centralus/topologies/vnets"), - // Properties: &armsecurity.TopologyResourceProperties{ - // CalculatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-07-10T13:56:10.575Z"); return t}()), - // TopologyResources: []*armsecurity.TopologySingleResource{ - // { - // Children: []*armsecurity.TopologySingleResourceChild{ - // { - // ResourceID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154bad/resourceGroups/myservers/providers/Microsoft.Network/virtualNetworks/myvnet/subnets/mysubnet"), - // }}, - // Location: to.Ptr("westus"), - // NetworkZones: to.Ptr("Internal"), - // RecommendationsExist: to.Ptr(false), - // ResourceID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154bad/resourceGroups/myservers/providers/Microsoft.Network/virtualNetworks/myvnet"), - // Severity: to.Ptr("Healthy"), - // TopologyScore: to.Ptr[int32](0), - // }}, - // }, - // }, - // { - // Location: to.Ptr("westus"), - // Name: to.Ptr("subnets"), - // Type: to.Ptr("Microsoft.Security/locations/topologies"), - // ID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154bad/resourceGroups/myservers/providers/Microsoft.Security/locations/centralus/topologies/subnets"), - // Properties: &armsecurity.TopologyResourceProperties{ - // CalculatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-07-10T13:56:10.575Z"); return t}()), - // TopologyResources: []*armsecurity.TopologySingleResource{ - // { - // Location: to.Ptr("westus"), - // NetworkZones: to.Ptr("Internal"), - // Parents: []*armsecurity.TopologySingleResourceParent{ - // { - // ResourceID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154bad/resourceGroups/myservers/providers/Microsoft.Network/virtualNetworks/myvnet"), - // }}, - // RecommendationsExist: to.Ptr(false), - // ResourceID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154bad/resourceGroups/myservers/providers/Microsoft.Network/virtualNetworks/myvnet/subnets/mysubnet"), - // Severity: to.Ptr("Healthy"), - // TopologyScore: to.Ptr[int32](5), - // }}, - // }, - // }}, - // } - } -} - -// 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/Topology/GetTopology_example.json -func ExampleTopologyClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTopologyClient().Get(ctx, "myservers", "centralus", "vnets", 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.TopologyResource = armsecurity.TopologyResource{ - // Location: to.Ptr("westus"), - // Name: to.Ptr("vnets"), - // Type: to.Ptr("Microsoft.Security/locations/topologies"), - // ID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154bad/resourceGroups/myservers/providers/Microsoft.Security/locations/centralus/topologies/vnets"), - // Properties: &armsecurity.TopologyResourceProperties{ - // CalculatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-07-10T13:56:10.575Z"); return t}()), - // TopologyResources: []*armsecurity.TopologySingleResource{ - // { - // Children: []*armsecurity.TopologySingleResourceChild{ - // { - // ResourceID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154bad/resourceGroups/myservers/providers/Microsoft.Network/virtualNetworks/myvnet/subnets/mysubnet"), - // }}, - // Location: to.Ptr("westus"), - // NetworkZones: to.Ptr("InternetFacing"), - // RecommendationsExist: to.Ptr(false), - // ResourceID: to.Ptr("/subscriptions/3eeab341-f466-499c-a8be-85427e154bad/resourceGroups/myservers/providers/Microsoft.Network/virtualNetworks/myvnet"), - // Severity: to.Ptr("Healthy"), - // TopologyScore: to.Ptr[int32](0), - // }}, - // }, - // } -} diff --git a/sdk/resourcemanager/security/armsecurity/workspacesettings_client.go b/sdk/resourcemanager/security/armsecurity/workspacesettings_client.go deleted file mode 100644 index e1eb0629416f..000000000000 --- a/sdk/resourcemanager/security/armsecurity/workspacesettings_client.go +++ /dev/null @@ -1,338 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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" -) - -// WorkspaceSettingsClient contains the methods for the WorkspaceSettings group. -// Don't use this type directly, use NewWorkspaceSettingsClient() instead. -type WorkspaceSettingsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewWorkspaceSettingsClient creates a new instance of WorkspaceSettingsClient 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 NewWorkspaceSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceSettingsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &WorkspaceSettingsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Create - creating settings about where we should store your security data and logs -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2017-08-01-preview -// - workspaceSettingName - Name of the security setting -// - workspaceSetting - Security data setting object -// - options - WorkspaceSettingsClientCreateOptions contains the optional parameters for the WorkspaceSettingsClient.Create -// method. -func (client *WorkspaceSettingsClient) Create(ctx context.Context, workspaceSettingName string, workspaceSetting WorkspaceSetting, options *WorkspaceSettingsClientCreateOptions) (WorkspaceSettingsClientCreateResponse, error) { - var err error - const operationName = "WorkspaceSettingsClient.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, workspaceSettingName, workspaceSetting, options) - if err != nil { - return WorkspaceSettingsClientCreateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return WorkspaceSettingsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return WorkspaceSettingsClientCreateResponse{}, err - } - resp, err := client.createHandleResponse(httpResp) - return resp, err -} - -// createCreateRequest creates the Create request. -func (client *WorkspaceSettingsClient) createCreateRequest(ctx context.Context, workspaceSettingName string, workspaceSetting WorkspaceSetting, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if workspaceSettingName == "" { - return nil, errors.New("parameter workspaceSettingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{workspaceSettingName}", url.PathEscape(workspaceSettingName)) - 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", "2017-08-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, workspaceSetting); err != nil { - return nil, err - } - return req, nil -} - -// createHandleResponse handles the Create response. -func (client *WorkspaceSettingsClient) createHandleResponse(resp *http.Response) (WorkspaceSettingsClientCreateResponse, error) { - result := WorkspaceSettingsClientCreateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.WorkspaceSetting); err != nil { - return WorkspaceSettingsClientCreateResponse{}, err - } - return result, nil -} - -// Delete - Deletes the custom workspace settings for this subscription. new VMs will report to the default workspace -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2017-08-01-preview -// - workspaceSettingName - Name of the security setting -// - options - WorkspaceSettingsClientDeleteOptions contains the optional parameters for the WorkspaceSettingsClient.Delete -// method. -func (client *WorkspaceSettingsClient) Delete(ctx context.Context, workspaceSettingName string, options *WorkspaceSettingsClientDeleteOptions) (WorkspaceSettingsClientDeleteResponse, error) { - var err error - const operationName = "WorkspaceSettingsClient.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, workspaceSettingName, options) - if err != nil { - return WorkspaceSettingsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return WorkspaceSettingsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return WorkspaceSettingsClientDeleteResponse{}, err - } - return WorkspaceSettingsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *WorkspaceSettingsClient) deleteCreateRequest(ctx context.Context, workspaceSettingName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if workspaceSettingName == "" { - return nil, errors.New("parameter workspaceSettingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{workspaceSettingName}", url.PathEscape(workspaceSettingName)) - 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", "2017-08-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Settings about where we should store your security data and logs. If the result is empty, it means that no custom-workspace -// configuration was set -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2017-08-01-preview -// - workspaceSettingName - Name of the security setting -// - options - WorkspaceSettingsClientGetOptions contains the optional parameters for the WorkspaceSettingsClient.Get method. -func (client *WorkspaceSettingsClient) Get(ctx context.Context, workspaceSettingName string, options *WorkspaceSettingsClientGetOptions) (WorkspaceSettingsClientGetResponse, error) { - var err error - const operationName = "WorkspaceSettingsClient.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, workspaceSettingName, options) - if err != nil { - return WorkspaceSettingsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return WorkspaceSettingsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return WorkspaceSettingsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *WorkspaceSettingsClient) getCreateRequest(ctx context.Context, workspaceSettingName string, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if workspaceSettingName == "" { - return nil, errors.New("parameter workspaceSettingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{workspaceSettingName}", url.PathEscape(workspaceSettingName)) - 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", "2017-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 *WorkspaceSettingsClient) getHandleResponse(resp *http.Response) (WorkspaceSettingsClientGetResponse, error) { - result := WorkspaceSettingsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.WorkspaceSetting); err != nil { - return WorkspaceSettingsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Settings about where we should store your security data and logs. If the result is empty, it means that -// no custom-workspace configuration was set -// -// Generated from API version 2017-08-01-preview -// - options - WorkspaceSettingsClientListOptions contains the optional parameters for the WorkspaceSettingsClient.NewListPager -// method. -func (client *WorkspaceSettingsClient) NewListPager(options *WorkspaceSettingsClientListOptions) *runtime.Pager[WorkspaceSettingsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[WorkspaceSettingsClientListResponse]{ - More: func(page WorkspaceSettingsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *WorkspaceSettingsClientListResponse) (WorkspaceSettingsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "WorkspaceSettingsClient.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 WorkspaceSettingsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *WorkspaceSettingsClient) listCreateRequest(ctx context.Context, options *WorkspaceSettingsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings" - 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", "2017-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 *WorkspaceSettingsClient) listHandleResponse(resp *http.Response) (WorkspaceSettingsClientListResponse, error) { - result := WorkspaceSettingsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.WorkspaceSettingList); err != nil { - return WorkspaceSettingsClientListResponse{}, err - } - return result, nil -} - -// Update - Settings about where we should store your security data and logs -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2017-08-01-preview -// - workspaceSettingName - Name of the security setting -// - workspaceSetting - Security data setting object -// - options - WorkspaceSettingsClientUpdateOptions contains the optional parameters for the WorkspaceSettingsClient.Update -// method. -func (client *WorkspaceSettingsClient) Update(ctx context.Context, workspaceSettingName string, workspaceSetting WorkspaceSetting, options *WorkspaceSettingsClientUpdateOptions) (WorkspaceSettingsClientUpdateResponse, error) { - var err error - const operationName = "WorkspaceSettingsClient.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, workspaceSettingName, workspaceSetting, options) - if err != nil { - return WorkspaceSettingsClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return WorkspaceSettingsClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return WorkspaceSettingsClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *WorkspaceSettingsClient) updateCreateRequest(ctx context.Context, workspaceSettingName string, workspaceSetting WorkspaceSetting, options *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") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if workspaceSettingName == "" { - return nil, errors.New("parameter workspaceSettingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{workspaceSettingName}", url.PathEscape(workspaceSettingName)) - 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", "2017-08-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, workspaceSetting); err != nil { - return nil, err - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *WorkspaceSettingsClient) updateHandleResponse(resp *http.Response) (WorkspaceSettingsClientUpdateResponse, error) { - result := WorkspaceSettingsClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.WorkspaceSetting); err != nil { - return WorkspaceSettingsClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/workspacesettings_client_example_test.go b/sdk/resourcemanager/security/armsecurity/workspacesettings_client_example_test.go deleted file mode 100644 index 007d331775ad..000000000000 --- a/sdk/resourcemanager/security/armsecurity/workspacesettings_client_example_test.go +++ /dev/null @@ -1,184 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/2017-08-01-preview/examples/WorkspaceSettings/GetWorkspaceSettings_example.json -func ExampleWorkspaceSettingsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWorkspaceSettingsClient().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.WorkspaceSettingList = armsecurity.WorkspaceSettingList{ - // Value: []*armsecurity.WorkspaceSetting{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/workspaceSettings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/workspaceSettings/default"), - // Properties: &armsecurity.WorkspaceSettingProperties{ - // Scope: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23"), - // WorkspaceID: to.Ptr("/subscriptions/c4930e90-cd72-4aa5-93e9-2d081d129569/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace1"), - // }, - // }, - // { - // Name: to.Ptr("myRg"), - // Type: to.Ptr("Microsoft.Security/workspaceSettings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Security/workspaceSettings/myRg"), - // Properties: &armsecurity.WorkspaceSettingProperties{ - // Scope: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg"), - // WorkspaceID: to.Ptr("/subscriptions/c4930e90-cd72-4aa5-93e9-2d081d129569/resourceGroups/myOtherRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace2"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/WorkspaceSettings/GetWorkspaceSetting_example.json -func ExampleWorkspaceSettingsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkspaceSettingsClient().Get(ctx, "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.WorkspaceSetting = armsecurity.WorkspaceSetting{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/workspaceSettings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/workspaceSettings/default"), - // Properties: &armsecurity.WorkspaceSettingProperties{ - // Scope: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23"), - // WorkspaceID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/WorkspaceSettings/CreateWorkspaceSetting_example.json -func ExampleWorkspaceSettingsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkspaceSettingsClient().Create(ctx, "default", armsecurity.WorkspaceSetting{ - Name: to.Ptr("default"), - Type: to.Ptr("Microsoft.Security/workspaceSettings"), - ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/workspaceSettings/default"), - Properties: &armsecurity.WorkspaceSettingProperties{ - Scope: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23"), - WorkspaceID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.WorkspaceSetting = armsecurity.WorkspaceSetting{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/workspaceSettings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/workspaceSettings/default"), - // Properties: &armsecurity.WorkspaceSettingProperties{ - // Scope: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23"), - // WorkspaceID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/WorkspaceSettings/UpdateWorkspaceSetting_example.json -func ExampleWorkspaceSettingsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkspaceSettingsClient().Update(ctx, "default", armsecurity.WorkspaceSetting{ - Name: to.Ptr("default"), - Type: to.Ptr("Microsoft.Security/workspaceSettings"), - ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/workspaceSettings/default"), - Properties: &armsecurity.WorkspaceSettingProperties{ - WorkspaceID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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.WorkspaceSetting = armsecurity.WorkspaceSetting{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/workspaceSettings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/workspaceSettings/default"), - // Properties: &armsecurity.WorkspaceSettingProperties{ - // Scope: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23"), - // WorkspaceID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/WorkspaceSettings/DeleteWorkspaceSetting_example.json -func ExampleWorkspaceSettingsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewWorkspaceSettingsClient().Delete(ctx, "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -}