From d4645bd7e234b0435800708bf03fd3bb461842bb Mon Sep 17 00:00:00 2001 From: Jiahui Peng <46921893+Alancere@users.noreply.github.com> Date: Mon, 21 Mar 2022 21:21:11 +0800 Subject: [PATCH] Release v62.3.0 (#17336) * Generated from specification/storagecache/resource-manager/readme.md tag package-2022-01 (commit hash: 162460648e39b3cd20ef3d302008add138e90223) * Generated from specification/applicationinsights/resource-manager/readme.md tag package-2022-02-01 (commit hash: 162460648e39b3cd20ef3d302008add138e90223) * Generated from specification/batch/resource-manager/readme.md tag package-2022-01 (commit hash: 162460648e39b3cd20ef3d302008add138e90223) * Generated from specification/cdn/resource-manager/readme.md tag package-2021-06 (commit hash: 162460648e39b3cd20ef3d302008add138e90223) * Generated from specification/msi/resource-manager/readme.md tag package-preview-2021-09 (commit hash: 162460648e39b3cd20ef3d302008add138e90223) * Generated from specification/streamanalytics/resource-manager/readme.md tag package-pure-2020-03 (commit hash: 162460648e39b3cd20ef3d302008add138e90223) * Generated from specification/securityinsights/resource-manager/readme.md tag package-preview-2022-01 (commit hash: 162460648e39b3cd20ef3d302008add138e90223) * v62.3.0 --- CHANGELOG.md | 17 + .../batch/mgmt/batch/batchapi/models.go | 2 +- profiles/latest/batch/mgmt/batch/models.go | 23 +- profiles/latest/cdn/mgmt/cdn/cdnapi/models.go | 2 +- profiles/latest/cdn/mgmt/cdn/models.go | 322 +- .../storagecache/mgmt/storagecache/models.go | 21 +- .../storagecache/storagecacheapi/models.go | 3 +- .../mgmt/streamanalytics/models.go | 3 + .../batch/mgmt/batch/batchapi/models.go | 2 +- profiles/preview/batch/mgmt/batch/models.go | 23 +- .../preview/cdn/mgmt/cdn/cdnapi/models.go | 2 +- profiles/preview/cdn/mgmt/cdn/models.go | 322 +- .../mgmt/insights/insightsapi/models.go | 2 +- .../appinsights/mgmt/insights/models.go | 2 +- .../preview/preview/msi/mgmt/msi/models.go | 16 +- .../preview/msi/mgmt/msi/msiapi/models.go | 2 +- .../mgmt/securityinsight/models.go | 234 +- .../securityinsightapi/models.go | 2 +- .../storagecache/mgmt/storagecache/models.go | 21 +- .../storagecache/storagecacheapi/models.go | 3 +- .../mgmt/streamanalytics/models.go | 3 + .../batch/mgmt/2022-01-01/batch/CHANGELOG.md | 2 + .../batch/mgmt/2022-01-01/batch/_meta.json | 11 + .../batch/mgmt/2022-01-01/batch/account.go | 1224 + .../mgmt/2022-01-01/batch/application.go | 530 + .../2022-01-01/batch/applicationpackage.go | 566 + .../2022-01-01/batch/batchapi/interfaces.go | 125 + .../mgmt/2022-01-01/batch/certificate.go | 660 + .../batch/mgmt/2022-01-01/batch/client.go | 41 + services/batch/mgmt/2022-01-01/batch/enums.go | 617 + .../batch/mgmt/2022-01-01/batch/location.go | 440 + .../batch/mgmt/2022-01-01/batch/models.go | 4075 +++ .../batch/mgmt/2022-01-01/batch/operations.go | 140 + services/batch/mgmt/2022-01-01/batch/pool.go | 786 + .../batch/privateendpointconnection.go | 358 + .../2022-01-01/batch/privatelinkresource.go | 253 + .../batch/mgmt/2022-01-01/batch/version.go | 19 + services/cdn/mgmt/2021-06-01/cdn/CHANGELOG.md | 2 + services/cdn/mgmt/2021-06-01/cdn/_meta.json | 11 + .../mgmt/2021-06-01/cdn/afdcustomdomains.go | 616 + .../cdn/mgmt/2021-06-01/cdn/afdendpoints.go | 844 + .../mgmt/2021-06-01/cdn/afdorigingroups.go | 663 + .../cdn/mgmt/2021-06-01/cdn/afdorigins.go | 551 + .../cdn/mgmt/2021-06-01/cdn/afdprofiles.go | 249 + .../mgmt/2021-06-01/cdn/cdnapi/interfaces.go | 285 + services/cdn/mgmt/2021-06-01/cdn/client.go | 377 + .../cdn/mgmt/2021-06-01/cdn/customdomains.go | 620 + services/cdn/mgmt/2021-06-01/cdn/edgenodes.go | 140 + services/cdn/mgmt/2021-06-01/cdn/endpoints.go | 1111 + services/cdn/mgmt/2021-06-01/cdn/enums.go | 1923 ++ .../cdn/mgmt/2021-06-01/cdn/loganalytics.go | 608 + .../mgmt/2021-06-01/cdn/managedrulesets.go | 144 + services/cdn/mgmt/2021-06-01/cdn/models.go | 14642 +++++++++ .../cdn/mgmt/2021-06-01/cdn/operations.go | 140 + .../cdn/mgmt/2021-06-01/cdn/origingroups.go | 526 + services/cdn/mgmt/2021-06-01/cdn/origins.go | 526 + services/cdn/mgmt/2021-06-01/cdn/policies.go | 520 + services/cdn/mgmt/2021-06-01/cdn/profiles.go | 938 + .../cdn/mgmt/2021-06-01/cdn/resourceusage.go | 144 + services/cdn/mgmt/2021-06-01/cdn/routes.go | 538 + services/cdn/mgmt/2021-06-01/cdn/rules.go | 536 + services/cdn/mgmt/2021-06-01/cdn/rulesets.go | 553 + services/cdn/mgmt/2021-06-01/cdn/secrets.go | 428 + .../mgmt/2021-06-01/cdn/securitypolicies.go | 522 + services/cdn/mgmt/2021-06-01/cdn/validate.go | 113 + services/cdn/mgmt/2021-06-01/cdn/version.go | 19 + .../2022-02-01-preview/insights/CHANGELOG.md | 2 + .../2022-02-01-preview/insights/_meta.json | 11 + .../insights/analyticsitems.go | 429 + .../insights/annotations.go | 383 + .../2022-02-01-preview/insights/apikeys.go | 380 + .../2022-02-01-preview/insights/client.go | 41 + .../insights/componentavailablefeatures.go | 118 + .../componentcurrentbillingfeatures.go | 207 + .../insights/componentfeaturecapabilities.go | 118 + .../componentlinkedstorageaccounts.go | 384 + .../insights/componentquotastatus.go | 118 + .../2022-02-01-preview/insights/components.go | 807 + .../mgmt/2022-02-01-preview/insights/enums.go | 324 + .../insights/exportconfigurations.go | 471 + .../2022-02-01-preview/insights/favorites.go | 497 + .../insights/insightsapi/interfaces.go | 221 + .../2022-02-01-preview/insights/livetoken.go | 104 + .../2022-02-01-preview/insights/models.go | 3321 ++ .../insights/myworkbooks.go | 664 + .../2022-02-01-preview/insights/operations.go | 140 + .../proactivedetectionconfigurations.go | 298 + .../2022-02-01-preview/insights/version.go | 19 + .../insights/webtestlocations.go | 118 + .../2022-02-01-preview/insights/webtests.go | 755 + .../2022-02-01-preview/insights/workbooks.go | 885 + .../insights/workbooktemplates.go | 469 + .../insights/workitemconfigurations.go | 559 + .../mgmt/2021-09-30-preview/msi/CHANGELOG.md | 2 + .../mgmt/2021-09-30-preview/msi/_meta.json | 11 + .../msi/mgmt/2021-09-30-preview/msi/client.go | 41 + .../msi/mgmt/2021-09-30-preview/msi/models.go | 971 + .../msi/msiapi/interfaces.go | 44 + .../mgmt/2021-09-30-preview/msi/operations.go | 140 + .../msi/systemassignedidentities.go | 105 + .../msi/userassignedidentities.go | 723 + .../mgmt/2021-09-30-preview/msi/version.go | 19 + .../securityinsight/CHANGELOG.md | 2 + .../securityinsight/_meta.json | 11 + .../securityinsight/actions.go | 445 + .../securityinsight/alertrules.go | 434 + .../securityinsight/alertruletemplates.go | 253 + .../securityinsight/automationrules.go | 458 + .../securityinsight/bookmark.go | 125 + .../securityinsight/bookmarkrelations.go | 464 + .../securityinsight/bookmarks.go | 439 + .../securityinsight/client.go | 41 + .../securityinsight/dataconnectors.go | 615 + .../dataconnectorscheckrequirements.go | 125 + .../securityinsight/domainwhois.go | 117 + .../securityinsight/entities.go | 532 + .../securityinsight/entitiesgettimeline.go | 129 + .../securityinsight/entitiesrelations.go | 183 + .../securityinsight/entityqueries.go | 438 + .../securityinsight/entityquerytemplates.go | 258 + .../securityinsight/entityrelations.go | 124 + .../securityinsight/enums.go | 1934 ++ .../securityinsight/incidentcomments.go | 464 + .../securityinsight/incidentrelations.go | 464 + .../securityinsight/incidents.go | 915 + .../securityinsight/ipgeodata.go | 117 + .../securityinsight/metadata.go | 547 + .../securityinsight/models.go | 26673 ++++++++++++++++ .../securityinsight/officeconsents.go | 341 + .../securityinsight/operations.go | 140 + .../securityinsight/productsettings.go | 392 + .../securityinsightapi/interfaces.go | 330 + .../sentinelonboardingstates.go | 397 + .../securityinsight/sourcecontrol.go | 165 + .../securityinsight/sourcecontrols.go | 440 + .../threatintelligenceindicator.go | 715 + .../threatintelligenceindicatormetrics.go | 123 + .../threatintelligenceindicators.go | 182 + .../securityinsight/version.go | 19 + .../securityinsight/watchlistitems.go | 451 + .../securityinsight/watchlists.go | 450 + .../mgmt/2022-01-01/storagecache/CHANGELOG.md | 2 + .../mgmt/2022-01-01/storagecache/_meta.json | 11 + .../2022-01-01/storagecache/ascoperations.go | 109 + .../mgmt/2022-01-01/storagecache/ascusages.go | 148 + .../mgmt/2022-01-01/storagecache/caches.go | 1077 + .../mgmt/2022-01-01/storagecache/client.go | 42 + .../mgmt/2022-01-01/storagecache/enums.go | 277 + .../mgmt/2022-01-01/storagecache/models.go | 2693 ++ .../2022-01-01/storagecache/operations.go | 141 + .../mgmt/2022-01-01/storagecache/skus.go | 145 + .../storagecacheapi/interfaces.go | 92 + .../2022-01-01/storagecache/storagetarget.go | 392 + .../2022-01-01/storagecache/storagetargets.go | 538 + .../2022-01-01/storagecache/usagemodels.go | 145 + .../mgmt/2022-01-01/storagecache/version.go | 19 + .../2020-03-01/streamanalytics/CHANGELOG.md | 49 + .../2020-03-01/streamanalytics/_meta.json | 2 +- .../mgmt/2020-03-01/streamanalytics/enums.go | 4 +- .../mgmt/2020-03-01/streamanalytics/models.go | 240 +- version/version.go | 2 +- 161 files changed, 99399 insertions(+), 243 deletions(-) create mode 100644 services/batch/mgmt/2022-01-01/batch/CHANGELOG.md create mode 100644 services/batch/mgmt/2022-01-01/batch/_meta.json create mode 100644 services/batch/mgmt/2022-01-01/batch/account.go create mode 100644 services/batch/mgmt/2022-01-01/batch/application.go create mode 100644 services/batch/mgmt/2022-01-01/batch/applicationpackage.go create mode 100644 services/batch/mgmt/2022-01-01/batch/batchapi/interfaces.go create mode 100644 services/batch/mgmt/2022-01-01/batch/certificate.go create mode 100644 services/batch/mgmt/2022-01-01/batch/client.go create mode 100644 services/batch/mgmt/2022-01-01/batch/enums.go create mode 100644 services/batch/mgmt/2022-01-01/batch/location.go create mode 100644 services/batch/mgmt/2022-01-01/batch/models.go create mode 100644 services/batch/mgmt/2022-01-01/batch/operations.go create mode 100644 services/batch/mgmt/2022-01-01/batch/pool.go create mode 100644 services/batch/mgmt/2022-01-01/batch/privateendpointconnection.go create mode 100644 services/batch/mgmt/2022-01-01/batch/privatelinkresource.go create mode 100644 services/batch/mgmt/2022-01-01/batch/version.go create mode 100644 services/cdn/mgmt/2021-06-01/cdn/CHANGELOG.md create mode 100644 services/cdn/mgmt/2021-06-01/cdn/_meta.json create mode 100644 services/cdn/mgmt/2021-06-01/cdn/afdcustomdomains.go create mode 100644 services/cdn/mgmt/2021-06-01/cdn/afdendpoints.go create mode 100644 services/cdn/mgmt/2021-06-01/cdn/afdorigingroups.go create mode 100644 services/cdn/mgmt/2021-06-01/cdn/afdorigins.go create mode 100644 services/cdn/mgmt/2021-06-01/cdn/afdprofiles.go create mode 100644 services/cdn/mgmt/2021-06-01/cdn/cdnapi/interfaces.go create mode 100644 services/cdn/mgmt/2021-06-01/cdn/client.go create mode 100644 services/cdn/mgmt/2021-06-01/cdn/customdomains.go create mode 100644 services/cdn/mgmt/2021-06-01/cdn/edgenodes.go create mode 100644 services/cdn/mgmt/2021-06-01/cdn/endpoints.go create mode 100644 services/cdn/mgmt/2021-06-01/cdn/enums.go create mode 100644 services/cdn/mgmt/2021-06-01/cdn/loganalytics.go create mode 100644 services/cdn/mgmt/2021-06-01/cdn/managedrulesets.go create mode 100644 services/cdn/mgmt/2021-06-01/cdn/models.go create mode 100644 services/cdn/mgmt/2021-06-01/cdn/operations.go create mode 100644 services/cdn/mgmt/2021-06-01/cdn/origingroups.go create mode 100644 services/cdn/mgmt/2021-06-01/cdn/origins.go create mode 100644 services/cdn/mgmt/2021-06-01/cdn/policies.go create mode 100644 services/cdn/mgmt/2021-06-01/cdn/profiles.go create mode 100644 services/cdn/mgmt/2021-06-01/cdn/resourceusage.go create mode 100644 services/cdn/mgmt/2021-06-01/cdn/routes.go create mode 100644 services/cdn/mgmt/2021-06-01/cdn/rules.go create mode 100644 services/cdn/mgmt/2021-06-01/cdn/rulesets.go create mode 100644 services/cdn/mgmt/2021-06-01/cdn/secrets.go create mode 100644 services/cdn/mgmt/2021-06-01/cdn/securitypolicies.go create mode 100644 services/cdn/mgmt/2021-06-01/cdn/validate.go create mode 100644 services/cdn/mgmt/2021-06-01/cdn/version.go create mode 100644 services/preview/appinsights/mgmt/2022-02-01-preview/insights/CHANGELOG.md create mode 100644 services/preview/appinsights/mgmt/2022-02-01-preview/insights/_meta.json create mode 100644 services/preview/appinsights/mgmt/2022-02-01-preview/insights/analyticsitems.go create mode 100644 services/preview/appinsights/mgmt/2022-02-01-preview/insights/annotations.go create mode 100644 services/preview/appinsights/mgmt/2022-02-01-preview/insights/apikeys.go create mode 100644 services/preview/appinsights/mgmt/2022-02-01-preview/insights/client.go create mode 100644 services/preview/appinsights/mgmt/2022-02-01-preview/insights/componentavailablefeatures.go create mode 100644 services/preview/appinsights/mgmt/2022-02-01-preview/insights/componentcurrentbillingfeatures.go create mode 100644 services/preview/appinsights/mgmt/2022-02-01-preview/insights/componentfeaturecapabilities.go create mode 100644 services/preview/appinsights/mgmt/2022-02-01-preview/insights/componentlinkedstorageaccounts.go create mode 100644 services/preview/appinsights/mgmt/2022-02-01-preview/insights/componentquotastatus.go create mode 100644 services/preview/appinsights/mgmt/2022-02-01-preview/insights/components.go create mode 100644 services/preview/appinsights/mgmt/2022-02-01-preview/insights/enums.go create mode 100644 services/preview/appinsights/mgmt/2022-02-01-preview/insights/exportconfigurations.go create mode 100644 services/preview/appinsights/mgmt/2022-02-01-preview/insights/favorites.go create mode 100644 services/preview/appinsights/mgmt/2022-02-01-preview/insights/insightsapi/interfaces.go create mode 100644 services/preview/appinsights/mgmt/2022-02-01-preview/insights/livetoken.go create mode 100644 services/preview/appinsights/mgmt/2022-02-01-preview/insights/models.go create mode 100644 services/preview/appinsights/mgmt/2022-02-01-preview/insights/myworkbooks.go create mode 100644 services/preview/appinsights/mgmt/2022-02-01-preview/insights/operations.go create mode 100644 services/preview/appinsights/mgmt/2022-02-01-preview/insights/proactivedetectionconfigurations.go create mode 100644 services/preview/appinsights/mgmt/2022-02-01-preview/insights/version.go create mode 100644 services/preview/appinsights/mgmt/2022-02-01-preview/insights/webtestlocations.go create mode 100644 services/preview/appinsights/mgmt/2022-02-01-preview/insights/webtests.go create mode 100644 services/preview/appinsights/mgmt/2022-02-01-preview/insights/workbooks.go create mode 100644 services/preview/appinsights/mgmt/2022-02-01-preview/insights/workbooktemplates.go create mode 100644 services/preview/appinsights/mgmt/2022-02-01-preview/insights/workitemconfigurations.go create mode 100644 services/preview/msi/mgmt/2021-09-30-preview/msi/CHANGELOG.md create mode 100644 services/preview/msi/mgmt/2021-09-30-preview/msi/_meta.json create mode 100644 services/preview/msi/mgmt/2021-09-30-preview/msi/client.go create mode 100644 services/preview/msi/mgmt/2021-09-30-preview/msi/models.go create mode 100644 services/preview/msi/mgmt/2021-09-30-preview/msi/msiapi/interfaces.go create mode 100644 services/preview/msi/mgmt/2021-09-30-preview/msi/operations.go create mode 100644 services/preview/msi/mgmt/2021-09-30-preview/msi/systemassignedidentities.go create mode 100644 services/preview/msi/mgmt/2021-09-30-preview/msi/userassignedidentities.go create mode 100644 services/preview/msi/mgmt/2021-09-30-preview/msi/version.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/CHANGELOG.md create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/_meta.json create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/actions.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/alertrules.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/alertruletemplates.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/automationrules.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/bookmark.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/bookmarkrelations.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/bookmarks.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/client.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/dataconnectors.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/dataconnectorscheckrequirements.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/domainwhois.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/entities.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/entitiesgettimeline.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/entitiesrelations.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/entityqueries.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/entityquerytemplates.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/entityrelations.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/enums.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/incidentcomments.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/incidentrelations.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/incidents.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/ipgeodata.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/metadata.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/models.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/officeconsents.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/operations.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/productsettings.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/securityinsightapi/interfaces.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/sentinelonboardingstates.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/sourcecontrol.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/sourcecontrols.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/threatintelligenceindicator.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/threatintelligenceindicatormetrics.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/threatintelligenceindicators.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/version.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/watchlistitems.go create mode 100644 services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/watchlists.go create mode 100644 services/storagecache/mgmt/2022-01-01/storagecache/CHANGELOG.md create mode 100644 services/storagecache/mgmt/2022-01-01/storagecache/_meta.json create mode 100644 services/storagecache/mgmt/2022-01-01/storagecache/ascoperations.go create mode 100644 services/storagecache/mgmt/2022-01-01/storagecache/ascusages.go create mode 100644 services/storagecache/mgmt/2022-01-01/storagecache/caches.go create mode 100644 services/storagecache/mgmt/2022-01-01/storagecache/client.go create mode 100644 services/storagecache/mgmt/2022-01-01/storagecache/enums.go create mode 100644 services/storagecache/mgmt/2022-01-01/storagecache/models.go create mode 100644 services/storagecache/mgmt/2022-01-01/storagecache/operations.go create mode 100644 services/storagecache/mgmt/2022-01-01/storagecache/skus.go create mode 100644 services/storagecache/mgmt/2022-01-01/storagecache/storagecacheapi/interfaces.go create mode 100644 services/storagecache/mgmt/2022-01-01/storagecache/storagetarget.go create mode 100644 services/storagecache/mgmt/2022-01-01/storagecache/storagetargets.go create mode 100644 services/storagecache/mgmt/2022-01-01/storagecache/usagemodels.go create mode 100644 services/storagecache/mgmt/2022-01-01/storagecache/version.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 50b39da3bec8..f72cf686faef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # CHANGELOG +## `v62.3.0` + +### New Packages + +- `github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch` +- `github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn` +- `github.com/Azure/azure-sdk-for-go/services/preview/appinsights/mgmt/2022-02-01-preview/insights` +- `github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2021-09-30-preview/msi` +- `github.com/Azure/azure-sdk-for-go/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight` +- `github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2022-01-01/storagecache` + +### Updated Packages + +| Package Path | Changelog | +| :--- | :---: | +| `github.com/Azure/azure-sdk-for-go/services/streamanalytics/mgmt/2020-03-01/streamanalytics` | [details](https://github.com/Azure/azure-sdk-for-go/tree/main/services/streamanalytics/mgmt/2020-03-01/streamanalytics/CHANGELOG.md) | + ## `v62.2.0` ### New Packages diff --git a/profiles/latest/batch/mgmt/batch/batchapi/models.go b/profiles/latest/batch/mgmt/batch/batchapi/models.go index 9832294c1618..9de6b7d1a3b7 100644 --- a/profiles/latest/batch/mgmt/batch/batchapi/models.go +++ b/profiles/latest/batch/mgmt/batch/batchapi/models.go @@ -9,7 +9,7 @@ package batchapi -import original "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2021-06-01/batch/batchapi" +import original "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/batchapi" type AccountClientAPI = original.AccountClientAPI type ApplicationClientAPI = original.ApplicationClientAPI diff --git a/profiles/latest/batch/mgmt/batch/models.go b/profiles/latest/batch/mgmt/batch/models.go index 185e4bf84b91..715cd9b73003 100644 --- a/profiles/latest/batch/mgmt/batch/models.go +++ b/profiles/latest/batch/mgmt/batch/models.go @@ -12,7 +12,7 @@ package batch import ( "context" - original "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2021-06-01/batch" + original "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch" ) const ( @@ -130,6 +130,13 @@ const ( DiskEncryptionTargetTemporaryDisk DiskEncryptionTarget = original.DiskEncryptionTargetTemporaryDisk ) +type DynamicVNetAssignmentScope = original.DynamicVNetAssignmentScope + +const ( + DynamicVNetAssignmentScopeJob DynamicVNetAssignmentScope = original.DynamicVNetAssignmentScopeJob + DynamicVNetAssignmentScopeNone DynamicVNetAssignmentScope = original.DynamicVNetAssignmentScopeNone +) + type ElevationLevel = original.ElevationLevel const ( @@ -324,6 +331,11 @@ type ContainerRegistry = original.ContainerRegistry type DataDisk = original.DataDisk type DeleteCertificateError = original.DeleteCertificateError type DeploymentConfiguration = original.DeploymentConfiguration +type DetectorListResult = original.DetectorListResult +type DetectorListResultIterator = original.DetectorListResultIterator +type DetectorListResultPage = original.DetectorListResultPage +type DetectorResponse = original.DetectorResponse +type DetectorResponseProperties = original.DetectorResponseProperties type DiffDiskSettings = original.DiffDiskSettings type DiskEncryptionConfiguration = original.DiskEncryptionConfiguration type EncryptionProperties = original.EncryptionProperties @@ -445,6 +457,12 @@ func NewCertificateClient(subscriptionID string) CertificateClient { func NewCertificateClientWithBaseURI(baseURI string, subscriptionID string) CertificateClient { return original.NewCertificateClientWithBaseURI(baseURI, subscriptionID) } +func NewDetectorListResultIterator(page DetectorListResultPage) DetectorListResultIterator { + return original.NewDetectorListResultIterator(page) +} +func NewDetectorListResultPage(cur DetectorListResult, getNextPage func(context.Context, DetectorListResult) (DetectorListResult, error)) DetectorListResultPage { + return original.NewDetectorListResultPage(cur, getNextPage) +} func NewListApplicationPackagesResultIterator(page ListApplicationPackagesResultPage) ListApplicationPackagesResultIterator { return original.NewListApplicationPackagesResultIterator(page) } @@ -577,6 +595,9 @@ func PossibleDiffDiskPlacementValues() []DiffDiskPlacement { func PossibleDiskEncryptionTargetValues() []DiskEncryptionTarget { return original.PossibleDiskEncryptionTargetValues() } +func PossibleDynamicVNetAssignmentScopeValues() []DynamicVNetAssignmentScope { + return original.PossibleDynamicVNetAssignmentScopeValues() +} func PossibleElevationLevelValues() []ElevationLevel { return original.PossibleElevationLevelValues() } diff --git a/profiles/latest/cdn/mgmt/cdn/cdnapi/models.go b/profiles/latest/cdn/mgmt/cdn/cdnapi/models.go index e623aae70f3a..fd73f0983055 100644 --- a/profiles/latest/cdn/mgmt/cdn/cdnapi/models.go +++ b/profiles/latest/cdn/mgmt/cdn/cdnapi/models.go @@ -9,7 +9,7 @@ package cdnapi -import original "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn/cdnapi" +import original "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/cdnapi" type AFDCustomDomainsClientAPI = original.AFDCustomDomainsClientAPI type AFDEndpointsClientAPI = original.AFDEndpointsClientAPI diff --git a/profiles/latest/cdn/mgmt/cdn/models.go b/profiles/latest/cdn/mgmt/cdn/models.go index b3f930122255..4a6c18c5f06a 100644 --- a/profiles/latest/cdn/mgmt/cdn/models.go +++ b/profiles/latest/cdn/mgmt/cdn/models.go @@ -12,7 +12,7 @@ package cdn import ( "context" - original "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" + original "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" ) const ( @@ -38,8 +38,9 @@ const ( type AfdCertificateType = original.AfdCertificateType const ( - AfdCertificateTypeCustomerCertificate AfdCertificateType = original.AfdCertificateTypeCustomerCertificate - AfdCertificateTypeManagedCertificate AfdCertificateType = original.AfdCertificateTypeManagedCertificate + AfdCertificateTypeAzureFirstPartyManagedCertificate AfdCertificateType = original.AfdCertificateTypeAzureFirstPartyManagedCertificate + AfdCertificateTypeCustomerCertificate AfdCertificateType = original.AfdCertificateTypeCustomerCertificate + AfdCertificateTypeManagedCertificate AfdCertificateType = original.AfdCertificateTypeManagedCertificate ) type AfdMinimumTLSVersion = original.AfdMinimumTLSVersion @@ -62,9 +63,10 @@ const ( type AfdQueryStringCachingBehavior = original.AfdQueryStringCachingBehavior const ( - AfdQueryStringCachingBehaviorIgnoreQueryString AfdQueryStringCachingBehavior = original.AfdQueryStringCachingBehaviorIgnoreQueryString - AfdQueryStringCachingBehaviorNotSet AfdQueryStringCachingBehavior = original.AfdQueryStringCachingBehaviorNotSet - AfdQueryStringCachingBehaviorUseQueryString AfdQueryStringCachingBehavior = original.AfdQueryStringCachingBehaviorUseQueryString + AfdQueryStringCachingBehaviorIgnoreQueryString AfdQueryStringCachingBehavior = original.AfdQueryStringCachingBehaviorIgnoreQueryString + AfdQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings AfdQueryStringCachingBehavior = original.AfdQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings + AfdQueryStringCachingBehaviorIncludeSpecifiedQueryStrings AfdQueryStringCachingBehavior = original.AfdQueryStringCachingBehaviorIncludeSpecifiedQueryStrings + AfdQueryStringCachingBehaviorUseQueryString AfdQueryStringCachingBehavior = original.AfdQueryStringCachingBehaviorUseQueryString ) type Algorithm = original.Algorithm @@ -73,6 +75,15 @@ const ( AlgorithmSHA256 Algorithm = original.AlgorithmSHA256 ) +type AutoGeneratedDomainNameLabelScope = original.AutoGeneratedDomainNameLabelScope + +const ( + AutoGeneratedDomainNameLabelScopeNoReuse AutoGeneratedDomainNameLabelScope = original.AutoGeneratedDomainNameLabelScopeNoReuse + AutoGeneratedDomainNameLabelScopeResourceGroupReuse AutoGeneratedDomainNameLabelScope = original.AutoGeneratedDomainNameLabelScopeResourceGroupReuse + AutoGeneratedDomainNameLabelScopeSubscriptionReuse AutoGeneratedDomainNameLabelScope = original.AutoGeneratedDomainNameLabelScopeSubscriptionReuse + AutoGeneratedDomainNameLabelScopeTenantReuse AutoGeneratedDomainNameLabelScope = original.AutoGeneratedDomainNameLabelScopeTenantReuse +) + type CacheBehavior = original.CacheBehavior const ( @@ -96,6 +107,21 @@ const ( CertificateTypeShared CertificateType = original.CertificateTypeShared ) +type ClientPortOperator = original.ClientPortOperator + +const ( + ClientPortOperatorAny ClientPortOperator = original.ClientPortOperatorAny + ClientPortOperatorBeginsWith ClientPortOperator = original.ClientPortOperatorBeginsWith + ClientPortOperatorContains ClientPortOperator = original.ClientPortOperatorContains + ClientPortOperatorEndsWith ClientPortOperator = original.ClientPortOperatorEndsWith + ClientPortOperatorEqual ClientPortOperator = original.ClientPortOperatorEqual + ClientPortOperatorGreaterThan ClientPortOperator = original.ClientPortOperatorGreaterThan + ClientPortOperatorGreaterThanOrEqual ClientPortOperator = original.ClientPortOperatorGreaterThanOrEqual + ClientPortOperatorLessThan ClientPortOperator = original.ClientPortOperatorLessThan + ClientPortOperatorLessThanOrEqual ClientPortOperator = original.ClientPortOperatorLessThanOrEqual + ClientPortOperatorRegEx ClientPortOperator = original.ClientPortOperatorRegEx +) + type CookiesOperator = original.CookiesOperator const ( @@ -171,12 +197,15 @@ const ( type DomainValidationState = original.DomainValidationState const ( - DomainValidationStateApproved DomainValidationState = original.DomainValidationStateApproved - DomainValidationStatePending DomainValidationState = original.DomainValidationStatePending - DomainValidationStatePendingRevalidation DomainValidationState = original.DomainValidationStatePendingRevalidation - DomainValidationStateSubmitting DomainValidationState = original.DomainValidationStateSubmitting - DomainValidationStateTimedOut DomainValidationState = original.DomainValidationStateTimedOut - DomainValidationStateUnknown DomainValidationState = original.DomainValidationStateUnknown + DomainValidationStateApproved DomainValidationState = original.DomainValidationStateApproved + DomainValidationStateInternalError DomainValidationState = original.DomainValidationStateInternalError + DomainValidationStatePending DomainValidationState = original.DomainValidationStatePending + DomainValidationStatePendingRevalidation DomainValidationState = original.DomainValidationStatePendingRevalidation + DomainValidationStateRefreshingValidationToken DomainValidationState = original.DomainValidationStateRefreshingValidationToken + DomainValidationStateRejected DomainValidationState = original.DomainValidationStateRejected + DomainValidationStateSubmitting DomainValidationState = original.DomainValidationStateSubmitting + DomainValidationStateTimedOut DomainValidationState = original.DomainValidationStateTimedOut + DomainValidationStateUnknown DomainValidationState = original.DomainValidationStateUnknown ) type EnabledState = original.EnabledState @@ -251,6 +280,21 @@ const ( HealthProbeRequestTypeNotSet HealthProbeRequestType = original.HealthProbeRequestTypeNotSet ) +type HostNameOperator = original.HostNameOperator + +const ( + HostNameOperatorAny HostNameOperator = original.HostNameOperatorAny + HostNameOperatorBeginsWith HostNameOperator = original.HostNameOperatorBeginsWith + HostNameOperatorContains HostNameOperator = original.HostNameOperatorContains + HostNameOperatorEndsWith HostNameOperator = original.HostNameOperatorEndsWith + HostNameOperatorEqual HostNameOperator = original.HostNameOperatorEqual + HostNameOperatorGreaterThan HostNameOperator = original.HostNameOperatorGreaterThan + HostNameOperatorGreaterThanOrEqual HostNameOperator = original.HostNameOperatorGreaterThanOrEqual + HostNameOperatorLessThan HostNameOperator = original.HostNameOperatorLessThan + HostNameOperatorLessThanOrEqual HostNameOperator = original.HostNameOperatorLessThanOrEqual + HostNameOperatorRegEx HostNameOperator = original.HostNameOperatorRegEx +) + type IdentityType = original.IdentityType const ( @@ -289,11 +333,11 @@ const ( type LogMetricsGroupBy = original.LogMetricsGroupBy const ( - LogMetricsGroupByCacheStatus LogMetricsGroupBy = original.LogMetricsGroupByCacheStatus - LogMetricsGroupByCountry LogMetricsGroupBy = original.LogMetricsGroupByCountry - LogMetricsGroupByCustomDomain LogMetricsGroupBy = original.LogMetricsGroupByCustomDomain - LogMetricsGroupByHTTPStatusCode LogMetricsGroupBy = original.LogMetricsGroupByHTTPStatusCode - LogMetricsGroupByProtocol LogMetricsGroupBy = original.LogMetricsGroupByProtocol + LogMetricsGroupByCacheStatus LogMetricsGroupBy = original.LogMetricsGroupByCacheStatus + LogMetricsGroupByCountryOrRegion LogMetricsGroupBy = original.LogMetricsGroupByCountryOrRegion + LogMetricsGroupByCustomDomain LogMetricsGroupBy = original.LogMetricsGroupByCustomDomain + LogMetricsGroupByHTTPStatusCode LogMetricsGroupBy = original.LogMetricsGroupByHTTPStatusCode + LogMetricsGroupByProtocol LogMetricsGroupBy = original.LogMetricsGroupByProtocol ) type LogRanking = original.LogRanking @@ -331,20 +375,6 @@ const ( MatchProcessingBehaviorStop MatchProcessingBehavior = original.MatchProcessingBehaviorStop ) -type MatchVariable = original.MatchVariable - -const ( - MatchVariableCookies MatchVariable = original.MatchVariableCookies - MatchVariablePostArgs MatchVariable = original.MatchVariablePostArgs - MatchVariableQueryString MatchVariable = original.MatchVariableQueryString - MatchVariableRemoteAddr MatchVariable = original.MatchVariableRemoteAddr - MatchVariableRequestBody MatchVariable = original.MatchVariableRequestBody - MatchVariableRequestHeader MatchVariable = original.MatchVariableRequestHeader - MatchVariableRequestMethod MatchVariable = original.MatchVariableRequestMethod - MatchVariableRequestURI MatchVariable = original.MatchVariableRequestURI - MatchVariableSocketAddr MatchVariable = original.MatchVariableSocketAddr -) - type MinimumTLSVersion = original.MinimumTLSVersion const ( @@ -356,8 +386,10 @@ const ( type Name = original.Name const ( + NameClientPort Name = original.NameClientPort NameCookies Name = original.NameCookies NameDeliveryRuleCondition Name = original.NameDeliveryRuleCondition + NameHostName Name = original.NameHostName NameHTTPVersion Name = original.NameHTTPVersion NameIsDevice Name = original.NameIsDevice NamePostArgs Name = original.NamePostArgs @@ -368,6 +400,9 @@ const ( NameRequestMethod Name = original.NameRequestMethod NameRequestScheme Name = original.NameRequestScheme NameRequestURI Name = original.NameRequestURI + NameServerPort Name = original.NameServerPort + NameSocketAddr Name = original.NameSocketAddr + NameSslProtocol Name = original.NameSslProtocol NameURLFileExtension Name = original.NameURLFileExtension NameURLFileName Name = original.NameURLFileName NameURLPath Name = original.NameURLPath @@ -376,15 +411,16 @@ const ( type NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleAction const ( - NameBasicDeliveryRuleActionNameCacheExpiration NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameCacheExpiration - NameBasicDeliveryRuleActionNameCacheKeyQueryString NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameCacheKeyQueryString - NameBasicDeliveryRuleActionNameDeliveryRuleAction NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameDeliveryRuleAction - NameBasicDeliveryRuleActionNameModifyRequestHeader NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameModifyRequestHeader - NameBasicDeliveryRuleActionNameModifyResponseHeader NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameModifyResponseHeader - NameBasicDeliveryRuleActionNameOriginGroupOverride NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameOriginGroupOverride - NameBasicDeliveryRuleActionNameURLRedirect NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameURLRedirect - NameBasicDeliveryRuleActionNameURLRewrite NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameURLRewrite - NameBasicDeliveryRuleActionNameURLSigning NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameURLSigning + NameBasicDeliveryRuleActionNameCacheExpiration NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameCacheExpiration + NameBasicDeliveryRuleActionNameCacheKeyQueryString NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameCacheKeyQueryString + NameBasicDeliveryRuleActionNameDeliveryRuleAction NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameDeliveryRuleAction + NameBasicDeliveryRuleActionNameModifyRequestHeader NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameModifyRequestHeader + NameBasicDeliveryRuleActionNameModifyResponseHeader NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameModifyResponseHeader + NameBasicDeliveryRuleActionNameOriginGroupOverride NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameOriginGroupOverride + NameBasicDeliveryRuleActionNameRouteConfigurationOverride NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameRouteConfigurationOverride + NameBasicDeliveryRuleActionNameURLRedirect NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameURLRedirect + NameBasicDeliveryRuleActionNameURLRewrite NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameURLRewrite + NameBasicDeliveryRuleActionNameURLSigning NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameURLSigning ) type Operator = original.Operator @@ -618,7 +654,8 @@ const ( type ResourceType = original.ResourceType const ( - ResourceTypeMicrosoftCdnProfilesEndpoints ResourceType = original.ResourceTypeMicrosoftCdnProfilesEndpoints + ResourceTypeMicrosoftCdnProfilesAfdEndpoints ResourceType = original.ResourceTypeMicrosoftCdnProfilesAfdEndpoints + ResourceTypeMicrosoftCdnProfilesEndpoints ResourceType = original.ResourceTypeMicrosoftCdnProfilesEndpoints ) type ResponseBasedDetectedErrorTypes = original.ResponseBasedDetectedErrorTypes @@ -629,6 +666,54 @@ const ( ResponseBasedDetectedErrorTypesTCPErrorsOnly ResponseBasedDetectedErrorTypes = original.ResponseBasedDetectedErrorTypesTCPErrorsOnly ) +type RuleCacheBehavior = original.RuleCacheBehavior + +const ( + RuleCacheBehaviorHonorOrigin RuleCacheBehavior = original.RuleCacheBehaviorHonorOrigin + RuleCacheBehaviorOverrideAlways RuleCacheBehavior = original.RuleCacheBehaviorOverrideAlways + RuleCacheBehaviorOverrideIfOriginMissing RuleCacheBehavior = original.RuleCacheBehaviorOverrideIfOriginMissing +) + +type RuleIsCompressionEnabled = original.RuleIsCompressionEnabled + +const ( + RuleIsCompressionEnabledDisabled RuleIsCompressionEnabled = original.RuleIsCompressionEnabledDisabled + RuleIsCompressionEnabledEnabled RuleIsCompressionEnabled = original.RuleIsCompressionEnabledEnabled +) + +type RuleQueryStringCachingBehavior = original.RuleQueryStringCachingBehavior + +const ( + RuleQueryStringCachingBehaviorIgnoreQueryString RuleQueryStringCachingBehavior = original.RuleQueryStringCachingBehaviorIgnoreQueryString + RuleQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings RuleQueryStringCachingBehavior = original.RuleQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings + RuleQueryStringCachingBehaviorIncludeSpecifiedQueryStrings RuleQueryStringCachingBehavior = original.RuleQueryStringCachingBehaviorIncludeSpecifiedQueryStrings + RuleQueryStringCachingBehaviorUseQueryString RuleQueryStringCachingBehavior = original.RuleQueryStringCachingBehaviorUseQueryString +) + +type SecretType = original.SecretType + +const ( + SecretTypeAzureFirstPartyManagedCertificate SecretType = original.SecretTypeAzureFirstPartyManagedCertificate + SecretTypeCustomerCertificate SecretType = original.SecretTypeCustomerCertificate + SecretTypeManagedCertificate SecretType = original.SecretTypeManagedCertificate + SecretTypeURLSigningKey SecretType = original.SecretTypeURLSigningKey +) + +type ServerPortOperator = original.ServerPortOperator + +const ( + ServerPortOperatorAny ServerPortOperator = original.ServerPortOperatorAny + ServerPortOperatorBeginsWith ServerPortOperator = original.ServerPortOperatorBeginsWith + ServerPortOperatorContains ServerPortOperator = original.ServerPortOperatorContains + ServerPortOperatorEndsWith ServerPortOperator = original.ServerPortOperatorEndsWith + ServerPortOperatorEqual ServerPortOperator = original.ServerPortOperatorEqual + ServerPortOperatorGreaterThan ServerPortOperator = original.ServerPortOperatorGreaterThan + ServerPortOperatorGreaterThanOrEqual ServerPortOperator = original.ServerPortOperatorGreaterThanOrEqual + ServerPortOperatorLessThan ServerPortOperator = original.ServerPortOperatorLessThan + ServerPortOperatorLessThanOrEqual ServerPortOperator = original.ServerPortOperatorLessThanOrEqual + ServerPortOperatorRegEx ServerPortOperator = original.ServerPortOperatorRegEx +) + type SharedPrivateLinkResourceStatus = original.SharedPrivateLinkResourceStatus const ( @@ -644,7 +729,6 @@ type SkuName = original.SkuName const ( SkuNameCustomVerizon SkuName = original.SkuNameCustomVerizon SkuNamePremiumAzureFrontDoor SkuName = original.SkuNamePremiumAzureFrontDoor - SkuNamePremiumChinaCdn SkuName = original.SkuNamePremiumChinaCdn SkuNamePremiumVerizon SkuName = original.SkuNamePremiumVerizon SkuNameStandard955BandWidthChinaCdn SkuName = original.SkuNameStandard955BandWidthChinaCdn SkuNameStandardAkamai SkuName = original.SkuNameStandardAkamai @@ -658,6 +742,21 @@ const ( SkuNameStandardVerizon SkuName = original.SkuNameStandardVerizon ) +type SocketAddrOperator = original.SocketAddrOperator + +const ( + SocketAddrOperatorAny SocketAddrOperator = original.SocketAddrOperatorAny + SocketAddrOperatorIPMatch SocketAddrOperator = original.SocketAddrOperatorIPMatch +) + +type SslProtocol = original.SslProtocol + +const ( + SslProtocolTLSv1 SslProtocol = original.SslProtocolTLSv1 + SslProtocolTLSv11 SslProtocol = original.SslProtocolTLSv11 + SslProtocolTLSv12 SslProtocol = original.SslProtocolTLSv12 +) + type Status = original.Status const ( @@ -670,8 +769,12 @@ const ( type Transform = original.Transform const ( - TransformLowercase Transform = original.TransformLowercase - TransformUppercase Transform = original.TransformUppercase + TransformLowercase Transform = original.TransformLowercase + TransformRemoveNulls Transform = original.TransformRemoveNulls + TransformTrim Transform = original.TransformTrim + TransformUppercase Transform = original.TransformUppercase + TransformURLDecode Transform = original.TransformURLDecode + TransformURLEncode Transform = original.TransformURLEncode ) type TransformType = original.TransformType @@ -688,17 +791,18 @@ const ( type Type = original.Type const ( - TypeSecurityPolicyParameters Type = original.TypeSecurityPolicyParameters - TypeWebApplicationFirewall Type = original.TypeWebApplicationFirewall + TypeSecurityPolicyPropertiesParameters Type = original.TypeSecurityPolicyPropertiesParameters + TypeWebApplicationFirewall Type = original.TypeWebApplicationFirewall ) type TypeBasicSecretParameters = original.TypeBasicSecretParameters const ( - TypeBasicSecretParametersTypeCustomerCertificate TypeBasicSecretParameters = original.TypeBasicSecretParametersTypeCustomerCertificate - TypeBasicSecretParametersTypeManagedCertificate TypeBasicSecretParameters = original.TypeBasicSecretParametersTypeManagedCertificate - TypeBasicSecretParametersTypeSecretParameters TypeBasicSecretParameters = original.TypeBasicSecretParametersTypeSecretParameters - TypeBasicSecretParametersTypeURLSigningKey TypeBasicSecretParameters = original.TypeBasicSecretParametersTypeURLSigningKey + TypeBasicSecretParametersTypeAzureFirstPartyManagedCertificate TypeBasicSecretParameters = original.TypeBasicSecretParametersTypeAzureFirstPartyManagedCertificate + TypeBasicSecretParametersTypeCustomerCertificate TypeBasicSecretParameters = original.TypeBasicSecretParametersTypeCustomerCertificate + TypeBasicSecretParametersTypeManagedCertificate TypeBasicSecretParameters = original.TypeBasicSecretParametersTypeManagedCertificate + TypeBasicSecretParametersTypeSecretParameters TypeBasicSecretParameters = original.TypeBasicSecretParametersTypeSecretParameters + TypeBasicSecretParametersTypeURLSigningKey TypeBasicSecretParameters = original.TypeBasicSecretParametersTypeURLSigningKey ) type URLFileExtensionOperator = original.URLFileExtensionOperator @@ -753,6 +857,7 @@ const ( UnitBitsPerSecond Unit = original.UnitBitsPerSecond UnitBytes Unit = original.UnitBytes UnitCount Unit = original.UnitCount + UnitMilliSeconds Unit = original.UnitMilliSeconds ) type Unit1 = original.Unit1 @@ -761,14 +866,6 @@ const ( Unit1Count Unit1 = original.Unit1Count ) -type ValidateSecretType = original.ValidateSecretType - -const ( - ValidateSecretTypeCustomerCertificate ValidateSecretType = original.ValidateSecretTypeCustomerCertificate - ValidateSecretTypeManagedCertificate ValidateSecretType = original.ValidateSecretTypeManagedCertificate - ValidateSecretTypeURLSigningKey ValidateSecretType = original.ValidateSecretTypeURLSigningKey -) - type WafAction = original.WafAction const ( @@ -786,6 +883,20 @@ const ( WafGranularityPT5M WafGranularity = original.WafGranularityPT5M ) +type WafMatchVariable = original.WafMatchVariable + +const ( + WafMatchVariableCookies WafMatchVariable = original.WafMatchVariableCookies + WafMatchVariablePostArgs WafMatchVariable = original.WafMatchVariablePostArgs + WafMatchVariableQueryString WafMatchVariable = original.WafMatchVariableQueryString + WafMatchVariableRemoteAddr WafMatchVariable = original.WafMatchVariableRemoteAddr + WafMatchVariableRequestBody WafMatchVariable = original.WafMatchVariableRequestBody + WafMatchVariableRequestHeader WafMatchVariable = original.WafMatchVariableRequestHeader + WafMatchVariableRequestMethod WafMatchVariable = original.WafMatchVariableRequestMethod + WafMatchVariableRequestURI WafMatchVariable = original.WafMatchVariableRequestURI + WafMatchVariableSocketAddr WafMatchVariable = original.WafMatchVariableSocketAddr +) + type WafMetric = original.WafMetric const ( @@ -802,14 +913,14 @@ const ( type WafRankingType = original.WafRankingType const ( - WafRankingTypeAction WafRankingType = original.WafRankingTypeAction - WafRankingTypeClientIP WafRankingType = original.WafRankingTypeClientIP - WafRankingTypeCountry WafRankingType = original.WafRankingTypeCountry - WafRankingTypeRuleGroup WafRankingType = original.WafRankingTypeRuleGroup - WafRankingTypeRuleID WafRankingType = original.WafRankingTypeRuleID - WafRankingTypeRuleType WafRankingType = original.WafRankingTypeRuleType - WafRankingTypeURL WafRankingType = original.WafRankingTypeURL - WafRankingTypeUserAgent WafRankingType = original.WafRankingTypeUserAgent + WafRankingTypeAction WafRankingType = original.WafRankingTypeAction + WafRankingTypeClientIP WafRankingType = original.WafRankingTypeClientIP + WafRankingTypeCountryOrRegion WafRankingType = original.WafRankingTypeCountryOrRegion + WafRankingTypeRuleGroup WafRankingType = original.WafRankingTypeRuleGroup + WafRankingTypeRuleID WafRankingType = original.WafRankingTypeRuleID + WafRankingTypeRuleType WafRankingType = original.WafRankingTypeRuleType + WafRankingTypeURL WafRankingType = original.WafRankingTypeURL + WafRankingTypeUserAgent WafRankingType = original.WafRankingTypeUserAgent ) type WafRuleType = original.WafRuleType @@ -869,21 +980,30 @@ type AFDOriginsDeleteFuture = original.AFDOriginsDeleteFuture type AFDOriginsUpdateFuture = original.AFDOriginsUpdateFuture type AFDProfilesClient = original.AFDProfilesClient type AFDStateProperties = original.AFDStateProperties +type ActivatedResourceReference = original.ActivatedResourceReference type AfdErrorResponse = original.AfdErrorResponse type AfdPurgeParameters = original.AfdPurgeParameters +type AfdRouteCacheConfiguration = original.AfdRouteCacheConfiguration +type AzureFirstPartyManagedCertificate = original.AzureFirstPartyManagedCertificate +type AzureFirstPartyManagedCertificateParameters = original.AzureFirstPartyManagedCertificateParameters type BaseClient = original.BaseClient type BasicCustomDomainHTTPSParameters = original.BasicCustomDomainHTTPSParameters type BasicDeliveryRuleAction = original.BasicDeliveryRuleAction type BasicDeliveryRuleCondition = original.BasicDeliveryRuleCondition type BasicSecretParameters = original.BasicSecretParameters -type BasicSecurityPolicyParameters = original.BasicSecurityPolicyParameters +type BasicSecurityPolicyPropertiesParameters = original.BasicSecurityPolicyPropertiesParameters +type CacheConfiguration = original.CacheConfiguration type CacheExpirationActionParameters = original.CacheExpirationActionParameters type CacheKeyQueryStringActionParameters = original.CacheKeyQueryStringActionParameters type Certificate = original.Certificate type CertificateSourceParameters = original.CertificateSourceParameters +type CheckEndpointNameAvailabilityInput = original.CheckEndpointNameAvailabilityInput +type CheckEndpointNameAvailabilityOutput = original.CheckEndpointNameAvailabilityOutput +type CheckHostNameAvailabilityInput = original.CheckHostNameAvailabilityInput type CheckNameAvailabilityInput = original.CheckNameAvailabilityInput type CheckNameAvailabilityOutput = original.CheckNameAvailabilityOutput type CidrIPAddress = original.CidrIPAddress +type ClientPortMatchConditionParameters = original.ClientPortMatchConditionParameters type CompressionSettings = original.CompressionSettings type ContinentsResponse = original.ContinentsResponse type ContinentsResponseContinentsItem = original.ContinentsResponseContinentsItem @@ -900,8 +1020,6 @@ type CustomDomainPropertiesParameters = original.CustomDomainPropertiesParameter type CustomDomainsClient = original.CustomDomainsClient type CustomDomainsCreateFuture = original.CustomDomainsCreateFuture type CustomDomainsDeleteFuture = original.CustomDomainsDeleteFuture -type CustomDomainsDisableCustomHTTPSFuture = original.CustomDomainsDisableCustomHTTPSFuture -type CustomDomainsEnableCustomHTTPSFuture = original.CustomDomainsEnableCustomHTTPSFuture type CustomRule = original.CustomRule type CustomRuleList = original.CustomRuleList type CustomerCertificate = original.CustomerCertificate @@ -914,9 +1032,11 @@ type DeliveryRule = original.DeliveryRule type DeliveryRuleAction = original.DeliveryRuleAction type DeliveryRuleCacheExpirationAction = original.DeliveryRuleCacheExpirationAction type DeliveryRuleCacheKeyQueryStringAction = original.DeliveryRuleCacheKeyQueryStringAction +type DeliveryRuleClientPortCondition = original.DeliveryRuleClientPortCondition type DeliveryRuleCondition = original.DeliveryRuleCondition type DeliveryRuleCookiesCondition = original.DeliveryRuleCookiesCondition type DeliveryRuleHTTPVersionCondition = original.DeliveryRuleHTTPVersionCondition +type DeliveryRuleHostNameCondition = original.DeliveryRuleHostNameCondition type DeliveryRuleIsDeviceCondition = original.DeliveryRuleIsDeviceCondition type DeliveryRulePostArgsCondition = original.DeliveryRulePostArgsCondition type DeliveryRuleQueryStringCondition = original.DeliveryRuleQueryStringCondition @@ -928,9 +1048,14 @@ type DeliveryRuleRequestMethodCondition = original.DeliveryRuleRequestMethodCond type DeliveryRuleRequestSchemeCondition = original.DeliveryRuleRequestSchemeCondition type DeliveryRuleRequestURICondition = original.DeliveryRuleRequestURICondition type DeliveryRuleResponseHeaderAction = original.DeliveryRuleResponseHeaderAction +type DeliveryRuleRouteConfigurationOverrideAction = original.DeliveryRuleRouteConfigurationOverrideAction +type DeliveryRuleServerPortCondition = original.DeliveryRuleServerPortCondition +type DeliveryRuleSocketAddrCondition = original.DeliveryRuleSocketAddrCondition +type DeliveryRuleSslProtocolCondition = original.DeliveryRuleSslProtocolCondition type DeliveryRuleURLFileExtensionCondition = original.DeliveryRuleURLFileExtensionCondition type DeliveryRuleURLFileNameCondition = original.DeliveryRuleURLFileNameCondition type DeliveryRuleURLPathCondition = original.DeliveryRuleURLPathCondition +type DimensionProperties = original.DimensionProperties type DomainValidationProperties = original.DomainValidationProperties type EdgeNode = original.EdgeNode type EdgeNodeProperties = original.EdgeNodeProperties @@ -956,12 +1081,15 @@ type EndpointsPurgeContentFuture = original.EndpointsPurgeContentFuture type EndpointsStartFuture = original.EndpointsStartFuture type EndpointsStopFuture = original.EndpointsStopFuture type EndpointsUpdateFuture = original.EndpointsUpdateFuture +type ErrorAdditionalInfo = original.ErrorAdditionalInfo +type ErrorDetail = original.ErrorDetail type ErrorResponse = original.ErrorResponse type GeoFilter = original.GeoFilter type HTTPErrorRangeParameters = original.HTTPErrorRangeParameters type HTTPVersionMatchConditionParameters = original.HTTPVersionMatchConditionParameters type HeaderActionParameters = original.HeaderActionParameters type HealthProbeParameters = original.HealthProbeParameters +type HostNameMatchConditionParameters = original.HostNameMatchConditionParameters type IPAddressGroup = original.IPAddressGroup type IsDeviceMatchConditionParameters = original.IsDeviceMatchConditionParameters type KeyVaultCertificateSourceParameters = original.KeyVaultCertificateSourceParameters @@ -969,6 +1097,7 @@ type KeyVaultSigningKeyParameters = original.KeyVaultSigningKeyParameters type LoadBalancingSettingsParameters = original.LoadBalancingSettingsParameters type LoadParameters = original.LoadParameters type LogAnalyticsClient = original.LogAnalyticsClient +type LogSpecification = original.LogSpecification type ManagedCertificate = original.ManagedCertificate type ManagedCertificateParameters = original.ManagedCertificateParameters type ManagedHTTPSParameters = original.ManagedHTTPSParameters @@ -985,12 +1114,15 @@ type ManagedRuleSetDefinitionProperties = original.ManagedRuleSetDefinitionPrope type ManagedRuleSetList = original.ManagedRuleSetList type ManagedRuleSetsClient = original.ManagedRuleSetsClient type MatchCondition = original.MatchCondition +type MetricAvailability = original.MetricAvailability +type MetricSpecification = original.MetricSpecification type MetricsResponse = original.MetricsResponse type MetricsResponseSeriesItem = original.MetricsResponseSeriesItem type MetricsResponseSeriesItemDataItem = original.MetricsResponseSeriesItemDataItem type MetricsResponseSeriesItemGroupsItem = original.MetricsResponseSeriesItemGroupsItem type Operation = original.Operation type OperationDisplay = original.OperationDisplay +type OperationProperties = original.OperationProperties type OperationsClient = original.OperationsClient type OperationsListResult = original.OperationsListResult type OperationsListResultIterator = original.OperationsListResultIterator @@ -1000,6 +1132,7 @@ type OriginGroup = original.OriginGroup type OriginGroupListResult = original.OriginGroupListResult type OriginGroupListResultIterator = original.OriginGroupListResultIterator type OriginGroupListResultPage = original.OriginGroupListResultPage +type OriginGroupOverride = original.OriginGroupOverride type OriginGroupOverrideAction = original.OriginGroupOverrideAction type OriginGroupOverrideActionParameters = original.OriginGroupOverrideActionParameters type OriginGroupProperties = original.OriginGroupProperties @@ -1029,6 +1162,7 @@ type ProfileListResult = original.ProfileListResult type ProfileListResultIterator = original.ProfileListResultIterator type ProfileListResultPage = original.ProfileListResultPage type ProfileProperties = original.ProfileProperties +type ProfilePropertiesUpdateParameters = original.ProfilePropertiesUpdateParameters type ProfileUpdateParameters = original.ProfileUpdateParameters type ProfilesClient = original.ProfilesClient type ProfilesCreateFuture = original.ProfilesCreateFuture @@ -1062,6 +1196,7 @@ type ResourcesResponseEndpointsItem = original.ResourcesResponseEndpointsItem type ResourcesResponseEndpointsItemCustomDomainsItem = original.ResourcesResponseEndpointsItemCustomDomainsItem type ResponseBasedOriginErrorDetectionParameters = original.ResponseBasedOriginErrorDetectionParameters type Route = original.Route +type RouteConfigurationOverrideActionParameters = original.RouteConfigurationOverrideActionParameters type RouteListResult = original.RouteListResult type RouteListResultIterator = original.RouteListResultIterator type RouteListResultPage = original.RouteListResultPage @@ -1083,7 +1218,6 @@ type RuleSetListResultIterator = original.RuleSetListResultIterator type RuleSetListResultPage = original.RuleSetListResultPage type RuleSetProperties = original.RuleSetProperties type RuleSetsClient = original.RuleSetsClient -type RuleSetsCreateFuture = original.RuleSetsCreateFuture type RuleSetsDeleteFuture = original.RuleSetsDeleteFuture type RuleUpdateParameters = original.RuleUpdateParameters type RuleUpdatePropertiesParameters = original.RuleUpdatePropertiesParameters @@ -1100,7 +1234,6 @@ type SecretProperties = original.SecretProperties type SecretsClient = original.SecretsClient type SecretsCreateFuture = original.SecretsCreateFuture type SecretsDeleteFuture = original.SecretsDeleteFuture -type SecretsUpdateFuture = original.SecretsUpdateFuture type SecurityPoliciesClient = original.SecurityPoliciesClient type SecurityPoliciesCreateFuture = original.SecurityPoliciesCreateFuture type SecurityPoliciesDeleteFuture = original.SecurityPoliciesDeleteFuture @@ -1109,12 +1242,18 @@ type SecurityPolicy = original.SecurityPolicy type SecurityPolicyListResult = original.SecurityPolicyListResult type SecurityPolicyListResultIterator = original.SecurityPolicyListResultIterator type SecurityPolicyListResultPage = original.SecurityPolicyListResultPage -type SecurityPolicyParameters = original.SecurityPolicyParameters type SecurityPolicyProperties = original.SecurityPolicyProperties +type SecurityPolicyPropertiesParameters = original.SecurityPolicyPropertiesParameters +type SecurityPolicyUpdateParameters = original.SecurityPolicyUpdateParameters +type SecurityPolicyUpdateProperties = original.SecurityPolicyUpdateProperties type SecurityPolicyWebApplicationFirewallAssociation = original.SecurityPolicyWebApplicationFirewallAssociation type SecurityPolicyWebApplicationFirewallParameters = original.SecurityPolicyWebApplicationFirewallParameters +type ServerPortMatchConditionParameters = original.ServerPortMatchConditionParameters +type ServiceSpecification = original.ServiceSpecification type SharedPrivateLinkResourceProperties = original.SharedPrivateLinkResourceProperties type Sku = original.Sku +type SocketAddrMatchConditionParameters = original.SocketAddrMatchConditionParameters +type SslProtocolMatchConditionParameters = original.SslProtocolMatchConditionParameters type SsoURI = original.SsoURI type SupportedOptimizationTypesListResult = original.SupportedOptimizationTypesListResult type SystemData = original.SystemData @@ -1438,6 +1577,9 @@ func PossibleAfdQueryStringCachingBehaviorValues() []AfdQueryStringCachingBehavi func PossibleAlgorithmValues() []Algorithm { return original.PossibleAlgorithmValues() } +func PossibleAutoGeneratedDomainNameLabelScopeValues() []AutoGeneratedDomainNameLabelScope { + return original.PossibleAutoGeneratedDomainNameLabelScopeValues() +} func PossibleCacheBehaviorValues() []CacheBehavior { return original.PossibleCacheBehaviorValues() } @@ -1447,6 +1589,9 @@ func PossibleCertificateSourceValues() []CertificateSource { func PossibleCertificateTypeValues() []CertificateType { return original.PossibleCertificateTypeValues() } +func PossibleClientPortOperatorValues() []ClientPortOperator { + return original.PossibleClientPortOperatorValues() +} func PossibleCookiesOperatorValues() []CookiesOperator { return original.PossibleCookiesOperatorValues() } @@ -1498,6 +1643,9 @@ func PossibleHeaderActionValues() []HeaderAction { func PossibleHealthProbeRequestTypeValues() []HealthProbeRequestType { return original.PossibleHealthProbeRequestTypeValues() } +func PossibleHostNameOperatorValues() []HostNameOperator { + return original.PossibleHostNameOperatorValues() +} func PossibleIdentityTypeValues() []IdentityType { return original.PossibleIdentityTypeValues() } @@ -1525,9 +1673,6 @@ func PossibleManagedRuleEnabledStateValues() []ManagedRuleEnabledState { func PossibleMatchProcessingBehaviorValues() []MatchProcessingBehavior { return original.PossibleMatchProcessingBehaviorValues() } -func PossibleMatchVariableValues() []MatchVariable { - return original.PossibleMatchVariableValues() -} func PossibleMinimumTLSVersionValues() []MinimumTLSVersion { return original.PossibleMinimumTLSVersionValues() } @@ -1609,12 +1754,33 @@ func PossibleResourceTypeValues() []ResourceType { func PossibleResponseBasedDetectedErrorTypesValues() []ResponseBasedDetectedErrorTypes { return original.PossibleResponseBasedDetectedErrorTypesValues() } +func PossibleRuleCacheBehaviorValues() []RuleCacheBehavior { + return original.PossibleRuleCacheBehaviorValues() +} +func PossibleRuleIsCompressionEnabledValues() []RuleIsCompressionEnabled { + return original.PossibleRuleIsCompressionEnabledValues() +} +func PossibleRuleQueryStringCachingBehaviorValues() []RuleQueryStringCachingBehavior { + return original.PossibleRuleQueryStringCachingBehaviorValues() +} +func PossibleSecretTypeValues() []SecretType { + return original.PossibleSecretTypeValues() +} +func PossibleServerPortOperatorValues() []ServerPortOperator { + return original.PossibleServerPortOperatorValues() +} func PossibleSharedPrivateLinkResourceStatusValues() []SharedPrivateLinkResourceStatus { return original.PossibleSharedPrivateLinkResourceStatusValues() } func PossibleSkuNameValues() []SkuName { return original.PossibleSkuNameValues() } +func PossibleSocketAddrOperatorValues() []SocketAddrOperator { + return original.PossibleSocketAddrOperatorValues() +} +func PossibleSslProtocolValues() []SslProtocol { + return original.PossibleSslProtocolValues() +} func PossibleStatusValues() []Status { return original.PossibleStatusValues() } @@ -1645,15 +1811,15 @@ func PossibleUnit1Values() []Unit1 { func PossibleUnitValues() []Unit { return original.PossibleUnitValues() } -func PossibleValidateSecretTypeValues() []ValidateSecretType { - return original.PossibleValidateSecretTypeValues() -} func PossibleWafActionValues() []WafAction { return original.PossibleWafActionValues() } func PossibleWafGranularityValues() []WafGranularity { return original.PossibleWafGranularityValues() } +func PossibleWafMatchVariableValues() []WafMatchVariable { + return original.PossibleWafMatchVariableValues() +} func PossibleWafMetricValues() []WafMetric { return original.PossibleWafMetricValues() } diff --git a/profiles/latest/storagecache/mgmt/storagecache/models.go b/profiles/latest/storagecache/mgmt/storagecache/models.go index c0d2c7bde092..c4d918c14be8 100644 --- a/profiles/latest/storagecache/mgmt/storagecache/models.go +++ b/profiles/latest/storagecache/mgmt/storagecache/models.go @@ -12,7 +12,7 @@ package storagecache import ( "context" - original "github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2021-09-01/storagecache" + original "github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2022-01-01/storagecache" ) const ( @@ -157,6 +157,7 @@ type APIOperationPropertiesServiceSpecification = original.APIOperationPropertie type AscOperation = original.AscOperation type AscOperationProperties = original.AscOperationProperties type AscOperationsClient = original.AscOperationsClient +type AscUsagesClient = original.AscUsagesClient type BaseClient = original.BaseClient type BlobNfsTarget = original.BlobNfsTarget type Cache = original.Cache @@ -205,11 +206,17 @@ type ResourceSkuLocationInfo = original.ResourceSkuLocationInfo type ResourceSkusResult = original.ResourceSkusResult type ResourceSkusResultIterator = original.ResourceSkusResultIterator type ResourceSkusResultPage = original.ResourceSkusResultPage +type ResourceUsage = original.ResourceUsage +type ResourceUsageName = original.ResourceUsageName +type ResourceUsagesListResult = original.ResourceUsagesListResult +type ResourceUsagesListResultIterator = original.ResourceUsagesListResultIterator +type ResourceUsagesListResultPage = original.ResourceUsagesListResultPage type Restriction = original.Restriction type SkusClient = original.SkusClient type StorageTarget = original.StorageTarget type StorageTargetClient = original.StorageTargetClient type StorageTargetFlushFuture = original.StorageTargetFlushFuture +type StorageTargetInvalidateFuture = original.StorageTargetInvalidateFuture type StorageTargetProperties = original.StorageTargetProperties type StorageTargetResource = original.StorageTargetResource type StorageTargetResumeFuture = original.StorageTargetResumeFuture @@ -245,6 +252,12 @@ func NewAscOperationsClient(subscriptionID string) AscOperationsClient { func NewAscOperationsClientWithBaseURI(baseURI string, subscriptionID string) AscOperationsClient { return original.NewAscOperationsClientWithBaseURI(baseURI, subscriptionID) } +func NewAscUsagesClient(subscriptionID string) AscUsagesClient { + return original.NewAscUsagesClient(subscriptionID) +} +func NewAscUsagesClientWithBaseURI(baseURI string, subscriptionID string) AscUsagesClient { + return original.NewAscUsagesClientWithBaseURI(baseURI, subscriptionID) +} func NewCachesClient(subscriptionID string) CachesClient { return original.NewCachesClient(subscriptionID) } @@ -269,6 +282,12 @@ func NewResourceSkusResultIterator(page ResourceSkusResultPage) ResourceSkusResu func NewResourceSkusResultPage(cur ResourceSkusResult, getNextPage func(context.Context, ResourceSkusResult) (ResourceSkusResult, error)) ResourceSkusResultPage { return original.NewResourceSkusResultPage(cur, getNextPage) } +func NewResourceUsagesListResultIterator(page ResourceUsagesListResultPage) ResourceUsagesListResultIterator { + return original.NewResourceUsagesListResultIterator(page) +} +func NewResourceUsagesListResultPage(cur ResourceUsagesListResult, getNextPage func(context.Context, ResourceUsagesListResult) (ResourceUsagesListResult, error)) ResourceUsagesListResultPage { + return original.NewResourceUsagesListResultPage(cur, getNextPage) +} func NewSkusClient(subscriptionID string) SkusClient { return original.NewSkusClient(subscriptionID) } diff --git a/profiles/latest/storagecache/mgmt/storagecache/storagecacheapi/models.go b/profiles/latest/storagecache/mgmt/storagecache/storagecacheapi/models.go index 59229679ce11..0ba45b0053ee 100644 --- a/profiles/latest/storagecache/mgmt/storagecache/storagecacheapi/models.go +++ b/profiles/latest/storagecache/mgmt/storagecache/storagecacheapi/models.go @@ -9,9 +9,10 @@ package storagecacheapi -import original "github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2021-09-01/storagecache/storagecacheapi" +import original "github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2022-01-01/storagecache/storagecacheapi" type AscOperationsClientAPI = original.AscOperationsClientAPI +type AscUsagesClientAPI = original.AscUsagesClientAPI type CachesClientAPI = original.CachesClientAPI type OperationsClientAPI = original.OperationsClientAPI type SkusClientAPI = original.SkusClientAPI diff --git a/profiles/latest/streamanalytics/mgmt/streamanalytics/models.go b/profiles/latest/streamanalytics/mgmt/streamanalytics/models.go index b1f824a69c54..2416e271486d 100644 --- a/profiles/latest/streamanalytics/mgmt/streamanalytics/models.go +++ b/profiles/latest/streamanalytics/mgmt/streamanalytics/models.go @@ -188,6 +188,7 @@ const ( type TypeBasicOutputDataSource = original.TypeBasicOutputDataSource const ( + TypeBasicOutputDataSourceTypeMicrosoftAzureFunction TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypeMicrosoftAzureFunction TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub @@ -229,6 +230,8 @@ const ( type AvroSerialization = original.AvroSerialization type AzureDataLakeStoreOutputDataSource = original.AzureDataLakeStoreOutputDataSource type AzureDataLakeStoreOutputDataSourceProperties = original.AzureDataLakeStoreOutputDataSourceProperties +type AzureFunctionOutputDataSource = original.AzureFunctionOutputDataSource +type AzureFunctionOutputDataSourceProperties = original.AzureFunctionOutputDataSourceProperties type AzureMachineLearningWebServiceFunctionBinding = original.AzureMachineLearningWebServiceFunctionBinding type AzureMachineLearningWebServiceFunctionBindingProperties = original.AzureMachineLearningWebServiceFunctionBindingProperties type AzureMachineLearningWebServiceFunctionBindingRetrievalProperties = original.AzureMachineLearningWebServiceFunctionBindingRetrievalProperties diff --git a/profiles/preview/batch/mgmt/batch/batchapi/models.go b/profiles/preview/batch/mgmt/batch/batchapi/models.go index 9832294c1618..9de6b7d1a3b7 100644 --- a/profiles/preview/batch/mgmt/batch/batchapi/models.go +++ b/profiles/preview/batch/mgmt/batch/batchapi/models.go @@ -9,7 +9,7 @@ package batchapi -import original "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2021-06-01/batch/batchapi" +import original "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/batchapi" type AccountClientAPI = original.AccountClientAPI type ApplicationClientAPI = original.ApplicationClientAPI diff --git a/profiles/preview/batch/mgmt/batch/models.go b/profiles/preview/batch/mgmt/batch/models.go index 09815d726a2c..a991de901303 100644 --- a/profiles/preview/batch/mgmt/batch/models.go +++ b/profiles/preview/batch/mgmt/batch/models.go @@ -12,7 +12,7 @@ package batch import ( "context" - original "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2021-06-01/batch" + original "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch" ) const ( @@ -130,6 +130,13 @@ const ( DiskEncryptionTargetTemporaryDisk DiskEncryptionTarget = original.DiskEncryptionTargetTemporaryDisk ) +type DynamicVNetAssignmentScope = original.DynamicVNetAssignmentScope + +const ( + DynamicVNetAssignmentScopeJob DynamicVNetAssignmentScope = original.DynamicVNetAssignmentScopeJob + DynamicVNetAssignmentScopeNone DynamicVNetAssignmentScope = original.DynamicVNetAssignmentScopeNone +) + type ElevationLevel = original.ElevationLevel const ( @@ -324,6 +331,11 @@ type ContainerRegistry = original.ContainerRegistry type DataDisk = original.DataDisk type DeleteCertificateError = original.DeleteCertificateError type DeploymentConfiguration = original.DeploymentConfiguration +type DetectorListResult = original.DetectorListResult +type DetectorListResultIterator = original.DetectorListResultIterator +type DetectorListResultPage = original.DetectorListResultPage +type DetectorResponse = original.DetectorResponse +type DetectorResponseProperties = original.DetectorResponseProperties type DiffDiskSettings = original.DiffDiskSettings type DiskEncryptionConfiguration = original.DiskEncryptionConfiguration type EncryptionProperties = original.EncryptionProperties @@ -445,6 +457,12 @@ func NewCertificateClient(subscriptionID string) CertificateClient { func NewCertificateClientWithBaseURI(baseURI string, subscriptionID string) CertificateClient { return original.NewCertificateClientWithBaseURI(baseURI, subscriptionID) } +func NewDetectorListResultIterator(page DetectorListResultPage) DetectorListResultIterator { + return original.NewDetectorListResultIterator(page) +} +func NewDetectorListResultPage(cur DetectorListResult, getNextPage func(context.Context, DetectorListResult) (DetectorListResult, error)) DetectorListResultPage { + return original.NewDetectorListResultPage(cur, getNextPage) +} func NewListApplicationPackagesResultIterator(page ListApplicationPackagesResultPage) ListApplicationPackagesResultIterator { return original.NewListApplicationPackagesResultIterator(page) } @@ -577,6 +595,9 @@ func PossibleDiffDiskPlacementValues() []DiffDiskPlacement { func PossibleDiskEncryptionTargetValues() []DiskEncryptionTarget { return original.PossibleDiskEncryptionTargetValues() } +func PossibleDynamicVNetAssignmentScopeValues() []DynamicVNetAssignmentScope { + return original.PossibleDynamicVNetAssignmentScopeValues() +} func PossibleElevationLevelValues() []ElevationLevel { return original.PossibleElevationLevelValues() } diff --git a/profiles/preview/cdn/mgmt/cdn/cdnapi/models.go b/profiles/preview/cdn/mgmt/cdn/cdnapi/models.go index e623aae70f3a..fd73f0983055 100644 --- a/profiles/preview/cdn/mgmt/cdn/cdnapi/models.go +++ b/profiles/preview/cdn/mgmt/cdn/cdnapi/models.go @@ -9,7 +9,7 @@ package cdnapi -import original "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn/cdnapi" +import original "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/cdnapi" type AFDCustomDomainsClientAPI = original.AFDCustomDomainsClientAPI type AFDEndpointsClientAPI = original.AFDEndpointsClientAPI diff --git a/profiles/preview/cdn/mgmt/cdn/models.go b/profiles/preview/cdn/mgmt/cdn/models.go index fc9bd7da96db..788711191793 100644 --- a/profiles/preview/cdn/mgmt/cdn/models.go +++ b/profiles/preview/cdn/mgmt/cdn/models.go @@ -12,7 +12,7 @@ package cdn import ( "context" - original "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" + original "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" ) const ( @@ -38,8 +38,9 @@ const ( type AfdCertificateType = original.AfdCertificateType const ( - AfdCertificateTypeCustomerCertificate AfdCertificateType = original.AfdCertificateTypeCustomerCertificate - AfdCertificateTypeManagedCertificate AfdCertificateType = original.AfdCertificateTypeManagedCertificate + AfdCertificateTypeAzureFirstPartyManagedCertificate AfdCertificateType = original.AfdCertificateTypeAzureFirstPartyManagedCertificate + AfdCertificateTypeCustomerCertificate AfdCertificateType = original.AfdCertificateTypeCustomerCertificate + AfdCertificateTypeManagedCertificate AfdCertificateType = original.AfdCertificateTypeManagedCertificate ) type AfdMinimumTLSVersion = original.AfdMinimumTLSVersion @@ -62,9 +63,10 @@ const ( type AfdQueryStringCachingBehavior = original.AfdQueryStringCachingBehavior const ( - AfdQueryStringCachingBehaviorIgnoreQueryString AfdQueryStringCachingBehavior = original.AfdQueryStringCachingBehaviorIgnoreQueryString - AfdQueryStringCachingBehaviorNotSet AfdQueryStringCachingBehavior = original.AfdQueryStringCachingBehaviorNotSet - AfdQueryStringCachingBehaviorUseQueryString AfdQueryStringCachingBehavior = original.AfdQueryStringCachingBehaviorUseQueryString + AfdQueryStringCachingBehaviorIgnoreQueryString AfdQueryStringCachingBehavior = original.AfdQueryStringCachingBehaviorIgnoreQueryString + AfdQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings AfdQueryStringCachingBehavior = original.AfdQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings + AfdQueryStringCachingBehaviorIncludeSpecifiedQueryStrings AfdQueryStringCachingBehavior = original.AfdQueryStringCachingBehaviorIncludeSpecifiedQueryStrings + AfdQueryStringCachingBehaviorUseQueryString AfdQueryStringCachingBehavior = original.AfdQueryStringCachingBehaviorUseQueryString ) type Algorithm = original.Algorithm @@ -73,6 +75,15 @@ const ( AlgorithmSHA256 Algorithm = original.AlgorithmSHA256 ) +type AutoGeneratedDomainNameLabelScope = original.AutoGeneratedDomainNameLabelScope + +const ( + AutoGeneratedDomainNameLabelScopeNoReuse AutoGeneratedDomainNameLabelScope = original.AutoGeneratedDomainNameLabelScopeNoReuse + AutoGeneratedDomainNameLabelScopeResourceGroupReuse AutoGeneratedDomainNameLabelScope = original.AutoGeneratedDomainNameLabelScopeResourceGroupReuse + AutoGeneratedDomainNameLabelScopeSubscriptionReuse AutoGeneratedDomainNameLabelScope = original.AutoGeneratedDomainNameLabelScopeSubscriptionReuse + AutoGeneratedDomainNameLabelScopeTenantReuse AutoGeneratedDomainNameLabelScope = original.AutoGeneratedDomainNameLabelScopeTenantReuse +) + type CacheBehavior = original.CacheBehavior const ( @@ -96,6 +107,21 @@ const ( CertificateTypeShared CertificateType = original.CertificateTypeShared ) +type ClientPortOperator = original.ClientPortOperator + +const ( + ClientPortOperatorAny ClientPortOperator = original.ClientPortOperatorAny + ClientPortOperatorBeginsWith ClientPortOperator = original.ClientPortOperatorBeginsWith + ClientPortOperatorContains ClientPortOperator = original.ClientPortOperatorContains + ClientPortOperatorEndsWith ClientPortOperator = original.ClientPortOperatorEndsWith + ClientPortOperatorEqual ClientPortOperator = original.ClientPortOperatorEqual + ClientPortOperatorGreaterThan ClientPortOperator = original.ClientPortOperatorGreaterThan + ClientPortOperatorGreaterThanOrEqual ClientPortOperator = original.ClientPortOperatorGreaterThanOrEqual + ClientPortOperatorLessThan ClientPortOperator = original.ClientPortOperatorLessThan + ClientPortOperatorLessThanOrEqual ClientPortOperator = original.ClientPortOperatorLessThanOrEqual + ClientPortOperatorRegEx ClientPortOperator = original.ClientPortOperatorRegEx +) + type CookiesOperator = original.CookiesOperator const ( @@ -171,12 +197,15 @@ const ( type DomainValidationState = original.DomainValidationState const ( - DomainValidationStateApproved DomainValidationState = original.DomainValidationStateApproved - DomainValidationStatePending DomainValidationState = original.DomainValidationStatePending - DomainValidationStatePendingRevalidation DomainValidationState = original.DomainValidationStatePendingRevalidation - DomainValidationStateSubmitting DomainValidationState = original.DomainValidationStateSubmitting - DomainValidationStateTimedOut DomainValidationState = original.DomainValidationStateTimedOut - DomainValidationStateUnknown DomainValidationState = original.DomainValidationStateUnknown + DomainValidationStateApproved DomainValidationState = original.DomainValidationStateApproved + DomainValidationStateInternalError DomainValidationState = original.DomainValidationStateInternalError + DomainValidationStatePending DomainValidationState = original.DomainValidationStatePending + DomainValidationStatePendingRevalidation DomainValidationState = original.DomainValidationStatePendingRevalidation + DomainValidationStateRefreshingValidationToken DomainValidationState = original.DomainValidationStateRefreshingValidationToken + DomainValidationStateRejected DomainValidationState = original.DomainValidationStateRejected + DomainValidationStateSubmitting DomainValidationState = original.DomainValidationStateSubmitting + DomainValidationStateTimedOut DomainValidationState = original.DomainValidationStateTimedOut + DomainValidationStateUnknown DomainValidationState = original.DomainValidationStateUnknown ) type EnabledState = original.EnabledState @@ -251,6 +280,21 @@ const ( HealthProbeRequestTypeNotSet HealthProbeRequestType = original.HealthProbeRequestTypeNotSet ) +type HostNameOperator = original.HostNameOperator + +const ( + HostNameOperatorAny HostNameOperator = original.HostNameOperatorAny + HostNameOperatorBeginsWith HostNameOperator = original.HostNameOperatorBeginsWith + HostNameOperatorContains HostNameOperator = original.HostNameOperatorContains + HostNameOperatorEndsWith HostNameOperator = original.HostNameOperatorEndsWith + HostNameOperatorEqual HostNameOperator = original.HostNameOperatorEqual + HostNameOperatorGreaterThan HostNameOperator = original.HostNameOperatorGreaterThan + HostNameOperatorGreaterThanOrEqual HostNameOperator = original.HostNameOperatorGreaterThanOrEqual + HostNameOperatorLessThan HostNameOperator = original.HostNameOperatorLessThan + HostNameOperatorLessThanOrEqual HostNameOperator = original.HostNameOperatorLessThanOrEqual + HostNameOperatorRegEx HostNameOperator = original.HostNameOperatorRegEx +) + type IdentityType = original.IdentityType const ( @@ -289,11 +333,11 @@ const ( type LogMetricsGroupBy = original.LogMetricsGroupBy const ( - LogMetricsGroupByCacheStatus LogMetricsGroupBy = original.LogMetricsGroupByCacheStatus - LogMetricsGroupByCountry LogMetricsGroupBy = original.LogMetricsGroupByCountry - LogMetricsGroupByCustomDomain LogMetricsGroupBy = original.LogMetricsGroupByCustomDomain - LogMetricsGroupByHTTPStatusCode LogMetricsGroupBy = original.LogMetricsGroupByHTTPStatusCode - LogMetricsGroupByProtocol LogMetricsGroupBy = original.LogMetricsGroupByProtocol + LogMetricsGroupByCacheStatus LogMetricsGroupBy = original.LogMetricsGroupByCacheStatus + LogMetricsGroupByCountryOrRegion LogMetricsGroupBy = original.LogMetricsGroupByCountryOrRegion + LogMetricsGroupByCustomDomain LogMetricsGroupBy = original.LogMetricsGroupByCustomDomain + LogMetricsGroupByHTTPStatusCode LogMetricsGroupBy = original.LogMetricsGroupByHTTPStatusCode + LogMetricsGroupByProtocol LogMetricsGroupBy = original.LogMetricsGroupByProtocol ) type LogRanking = original.LogRanking @@ -331,20 +375,6 @@ const ( MatchProcessingBehaviorStop MatchProcessingBehavior = original.MatchProcessingBehaviorStop ) -type MatchVariable = original.MatchVariable - -const ( - MatchVariableCookies MatchVariable = original.MatchVariableCookies - MatchVariablePostArgs MatchVariable = original.MatchVariablePostArgs - MatchVariableQueryString MatchVariable = original.MatchVariableQueryString - MatchVariableRemoteAddr MatchVariable = original.MatchVariableRemoteAddr - MatchVariableRequestBody MatchVariable = original.MatchVariableRequestBody - MatchVariableRequestHeader MatchVariable = original.MatchVariableRequestHeader - MatchVariableRequestMethod MatchVariable = original.MatchVariableRequestMethod - MatchVariableRequestURI MatchVariable = original.MatchVariableRequestURI - MatchVariableSocketAddr MatchVariable = original.MatchVariableSocketAddr -) - type MinimumTLSVersion = original.MinimumTLSVersion const ( @@ -356,8 +386,10 @@ const ( type Name = original.Name const ( + NameClientPort Name = original.NameClientPort NameCookies Name = original.NameCookies NameDeliveryRuleCondition Name = original.NameDeliveryRuleCondition + NameHostName Name = original.NameHostName NameHTTPVersion Name = original.NameHTTPVersion NameIsDevice Name = original.NameIsDevice NamePostArgs Name = original.NamePostArgs @@ -368,6 +400,9 @@ const ( NameRequestMethod Name = original.NameRequestMethod NameRequestScheme Name = original.NameRequestScheme NameRequestURI Name = original.NameRequestURI + NameServerPort Name = original.NameServerPort + NameSocketAddr Name = original.NameSocketAddr + NameSslProtocol Name = original.NameSslProtocol NameURLFileExtension Name = original.NameURLFileExtension NameURLFileName Name = original.NameURLFileName NameURLPath Name = original.NameURLPath @@ -376,15 +411,16 @@ const ( type NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleAction const ( - NameBasicDeliveryRuleActionNameCacheExpiration NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameCacheExpiration - NameBasicDeliveryRuleActionNameCacheKeyQueryString NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameCacheKeyQueryString - NameBasicDeliveryRuleActionNameDeliveryRuleAction NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameDeliveryRuleAction - NameBasicDeliveryRuleActionNameModifyRequestHeader NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameModifyRequestHeader - NameBasicDeliveryRuleActionNameModifyResponseHeader NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameModifyResponseHeader - NameBasicDeliveryRuleActionNameOriginGroupOverride NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameOriginGroupOverride - NameBasicDeliveryRuleActionNameURLRedirect NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameURLRedirect - NameBasicDeliveryRuleActionNameURLRewrite NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameURLRewrite - NameBasicDeliveryRuleActionNameURLSigning NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameURLSigning + NameBasicDeliveryRuleActionNameCacheExpiration NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameCacheExpiration + NameBasicDeliveryRuleActionNameCacheKeyQueryString NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameCacheKeyQueryString + NameBasicDeliveryRuleActionNameDeliveryRuleAction NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameDeliveryRuleAction + NameBasicDeliveryRuleActionNameModifyRequestHeader NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameModifyRequestHeader + NameBasicDeliveryRuleActionNameModifyResponseHeader NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameModifyResponseHeader + NameBasicDeliveryRuleActionNameOriginGroupOverride NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameOriginGroupOverride + NameBasicDeliveryRuleActionNameRouteConfigurationOverride NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameRouteConfigurationOverride + NameBasicDeliveryRuleActionNameURLRedirect NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameURLRedirect + NameBasicDeliveryRuleActionNameURLRewrite NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameURLRewrite + NameBasicDeliveryRuleActionNameURLSigning NameBasicDeliveryRuleAction = original.NameBasicDeliveryRuleActionNameURLSigning ) type Operator = original.Operator @@ -618,7 +654,8 @@ const ( type ResourceType = original.ResourceType const ( - ResourceTypeMicrosoftCdnProfilesEndpoints ResourceType = original.ResourceTypeMicrosoftCdnProfilesEndpoints + ResourceTypeMicrosoftCdnProfilesAfdEndpoints ResourceType = original.ResourceTypeMicrosoftCdnProfilesAfdEndpoints + ResourceTypeMicrosoftCdnProfilesEndpoints ResourceType = original.ResourceTypeMicrosoftCdnProfilesEndpoints ) type ResponseBasedDetectedErrorTypes = original.ResponseBasedDetectedErrorTypes @@ -629,6 +666,54 @@ const ( ResponseBasedDetectedErrorTypesTCPErrorsOnly ResponseBasedDetectedErrorTypes = original.ResponseBasedDetectedErrorTypesTCPErrorsOnly ) +type RuleCacheBehavior = original.RuleCacheBehavior + +const ( + RuleCacheBehaviorHonorOrigin RuleCacheBehavior = original.RuleCacheBehaviorHonorOrigin + RuleCacheBehaviorOverrideAlways RuleCacheBehavior = original.RuleCacheBehaviorOverrideAlways + RuleCacheBehaviorOverrideIfOriginMissing RuleCacheBehavior = original.RuleCacheBehaviorOverrideIfOriginMissing +) + +type RuleIsCompressionEnabled = original.RuleIsCompressionEnabled + +const ( + RuleIsCompressionEnabledDisabled RuleIsCompressionEnabled = original.RuleIsCompressionEnabledDisabled + RuleIsCompressionEnabledEnabled RuleIsCompressionEnabled = original.RuleIsCompressionEnabledEnabled +) + +type RuleQueryStringCachingBehavior = original.RuleQueryStringCachingBehavior + +const ( + RuleQueryStringCachingBehaviorIgnoreQueryString RuleQueryStringCachingBehavior = original.RuleQueryStringCachingBehaviorIgnoreQueryString + RuleQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings RuleQueryStringCachingBehavior = original.RuleQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings + RuleQueryStringCachingBehaviorIncludeSpecifiedQueryStrings RuleQueryStringCachingBehavior = original.RuleQueryStringCachingBehaviorIncludeSpecifiedQueryStrings + RuleQueryStringCachingBehaviorUseQueryString RuleQueryStringCachingBehavior = original.RuleQueryStringCachingBehaviorUseQueryString +) + +type SecretType = original.SecretType + +const ( + SecretTypeAzureFirstPartyManagedCertificate SecretType = original.SecretTypeAzureFirstPartyManagedCertificate + SecretTypeCustomerCertificate SecretType = original.SecretTypeCustomerCertificate + SecretTypeManagedCertificate SecretType = original.SecretTypeManagedCertificate + SecretTypeURLSigningKey SecretType = original.SecretTypeURLSigningKey +) + +type ServerPortOperator = original.ServerPortOperator + +const ( + ServerPortOperatorAny ServerPortOperator = original.ServerPortOperatorAny + ServerPortOperatorBeginsWith ServerPortOperator = original.ServerPortOperatorBeginsWith + ServerPortOperatorContains ServerPortOperator = original.ServerPortOperatorContains + ServerPortOperatorEndsWith ServerPortOperator = original.ServerPortOperatorEndsWith + ServerPortOperatorEqual ServerPortOperator = original.ServerPortOperatorEqual + ServerPortOperatorGreaterThan ServerPortOperator = original.ServerPortOperatorGreaterThan + ServerPortOperatorGreaterThanOrEqual ServerPortOperator = original.ServerPortOperatorGreaterThanOrEqual + ServerPortOperatorLessThan ServerPortOperator = original.ServerPortOperatorLessThan + ServerPortOperatorLessThanOrEqual ServerPortOperator = original.ServerPortOperatorLessThanOrEqual + ServerPortOperatorRegEx ServerPortOperator = original.ServerPortOperatorRegEx +) + type SharedPrivateLinkResourceStatus = original.SharedPrivateLinkResourceStatus const ( @@ -644,7 +729,6 @@ type SkuName = original.SkuName const ( SkuNameCustomVerizon SkuName = original.SkuNameCustomVerizon SkuNamePremiumAzureFrontDoor SkuName = original.SkuNamePremiumAzureFrontDoor - SkuNamePremiumChinaCdn SkuName = original.SkuNamePremiumChinaCdn SkuNamePremiumVerizon SkuName = original.SkuNamePremiumVerizon SkuNameStandard955BandWidthChinaCdn SkuName = original.SkuNameStandard955BandWidthChinaCdn SkuNameStandardAkamai SkuName = original.SkuNameStandardAkamai @@ -658,6 +742,21 @@ const ( SkuNameStandardVerizon SkuName = original.SkuNameStandardVerizon ) +type SocketAddrOperator = original.SocketAddrOperator + +const ( + SocketAddrOperatorAny SocketAddrOperator = original.SocketAddrOperatorAny + SocketAddrOperatorIPMatch SocketAddrOperator = original.SocketAddrOperatorIPMatch +) + +type SslProtocol = original.SslProtocol + +const ( + SslProtocolTLSv1 SslProtocol = original.SslProtocolTLSv1 + SslProtocolTLSv11 SslProtocol = original.SslProtocolTLSv11 + SslProtocolTLSv12 SslProtocol = original.SslProtocolTLSv12 +) + type Status = original.Status const ( @@ -670,8 +769,12 @@ const ( type Transform = original.Transform const ( - TransformLowercase Transform = original.TransformLowercase - TransformUppercase Transform = original.TransformUppercase + TransformLowercase Transform = original.TransformLowercase + TransformRemoveNulls Transform = original.TransformRemoveNulls + TransformTrim Transform = original.TransformTrim + TransformUppercase Transform = original.TransformUppercase + TransformURLDecode Transform = original.TransformURLDecode + TransformURLEncode Transform = original.TransformURLEncode ) type TransformType = original.TransformType @@ -688,17 +791,18 @@ const ( type Type = original.Type const ( - TypeSecurityPolicyParameters Type = original.TypeSecurityPolicyParameters - TypeWebApplicationFirewall Type = original.TypeWebApplicationFirewall + TypeSecurityPolicyPropertiesParameters Type = original.TypeSecurityPolicyPropertiesParameters + TypeWebApplicationFirewall Type = original.TypeWebApplicationFirewall ) type TypeBasicSecretParameters = original.TypeBasicSecretParameters const ( - TypeBasicSecretParametersTypeCustomerCertificate TypeBasicSecretParameters = original.TypeBasicSecretParametersTypeCustomerCertificate - TypeBasicSecretParametersTypeManagedCertificate TypeBasicSecretParameters = original.TypeBasicSecretParametersTypeManagedCertificate - TypeBasicSecretParametersTypeSecretParameters TypeBasicSecretParameters = original.TypeBasicSecretParametersTypeSecretParameters - TypeBasicSecretParametersTypeURLSigningKey TypeBasicSecretParameters = original.TypeBasicSecretParametersTypeURLSigningKey + TypeBasicSecretParametersTypeAzureFirstPartyManagedCertificate TypeBasicSecretParameters = original.TypeBasicSecretParametersTypeAzureFirstPartyManagedCertificate + TypeBasicSecretParametersTypeCustomerCertificate TypeBasicSecretParameters = original.TypeBasicSecretParametersTypeCustomerCertificate + TypeBasicSecretParametersTypeManagedCertificate TypeBasicSecretParameters = original.TypeBasicSecretParametersTypeManagedCertificate + TypeBasicSecretParametersTypeSecretParameters TypeBasicSecretParameters = original.TypeBasicSecretParametersTypeSecretParameters + TypeBasicSecretParametersTypeURLSigningKey TypeBasicSecretParameters = original.TypeBasicSecretParametersTypeURLSigningKey ) type URLFileExtensionOperator = original.URLFileExtensionOperator @@ -753,6 +857,7 @@ const ( UnitBitsPerSecond Unit = original.UnitBitsPerSecond UnitBytes Unit = original.UnitBytes UnitCount Unit = original.UnitCount + UnitMilliSeconds Unit = original.UnitMilliSeconds ) type Unit1 = original.Unit1 @@ -761,14 +866,6 @@ const ( Unit1Count Unit1 = original.Unit1Count ) -type ValidateSecretType = original.ValidateSecretType - -const ( - ValidateSecretTypeCustomerCertificate ValidateSecretType = original.ValidateSecretTypeCustomerCertificate - ValidateSecretTypeManagedCertificate ValidateSecretType = original.ValidateSecretTypeManagedCertificate - ValidateSecretTypeURLSigningKey ValidateSecretType = original.ValidateSecretTypeURLSigningKey -) - type WafAction = original.WafAction const ( @@ -786,6 +883,20 @@ const ( WafGranularityPT5M WafGranularity = original.WafGranularityPT5M ) +type WafMatchVariable = original.WafMatchVariable + +const ( + WafMatchVariableCookies WafMatchVariable = original.WafMatchVariableCookies + WafMatchVariablePostArgs WafMatchVariable = original.WafMatchVariablePostArgs + WafMatchVariableQueryString WafMatchVariable = original.WafMatchVariableQueryString + WafMatchVariableRemoteAddr WafMatchVariable = original.WafMatchVariableRemoteAddr + WafMatchVariableRequestBody WafMatchVariable = original.WafMatchVariableRequestBody + WafMatchVariableRequestHeader WafMatchVariable = original.WafMatchVariableRequestHeader + WafMatchVariableRequestMethod WafMatchVariable = original.WafMatchVariableRequestMethod + WafMatchVariableRequestURI WafMatchVariable = original.WafMatchVariableRequestURI + WafMatchVariableSocketAddr WafMatchVariable = original.WafMatchVariableSocketAddr +) + type WafMetric = original.WafMetric const ( @@ -802,14 +913,14 @@ const ( type WafRankingType = original.WafRankingType const ( - WafRankingTypeAction WafRankingType = original.WafRankingTypeAction - WafRankingTypeClientIP WafRankingType = original.WafRankingTypeClientIP - WafRankingTypeCountry WafRankingType = original.WafRankingTypeCountry - WafRankingTypeRuleGroup WafRankingType = original.WafRankingTypeRuleGroup - WafRankingTypeRuleID WafRankingType = original.WafRankingTypeRuleID - WafRankingTypeRuleType WafRankingType = original.WafRankingTypeRuleType - WafRankingTypeURL WafRankingType = original.WafRankingTypeURL - WafRankingTypeUserAgent WafRankingType = original.WafRankingTypeUserAgent + WafRankingTypeAction WafRankingType = original.WafRankingTypeAction + WafRankingTypeClientIP WafRankingType = original.WafRankingTypeClientIP + WafRankingTypeCountryOrRegion WafRankingType = original.WafRankingTypeCountryOrRegion + WafRankingTypeRuleGroup WafRankingType = original.WafRankingTypeRuleGroup + WafRankingTypeRuleID WafRankingType = original.WafRankingTypeRuleID + WafRankingTypeRuleType WafRankingType = original.WafRankingTypeRuleType + WafRankingTypeURL WafRankingType = original.WafRankingTypeURL + WafRankingTypeUserAgent WafRankingType = original.WafRankingTypeUserAgent ) type WafRuleType = original.WafRuleType @@ -869,21 +980,30 @@ type AFDOriginsDeleteFuture = original.AFDOriginsDeleteFuture type AFDOriginsUpdateFuture = original.AFDOriginsUpdateFuture type AFDProfilesClient = original.AFDProfilesClient type AFDStateProperties = original.AFDStateProperties +type ActivatedResourceReference = original.ActivatedResourceReference type AfdErrorResponse = original.AfdErrorResponse type AfdPurgeParameters = original.AfdPurgeParameters +type AfdRouteCacheConfiguration = original.AfdRouteCacheConfiguration +type AzureFirstPartyManagedCertificate = original.AzureFirstPartyManagedCertificate +type AzureFirstPartyManagedCertificateParameters = original.AzureFirstPartyManagedCertificateParameters type BaseClient = original.BaseClient type BasicCustomDomainHTTPSParameters = original.BasicCustomDomainHTTPSParameters type BasicDeliveryRuleAction = original.BasicDeliveryRuleAction type BasicDeliveryRuleCondition = original.BasicDeliveryRuleCondition type BasicSecretParameters = original.BasicSecretParameters -type BasicSecurityPolicyParameters = original.BasicSecurityPolicyParameters +type BasicSecurityPolicyPropertiesParameters = original.BasicSecurityPolicyPropertiesParameters +type CacheConfiguration = original.CacheConfiguration type CacheExpirationActionParameters = original.CacheExpirationActionParameters type CacheKeyQueryStringActionParameters = original.CacheKeyQueryStringActionParameters type Certificate = original.Certificate type CertificateSourceParameters = original.CertificateSourceParameters +type CheckEndpointNameAvailabilityInput = original.CheckEndpointNameAvailabilityInput +type CheckEndpointNameAvailabilityOutput = original.CheckEndpointNameAvailabilityOutput +type CheckHostNameAvailabilityInput = original.CheckHostNameAvailabilityInput type CheckNameAvailabilityInput = original.CheckNameAvailabilityInput type CheckNameAvailabilityOutput = original.CheckNameAvailabilityOutput type CidrIPAddress = original.CidrIPAddress +type ClientPortMatchConditionParameters = original.ClientPortMatchConditionParameters type CompressionSettings = original.CompressionSettings type ContinentsResponse = original.ContinentsResponse type ContinentsResponseContinentsItem = original.ContinentsResponseContinentsItem @@ -900,8 +1020,6 @@ type CustomDomainPropertiesParameters = original.CustomDomainPropertiesParameter type CustomDomainsClient = original.CustomDomainsClient type CustomDomainsCreateFuture = original.CustomDomainsCreateFuture type CustomDomainsDeleteFuture = original.CustomDomainsDeleteFuture -type CustomDomainsDisableCustomHTTPSFuture = original.CustomDomainsDisableCustomHTTPSFuture -type CustomDomainsEnableCustomHTTPSFuture = original.CustomDomainsEnableCustomHTTPSFuture type CustomRule = original.CustomRule type CustomRuleList = original.CustomRuleList type CustomerCertificate = original.CustomerCertificate @@ -914,9 +1032,11 @@ type DeliveryRule = original.DeliveryRule type DeliveryRuleAction = original.DeliveryRuleAction type DeliveryRuleCacheExpirationAction = original.DeliveryRuleCacheExpirationAction type DeliveryRuleCacheKeyQueryStringAction = original.DeliveryRuleCacheKeyQueryStringAction +type DeliveryRuleClientPortCondition = original.DeliveryRuleClientPortCondition type DeliveryRuleCondition = original.DeliveryRuleCondition type DeliveryRuleCookiesCondition = original.DeliveryRuleCookiesCondition type DeliveryRuleHTTPVersionCondition = original.DeliveryRuleHTTPVersionCondition +type DeliveryRuleHostNameCondition = original.DeliveryRuleHostNameCondition type DeliveryRuleIsDeviceCondition = original.DeliveryRuleIsDeviceCondition type DeliveryRulePostArgsCondition = original.DeliveryRulePostArgsCondition type DeliveryRuleQueryStringCondition = original.DeliveryRuleQueryStringCondition @@ -928,9 +1048,14 @@ type DeliveryRuleRequestMethodCondition = original.DeliveryRuleRequestMethodCond type DeliveryRuleRequestSchemeCondition = original.DeliveryRuleRequestSchemeCondition type DeliveryRuleRequestURICondition = original.DeliveryRuleRequestURICondition type DeliveryRuleResponseHeaderAction = original.DeliveryRuleResponseHeaderAction +type DeliveryRuleRouteConfigurationOverrideAction = original.DeliveryRuleRouteConfigurationOverrideAction +type DeliveryRuleServerPortCondition = original.DeliveryRuleServerPortCondition +type DeliveryRuleSocketAddrCondition = original.DeliveryRuleSocketAddrCondition +type DeliveryRuleSslProtocolCondition = original.DeliveryRuleSslProtocolCondition type DeliveryRuleURLFileExtensionCondition = original.DeliveryRuleURLFileExtensionCondition type DeliveryRuleURLFileNameCondition = original.DeliveryRuleURLFileNameCondition type DeliveryRuleURLPathCondition = original.DeliveryRuleURLPathCondition +type DimensionProperties = original.DimensionProperties type DomainValidationProperties = original.DomainValidationProperties type EdgeNode = original.EdgeNode type EdgeNodeProperties = original.EdgeNodeProperties @@ -956,12 +1081,15 @@ type EndpointsPurgeContentFuture = original.EndpointsPurgeContentFuture type EndpointsStartFuture = original.EndpointsStartFuture type EndpointsStopFuture = original.EndpointsStopFuture type EndpointsUpdateFuture = original.EndpointsUpdateFuture +type ErrorAdditionalInfo = original.ErrorAdditionalInfo +type ErrorDetail = original.ErrorDetail type ErrorResponse = original.ErrorResponse type GeoFilter = original.GeoFilter type HTTPErrorRangeParameters = original.HTTPErrorRangeParameters type HTTPVersionMatchConditionParameters = original.HTTPVersionMatchConditionParameters type HeaderActionParameters = original.HeaderActionParameters type HealthProbeParameters = original.HealthProbeParameters +type HostNameMatchConditionParameters = original.HostNameMatchConditionParameters type IPAddressGroup = original.IPAddressGroup type IsDeviceMatchConditionParameters = original.IsDeviceMatchConditionParameters type KeyVaultCertificateSourceParameters = original.KeyVaultCertificateSourceParameters @@ -969,6 +1097,7 @@ type KeyVaultSigningKeyParameters = original.KeyVaultSigningKeyParameters type LoadBalancingSettingsParameters = original.LoadBalancingSettingsParameters type LoadParameters = original.LoadParameters type LogAnalyticsClient = original.LogAnalyticsClient +type LogSpecification = original.LogSpecification type ManagedCertificate = original.ManagedCertificate type ManagedCertificateParameters = original.ManagedCertificateParameters type ManagedHTTPSParameters = original.ManagedHTTPSParameters @@ -985,12 +1114,15 @@ type ManagedRuleSetDefinitionProperties = original.ManagedRuleSetDefinitionPrope type ManagedRuleSetList = original.ManagedRuleSetList type ManagedRuleSetsClient = original.ManagedRuleSetsClient type MatchCondition = original.MatchCondition +type MetricAvailability = original.MetricAvailability +type MetricSpecification = original.MetricSpecification type MetricsResponse = original.MetricsResponse type MetricsResponseSeriesItem = original.MetricsResponseSeriesItem type MetricsResponseSeriesItemDataItem = original.MetricsResponseSeriesItemDataItem type MetricsResponseSeriesItemGroupsItem = original.MetricsResponseSeriesItemGroupsItem type Operation = original.Operation type OperationDisplay = original.OperationDisplay +type OperationProperties = original.OperationProperties type OperationsClient = original.OperationsClient type OperationsListResult = original.OperationsListResult type OperationsListResultIterator = original.OperationsListResultIterator @@ -1000,6 +1132,7 @@ type OriginGroup = original.OriginGroup type OriginGroupListResult = original.OriginGroupListResult type OriginGroupListResultIterator = original.OriginGroupListResultIterator type OriginGroupListResultPage = original.OriginGroupListResultPage +type OriginGroupOverride = original.OriginGroupOverride type OriginGroupOverrideAction = original.OriginGroupOverrideAction type OriginGroupOverrideActionParameters = original.OriginGroupOverrideActionParameters type OriginGroupProperties = original.OriginGroupProperties @@ -1029,6 +1162,7 @@ type ProfileListResult = original.ProfileListResult type ProfileListResultIterator = original.ProfileListResultIterator type ProfileListResultPage = original.ProfileListResultPage type ProfileProperties = original.ProfileProperties +type ProfilePropertiesUpdateParameters = original.ProfilePropertiesUpdateParameters type ProfileUpdateParameters = original.ProfileUpdateParameters type ProfilesClient = original.ProfilesClient type ProfilesCreateFuture = original.ProfilesCreateFuture @@ -1062,6 +1196,7 @@ type ResourcesResponseEndpointsItem = original.ResourcesResponseEndpointsItem type ResourcesResponseEndpointsItemCustomDomainsItem = original.ResourcesResponseEndpointsItemCustomDomainsItem type ResponseBasedOriginErrorDetectionParameters = original.ResponseBasedOriginErrorDetectionParameters type Route = original.Route +type RouteConfigurationOverrideActionParameters = original.RouteConfigurationOverrideActionParameters type RouteListResult = original.RouteListResult type RouteListResultIterator = original.RouteListResultIterator type RouteListResultPage = original.RouteListResultPage @@ -1083,7 +1218,6 @@ type RuleSetListResultIterator = original.RuleSetListResultIterator type RuleSetListResultPage = original.RuleSetListResultPage type RuleSetProperties = original.RuleSetProperties type RuleSetsClient = original.RuleSetsClient -type RuleSetsCreateFuture = original.RuleSetsCreateFuture type RuleSetsDeleteFuture = original.RuleSetsDeleteFuture type RuleUpdateParameters = original.RuleUpdateParameters type RuleUpdatePropertiesParameters = original.RuleUpdatePropertiesParameters @@ -1100,7 +1234,6 @@ type SecretProperties = original.SecretProperties type SecretsClient = original.SecretsClient type SecretsCreateFuture = original.SecretsCreateFuture type SecretsDeleteFuture = original.SecretsDeleteFuture -type SecretsUpdateFuture = original.SecretsUpdateFuture type SecurityPoliciesClient = original.SecurityPoliciesClient type SecurityPoliciesCreateFuture = original.SecurityPoliciesCreateFuture type SecurityPoliciesDeleteFuture = original.SecurityPoliciesDeleteFuture @@ -1109,12 +1242,18 @@ type SecurityPolicy = original.SecurityPolicy type SecurityPolicyListResult = original.SecurityPolicyListResult type SecurityPolicyListResultIterator = original.SecurityPolicyListResultIterator type SecurityPolicyListResultPage = original.SecurityPolicyListResultPage -type SecurityPolicyParameters = original.SecurityPolicyParameters type SecurityPolicyProperties = original.SecurityPolicyProperties +type SecurityPolicyPropertiesParameters = original.SecurityPolicyPropertiesParameters +type SecurityPolicyUpdateParameters = original.SecurityPolicyUpdateParameters +type SecurityPolicyUpdateProperties = original.SecurityPolicyUpdateProperties type SecurityPolicyWebApplicationFirewallAssociation = original.SecurityPolicyWebApplicationFirewallAssociation type SecurityPolicyWebApplicationFirewallParameters = original.SecurityPolicyWebApplicationFirewallParameters +type ServerPortMatchConditionParameters = original.ServerPortMatchConditionParameters +type ServiceSpecification = original.ServiceSpecification type SharedPrivateLinkResourceProperties = original.SharedPrivateLinkResourceProperties type Sku = original.Sku +type SocketAddrMatchConditionParameters = original.SocketAddrMatchConditionParameters +type SslProtocolMatchConditionParameters = original.SslProtocolMatchConditionParameters type SsoURI = original.SsoURI type SupportedOptimizationTypesListResult = original.SupportedOptimizationTypesListResult type SystemData = original.SystemData @@ -1438,6 +1577,9 @@ func PossibleAfdQueryStringCachingBehaviorValues() []AfdQueryStringCachingBehavi func PossibleAlgorithmValues() []Algorithm { return original.PossibleAlgorithmValues() } +func PossibleAutoGeneratedDomainNameLabelScopeValues() []AutoGeneratedDomainNameLabelScope { + return original.PossibleAutoGeneratedDomainNameLabelScopeValues() +} func PossibleCacheBehaviorValues() []CacheBehavior { return original.PossibleCacheBehaviorValues() } @@ -1447,6 +1589,9 @@ func PossibleCertificateSourceValues() []CertificateSource { func PossibleCertificateTypeValues() []CertificateType { return original.PossibleCertificateTypeValues() } +func PossibleClientPortOperatorValues() []ClientPortOperator { + return original.PossibleClientPortOperatorValues() +} func PossibleCookiesOperatorValues() []CookiesOperator { return original.PossibleCookiesOperatorValues() } @@ -1498,6 +1643,9 @@ func PossibleHeaderActionValues() []HeaderAction { func PossibleHealthProbeRequestTypeValues() []HealthProbeRequestType { return original.PossibleHealthProbeRequestTypeValues() } +func PossibleHostNameOperatorValues() []HostNameOperator { + return original.PossibleHostNameOperatorValues() +} func PossibleIdentityTypeValues() []IdentityType { return original.PossibleIdentityTypeValues() } @@ -1525,9 +1673,6 @@ func PossibleManagedRuleEnabledStateValues() []ManagedRuleEnabledState { func PossibleMatchProcessingBehaviorValues() []MatchProcessingBehavior { return original.PossibleMatchProcessingBehaviorValues() } -func PossibleMatchVariableValues() []MatchVariable { - return original.PossibleMatchVariableValues() -} func PossibleMinimumTLSVersionValues() []MinimumTLSVersion { return original.PossibleMinimumTLSVersionValues() } @@ -1609,12 +1754,33 @@ func PossibleResourceTypeValues() []ResourceType { func PossibleResponseBasedDetectedErrorTypesValues() []ResponseBasedDetectedErrorTypes { return original.PossibleResponseBasedDetectedErrorTypesValues() } +func PossibleRuleCacheBehaviorValues() []RuleCacheBehavior { + return original.PossibleRuleCacheBehaviorValues() +} +func PossibleRuleIsCompressionEnabledValues() []RuleIsCompressionEnabled { + return original.PossibleRuleIsCompressionEnabledValues() +} +func PossibleRuleQueryStringCachingBehaviorValues() []RuleQueryStringCachingBehavior { + return original.PossibleRuleQueryStringCachingBehaviorValues() +} +func PossibleSecretTypeValues() []SecretType { + return original.PossibleSecretTypeValues() +} +func PossibleServerPortOperatorValues() []ServerPortOperator { + return original.PossibleServerPortOperatorValues() +} func PossibleSharedPrivateLinkResourceStatusValues() []SharedPrivateLinkResourceStatus { return original.PossibleSharedPrivateLinkResourceStatusValues() } func PossibleSkuNameValues() []SkuName { return original.PossibleSkuNameValues() } +func PossibleSocketAddrOperatorValues() []SocketAddrOperator { + return original.PossibleSocketAddrOperatorValues() +} +func PossibleSslProtocolValues() []SslProtocol { + return original.PossibleSslProtocolValues() +} func PossibleStatusValues() []Status { return original.PossibleStatusValues() } @@ -1645,15 +1811,15 @@ func PossibleUnit1Values() []Unit1 { func PossibleUnitValues() []Unit { return original.PossibleUnitValues() } -func PossibleValidateSecretTypeValues() []ValidateSecretType { - return original.PossibleValidateSecretTypeValues() -} func PossibleWafActionValues() []WafAction { return original.PossibleWafActionValues() } func PossibleWafGranularityValues() []WafGranularity { return original.PossibleWafGranularityValues() } +func PossibleWafMatchVariableValues() []WafMatchVariable { + return original.PossibleWafMatchVariableValues() +} func PossibleWafMetricValues() []WafMetric { return original.PossibleWafMetricValues() } diff --git a/profiles/preview/preview/appinsights/mgmt/insights/insightsapi/models.go b/profiles/preview/preview/appinsights/mgmt/insights/insightsapi/models.go index f22cef5360a0..0bb54870ebd5 100644 --- a/profiles/preview/preview/appinsights/mgmt/insights/insightsapi/models.go +++ b/profiles/preview/preview/appinsights/mgmt/insights/insightsapi/models.go @@ -9,7 +9,7 @@ package insightsapi -import original "github.com/Azure/azure-sdk-for-go/services/preview/appinsights/mgmt/2022-01-11-preview/insights/insightsapi" +import original "github.com/Azure/azure-sdk-for-go/services/preview/appinsights/mgmt/2022-02-01-preview/insights/insightsapi" type APIKeysClientAPI = original.APIKeysClientAPI type AnalyticsItemsClientAPI = original.AnalyticsItemsClientAPI diff --git a/profiles/preview/preview/appinsights/mgmt/insights/models.go b/profiles/preview/preview/appinsights/mgmt/insights/models.go index fddf1f506eb5..ae4b08d96207 100644 --- a/profiles/preview/preview/appinsights/mgmt/insights/models.go +++ b/profiles/preview/preview/appinsights/mgmt/insights/models.go @@ -12,7 +12,7 @@ package insights import ( "context" - original "github.com/Azure/azure-sdk-for-go/services/preview/appinsights/mgmt/2022-01-11-preview/insights" + original "github.com/Azure/azure-sdk-for-go/services/preview/appinsights/mgmt/2022-02-01-preview/insights" ) const ( diff --git a/profiles/preview/preview/msi/mgmt/msi/models.go b/profiles/preview/preview/msi/mgmt/msi/models.go index 602bafcd061f..4635f876586d 100644 --- a/profiles/preview/preview/msi/mgmt/msi/models.go +++ b/profiles/preview/preview/msi/mgmt/msi/models.go @@ -12,19 +12,23 @@ package msi import ( "context" - original "github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi" + original "github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2021-09-30-preview/msi" ) const ( DefaultBaseURI = original.DefaultBaseURI ) +type AssociatedResourcesListResult = original.AssociatedResourcesListResult +type AssociatedResourcesListResultIterator = original.AssociatedResourcesListResultIterator +type AssociatedResourcesListResultPage = original.AssociatedResourcesListResultPage type AzureEntityResource = original.AzureEntityResource +type AzureResource = original.AzureResource type BaseClient = original.BaseClient type CloudError = original.CloudError type CloudErrorBody = original.CloudErrorBody type Identity = original.Identity -type IdentityProperties = original.IdentityProperties +type IdentityUpdate = original.IdentityUpdate type Operation = original.Operation type OperationDisplay = original.OperationDisplay type OperationListResult = original.OperationListResult @@ -35,15 +39,23 @@ type ProxyResource = original.ProxyResource type Resource = original.Resource type SystemAssignedIdentitiesClient = original.SystemAssignedIdentitiesClient type SystemAssignedIdentity = original.SystemAssignedIdentity +type SystemAssignedIdentityProperties = original.SystemAssignedIdentityProperties type TrackedResource = original.TrackedResource type UserAssignedIdentitiesClient = original.UserAssignedIdentitiesClient type UserAssignedIdentitiesListResult = original.UserAssignedIdentitiesListResult type UserAssignedIdentitiesListResultIterator = original.UserAssignedIdentitiesListResultIterator type UserAssignedIdentitiesListResultPage = original.UserAssignedIdentitiesListResultPage +type UserAssignedIdentityProperties = original.UserAssignedIdentityProperties func New(subscriptionID string) BaseClient { return original.New(subscriptionID) } +func NewAssociatedResourcesListResultIterator(page AssociatedResourcesListResultPage) AssociatedResourcesListResultIterator { + return original.NewAssociatedResourcesListResultIterator(page) +} +func NewAssociatedResourcesListResultPage(cur AssociatedResourcesListResult, getNextPage func(context.Context, AssociatedResourcesListResult) (AssociatedResourcesListResult, error)) AssociatedResourcesListResultPage { + return original.NewAssociatedResourcesListResultPage(cur, getNextPage) +} func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { return original.NewOperationListResultIterator(page) } diff --git a/profiles/preview/preview/msi/mgmt/msi/msiapi/models.go b/profiles/preview/preview/msi/mgmt/msi/msiapi/models.go index 249c7aa430da..5e57543047c5 100644 --- a/profiles/preview/preview/msi/mgmt/msi/msiapi/models.go +++ b/profiles/preview/preview/msi/mgmt/msi/msiapi/models.go @@ -9,7 +9,7 @@ package msiapi -import original "github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi/msiapi" +import original "github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2021-09-30-preview/msi/msiapi" type OperationsClientAPI = original.OperationsClientAPI type SystemAssignedIdentitiesClientAPI = original.SystemAssignedIdentitiesClientAPI diff --git a/profiles/preview/preview/securityinsight/mgmt/securityinsight/models.go b/profiles/preview/preview/securityinsight/mgmt/securityinsight/models.go index 351fe7830d7f..3fce64b8dada 100644 --- a/profiles/preview/preview/securityinsight/mgmt/securityinsight/models.go +++ b/profiles/preview/preview/securityinsight/mgmt/securityinsight/models.go @@ -12,7 +12,7 @@ package securityinsight import ( "context" - original "github.com/Azure/azure-sdk-for-go/services/preview/securityinsight/mgmt/2021-09-01-preview/securityinsight" + original "github.com/Azure/azure-sdk-for-go/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight" ) const ( @@ -22,9 +22,16 @@ const ( type ActionType = original.ActionType const ( - ActionTypeAutomationRuleAction ActionType = original.ActionTypeAutomationRuleAction - ActionTypeModifyProperties ActionType = original.ActionTypeModifyProperties - ActionTypeRunPlaybook ActionType = original.ActionTypeRunPlaybook + ActionTypeModifyProperties ActionType = original.ActionTypeModifyProperties + ActionTypeRunPlaybook ActionType = original.ActionTypeRunPlaybook +) + +type ActionTypeBasicAutomationRuleAction = original.ActionTypeBasicAutomationRuleAction + +const ( + ActionTypeBasicAutomationRuleActionActionTypeAutomationRuleAction ActionTypeBasicAutomationRuleAction = original.ActionTypeBasicAutomationRuleActionActionTypeAutomationRuleAction + ActionTypeBasicAutomationRuleActionActionTypeModifyProperties ActionTypeBasicAutomationRuleAction = original.ActionTypeBasicAutomationRuleActionActionTypeModifyProperties + ActionTypeBasicAutomationRuleActionActionTypeRunPlaybook ActionTypeBasicAutomationRuleAction = original.ActionTypeBasicAutomationRuleActionActionTypeRunPlaybook ) type AlertDetail = original.AlertDetail @@ -76,19 +83,23 @@ const ( type AttackTactic = original.AttackTactic const ( - AttackTacticCollection AttackTactic = original.AttackTacticCollection - AttackTacticCommandAndControl AttackTactic = original.AttackTacticCommandAndControl - AttackTacticCredentialAccess AttackTactic = original.AttackTacticCredentialAccess - AttackTacticDefenseEvasion AttackTactic = original.AttackTacticDefenseEvasion - AttackTacticDiscovery AttackTactic = original.AttackTacticDiscovery - AttackTacticExecution AttackTactic = original.AttackTacticExecution - AttackTacticExfiltration AttackTactic = original.AttackTacticExfiltration - AttackTacticImpact AttackTactic = original.AttackTacticImpact - AttackTacticInitialAccess AttackTactic = original.AttackTacticInitialAccess - AttackTacticLateralMovement AttackTactic = original.AttackTacticLateralMovement - AttackTacticPersistence AttackTactic = original.AttackTacticPersistence - AttackTacticPreAttack AttackTactic = original.AttackTacticPreAttack - AttackTacticPrivilegeEscalation AttackTactic = original.AttackTacticPrivilegeEscalation + AttackTacticCollection AttackTactic = original.AttackTacticCollection + AttackTacticCommandAndControl AttackTactic = original.AttackTacticCommandAndControl + AttackTacticCredentialAccess AttackTactic = original.AttackTacticCredentialAccess + AttackTacticDefenseEvasion AttackTactic = original.AttackTacticDefenseEvasion + AttackTacticDiscovery AttackTactic = original.AttackTacticDiscovery + AttackTacticExecution AttackTactic = original.AttackTacticExecution + AttackTacticExfiltration AttackTactic = original.AttackTacticExfiltration + AttackTacticImpact AttackTactic = original.AttackTacticImpact + AttackTacticImpairProcessControl AttackTactic = original.AttackTacticImpairProcessControl + AttackTacticInhibitResponseFunction AttackTactic = original.AttackTacticInhibitResponseFunction + AttackTacticInitialAccess AttackTactic = original.AttackTacticInitialAccess + AttackTacticLateralMovement AttackTactic = original.AttackTacticLateralMovement + AttackTacticPersistence AttackTactic = original.AttackTacticPersistence + AttackTacticPreAttack AttackTactic = original.AttackTacticPreAttack + AttackTacticPrivilegeEscalation AttackTactic = original.AttackTacticPrivilegeEscalation + AttackTacticReconnaissance AttackTactic = original.AttackTacticReconnaissance + AttackTacticResourceDevelopment AttackTactic = original.AttackTacticResourceDevelopment ) type AutomationRulePropertyConditionSupportedOperator = original.AutomationRulePropertyConditionSupportedOperator @@ -115,6 +126,7 @@ const ( AutomationRulePropertyConditionSupportedPropertyAccountPUID AutomationRulePropertyConditionSupportedProperty = original.AutomationRulePropertyConditionSupportedPropertyAccountPUID AutomationRulePropertyConditionSupportedPropertyAccountSid AutomationRulePropertyConditionSupportedProperty = original.AutomationRulePropertyConditionSupportedPropertyAccountSid AutomationRulePropertyConditionSupportedPropertyAccountUPNSuffix AutomationRulePropertyConditionSupportedProperty = original.AutomationRulePropertyConditionSupportedPropertyAccountUPNSuffix + AutomationRulePropertyConditionSupportedPropertyAlertProductNames AutomationRulePropertyConditionSupportedProperty = original.AutomationRulePropertyConditionSupportedPropertyAlertProductNames AutomationRulePropertyConditionSupportedPropertyAzureResourceResourceID AutomationRulePropertyConditionSupportedProperty = original.AutomationRulePropertyConditionSupportedPropertyAzureResourceResourceID AutomationRulePropertyConditionSupportedPropertyAzureResourceSubscriptionID AutomationRulePropertyConditionSupportedProperty = original.AutomationRulePropertyConditionSupportedPropertyAzureResourceSubscriptionID AutomationRulePropertyConditionSupportedPropertyCloudApplicationAppID AutomationRulePropertyConditionSupportedProperty = original.AutomationRulePropertyConditionSupportedPropertyCloudApplicationAppID @@ -129,6 +141,7 @@ const ( AutomationRulePropertyConditionSupportedPropertyHostNTDomain AutomationRulePropertyConditionSupportedProperty = original.AutomationRulePropertyConditionSupportedPropertyHostNTDomain AutomationRulePropertyConditionSupportedPropertyHostOSVersion AutomationRulePropertyConditionSupportedProperty = original.AutomationRulePropertyConditionSupportedPropertyHostOSVersion AutomationRulePropertyConditionSupportedPropertyIncidentDescription AutomationRulePropertyConditionSupportedProperty = original.AutomationRulePropertyConditionSupportedPropertyIncidentDescription + AutomationRulePropertyConditionSupportedPropertyIncidentLabel AutomationRulePropertyConditionSupportedProperty = original.AutomationRulePropertyConditionSupportedPropertyIncidentLabel AutomationRulePropertyConditionSupportedPropertyIncidentProviderName AutomationRulePropertyConditionSupportedProperty = original.AutomationRulePropertyConditionSupportedPropertyIncidentProviderName AutomationRulePropertyConditionSupportedPropertyIncidentRelatedAnalyticRuleIds AutomationRulePropertyConditionSupportedProperty = original.AutomationRulePropertyConditionSupportedPropertyIncidentRelatedAnalyticRuleIds AutomationRulePropertyConditionSupportedPropertyIncidentSeverity AutomationRulePropertyConditionSupportedProperty = original.AutomationRulePropertyConditionSupportedPropertyIncidentSeverity @@ -164,8 +177,14 @@ const ( type ConditionType = original.ConditionType const ( - ConditionTypeAutomationRuleCondition ConditionType = original.ConditionTypeAutomationRuleCondition - ConditionTypeProperty ConditionType = original.ConditionTypeProperty + ConditionTypeProperty ConditionType = original.ConditionTypeProperty +) + +type ConditionTypeBasicAutomationRuleCondition = original.ConditionTypeBasicAutomationRuleCondition + +const ( + ConditionTypeBasicAutomationRuleConditionConditionTypeAutomationRuleCondition ConditionTypeBasicAutomationRuleCondition = original.ConditionTypeBasicAutomationRuleConditionConditionTypeAutomationRuleCondition + ConditionTypeBasicAutomationRuleConditionConditionTypeProperty ConditionTypeBasicAutomationRuleCondition = original.ConditionTypeBasicAutomationRuleConditionConditionTypeProperty ) type ConfidenceLevel = original.ConfidenceLevel @@ -239,13 +258,16 @@ const ( DataConnectorKindAzureSecurityCenter DataConnectorKind = original.DataConnectorKindAzureSecurityCenter DataConnectorKindDynamics365 DataConnectorKind = original.DataConnectorKindDynamics365 DataConnectorKindGenericUI DataConnectorKind = original.DataConnectorKindGenericUI + DataConnectorKindIOT DataConnectorKind = original.DataConnectorKindIOT DataConnectorKindMicrosoftCloudAppSecurity DataConnectorKind = original.DataConnectorKindMicrosoftCloudAppSecurity DataConnectorKindMicrosoftDefenderAdvancedThreatProtection DataConnectorKind = original.DataConnectorKindMicrosoftDefenderAdvancedThreatProtection DataConnectorKindMicrosoftThreatIntelligence DataConnectorKind = original.DataConnectorKindMicrosoftThreatIntelligence DataConnectorKindMicrosoftThreatProtection DataConnectorKind = original.DataConnectorKindMicrosoftThreatProtection DataConnectorKindOffice365 DataConnectorKind = original.DataConnectorKindOffice365 + DataConnectorKindOffice365Project DataConnectorKind = original.DataConnectorKindOffice365Project DataConnectorKindOfficeATP DataConnectorKind = original.DataConnectorKindOfficeATP DataConnectorKindOfficeIRM DataConnectorKind = original.DataConnectorKindOfficeIRM + DataConnectorKindOfficePowerBI DataConnectorKind = original.DataConnectorKindOfficePowerBI DataConnectorKindThreatIntelligence DataConnectorKind = original.DataConnectorKindThreatIntelligence DataConnectorKindThreatIntelligenceTaxii DataConnectorKind = original.DataConnectorKindThreatIntelligenceTaxii ) @@ -289,6 +311,31 @@ const ( DeliveryLocationUnknown DeliveryLocation = original.DeliveryLocationUnknown ) +type DeploymentFetchStatus = original.DeploymentFetchStatus + +const ( + DeploymentFetchStatusNotFound DeploymentFetchStatus = original.DeploymentFetchStatusNotFound + DeploymentFetchStatusSuccess DeploymentFetchStatus = original.DeploymentFetchStatusSuccess + DeploymentFetchStatusUnauthorized DeploymentFetchStatus = original.DeploymentFetchStatusUnauthorized +) + +type DeploymentResult = original.DeploymentResult + +const ( + DeploymentResultCanceled DeploymentResult = original.DeploymentResultCanceled + DeploymentResultFailed DeploymentResult = original.DeploymentResultFailed + DeploymentResultSuccess DeploymentResult = original.DeploymentResultSuccess +) + +type DeploymentState = original.DeploymentState + +const ( + DeploymentStateCanceling DeploymentState = original.DeploymentStateCanceling + DeploymentStateCompleted DeploymentState = original.DeploymentStateCompleted + DeploymentStateInProgress DeploymentState = original.DeploymentStateInProgress + DeploymentStateQueued DeploymentState = original.DeploymentStateQueued +) + type ElevationToken = original.ElevationToken const ( @@ -432,8 +479,8 @@ const ( type IncidentLabelType = original.IncidentLabelType const ( - IncidentLabelTypeSystem IncidentLabelType = original.IncidentLabelTypeSystem - IncidentLabelTypeUser IncidentLabelType = original.IncidentLabelTypeUser + IncidentLabelTypeAutoAssigned IncidentLabelType = original.IncidentLabelTypeAutoAssigned + IncidentLabelTypeUser IncidentLabelType = original.IncidentLabelTypeUser ) type IncidentSeverity = original.IncidentSeverity @@ -475,20 +522,23 @@ const ( type Kind = original.Kind const ( - KindAnalyticsRule Kind = original.KindAnalyticsRule - KindAnalyticsRuleTemplate Kind = original.KindAnalyticsRuleTemplate - KindDataConnector Kind = original.KindDataConnector - KindDataType Kind = original.KindDataType - KindHuntingQuery Kind = original.KindHuntingQuery - KindInvestigationQuery Kind = original.KindInvestigationQuery - KindParser Kind = original.KindParser - KindPlaybook Kind = original.KindPlaybook - KindPlaybookTemplate Kind = original.KindPlaybookTemplate - KindSolution Kind = original.KindSolution - KindWatchlist Kind = original.KindWatchlist - KindWatchlistTemplate Kind = original.KindWatchlistTemplate - KindWorkbook Kind = original.KindWorkbook - KindWorkbookTemplate Kind = original.KindWorkbookTemplate + KindAnalyticsRule Kind = original.KindAnalyticsRule + KindAnalyticsRuleTemplate Kind = original.KindAnalyticsRuleTemplate + KindAutomationRule Kind = original.KindAutomationRule + KindAzureFunction Kind = original.KindAzureFunction + KindDataConnector Kind = original.KindDataConnector + KindDataType Kind = original.KindDataType + KindHuntingQuery Kind = original.KindHuntingQuery + KindInvestigationQuery Kind = original.KindInvestigationQuery + KindLogicAppsCustomConnector Kind = original.KindLogicAppsCustomConnector + KindParser Kind = original.KindParser + KindPlaybook Kind = original.KindPlaybook + KindPlaybookTemplate Kind = original.KindPlaybookTemplate + KindSolution Kind = original.KindSolution + KindWatchlist Kind = original.KindWatchlist + KindWatchlistTemplate Kind = original.KindWatchlistTemplate + KindWorkbook Kind = original.KindWorkbook + KindWorkbookTemplate Kind = original.KindWorkbookTemplate ) type KindBasicAlertRule = original.KindBasicAlertRule @@ -534,13 +584,16 @@ const ( KindBasicDataConnectorKindDataConnector KindBasicDataConnector = original.KindBasicDataConnectorKindDataConnector KindBasicDataConnectorKindDynamics365 KindBasicDataConnector = original.KindBasicDataConnectorKindDynamics365 KindBasicDataConnectorKindGenericUI KindBasicDataConnector = original.KindBasicDataConnectorKindGenericUI + KindBasicDataConnectorKindIOT KindBasicDataConnector = original.KindBasicDataConnectorKindIOT KindBasicDataConnectorKindMicrosoftCloudAppSecurity KindBasicDataConnector = original.KindBasicDataConnectorKindMicrosoftCloudAppSecurity KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection KindBasicDataConnector = original.KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection KindBasicDataConnectorKindMicrosoftThreatIntelligence KindBasicDataConnector = original.KindBasicDataConnectorKindMicrosoftThreatIntelligence KindBasicDataConnectorKindMicrosoftThreatProtection KindBasicDataConnector = original.KindBasicDataConnectorKindMicrosoftThreatProtection KindBasicDataConnectorKindOffice365 KindBasicDataConnector = original.KindBasicDataConnectorKindOffice365 + KindBasicDataConnectorKindOffice365Project KindBasicDataConnector = original.KindBasicDataConnectorKindOffice365Project KindBasicDataConnectorKindOfficeATP KindBasicDataConnector = original.KindBasicDataConnectorKindOfficeATP KindBasicDataConnectorKindOfficeIRM KindBasicDataConnector = original.KindBasicDataConnectorKindOfficeIRM + KindBasicDataConnectorKindOfficePowerBI KindBasicDataConnector = original.KindBasicDataConnectorKindOfficePowerBI KindBasicDataConnectorKindThreatIntelligence KindBasicDataConnector = original.KindBasicDataConnectorKindThreatIntelligence KindBasicDataConnectorKindThreatIntelligenceTaxii KindBasicDataConnector = original.KindBasicDataConnectorKindThreatIntelligenceTaxii ) @@ -555,12 +608,15 @@ const ( KindBasicDataConnectorsCheckRequirementsKindAzureSecurityCenter KindBasicDataConnectorsCheckRequirements = original.KindBasicDataConnectorsCheckRequirementsKindAzureSecurityCenter KindBasicDataConnectorsCheckRequirementsKindDataConnectorsCheckRequirements KindBasicDataConnectorsCheckRequirements = original.KindBasicDataConnectorsCheckRequirementsKindDataConnectorsCheckRequirements KindBasicDataConnectorsCheckRequirementsKindDynamics365 KindBasicDataConnectorsCheckRequirements = original.KindBasicDataConnectorsCheckRequirementsKindDynamics365 + KindBasicDataConnectorsCheckRequirementsKindIOT KindBasicDataConnectorsCheckRequirements = original.KindBasicDataConnectorsCheckRequirementsKindIOT KindBasicDataConnectorsCheckRequirementsKindMicrosoftCloudAppSecurity KindBasicDataConnectorsCheckRequirements = original.KindBasicDataConnectorsCheckRequirementsKindMicrosoftCloudAppSecurity KindBasicDataConnectorsCheckRequirementsKindMicrosoftDefenderAdvancedThreatProtection KindBasicDataConnectorsCheckRequirements = original.KindBasicDataConnectorsCheckRequirementsKindMicrosoftDefenderAdvancedThreatProtection KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatIntelligence KindBasicDataConnectorsCheckRequirements = original.KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatIntelligence KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatProtection KindBasicDataConnectorsCheckRequirements = original.KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatProtection + KindBasicDataConnectorsCheckRequirementsKindOffice365Project KindBasicDataConnectorsCheckRequirements = original.KindBasicDataConnectorsCheckRequirementsKindOffice365Project KindBasicDataConnectorsCheckRequirementsKindOfficeATP KindBasicDataConnectorsCheckRequirements = original.KindBasicDataConnectorsCheckRequirementsKindOfficeATP KindBasicDataConnectorsCheckRequirementsKindOfficeIRM KindBasicDataConnectorsCheckRequirements = original.KindBasicDataConnectorsCheckRequirementsKindOfficeIRM + KindBasicDataConnectorsCheckRequirementsKindOfficePowerBI KindBasicDataConnectorsCheckRequirements = original.KindBasicDataConnectorsCheckRequirementsKindOfficePowerBI KindBasicDataConnectorsCheckRequirementsKindThreatIntelligence KindBasicDataConnectorsCheckRequirements = original.KindBasicDataConnectorsCheckRequirementsKindThreatIntelligence KindBasicDataConnectorsCheckRequirementsKindThreatIntelligenceTaxii KindBasicDataConnectorsCheckRequirements = original.KindBasicDataConnectorsCheckRequirementsKindThreatIntelligenceTaxii ) @@ -771,13 +827,6 @@ const ( SkuKindPerGB SkuKind = original.SkuKindPerGB ) -type Source = original.Source - -const ( - SourceLocalfile Source = original.SourceLocalfile - SourceRemotestorage Source = original.SourceRemotestorage -) - type SourceKind = original.SourceKind const ( @@ -787,6 +836,13 @@ const ( SourceKindSourceRepository SourceKind = original.SourceKindSourceRepository ) +type SourceType = original.SourceType + +const ( + SourceTypeLocalfile SourceType = original.SourceTypeLocalfile + SourceTypeRemotestorage SourceType = original.SourceTypeRemotestorage +) + type SupportTier = original.SupportTier const ( @@ -826,6 +882,18 @@ const ( TriggerOperatorNotEqual TriggerOperator = original.TriggerOperatorNotEqual ) +type TriggersOn = original.TriggersOn + +const ( + TriggersOnIncidents TriggersOn = original.TriggersOnIncidents +) + +type TriggersWhen = original.TriggersWhen + +const ( + TriggersWhenCreated TriggersWhen = original.TriggersWhenCreated +) + type UebaDataSources = original.UebaDataSources const ( @@ -835,6 +903,13 @@ const ( UebaDataSourcesSigninLogs UebaDataSources = original.UebaDataSourcesSigninLogs ) +type Version = original.Version + +const ( + VersionV1 Version = original.VersionV1 + VersionV2 Version = original.VersionV2 +) + type AADCheckRequirements = original.AADCheckRequirements type AADCheckRequirementsProperties = original.AADCheckRequirementsProperties type AADDataConnector = original.AADDataConnector @@ -874,6 +949,7 @@ type AlertRuleTemplate = original.AlertRuleTemplate type AlertRuleTemplateDataSource = original.AlertRuleTemplateDataSource type AlertRuleTemplateModel = original.AlertRuleTemplateModel type AlertRuleTemplatePropertiesBase = original.AlertRuleTemplatePropertiesBase +type AlertRuleTemplateWithMitreProperties = original.AlertRuleTemplateWithMitreProperties type AlertRuleTemplatesClient = original.AlertRuleTemplatesClient type AlertRuleTemplatesList = original.AlertRuleTemplatesList type AlertRuleTemplatesListIterator = original.AlertRuleTemplatesListIterator @@ -889,12 +965,9 @@ type AutomationRule = original.AutomationRule type AutomationRuleAction = original.AutomationRuleAction type AutomationRuleCondition = original.AutomationRuleCondition type AutomationRuleModifyPropertiesAction = original.AutomationRuleModifyPropertiesAction -type AutomationRuleModifyPropertiesActionActionConfiguration = original.AutomationRuleModifyPropertiesActionActionConfiguration type AutomationRuleProperties = original.AutomationRuleProperties type AutomationRulePropertyValuesCondition = original.AutomationRulePropertyValuesCondition -type AutomationRulePropertyValuesConditionConditionProperties = original.AutomationRulePropertyValuesConditionConditionProperties type AutomationRuleRunPlaybookAction = original.AutomationRuleRunPlaybookAction -type AutomationRuleRunPlaybookActionActionConfiguration = original.AutomationRuleRunPlaybookActionActionConfiguration type AutomationRuleTriggeringLogic = original.AutomationRuleTriggeringLogic type AutomationRulesClient = original.AutomationRulesClient type AutomationRulesList = original.AutomationRulesList @@ -911,6 +984,7 @@ type AwsS3DataConnector = original.AwsS3DataConnector type AwsS3DataConnectorDataTypes = original.AwsS3DataConnectorDataTypes type AwsS3DataConnectorDataTypesLogs = original.AwsS3DataConnectorDataTypesLogs type AwsS3DataConnectorProperties = original.AwsS3DataConnectorProperties +type AzureDevOpsResourceInfo = original.AzureDevOpsResourceInfo type AzureEntityResource = original.AzureEntityResource type AzureResourceEntity = original.AzureResourceEntity type AzureResourceEntityProperties = original.AzureResourceEntityProperties @@ -931,6 +1005,7 @@ type BasicSettings = original.BasicSettings type BasicThreatIntelligenceInformation = original.BasicThreatIntelligenceInformation type Bookmark = original.Bookmark type BookmarkClient = original.BookmarkClient +type BookmarkEntityMappings = original.BookmarkEntityMappings type BookmarkExpandParameters = original.BookmarkExpandParameters type BookmarkExpandResponse = original.BookmarkExpandResponse type BookmarkExpandResponseValue = original.BookmarkExpandResponseValue @@ -983,6 +1058,8 @@ type DataConnectorsCheckRequirements = original.DataConnectorsCheckRequirements type DataConnectorsCheckRequirementsClient = original.DataConnectorsCheckRequirementsClient type DataConnectorsClient = original.DataConnectorsClient type DataTypeDefinitions = original.DataTypeDefinitions +type Deployment = original.Deployment +type DeploymentInfo = original.DeploymentInfo type DomainWhoisClient = original.DomainWhoisClient type Dynamics365CheckRequirements = original.Dynamics365CheckRequirements type Dynamics365CheckRequirementsProperties = original.Dynamics365CheckRequirementsProperties @@ -1007,6 +1084,7 @@ type EntityEdges = original.EntityEdges type EntityExpandParameters = original.EntityExpandParameters type EntityExpandResponse = original.EntityExpandResponse type EntityExpandResponseValue = original.EntityExpandResponseValue +type EntityFieldMapping = original.EntityFieldMapping type EntityGetInsightsParameters = original.EntityGetInsightsParameters type EntityGetInsightsResponse = original.EntityGetInsightsResponse type EntityInsightItem = original.EntityInsightItem @@ -1035,9 +1113,6 @@ type EntityRelationsClient = original.EntityRelationsClient type EntityTimelineItem = original.EntityTimelineItem type EntityTimelineParameters = original.EntityTimelineParameters type EntityTimelineResponse = original.EntityTimelineResponse -type ErrorAdditionalInfo = original.ErrorAdditionalInfo -type ErrorDetail = original.ErrorDetail -type ErrorResponse = original.ErrorResponse type EventGroupingSettings = original.EventGroupingSettings type ExpansionEntityQueriesProperties = original.ExpansionEntityQueriesProperties type ExpansionEntityQuery = original.ExpansionEntityQuery @@ -1054,10 +1129,19 @@ type FusionAlertRule = original.FusionAlertRule type FusionAlertRuleProperties = original.FusionAlertRuleProperties type FusionAlertRuleTemplate = original.FusionAlertRuleTemplate type FusionAlertRuleTemplateProperties = original.FusionAlertRuleTemplateProperties +type FusionScenarioExclusionPattern = original.FusionScenarioExclusionPattern +type FusionSourceSettings = original.FusionSourceSettings +type FusionSourceSubTypeSetting = original.FusionSourceSubTypeSetting +type FusionSubTypeSeverityFilter = original.FusionSubTypeSeverityFilter +type FusionSubTypeSeverityFiltersItem = original.FusionSubTypeSeverityFiltersItem +type FusionTemplateSourceSetting = original.FusionTemplateSourceSetting +type FusionTemplateSourceSubType = original.FusionTemplateSourceSubType +type FusionTemplateSubTypeSeverityFilter = original.FusionTemplateSubTypeSeverityFilter type GeoLocation = original.GeoLocation type GetInsightsError = original.GetInsightsError type GetInsightsResultsMetadata = original.GetInsightsResultsMetadata type GetQueriesResponse = original.GetQueriesResponse +type GitHubResourceInfo = original.GitHubResourceInfo type GraphQueries = original.GraphQueries type GroupingConfiguration = original.GroupingConfiguration type HostEntity = original.HostEntity @@ -1087,6 +1171,7 @@ type IncidentListIterator = original.IncidentListIterator type IncidentListPage = original.IncidentListPage type IncidentOwnerInfo = original.IncidentOwnerInfo type IncidentProperties = original.IncidentProperties +type IncidentPropertiesAction = original.IncidentPropertiesAction type IncidentRelationsClient = original.IncidentRelationsClient type IncidentsClient = original.IncidentsClient type InsightQueryItem = original.InsightQueryItem @@ -1102,6 +1187,10 @@ type InsightsTableResult = original.InsightsTableResult type InsightsTableResultColumnsItem = original.InsightsTableResultColumnsItem type InstructionSteps = original.InstructionSteps type InstructionStepsInstructionsItem = original.InstructionStepsInstructionsItem +type IoTCheckRequirements = original.IoTCheckRequirements +type IoTCheckRequirementsProperties = original.IoTCheckRequirementsProperties +type IoTDataConnector = original.IoTDataConnector +type IoTDataConnectorProperties = original.IoTDataConnectorProperties type IoTDeviceEntity = original.IoTDeviceEntity type IoTDeviceEntityProperties = original.IoTDeviceEntityProperties type LastDataReceivedDataType = original.LastDataReceivedDataType @@ -1138,6 +1227,7 @@ type MailboxEntity = original.MailboxEntity type MailboxEntityProperties = original.MailboxEntityProperties type MalwareEntity = original.MalwareEntity type MalwareEntityProperties = original.MalwareEntityProperties +type ManualTriggerRequestBody = original.ManualTriggerRequestBody type MetadataAuthor = original.MetadataAuthor type MetadataCategories = original.MetadataCategories type MetadataClient = original.MetadataClient @@ -1161,6 +1251,12 @@ type NrtAlertRule = original.NrtAlertRule type NrtAlertRuleProperties = original.NrtAlertRuleProperties type NrtAlertRuleTemplate = original.NrtAlertRuleTemplate type NrtAlertRuleTemplateProperties = original.NrtAlertRuleTemplateProperties +type Office365ProjectCheckRequirements = original.Office365ProjectCheckRequirements +type Office365ProjectCheckRequirementsProperties = original.Office365ProjectCheckRequirementsProperties +type Office365ProjectConnectorDataTypes = original.Office365ProjectConnectorDataTypes +type Office365ProjectConnectorDataTypesLogs = original.Office365ProjectConnectorDataTypesLogs +type Office365ProjectDataConnector = original.Office365ProjectDataConnector +type Office365ProjectDataConnectorProperties = original.Office365ProjectDataConnectorProperties type OfficeATPCheckRequirements = original.OfficeATPCheckRequirements type OfficeATPCheckRequirementsProperties = original.OfficeATPCheckRequirementsProperties type OfficeATPDataConnector = original.OfficeATPDataConnector @@ -1181,6 +1277,12 @@ type OfficeIRMCheckRequirements = original.OfficeIRMCheckRequirements type OfficeIRMCheckRequirementsProperties = original.OfficeIRMCheckRequirementsProperties type OfficeIRMDataConnector = original.OfficeIRMDataConnector type OfficeIRMDataConnectorProperties = original.OfficeIRMDataConnectorProperties +type OfficePowerBICheckRequirements = original.OfficePowerBICheckRequirements +type OfficePowerBICheckRequirementsProperties = original.OfficePowerBICheckRequirementsProperties +type OfficePowerBIConnectorDataTypes = original.OfficePowerBIConnectorDataTypes +type OfficePowerBIConnectorDataTypesLogs = original.OfficePowerBIConnectorDataTypesLogs +type OfficePowerBIDataConnector = original.OfficePowerBIDataConnector +type OfficePowerBIDataConnectorProperties = original.OfficePowerBIDataConnectorProperties type Operation = original.Operation type OperationDisplay = original.OperationDisplay type OperationsClient = original.OperationsClient @@ -1190,11 +1292,12 @@ type OperationsListPage = original.OperationsListPage type Permissions = original.Permissions type PermissionsCustomsItem = original.PermissionsCustomsItem type PermissionsResourceProviderItem = original.PermissionsResourceProviderItem +type PlaybookActionProperties = original.PlaybookActionProperties type ProcessEntity = original.ProcessEntity type ProcessEntityProperties = original.ProcessEntityProperties type ProductSettingsClient = original.ProductSettingsClient +type PropertyConditionProperties = original.PropertyConditionProperties type ProxyResource = original.ProxyResource -type QueryBasedAlertRuleProperties = original.QueryBasedAlertRuleProperties type QueryBasedAlertRuleTemplateProperties = original.QueryBasedAlertRuleTemplateProperties type RegistryKeyEntity = original.RegistryKeyEntity type RegistryKeyEntityProperties = original.RegistryKeyEntityProperties @@ -1210,6 +1313,7 @@ type RepoList = original.RepoList type RepoListIterator = original.RepoListIterator type RepoListPage = original.RepoListPage type Repository = original.Repository +type RepositoryResourceInfo = original.RepositoryResourceInfo type RequiredPermissions = original.RequiredPermissions type Resource = original.Resource type ResourceProvider = original.ResourceProvider @@ -1230,6 +1334,7 @@ type SentinelOnboardingState = original.SentinelOnboardingState type SentinelOnboardingStateProperties = original.SentinelOnboardingStateProperties type SentinelOnboardingStatesClient = original.SentinelOnboardingStatesClient type SentinelOnboardingStatesList = original.SentinelOnboardingStatesList +type SetObject = original.SetObject type SettingList = original.SettingList type Settings = original.Settings type SettingsModel = original.SettingsModel @@ -1264,7 +1369,6 @@ type ThreatIntelligenceGranularMarkingModel = original.ThreatIntelligenceGranula type ThreatIntelligenceIndicatorClient = original.ThreatIntelligenceIndicatorClient type ThreatIntelligenceIndicatorMetricsClient = original.ThreatIntelligenceIndicatorMetricsClient type ThreatIntelligenceIndicatorModel = original.ThreatIntelligenceIndicatorModel -type ThreatIntelligenceIndicatorModelForRequestBody = original.ThreatIntelligenceIndicatorModelForRequestBody type ThreatIntelligenceIndicatorProperties = original.ThreatIntelligenceIndicatorProperties type ThreatIntelligenceIndicatorsClient = original.ThreatIntelligenceIndicatorsClient type ThreatIntelligenceInformation = original.ThreatIntelligenceInformation @@ -1279,7 +1383,6 @@ type ThreatIntelligenceMetrics = original.ThreatIntelligenceMetrics type ThreatIntelligenceMetricsList = original.ThreatIntelligenceMetricsList type ThreatIntelligenceParsedPattern = original.ThreatIntelligenceParsedPattern type ThreatIntelligenceParsedPatternTypeValue = original.ThreatIntelligenceParsedPatternTypeValue -type ThreatIntelligenceResourceKind = original.ThreatIntelligenceResourceKind type ThreatIntelligenceSortingCriteria = original.ThreatIntelligenceSortingCriteria type TiTaxiiCheckRequirements = original.TiTaxiiCheckRequirements type TiTaxiiCheckRequirementsProperties = original.TiTaxiiCheckRequirementsProperties @@ -1308,6 +1411,7 @@ type WatchlistListIterator = original.WatchlistListIterator type WatchlistListPage = original.WatchlistListPage type WatchlistProperties = original.WatchlistProperties type WatchlistsClient = original.WatchlistsClient +type Webhook = original.Webhook func New(subscriptionID string) BaseClient { return original.New(subscriptionID) @@ -1627,6 +1731,9 @@ func NewWatchlistsClientWithBaseURI(baseURI string, subscriptionID string) Watch func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { return original.NewWithBaseURI(baseURI, subscriptionID) } +func PossibleActionTypeBasicAutomationRuleActionValues() []ActionTypeBasicAutomationRuleAction { + return original.PossibleActionTypeBasicAutomationRuleActionValues() +} func PossibleActionTypeValues() []ActionType { return original.PossibleActionTypeValues() } @@ -1654,6 +1761,9 @@ func PossibleAutomationRulePropertyConditionSupportedOperatorValues() []Automati func PossibleAutomationRulePropertyConditionSupportedPropertyValues() []AutomationRulePropertyConditionSupportedProperty { return original.PossibleAutomationRulePropertyConditionSupportedPropertyValues() } +func PossibleConditionTypeBasicAutomationRuleConditionValues() []ConditionTypeBasicAutomationRuleCondition { + return original.PossibleConditionTypeBasicAutomationRuleConditionValues() +} func PossibleConditionTypeValues() []ConditionType { return original.PossibleConditionTypeValues() } @@ -1696,6 +1806,15 @@ func PossibleDeliveryActionValues() []DeliveryAction { func PossibleDeliveryLocationValues() []DeliveryLocation { return original.PossibleDeliveryLocationValues() } +func PossibleDeploymentFetchStatusValues() []DeploymentFetchStatus { + return original.PossibleDeploymentFetchStatusValues() +} +func PossibleDeploymentResultValues() []DeploymentResult { + return original.PossibleDeploymentResultValues() +} +func PossibleDeploymentStateValues() []DeploymentState { + return original.PossibleDeploymentStateValues() +} func PossibleElevationTokenValues() []ElevationToken { return original.PossibleElevationTokenValues() } @@ -1825,8 +1944,8 @@ func PossibleSkuKindValues() []SkuKind { func PossibleSourceKindValues() []SourceKind { return original.PossibleSourceKindValues() } -func PossibleSourceValues() []Source { - return original.PossibleSourceValues() +func PossibleSourceTypeValues() []SourceType { + return original.PossibleSourceTypeValues() } func PossibleSupportTierValues() []SupportTier { return original.PossibleSupportTierValues() @@ -1843,9 +1962,18 @@ func PossibleThreatIntelligenceSortingCriteriaEnumValues() []ThreatIntelligenceS func PossibleTriggerOperatorValues() []TriggerOperator { return original.PossibleTriggerOperatorValues() } +func PossibleTriggersOnValues() []TriggersOn { + return original.PossibleTriggersOnValues() +} +func PossibleTriggersWhenValues() []TriggersWhen { + return original.PossibleTriggersWhenValues() +} func PossibleUebaDataSourcesValues() []UebaDataSources { return original.PossibleUebaDataSourcesValues() } +func PossibleVersionValues() []Version { + return original.PossibleVersionValues() +} func UserAgent() string { return original.UserAgent() + " profiles/preview" } diff --git a/profiles/preview/preview/securityinsight/mgmt/securityinsight/securityinsightapi/models.go b/profiles/preview/preview/securityinsight/mgmt/securityinsight/securityinsightapi/models.go index 5090d53f24a8..5155fffcf147 100644 --- a/profiles/preview/preview/securityinsight/mgmt/securityinsight/securityinsightapi/models.go +++ b/profiles/preview/preview/securityinsight/mgmt/securityinsight/securityinsightapi/models.go @@ -9,7 +9,7 @@ package securityinsightapi -import original "github.com/Azure/azure-sdk-for-go/services/preview/securityinsight/mgmt/2021-09-01-preview/securityinsight/securityinsightapi" +import original "github.com/Azure/azure-sdk-for-go/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/securityinsightapi" type ActionsClientAPI = original.ActionsClientAPI type AlertRuleTemplatesClientAPI = original.AlertRuleTemplatesClientAPI diff --git a/profiles/preview/storagecache/mgmt/storagecache/models.go b/profiles/preview/storagecache/mgmt/storagecache/models.go index 4a03d02c0f5a..fc186e93220b 100644 --- a/profiles/preview/storagecache/mgmt/storagecache/models.go +++ b/profiles/preview/storagecache/mgmt/storagecache/models.go @@ -12,7 +12,7 @@ package storagecache import ( "context" - original "github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2021-09-01/storagecache" + original "github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2022-01-01/storagecache" ) const ( @@ -157,6 +157,7 @@ type APIOperationPropertiesServiceSpecification = original.APIOperationPropertie type AscOperation = original.AscOperation type AscOperationProperties = original.AscOperationProperties type AscOperationsClient = original.AscOperationsClient +type AscUsagesClient = original.AscUsagesClient type BaseClient = original.BaseClient type BlobNfsTarget = original.BlobNfsTarget type Cache = original.Cache @@ -205,11 +206,17 @@ type ResourceSkuLocationInfo = original.ResourceSkuLocationInfo type ResourceSkusResult = original.ResourceSkusResult type ResourceSkusResultIterator = original.ResourceSkusResultIterator type ResourceSkusResultPage = original.ResourceSkusResultPage +type ResourceUsage = original.ResourceUsage +type ResourceUsageName = original.ResourceUsageName +type ResourceUsagesListResult = original.ResourceUsagesListResult +type ResourceUsagesListResultIterator = original.ResourceUsagesListResultIterator +type ResourceUsagesListResultPage = original.ResourceUsagesListResultPage type Restriction = original.Restriction type SkusClient = original.SkusClient type StorageTarget = original.StorageTarget type StorageTargetClient = original.StorageTargetClient type StorageTargetFlushFuture = original.StorageTargetFlushFuture +type StorageTargetInvalidateFuture = original.StorageTargetInvalidateFuture type StorageTargetProperties = original.StorageTargetProperties type StorageTargetResource = original.StorageTargetResource type StorageTargetResumeFuture = original.StorageTargetResumeFuture @@ -245,6 +252,12 @@ func NewAscOperationsClient(subscriptionID string) AscOperationsClient { func NewAscOperationsClientWithBaseURI(baseURI string, subscriptionID string) AscOperationsClient { return original.NewAscOperationsClientWithBaseURI(baseURI, subscriptionID) } +func NewAscUsagesClient(subscriptionID string) AscUsagesClient { + return original.NewAscUsagesClient(subscriptionID) +} +func NewAscUsagesClientWithBaseURI(baseURI string, subscriptionID string) AscUsagesClient { + return original.NewAscUsagesClientWithBaseURI(baseURI, subscriptionID) +} func NewCachesClient(subscriptionID string) CachesClient { return original.NewCachesClient(subscriptionID) } @@ -269,6 +282,12 @@ func NewResourceSkusResultIterator(page ResourceSkusResultPage) ResourceSkusResu func NewResourceSkusResultPage(cur ResourceSkusResult, getNextPage func(context.Context, ResourceSkusResult) (ResourceSkusResult, error)) ResourceSkusResultPage { return original.NewResourceSkusResultPage(cur, getNextPage) } +func NewResourceUsagesListResultIterator(page ResourceUsagesListResultPage) ResourceUsagesListResultIterator { + return original.NewResourceUsagesListResultIterator(page) +} +func NewResourceUsagesListResultPage(cur ResourceUsagesListResult, getNextPage func(context.Context, ResourceUsagesListResult) (ResourceUsagesListResult, error)) ResourceUsagesListResultPage { + return original.NewResourceUsagesListResultPage(cur, getNextPage) +} func NewSkusClient(subscriptionID string) SkusClient { return original.NewSkusClient(subscriptionID) } diff --git a/profiles/preview/storagecache/mgmt/storagecache/storagecacheapi/models.go b/profiles/preview/storagecache/mgmt/storagecache/storagecacheapi/models.go index 59229679ce11..0ba45b0053ee 100644 --- a/profiles/preview/storagecache/mgmt/storagecache/storagecacheapi/models.go +++ b/profiles/preview/storagecache/mgmt/storagecache/storagecacheapi/models.go @@ -9,9 +9,10 @@ package storagecacheapi -import original "github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2021-09-01/storagecache/storagecacheapi" +import original "github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2022-01-01/storagecache/storagecacheapi" type AscOperationsClientAPI = original.AscOperationsClientAPI +type AscUsagesClientAPI = original.AscUsagesClientAPI type CachesClientAPI = original.CachesClientAPI type OperationsClientAPI = original.OperationsClientAPI type SkusClientAPI = original.SkusClientAPI diff --git a/profiles/preview/streamanalytics/mgmt/streamanalytics/models.go b/profiles/preview/streamanalytics/mgmt/streamanalytics/models.go index 6739f9b78fa2..90d515276060 100644 --- a/profiles/preview/streamanalytics/mgmt/streamanalytics/models.go +++ b/profiles/preview/streamanalytics/mgmt/streamanalytics/models.go @@ -188,6 +188,7 @@ const ( type TypeBasicOutputDataSource = original.TypeBasicOutputDataSource const ( + TypeBasicOutputDataSourceTypeMicrosoftAzureFunction TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypeMicrosoftAzureFunction TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub @@ -229,6 +230,8 @@ const ( type AvroSerialization = original.AvroSerialization type AzureDataLakeStoreOutputDataSource = original.AzureDataLakeStoreOutputDataSource type AzureDataLakeStoreOutputDataSourceProperties = original.AzureDataLakeStoreOutputDataSourceProperties +type AzureFunctionOutputDataSource = original.AzureFunctionOutputDataSource +type AzureFunctionOutputDataSourceProperties = original.AzureFunctionOutputDataSourceProperties type AzureMachineLearningWebServiceFunctionBinding = original.AzureMachineLearningWebServiceFunctionBinding type AzureMachineLearningWebServiceFunctionBindingProperties = original.AzureMachineLearningWebServiceFunctionBindingProperties type AzureMachineLearningWebServiceFunctionBindingRetrievalProperties = original.AzureMachineLearningWebServiceFunctionBindingRetrievalProperties diff --git a/services/batch/mgmt/2022-01-01/batch/CHANGELOG.md b/services/batch/mgmt/2022-01-01/batch/CHANGELOG.md new file mode 100644 index 000000000000..52911e4cc5e4 --- /dev/null +++ b/services/batch/mgmt/2022-01-01/batch/CHANGELOG.md @@ -0,0 +1,2 @@ +# Change History + diff --git a/services/batch/mgmt/2022-01-01/batch/_meta.json b/services/batch/mgmt/2022-01-01/batch/_meta.json new file mode 100644 index 000000000000..fd8e0a2af323 --- /dev/null +++ b/services/batch/mgmt/2022-01-01/batch/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "162460648e39b3cd20ef3d302008add138e90223", + "readme": "/_/azure-rest-api-specs/specification/batch/resource-manager/readme.md", + "tag": "package-2022-01", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2022-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/batch/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" + } +} \ No newline at end of file diff --git a/services/batch/mgmt/2022-01-01/batch/account.go b/services/batch/mgmt/2022-01-01/batch/account.go new file mode 100644 index 000000000000..85e1bf96682f --- /dev/null +++ b/services/batch/mgmt/2022-01-01/batch/account.go @@ -0,0 +1,1224 @@ +package batch + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AccountClient is the batch Client +type AccountClient struct { + BaseClient +} + +// NewAccountClient creates an instance of the AccountClient client. +func NewAccountClient(subscriptionID string) AccountClient { + return NewAccountClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAccountClientWithBaseURI creates an instance of the AccountClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAccountClientWithBaseURI(baseURI string, subscriptionID string) AccountClient { + return AccountClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API +// and should instead be updated with the Update Batch Account API. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - a name for the Batch account which must be unique within the region. Batch account names must +// be between 3 and 24 characters in length and must use only numbers and lowercase letters. This name is used +// as part of the DNS name that is used to access the Batch service in the region in which the account is +// created. For example: http://accountname.region.batch.azure.com/. +// parameters - additional parameters for account creation. +func (client AccountClient) Create(ctx context.Context, resourceGroupName string, accountName string, parameters AccountCreateParameters) (result AccountCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AccountCreateProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.AccountCreateProperties.AutoStorage", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.AccountCreateProperties.AutoStorage.StorageAccountID", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.AccountCreateProperties.KeyVaultReference", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.AccountCreateProperties.KeyVaultReference.ID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AccountCreateProperties.KeyVaultReference.URL", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("batch.AccountClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client AccountClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, parameters AccountCreateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) CreateSender(req *http.Request) (future AccountCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client AccountClient) CreateResponder(resp *http.Response) (result Account, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified Batch account. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +func (client AccountClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result AccountDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.AccountClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AccountClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) DeleteSender(req *http.Request) (future AccountDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AccountClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about the specified Batch account. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +func (client AccountClient) Get(ctx context.Context, resourceGroupName string, accountName string) (result Account, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.AccountClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AccountClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AccountClient) GetResponder(resp *http.Response) (result Account, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDetector gets information about the given detector for a given Batch account. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// detectorID - the name of the detector. +func (client AccountClient) GetDetector(ctx context.Context, resourceGroupName string, accountName string, detectorID string) (result DetectorResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.GetDetector") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.AccountClient", "GetDetector", err.Error()) + } + + req, err := client.GetDetectorPreparer(ctx, resourceGroupName, accountName, detectorID) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "GetDetector", nil, "Failure preparing request") + return + } + + resp, err := client.GetDetectorSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.AccountClient", "GetDetector", resp, "Failure sending request") + return + } + + result, err = client.GetDetectorResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "GetDetector", resp, "Failure responding to request") + return + } + + return +} + +// GetDetectorPreparer prepares the GetDetector request. +func (client AccountClient) GetDetectorPreparer(ctx context.Context, resourceGroupName string, accountName string, detectorID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "detectorId": autorest.Encode("path", detectorID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors/{detectorId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDetectorSender sends the GetDetector request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) GetDetectorSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetDetectorResponder handles the response to the GetDetector request. The method always +// closes the http.Response Body. +func (client AccountClient) GetDetectorResponder(resp *http.Response) (result DetectorResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetKeys this operation applies only to Batch accounts with allowedAuthenticationModes containing 'SharedKey'. If the +// Batch account doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients cannot use shared keys to +// authenticate, and must use another allowedAuthenticationModes instead. In this case, getting the keys will fail. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +func (client AccountClient) GetKeys(ctx context.Context, resourceGroupName string, accountName string) (result AccountKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.GetKeys") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.AccountClient", "GetKeys", err.Error()) + } + + req, err := client.GetKeysPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "GetKeys", nil, "Failure preparing request") + return + } + + resp, err := client.GetKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.AccountClient", "GetKeys", resp, "Failure sending request") + return + } + + result, err = client.GetKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "GetKeys", resp, "Failure responding to request") + return + } + + return +} + +// GetKeysPreparer prepares the GetKeys request. +func (client AccountClient) GetKeysPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetKeysSender sends the GetKeys request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) GetKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetKeysResponder handles the response to the GetKeys request. The method always +// closes the http.Response Body. +func (client AccountClient) GetKeysResponder(resp *http.Response) (result AccountKeys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets information about the Batch accounts associated with the subscription. +func (client AccountClient) List(ctx context.Context) (result AccountListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.List") + defer func() { + sc := -1 + if result.alr.Response.Response != nil { + sc = result.alr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.alr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.AccountClient", "List", resp, "Failure sending request") + return + } + + result.alr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "List", resp, "Failure responding to request") + return + } + if result.alr.hasNextLink() && result.alr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AccountClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Batch/batchAccounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AccountClient) ListResponder(resp *http.Response) (result AccountListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AccountClient) listNextResults(ctx context.Context, lastResults AccountListResult) (result AccountListResult, err error) { + req, err := lastResults.accountListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AccountClient) ListComplete(ctx context.Context) (result AccountListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup gets information about the Batch accounts associated with the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +func (client AccountClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AccountListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.alr.Response.Response != nil { + sc = result.alr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.alr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.alr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.alr.hasNextLink() && result.alr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AccountClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client AccountClient) ListByResourceGroupResponder(resp *http.Response) (result AccountListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client AccountClient) listByResourceGroupNextResults(ctx context.Context, lastResults AccountListResult) (result AccountListResult, err error) { + req, err := lastResults.accountListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client AccountClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AccountListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListDetectors gets information about the detectors available for a given Batch account. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +func (client AccountClient) ListDetectors(ctx context.Context, resourceGroupName string, accountName string) (result DetectorListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.ListDetectors") + defer func() { + sc := -1 + if result.dlr.Response.Response != nil { + sc = result.dlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.AccountClient", "ListDetectors", err.Error()) + } + + result.fn = client.listDetectorsNextResults + req, err := client.ListDetectorsPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListDetectors", nil, "Failure preparing request") + return + } + + resp, err := client.ListDetectorsSender(req) + if err != nil { + result.dlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListDetectors", resp, "Failure sending request") + return + } + + result.dlr, err = client.ListDetectorsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListDetectors", resp, "Failure responding to request") + return + } + if result.dlr.hasNextLink() && result.dlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListDetectorsPreparer prepares the ListDetectors request. +func (client AccountClient) ListDetectorsPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListDetectorsSender sends the ListDetectors request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) ListDetectorsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListDetectorsResponder handles the response to the ListDetectors request. The method always +// closes the http.Response Body. +func (client AccountClient) ListDetectorsResponder(resp *http.Response) (result DetectorListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listDetectorsNextResults retrieves the next set of results, if any. +func (client AccountClient) listDetectorsNextResults(ctx context.Context, lastResults DetectorListResult) (result DetectorListResult, err error) { + req, err := lastResults.detectorListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listDetectorsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListDetectorsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listDetectorsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListDetectorsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "listDetectorsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListDetectorsComplete enumerates all values, automatically crossing page boundaries as required. +func (client AccountClient) ListDetectorsComplete(ctx context.Context, resourceGroupName string, accountName string) (result DetectorListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.ListDetectors") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListDetectors(ctx, resourceGroupName, accountName) + return +} + +// ListOutboundNetworkDependenciesEndpoints lists the endpoints that a Batch Compute Node under this Batch Account may +// call as part of Batch service administration. If you are deploying a Pool inside of a virtual network that you +// specify, you must make sure your network allows outbound access to these endpoints. Failure to allow access to these +// endpoints may cause Batch to mark the affected nodes as unusable. For more information about creating a pool inside +// of a virtual network, see https://docs.microsoft.com/en-us/azure/batch/batch-virtual-network. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +func (client AccountClient) ListOutboundNetworkDependenciesEndpoints(ctx context.Context, resourceGroupName string, accountName string) (result OutboundEnvironmentEndpointCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.ListOutboundNetworkDependenciesEndpoints") + defer func() { + sc := -1 + if result.oeec.Response.Response != nil { + sc = result.oeec.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.AccountClient", "ListOutboundNetworkDependenciesEndpoints", err.Error()) + } + + result.fn = client.listOutboundNetworkDependenciesEndpointsNextResults + req, err := client.ListOutboundNetworkDependenciesEndpointsPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") + return + } + + resp, err := client.ListOutboundNetworkDependenciesEndpointsSender(req) + if err != nil { + result.oeec.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListOutboundNetworkDependenciesEndpoints", resp, "Failure sending request") + return + } + + result.oeec, err = client.ListOutboundNetworkDependenciesEndpointsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListOutboundNetworkDependenciesEndpoints", resp, "Failure responding to request") + return + } + if result.oeec.hasNextLink() && result.oeec.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListOutboundNetworkDependenciesEndpointsPreparer prepares the ListOutboundNetworkDependenciesEndpoints request. +func (client AccountClient) ListOutboundNetworkDependenciesEndpointsPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/outboundNetworkDependenciesEndpoints", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListOutboundNetworkDependenciesEndpointsSender sends the ListOutboundNetworkDependenciesEndpoints request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) ListOutboundNetworkDependenciesEndpointsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListOutboundNetworkDependenciesEndpointsResponder handles the response to the ListOutboundNetworkDependenciesEndpoints request. The method always +// closes the http.Response Body. +func (client AccountClient) ListOutboundNetworkDependenciesEndpointsResponder(resp *http.Response) (result OutboundEnvironmentEndpointCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listOutboundNetworkDependenciesEndpointsNextResults retrieves the next set of results, if any. +func (client AccountClient) listOutboundNetworkDependenciesEndpointsNextResults(ctx context.Context, lastResults OutboundEnvironmentEndpointCollection) (result OutboundEnvironmentEndpointCollection, err error) { + req, err := lastResults.outboundEnvironmentEndpointCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listOutboundNetworkDependenciesEndpointsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListOutboundNetworkDependenciesEndpointsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listOutboundNetworkDependenciesEndpointsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListOutboundNetworkDependenciesEndpointsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "listOutboundNetworkDependenciesEndpointsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListOutboundNetworkDependenciesEndpointsComplete enumerates all values, automatically crossing page boundaries as required. +func (client AccountClient) ListOutboundNetworkDependenciesEndpointsComplete(ctx context.Context, resourceGroupName string, accountName string) (result OutboundEnvironmentEndpointCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.ListOutboundNetworkDependenciesEndpoints") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListOutboundNetworkDependenciesEndpoints(ctx, resourceGroupName, accountName) + return +} + +// RegenerateKey this operation applies only to Batch accounts with allowedAuthenticationModes containing 'SharedKey'. +// If the Batch account doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients cannot use shared keys to +// authenticate, and must use another allowedAuthenticationModes instead. In this case, regenerating the keys will +// fail. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// parameters - the type of key to regenerate. +func (client AccountClient) RegenerateKey(ctx context.Context, resourceGroupName string, accountName string, parameters AccountRegenerateKeyParameters) (result AccountKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.RegenerateKey") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.AccountClient", "RegenerateKey", err.Error()) + } + + req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, accountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "RegenerateKey", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.AccountClient", "RegenerateKey", resp, "Failure sending request") + return + } + + result, err = client.RegenerateKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "RegenerateKey", resp, "Failure responding to request") + return + } + + return +} + +// RegenerateKeyPreparer prepares the RegenerateKey request. +func (client AccountClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, accountName string, parameters AccountRegenerateKeyParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/regenerateKeys", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RegenerateKeySender sends the RegenerateKey request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) RegenerateKeySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always +// closes the http.Response Body. +func (client AccountClient) RegenerateKeyResponder(resp *http.Response) (result AccountKeys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// SynchronizeAutoStorageKeys synchronizes access keys for the auto-storage account configured for the specified Batch +// account, only if storage key authentication is being used. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +func (client AccountClient) SynchronizeAutoStorageKeys(ctx context.Context, resourceGroupName string, accountName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.SynchronizeAutoStorageKeys") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.AccountClient", "SynchronizeAutoStorageKeys", err.Error()) + } + + req, err := client.SynchronizeAutoStorageKeysPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "SynchronizeAutoStorageKeys", nil, "Failure preparing request") + return + } + + resp, err := client.SynchronizeAutoStorageKeysSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.AccountClient", "SynchronizeAutoStorageKeys", resp, "Failure sending request") + return + } + + result, err = client.SynchronizeAutoStorageKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "SynchronizeAutoStorageKeys", resp, "Failure responding to request") + return + } + + return +} + +// SynchronizeAutoStorageKeysPreparer prepares the SynchronizeAutoStorageKeys request. +func (client AccountClient) SynchronizeAutoStorageKeysPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/syncAutoStorageKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SynchronizeAutoStorageKeysSender sends the SynchronizeAutoStorageKeys request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) SynchronizeAutoStorageKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// SynchronizeAutoStorageKeysResponder handles the response to the SynchronizeAutoStorageKeys request. The method always +// closes the http.Response Body. +func (client AccountClient) SynchronizeAutoStorageKeysResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update updates the properties of an existing Batch account. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// parameters - additional parameters for account update. +func (client AccountClient) Update(ctx context.Context, resourceGroupName string, accountName string, parameters AccountUpdateParameters) (result Account, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.AccountClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AccountClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, parameters AccountUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AccountClient) UpdateResponder(resp *http.Response) (result Account, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/batch/mgmt/2022-01-01/batch/application.go b/services/batch/mgmt/2022-01-01/batch/application.go new file mode 100644 index 000000000000..d7019f9a7f45 --- /dev/null +++ b/services/batch/mgmt/2022-01-01/batch/application.go @@ -0,0 +1,530 @@ +package batch + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ApplicationClient is the batch Client +type ApplicationClient struct { + BaseClient +} + +// NewApplicationClient creates an instance of the ApplicationClient client. +func NewApplicationClient(subscriptionID string) ApplicationClient { + return NewApplicationClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewApplicationClientWithBaseURI creates an instance of the ApplicationClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewApplicationClientWithBaseURI(baseURI string, subscriptionID string) ApplicationClient { + return ApplicationClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create adds an application to the specified Batch account. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// applicationName - the name of the application. This must be unique within the account. +// parameters - the parameters for the request. +func (client ApplicationClient) Create(ctx context.Context, resourceGroupName string, accountName string, applicationName string, parameters *Application) (result Application, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: applicationName, + Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.ApplicationClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, applicationName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ApplicationClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, parameters *Application) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "applicationName": autorest.Encode("path", applicationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ApplicationClient) CreateResponder(resp *http.Response) (result Application, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an application. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// applicationName - the name of the application. This must be unique within the account. +func (client ApplicationClient) Delete(ctx context.Context, resourceGroupName string, accountName string, applicationName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: applicationName, + Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.ApplicationClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, applicationName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ApplicationClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "applicationName": autorest.Encode("path", applicationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ApplicationClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about the specified application. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// applicationName - the name of the application. This must be unique within the account. +func (client ApplicationClient) Get(ctx context.Context, resourceGroupName string, accountName string, applicationName string) (result Application, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: applicationName, + Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.ApplicationClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, applicationName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ApplicationClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "applicationName": autorest.Encode("path", applicationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ApplicationClient) GetResponder(resp *http.Response) (result Application, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all of the applications in the specified account. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// maxresults - the maximum number of items to return in the response. +func (client ApplicationClient) List(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result ListApplicationsResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.List") + defer func() { + sc := -1 + if result.lar.Response.Response != nil { + sc = result.lar.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.ApplicationClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, accountName, maxresults) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lar.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", resp, "Failure sending request") + return + } + + result.lar, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", resp, "Failure responding to request") + return + } + if result.lar.hasNextLink() && result.lar.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ApplicationClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ApplicationClient) ListResponder(resp *http.Response) (result ListApplicationsResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ApplicationClient) listNextResults(ctx context.Context, lastResults ListApplicationsResult) (result ListApplicationsResult, err error) { + req, err := lastResults.listApplicationsResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.ApplicationClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.ApplicationClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ApplicationClient) ListComplete(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result ListApplicationsResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, accountName, maxresults) + return +} + +// Update updates settings for the specified application. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// applicationName - the name of the application. This must be unique within the account. +// parameters - the parameters for the request. +func (client ApplicationClient) Update(ctx context.Context, resourceGroupName string, accountName string, applicationName string, parameters Application) (result Application, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: applicationName, + Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.ApplicationClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, applicationName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ApplicationClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, parameters Application) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "applicationName": autorest.Encode("path", applicationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ApplicationClient) UpdateResponder(resp *http.Response) (result Application, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/batch/mgmt/2022-01-01/batch/applicationpackage.go b/services/batch/mgmt/2022-01-01/batch/applicationpackage.go new file mode 100644 index 000000000000..eb01a9e23848 --- /dev/null +++ b/services/batch/mgmt/2022-01-01/batch/applicationpackage.go @@ -0,0 +1,566 @@ +package batch + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ApplicationPackageClient is the batch Client +type ApplicationPackageClient struct { + BaseClient +} + +// NewApplicationPackageClient creates an instance of the ApplicationPackageClient client. +func NewApplicationPackageClient(subscriptionID string) ApplicationPackageClient { + return NewApplicationPackageClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewApplicationPackageClientWithBaseURI creates an instance of the ApplicationPackageClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewApplicationPackageClientWithBaseURI(baseURI string, subscriptionID string) ApplicationPackageClient { + return ApplicationPackageClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Activate activates the specified application package. This should be done after the `ApplicationPackage` was created +// and uploaded. This needs to be done before an `ApplicationPackage` can be used on Pools or Tasks. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// applicationName - the name of the application. This must be unique within the account. +// versionName - the version of the application. +// parameters - the parameters for the request. +func (client ApplicationPackageClient) Activate(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string, parameters ActivateApplicationPackageParameters) (result ApplicationPackage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationPackageClient.Activate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: applicationName, + Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}, + {TargetValue: versionName, + Constraints: []validation.Constraint{{Target: "versionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "versionName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "versionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Format", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.ApplicationPackageClient", "Activate", err.Error()) + } + + req, err := client.ActivatePreparer(ctx, resourceGroupName, accountName, applicationName, versionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Activate", nil, "Failure preparing request") + return + } + + resp, err := client.ActivateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Activate", resp, "Failure sending request") + return + } + + result, err = client.ActivateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Activate", resp, "Failure responding to request") + return + } + + return +} + +// ActivatePreparer prepares the Activate request. +func (client ApplicationPackageClient) ActivatePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string, parameters ActivateApplicationPackageParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "applicationName": autorest.Encode("path", applicationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "versionName": autorest.Encode("path", versionName), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}/activate", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ActivateSender sends the Activate request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationPackageClient) ActivateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ActivateResponder handles the response to the Activate request. The method always +// closes the http.Response Body. +func (client ApplicationPackageClient) ActivateResponder(resp *http.Response) (result ApplicationPackage, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Create creates an application package record. The record contains a storageUrl where the package should be uploaded +// to. Once it is uploaded the `ApplicationPackage` needs to be activated using `ApplicationPackageActive` before it +// can be used. If the auto storage account was configured to use storage keys, the URL returned will contain a SAS. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// applicationName - the name of the application. This must be unique within the account. +// versionName - the version of the application. +// parameters - the parameters for the request. +func (client ApplicationPackageClient) Create(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string, parameters *ApplicationPackage) (result ApplicationPackage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationPackageClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: applicationName, + Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}, + {TargetValue: versionName, + Constraints: []validation.Constraint{{Target: "versionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "versionName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "versionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.ApplicationPackageClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, applicationName, versionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ApplicationPackageClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string, parameters *ApplicationPackage) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "applicationName": autorest.Encode("path", applicationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "versionName": autorest.Encode("path", versionName), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationPackageClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ApplicationPackageClient) CreateResponder(resp *http.Response) (result ApplicationPackage, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an application package record and its associated binary file. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// applicationName - the name of the application. This must be unique within the account. +// versionName - the version of the application. +func (client ApplicationPackageClient) Delete(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationPackageClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: applicationName, + Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}, + {TargetValue: versionName, + Constraints: []validation.Constraint{{Target: "versionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "versionName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "versionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.ApplicationPackageClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, applicationName, versionName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ApplicationPackageClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "applicationName": autorest.Encode("path", applicationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "versionName": autorest.Encode("path", versionName), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationPackageClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ApplicationPackageClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about the specified application package. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// applicationName - the name of the application. This must be unique within the account. +// versionName - the version of the application. +func (client ApplicationPackageClient) Get(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string) (result ApplicationPackage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationPackageClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: applicationName, + Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}, + {TargetValue: versionName, + Constraints: []validation.Constraint{{Target: "versionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "versionName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "versionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.ApplicationPackageClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, applicationName, versionName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ApplicationPackageClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "applicationName": autorest.Encode("path", applicationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "versionName": autorest.Encode("path", versionName), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationPackageClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ApplicationPackageClient) GetResponder(resp *http.Response) (result ApplicationPackage, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all of the application packages in the specified application. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// applicationName - the name of the application. This must be unique within the account. +// maxresults - the maximum number of items to return in the response. +func (client ApplicationPackageClient) List(ctx context.Context, resourceGroupName string, accountName string, applicationName string, maxresults *int32) (result ListApplicationPackagesResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationPackageClient.List") + defer func() { + sc := -1 + if result.lapr.Response.Response != nil { + sc = result.lapr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: applicationName, + Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.ApplicationPackageClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, accountName, applicationName, maxresults) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lapr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "List", resp, "Failure sending request") + return + } + + result.lapr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "List", resp, "Failure responding to request") + return + } + if result.lapr.hasNextLink() && result.lapr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ApplicationPackageClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, maxresults *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "applicationName": autorest.Encode("path", applicationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationPackageClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ApplicationPackageClient) ListResponder(resp *http.Response) (result ListApplicationPackagesResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ApplicationPackageClient) listNextResults(ctx context.Context, lastResults ListApplicationPackagesResult) (result ListApplicationPackagesResult, err error) { + req, err := lastResults.listApplicationPackagesResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ApplicationPackageClient) ListComplete(ctx context.Context, resourceGroupName string, accountName string, applicationName string, maxresults *int32) (result ListApplicationPackagesResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationPackageClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, accountName, applicationName, maxresults) + return +} diff --git a/services/batch/mgmt/2022-01-01/batch/batchapi/interfaces.go b/services/batch/mgmt/2022-01-01/batch/batchapi/interfaces.go new file mode 100644 index 000000000000..6954008ae12b --- /dev/null +++ b/services/batch/mgmt/2022-01-01/batch/batchapi/interfaces.go @@ -0,0 +1,125 @@ +package batchapi + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch" + "github.com/Azure/go-autorest/autorest" +) + +// AccountClientAPI contains the set of methods on the AccountClient type. +type AccountClientAPI interface { + Create(ctx context.Context, resourceGroupName string, accountName string, parameters batch.AccountCreateParameters) (result batch.AccountCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, accountName string) (result batch.AccountDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, accountName string) (result batch.Account, err error) + GetDetector(ctx context.Context, resourceGroupName string, accountName string, detectorID string) (result batch.DetectorResponse, err error) + GetKeys(ctx context.Context, resourceGroupName string, accountName string) (result batch.AccountKeys, err error) + List(ctx context.Context) (result batch.AccountListResultPage, err error) + ListComplete(ctx context.Context) (result batch.AccountListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result batch.AccountListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result batch.AccountListResultIterator, err error) + ListDetectors(ctx context.Context, resourceGroupName string, accountName string) (result batch.DetectorListResultPage, err error) + ListDetectorsComplete(ctx context.Context, resourceGroupName string, accountName string) (result batch.DetectorListResultIterator, err error) + ListOutboundNetworkDependenciesEndpoints(ctx context.Context, resourceGroupName string, accountName string) (result batch.OutboundEnvironmentEndpointCollectionPage, err error) + ListOutboundNetworkDependenciesEndpointsComplete(ctx context.Context, resourceGroupName string, accountName string) (result batch.OutboundEnvironmentEndpointCollectionIterator, err error) + RegenerateKey(ctx context.Context, resourceGroupName string, accountName string, parameters batch.AccountRegenerateKeyParameters) (result batch.AccountKeys, err error) + SynchronizeAutoStorageKeys(ctx context.Context, resourceGroupName string, accountName string) (result autorest.Response, err error) + Update(ctx context.Context, resourceGroupName string, accountName string, parameters batch.AccountUpdateParameters) (result batch.Account, err error) +} + +var _ AccountClientAPI = (*batch.AccountClient)(nil) + +// ApplicationPackageClientAPI contains the set of methods on the ApplicationPackageClient type. +type ApplicationPackageClientAPI interface { + Activate(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string, parameters batch.ActivateApplicationPackageParameters) (result batch.ApplicationPackage, err error) + Create(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string, parameters *batch.ApplicationPackage) (result batch.ApplicationPackage, err error) + Delete(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string) (result batch.ApplicationPackage, err error) + List(ctx context.Context, resourceGroupName string, accountName string, applicationName string, maxresults *int32) (result batch.ListApplicationPackagesResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, accountName string, applicationName string, maxresults *int32) (result batch.ListApplicationPackagesResultIterator, err error) +} + +var _ ApplicationPackageClientAPI = (*batch.ApplicationPackageClient)(nil) + +// ApplicationClientAPI contains the set of methods on the ApplicationClient type. +type ApplicationClientAPI interface { + Create(ctx context.Context, resourceGroupName string, accountName string, applicationName string, parameters *batch.Application) (result batch.Application, err error) + Delete(ctx context.Context, resourceGroupName string, accountName string, applicationName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, accountName string, applicationName string) (result batch.Application, err error) + List(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result batch.ListApplicationsResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result batch.ListApplicationsResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, accountName string, applicationName string, parameters batch.Application) (result batch.Application, err error) +} + +var _ ApplicationClientAPI = (*batch.ApplicationClient)(nil) + +// LocationClientAPI contains the set of methods on the LocationClient type. +type LocationClientAPI interface { + CheckNameAvailability(ctx context.Context, locationName string, parameters batch.CheckNameAvailabilityParameters) (result batch.CheckNameAvailabilityResult, err error) + GetQuotas(ctx context.Context, locationName string) (result batch.LocationQuota, err error) + ListSupportedCloudServiceSkus(ctx context.Context, locationName string, maxresults *int32, filter string) (result batch.SupportedSkusResultPage, err error) + ListSupportedCloudServiceSkusComplete(ctx context.Context, locationName string, maxresults *int32, filter string) (result batch.SupportedSkusResultIterator, err error) + ListSupportedVirtualMachineSkus(ctx context.Context, locationName string, maxresults *int32, filter string) (result batch.SupportedSkusResultPage, err error) + ListSupportedVirtualMachineSkusComplete(ctx context.Context, locationName string, maxresults *int32, filter string) (result batch.SupportedSkusResultIterator, err error) +} + +var _ LocationClientAPI = (*batch.LocationClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result batch.OperationListResultPage, err error) + ListComplete(ctx context.Context) (result batch.OperationListResultIterator, err error) +} + +var _ OperationsClientAPI = (*batch.OperationsClient)(nil) + +// CertificateClientAPI contains the set of methods on the CertificateClient type. +type CertificateClientAPI interface { + CancelDeletion(ctx context.Context, resourceGroupName string, accountName string, certificateName string) (result batch.Certificate, err error) + Create(ctx context.Context, resourceGroupName string, accountName string, certificateName string, parameters batch.CertificateCreateOrUpdateParameters, ifMatch string, ifNoneMatch string) (result batch.Certificate, err error) + Delete(ctx context.Context, resourceGroupName string, accountName string, certificateName string) (result batch.CertificateDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, accountName string, certificateName string) (result batch.Certificate, err error) + ListByBatchAccount(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (result batch.ListCertificatesResultPage, err error) + ListByBatchAccountComplete(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (result batch.ListCertificatesResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, accountName string, certificateName string, parameters batch.CertificateCreateOrUpdateParameters, ifMatch string) (result batch.Certificate, err error) +} + +var _ CertificateClientAPI = (*batch.CertificateClient)(nil) + +// PrivateLinkResourceClientAPI contains the set of methods on the PrivateLinkResourceClient type. +type PrivateLinkResourceClientAPI interface { + Get(ctx context.Context, resourceGroupName string, accountName string, privateLinkResourceName string) (result batch.PrivateLinkResource, err error) + ListByBatchAccount(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result batch.ListPrivateLinkResourcesResultPage, err error) + ListByBatchAccountComplete(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result batch.ListPrivateLinkResourcesResultIterator, err error) +} + +var _ PrivateLinkResourceClientAPI = (*batch.PrivateLinkResourceClient)(nil) + +// PrivateEndpointConnectionClientAPI contains the set of methods on the PrivateEndpointConnectionClient type. +type PrivateEndpointConnectionClientAPI interface { + Get(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result batch.PrivateEndpointConnection, err error) + ListByBatchAccount(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result batch.ListPrivateEndpointConnectionsResultPage, err error) + ListByBatchAccountComplete(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result batch.ListPrivateEndpointConnectionsResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters batch.PrivateEndpointConnection, ifMatch string) (result batch.PrivateEndpointConnectionUpdateFuture, err error) +} + +var _ PrivateEndpointConnectionClientAPI = (*batch.PrivateEndpointConnectionClient)(nil) + +// PoolClientAPI contains the set of methods on the PoolClient type. +type PoolClientAPI interface { + Create(ctx context.Context, resourceGroupName string, accountName string, poolName string, parameters batch.Pool, ifMatch string, ifNoneMatch string) (result batch.Pool, err error) + Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result batch.PoolDeleteFuture, err error) + DisableAutoScale(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result batch.Pool, err error) + Get(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result batch.Pool, err error) + ListByBatchAccount(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (result batch.ListPoolsResultPage, err error) + ListByBatchAccountComplete(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (result batch.ListPoolsResultIterator, err error) + StopResize(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result batch.Pool, err error) + Update(ctx context.Context, resourceGroupName string, accountName string, poolName string, parameters batch.Pool, ifMatch string) (result batch.Pool, err error) +} + +var _ PoolClientAPI = (*batch.PoolClient)(nil) diff --git a/services/batch/mgmt/2022-01-01/batch/certificate.go b/services/batch/mgmt/2022-01-01/batch/certificate.go new file mode 100644 index 000000000000..4e9e43a2a2ab --- /dev/null +++ b/services/batch/mgmt/2022-01-01/batch/certificate.go @@ -0,0 +1,660 @@ +package batch + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// CertificateClient is the batch Client +type CertificateClient struct { + BaseClient +} + +// NewCertificateClient creates an instance of the CertificateClient client. +func NewCertificateClient(subscriptionID string) CertificateClient { + return NewCertificateClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCertificateClientWithBaseURI creates an instance of the CertificateClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewCertificateClientWithBaseURI(baseURI string, subscriptionID string) CertificateClient { + return CertificateClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CancelDeletion if you try to delete a certificate that is being used by a pool or compute node, the status of the +// certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this +// operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not +// need to run this operation after the deletion failed. You must make sure that the certificate is not being used by +// any resources, and then you can try again to delete the certificate. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// certificateName - the identifier for the certificate. This must be made up of algorithm and thumbprint +// separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. +func (client CertificateClient) CancelDeletion(ctx context.Context, resourceGroupName string, accountName string, certificateName string) (result Certificate, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.CancelDeletion") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: certificateName, + Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.MaxLength, Rule: 45, Chain: nil}, + {Target: "certificateName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "certificateName", Name: validation.Pattern, Rule: `^[\w]+-[\w]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.CertificateClient", "CancelDeletion", err.Error()) + } + + req, err := client.CancelDeletionPreparer(ctx, resourceGroupName, accountName, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "CancelDeletion", nil, "Failure preparing request") + return + } + + resp, err := client.CancelDeletionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "CancelDeletion", resp, "Failure sending request") + return + } + + result, err = client.CancelDeletionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "CancelDeletion", resp, "Failure responding to request") + return + } + + return +} + +// CancelDeletionPreparer prepares the CancelDeletion request. +func (client CertificateClient) CancelDeletionPreparer(ctx context.Context, resourceGroupName string, accountName string, certificateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "certificateName": autorest.Encode("path", certificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}/cancelDelete", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CancelDeletionSender sends the CancelDeletion request. The method will close the +// http.Response Body if it receives an error. +func (client CertificateClient) CancelDeletionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CancelDeletionResponder handles the response to the CancelDeletion request. The method always +// closes the http.Response Body. +func (client CertificateClient) CancelDeletionResponder(resp *http.Response) (result Certificate, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Create creates a new certificate inside the specified account. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// certificateName - the identifier for the certificate. This must be made up of algorithm and thumbprint +// separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. +// parameters - additional parameters for certificate creation. +// ifMatch - the entity state (ETag) version of the certificate to update. A value of "*" can be used to apply +// the operation only if the certificate already exists. If omitted, this operation will always be applied. +// ifNoneMatch - set to '*' to allow a new certificate to be created, but to prevent updating an existing +// certificate. Other values will be ignored. +func (client CertificateClient) Create(ctx context.Context, resourceGroupName string, accountName string, certificateName string, parameters CertificateCreateOrUpdateParameters, ifMatch string, ifNoneMatch string) (result Certificate, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: certificateName, + Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.MaxLength, Rule: 45, Chain: nil}, + {Target: "certificateName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "certificateName", Name: validation.Pattern, Rule: `^[\w]+-[\w]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.CertificateCreateOrUpdateProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.CertificateCreateOrUpdateProperties.Data", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("batch.CertificateClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, certificateName, parameters, ifMatch, ifNoneMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client CertificateClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, certificateName string, parameters CertificateCreateOrUpdateParameters, ifMatch string, ifNoneMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "certificateName": autorest.Encode("path", certificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client CertificateClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client CertificateClient) CreateResponder(resp *http.Response) (result Certificate, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified certificate. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// certificateName - the identifier for the certificate. This must be made up of algorithm and thumbprint +// separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. +func (client CertificateClient) Delete(ctx context.Context, resourceGroupName string, accountName string, certificateName string) (result CertificateDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: certificateName, + Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.MaxLength, Rule: 45, Chain: nil}, + {Target: "certificateName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "certificateName", Name: validation.Pattern, Rule: `^[\w]+-[\w]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.CertificateClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client CertificateClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, certificateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "certificateName": autorest.Encode("path", certificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client CertificateClient) DeleteSender(req *http.Request) (future CertificateDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client CertificateClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about the specified certificate. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// certificateName - the identifier for the certificate. This must be made up of algorithm and thumbprint +// separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. +func (client CertificateClient) Get(ctx context.Context, resourceGroupName string, accountName string, certificateName string) (result Certificate, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: certificateName, + Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.MaxLength, Rule: 45, Chain: nil}, + {Target: "certificateName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "certificateName", Name: validation.Pattern, Rule: `^[\w]+-[\w]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.CertificateClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client CertificateClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, certificateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "certificateName": autorest.Encode("path", certificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client CertificateClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client CertificateClient) GetResponder(resp *http.Response) (result Certificate, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByBatchAccount lists all of the certificates in the specified account. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// maxresults - the maximum number of items to return in the response. +// selectParameter - comma separated list of properties that should be returned. e.g. +// "properties/provisioningState". Only top level properties under properties/ are valid for selection. +// filter - oData filter expression. Valid properties for filtering are "properties/provisioningState", +// "properties/provisioningStateTransitionTime", "name". +func (client CertificateClient) ListByBatchAccount(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (result ListCertificatesResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.ListByBatchAccount") + defer func() { + sc := -1 + if result.lcr.Response.Response != nil { + sc = result.lcr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.CertificateClient", "ListByBatchAccount", err.Error()) + } + + result.fn = client.listByBatchAccountNextResults + req, err := client.ListByBatchAccountPreparer(ctx, resourceGroupName, accountName, maxresults, selectParameter, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "ListByBatchAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByBatchAccountSender(req) + if err != nil { + result.lcr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "ListByBatchAccount", resp, "Failure sending request") + return + } + + result.lcr, err = client.ListByBatchAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "ListByBatchAccount", resp, "Failure responding to request") + return + } + if result.lcr.hasNextLink() && result.lcr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByBatchAccountPreparer prepares the ListByBatchAccount request. +func (client CertificateClient) ListByBatchAccountPreparer(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByBatchAccountSender sends the ListByBatchAccount request. The method will close the +// http.Response Body if it receives an error. +func (client CertificateClient) ListByBatchAccountSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByBatchAccountResponder handles the response to the ListByBatchAccount request. The method always +// closes the http.Response Body. +func (client CertificateClient) ListByBatchAccountResponder(resp *http.Response) (result ListCertificatesResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByBatchAccountNextResults retrieves the next set of results, if any. +func (client CertificateClient) listByBatchAccountNextResults(ctx context.Context, lastResults ListCertificatesResult) (result ListCertificatesResult, err error) { + req, err := lastResults.listCertificatesResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.CertificateClient", "listByBatchAccountNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByBatchAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.CertificateClient", "listByBatchAccountNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByBatchAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "listByBatchAccountNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByBatchAccountComplete enumerates all values, automatically crossing page boundaries as required. +func (client CertificateClient) ListByBatchAccountComplete(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (result ListCertificatesResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.ListByBatchAccount") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByBatchAccount(ctx, resourceGroupName, accountName, maxresults, selectParameter, filter) + return +} + +// Update updates the properties of an existing certificate. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// certificateName - the identifier for the certificate. This must be made up of algorithm and thumbprint +// separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. +// parameters - certificate entity to update. +// ifMatch - the entity state (ETag) version of the certificate to update. This value can be omitted or set to +// "*" to apply the operation unconditionally. +func (client CertificateClient) Update(ctx context.Context, resourceGroupName string, accountName string, certificateName string, parameters CertificateCreateOrUpdateParameters, ifMatch string) (result Certificate, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: certificateName, + Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.MaxLength, Rule: 45, Chain: nil}, + {Target: "certificateName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "certificateName", Name: validation.Pattern, Rule: `^[\w]+-[\w]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.CertificateClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, certificateName, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client CertificateClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, certificateName string, parameters CertificateCreateOrUpdateParameters, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "certificateName": autorest.Encode("path", certificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client CertificateClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client CertificateClient) UpdateResponder(resp *http.Response) (result Certificate, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/batch/mgmt/2022-01-01/batch/client.go b/services/batch/mgmt/2022-01-01/batch/client.go new file mode 100644 index 000000000000..aae03e039f8b --- /dev/null +++ b/services/batch/mgmt/2022-01-01/batch/client.go @@ -0,0 +1,41 @@ +// Package batch implements the Azure ARM Batch service API version 2022-01-01. +// +// Batch Client +package batch + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Batch + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Batch. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/batch/mgmt/2022-01-01/batch/enums.go b/services/batch/mgmt/2022-01-01/batch/enums.go new file mode 100644 index 000000000000..46526f60e854 --- /dev/null +++ b/services/batch/mgmt/2022-01-01/batch/enums.go @@ -0,0 +1,617 @@ +package batch + +// Copyright (c) Microsoft Corporation. All rights 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. + +// AccountKeyType enumerates the values for account key type. +type AccountKeyType string + +const ( + // AccountKeyTypePrimary The primary account key. + AccountKeyTypePrimary AccountKeyType = "Primary" + // AccountKeyTypeSecondary The secondary account key. + AccountKeyTypeSecondary AccountKeyType = "Secondary" +) + +// PossibleAccountKeyTypeValues returns an array of possible values for the AccountKeyType const type. +func PossibleAccountKeyTypeValues() []AccountKeyType { + return []AccountKeyType{AccountKeyTypePrimary, AccountKeyTypeSecondary} +} + +// AllocationState enumerates the values for allocation state. +type AllocationState string + +const ( + // AllocationStateResizing The pool is resizing; that is, compute nodes are being added to or removed from + // the pool. + AllocationStateResizing AllocationState = "Resizing" + // AllocationStateSteady The pool is not resizing. There are no changes to the number of nodes in the pool + // in progress. A pool enters this state when it is created and when no operations are being performed on + // the pool to change the number of nodes. + AllocationStateSteady AllocationState = "Steady" + // AllocationStateStopping The pool was resizing, but the user has requested that the resize be stopped, + // but the stop request has not yet been completed. + AllocationStateStopping AllocationState = "Stopping" +) + +// PossibleAllocationStateValues returns an array of possible values for the AllocationState const type. +func PossibleAllocationStateValues() []AllocationState { + return []AllocationState{AllocationStateResizing, AllocationStateSteady, AllocationStateStopping} +} + +// AuthenticationMode enumerates the values for authentication mode. +type AuthenticationMode string + +const ( + // AuthenticationModeAAD The authentication mode using Azure Active Directory. + AuthenticationModeAAD AuthenticationMode = "AAD" + // AuthenticationModeSharedKey The authentication mode using shared keys. + AuthenticationModeSharedKey AuthenticationMode = "SharedKey" + // AuthenticationModeTaskAuthenticationToken The authentication mode using task authentication tokens. + AuthenticationModeTaskAuthenticationToken AuthenticationMode = "TaskAuthenticationToken" +) + +// PossibleAuthenticationModeValues returns an array of possible values for the AuthenticationMode const type. +func PossibleAuthenticationModeValues() []AuthenticationMode { + return []AuthenticationMode{AuthenticationModeAAD, AuthenticationModeSharedKey, AuthenticationModeTaskAuthenticationToken} +} + +// AutoStorageAuthenticationMode enumerates the values for auto storage authentication mode. +type AutoStorageAuthenticationMode string + +const ( + // AutoStorageAuthenticationModeBatchAccountManagedIdentity The Batch service will authenticate requests to + // auto-storage using the managed identity assigned to the Batch account. + AutoStorageAuthenticationModeBatchAccountManagedIdentity AutoStorageAuthenticationMode = "BatchAccountManagedIdentity" + // AutoStorageAuthenticationModeStorageKeys The Batch service will authenticate requests to auto-storage + // using storage account keys. + AutoStorageAuthenticationModeStorageKeys AutoStorageAuthenticationMode = "StorageKeys" +) + +// PossibleAutoStorageAuthenticationModeValues returns an array of possible values for the AutoStorageAuthenticationMode const type. +func PossibleAutoStorageAuthenticationModeValues() []AutoStorageAuthenticationMode { + return []AutoStorageAuthenticationMode{AutoStorageAuthenticationModeBatchAccountManagedIdentity, AutoStorageAuthenticationModeStorageKeys} +} + +// AutoUserScope enumerates the values for auto user scope. +type AutoUserScope string + +const ( + // AutoUserScopePool Specifies that the task runs as the common auto user account which is created on every + // node in a pool. + AutoUserScopePool AutoUserScope = "Pool" + // AutoUserScopeTask Specifies that the service should create a new user for the task. + AutoUserScopeTask AutoUserScope = "Task" +) + +// PossibleAutoUserScopeValues returns an array of possible values for the AutoUserScope const type. +func PossibleAutoUserScopeValues() []AutoUserScope { + return []AutoUserScope{AutoUserScopePool, AutoUserScopeTask} +} + +// CachingType enumerates the values for caching type. +type CachingType string + +const ( + // CachingTypeNone The caching mode for the disk is not enabled. + CachingTypeNone CachingType = "None" + // CachingTypeReadOnly The caching mode for the disk is read only. + CachingTypeReadOnly CachingType = "ReadOnly" + // CachingTypeReadWrite The caching mode for the disk is read and write. + CachingTypeReadWrite CachingType = "ReadWrite" +) + +// PossibleCachingTypeValues returns an array of possible values for the CachingType const type. +func PossibleCachingTypeValues() []CachingType { + return []CachingType{CachingTypeNone, CachingTypeReadOnly, CachingTypeReadWrite} +} + +// CertificateFormat enumerates the values for certificate format. +type CertificateFormat string + +const ( + // CertificateFormatCer The certificate is a base64-encoded X.509 certificate. + CertificateFormatCer CertificateFormat = "Cer" + // CertificateFormatPfx The certificate is a PFX (PKCS#12) formatted certificate or certificate chain. + CertificateFormatPfx CertificateFormat = "Pfx" +) + +// PossibleCertificateFormatValues returns an array of possible values for the CertificateFormat const type. +func PossibleCertificateFormatValues() []CertificateFormat { + return []CertificateFormat{CertificateFormatCer, CertificateFormatPfx} +} + +// CertificateProvisioningState enumerates the values for certificate provisioning state. +type CertificateProvisioningState string + +const ( + // CertificateProvisioningStateDeleting The user has requested that the certificate be deleted, but the + // delete operation has not yet completed. You may not reference the certificate when creating or updating + // pools. + CertificateProvisioningStateDeleting CertificateProvisioningState = "Deleting" + // CertificateProvisioningStateFailed The user requested that the certificate be deleted, but there are + // pools that still have references to the certificate, or it is still installed on one or more compute + // nodes. (The latter can occur if the certificate has been removed from the pool, but the node has not yet + // restarted. Nodes refresh their certificates only when they restart.) You may use the cancel certificate + // delete operation to cancel the delete, or the delete certificate operation to retry the delete. + CertificateProvisioningStateFailed CertificateProvisioningState = "Failed" + // CertificateProvisioningStateSucceeded The certificate is available for use in pools. + CertificateProvisioningStateSucceeded CertificateProvisioningState = "Succeeded" +) + +// PossibleCertificateProvisioningStateValues returns an array of possible values for the CertificateProvisioningState const type. +func PossibleCertificateProvisioningStateValues() []CertificateProvisioningState { + return []CertificateProvisioningState{CertificateProvisioningStateDeleting, CertificateProvisioningStateFailed, CertificateProvisioningStateSucceeded} +} + +// CertificateStoreLocation enumerates the values for certificate store location. +type CertificateStoreLocation string + +const ( + // CertificateStoreLocationCurrentUser Certificates should be installed to the CurrentUser certificate + // store. + CertificateStoreLocationCurrentUser CertificateStoreLocation = "CurrentUser" + // CertificateStoreLocationLocalMachine Certificates should be installed to the LocalMachine certificate + // store. + CertificateStoreLocationLocalMachine CertificateStoreLocation = "LocalMachine" +) + +// PossibleCertificateStoreLocationValues returns an array of possible values for the CertificateStoreLocation const type. +func PossibleCertificateStoreLocationValues() []CertificateStoreLocation { + return []CertificateStoreLocation{CertificateStoreLocationCurrentUser, CertificateStoreLocationLocalMachine} +} + +// CertificateVisibility enumerates the values for certificate visibility. +type CertificateVisibility string + +const ( + // CertificateVisibilityRemoteUser The certificate should be visible to the user accounts under which users + // remotely access the node. + CertificateVisibilityRemoteUser CertificateVisibility = "RemoteUser" + // CertificateVisibilityStartTask The certificate should be visible to the user account under which the + // start task is run. Note that if AutoUser Scope is Pool for both the StartTask and a Task, this + // certificate will be visible to the Task as well. + CertificateVisibilityStartTask CertificateVisibility = "StartTask" + // CertificateVisibilityTask The certificate should be visible to the user accounts under which job tasks + // are run. + CertificateVisibilityTask CertificateVisibility = "Task" +) + +// PossibleCertificateVisibilityValues returns an array of possible values for the CertificateVisibility const type. +func PossibleCertificateVisibilityValues() []CertificateVisibility { + return []CertificateVisibility{CertificateVisibilityRemoteUser, CertificateVisibilityStartTask, CertificateVisibilityTask} +} + +// ComputeNodeDeallocationOption enumerates the values for compute node deallocation option. +type ComputeNodeDeallocationOption string + +const ( + // ComputeNodeDeallocationOptionRequeue Terminate running task processes and requeue the tasks. The tasks + // will run again when a node is available. Remove nodes as soon as tasks have been terminated. + ComputeNodeDeallocationOptionRequeue ComputeNodeDeallocationOption = "Requeue" + // ComputeNodeDeallocationOptionRetainedData Allow currently running tasks to complete, then wait for all + // task data retention periods to expire. Schedule no new tasks while waiting. Remove nodes when all task + // retention periods have expired. + ComputeNodeDeallocationOptionRetainedData ComputeNodeDeallocationOption = "RetainedData" + // ComputeNodeDeallocationOptionTaskCompletion Allow currently running tasks to complete. Schedule no new + // tasks while waiting. Remove nodes when all tasks have completed. + ComputeNodeDeallocationOptionTaskCompletion ComputeNodeDeallocationOption = "TaskCompletion" + // ComputeNodeDeallocationOptionTerminate Terminate running tasks. The tasks will be completed with + // failureInfo indicating that they were terminated, and will not run again. Remove nodes as soon as tasks + // have been terminated. + ComputeNodeDeallocationOptionTerminate ComputeNodeDeallocationOption = "Terminate" +) + +// PossibleComputeNodeDeallocationOptionValues returns an array of possible values for the ComputeNodeDeallocationOption const type. +func PossibleComputeNodeDeallocationOptionValues() []ComputeNodeDeallocationOption { + return []ComputeNodeDeallocationOption{ComputeNodeDeallocationOptionRequeue, ComputeNodeDeallocationOptionRetainedData, ComputeNodeDeallocationOptionTaskCompletion, ComputeNodeDeallocationOptionTerminate} +} + +// ComputeNodeFillType enumerates the values for compute node fill type. +type ComputeNodeFillType string + +const ( + // ComputeNodeFillTypePack As many tasks as possible (taskSlotsPerNode) should be assigned to each node in + // the pool before any tasks are assigned to the next node in the pool. + ComputeNodeFillTypePack ComputeNodeFillType = "Pack" + // ComputeNodeFillTypeSpread Tasks should be assigned evenly across all nodes in the pool. + ComputeNodeFillTypeSpread ComputeNodeFillType = "Spread" +) + +// PossibleComputeNodeFillTypeValues returns an array of possible values for the ComputeNodeFillType const type. +func PossibleComputeNodeFillTypeValues() []ComputeNodeFillType { + return []ComputeNodeFillType{ComputeNodeFillTypePack, ComputeNodeFillTypeSpread} +} + +// ContainerWorkingDirectory enumerates the values for container working directory. +type ContainerWorkingDirectory string + +const ( + // ContainerWorkingDirectoryContainerImageDefault Using container image defined working directory. Beware + // that this directory will not contain the resource files downloaded by Batch. + ContainerWorkingDirectoryContainerImageDefault ContainerWorkingDirectory = "ContainerImageDefault" + // ContainerWorkingDirectoryTaskWorkingDirectory Use the standard Batch service task working directory, + // which will contain the Task resource files populated by Batch. + ContainerWorkingDirectoryTaskWorkingDirectory ContainerWorkingDirectory = "TaskWorkingDirectory" +) + +// PossibleContainerWorkingDirectoryValues returns an array of possible values for the ContainerWorkingDirectory const type. +func PossibleContainerWorkingDirectoryValues() []ContainerWorkingDirectory { + return []ContainerWorkingDirectory{ContainerWorkingDirectoryContainerImageDefault, ContainerWorkingDirectoryTaskWorkingDirectory} +} + +// DiffDiskPlacement enumerates the values for diff disk placement. +type DiffDiskPlacement string + +const ( + // DiffDiskPlacementCacheDisk The Ephemeral OS Disk is stored on the VM cache. + DiffDiskPlacementCacheDisk DiffDiskPlacement = "CacheDisk" +) + +// PossibleDiffDiskPlacementValues returns an array of possible values for the DiffDiskPlacement const type. +func PossibleDiffDiskPlacementValues() []DiffDiskPlacement { + return []DiffDiskPlacement{DiffDiskPlacementCacheDisk} +} + +// DiskEncryptionTarget enumerates the values for disk encryption target. +type DiskEncryptionTarget string + +const ( + // DiskEncryptionTargetOsDisk The OS Disk on the compute node is encrypted. + DiskEncryptionTargetOsDisk DiskEncryptionTarget = "OsDisk" + // DiskEncryptionTargetTemporaryDisk The temporary disk on the compute node is encrypted. On Linux this + // encryption applies to other partitions (such as those on mounted data disks) when encryption occurs at + // boot time. + DiskEncryptionTargetTemporaryDisk DiskEncryptionTarget = "TemporaryDisk" +) + +// PossibleDiskEncryptionTargetValues returns an array of possible values for the DiskEncryptionTarget const type. +func PossibleDiskEncryptionTargetValues() []DiskEncryptionTarget { + return []DiskEncryptionTarget{DiskEncryptionTargetOsDisk, DiskEncryptionTargetTemporaryDisk} +} + +// DynamicVNetAssignmentScope enumerates the values for dynamic v net assignment scope. +type DynamicVNetAssignmentScope string + +const ( + // DynamicVNetAssignmentScopeJob Dynamic VNet assignment is done per-job. Don't use this option unless your + // batch account has been approved to use this feature. + DynamicVNetAssignmentScopeJob DynamicVNetAssignmentScope = "job" + // DynamicVNetAssignmentScopeNone No dynamic VNet assignment is enabled. + DynamicVNetAssignmentScopeNone DynamicVNetAssignmentScope = "none" +) + +// PossibleDynamicVNetAssignmentScopeValues returns an array of possible values for the DynamicVNetAssignmentScope const type. +func PossibleDynamicVNetAssignmentScopeValues() []DynamicVNetAssignmentScope { + return []DynamicVNetAssignmentScope{DynamicVNetAssignmentScopeJob, DynamicVNetAssignmentScopeNone} +} + +// ElevationLevel enumerates the values for elevation level. +type ElevationLevel string + +const ( + // ElevationLevelAdmin The user is a user with elevated access and operates with full Administrator + // permissions. + ElevationLevelAdmin ElevationLevel = "Admin" + // ElevationLevelNonAdmin The user is a standard user without elevated access. + ElevationLevelNonAdmin ElevationLevel = "NonAdmin" +) + +// PossibleElevationLevelValues returns an array of possible values for the ElevationLevel const type. +func PossibleElevationLevelValues() []ElevationLevel { + return []ElevationLevel{ElevationLevelAdmin, ElevationLevelNonAdmin} +} + +// InboundEndpointProtocol enumerates the values for inbound endpoint protocol. +type InboundEndpointProtocol string + +const ( + // InboundEndpointProtocolTCP Use TCP for the endpoint. + InboundEndpointProtocolTCP InboundEndpointProtocol = "TCP" + // InboundEndpointProtocolUDP Use UDP for the endpoint. + InboundEndpointProtocolUDP InboundEndpointProtocol = "UDP" +) + +// PossibleInboundEndpointProtocolValues returns an array of possible values for the InboundEndpointProtocol const type. +func PossibleInboundEndpointProtocolValues() []InboundEndpointProtocol { + return []InboundEndpointProtocol{InboundEndpointProtocolTCP, InboundEndpointProtocolUDP} +} + +// InterNodeCommunicationState enumerates the values for inter node communication state. +type InterNodeCommunicationState string + +const ( + // InterNodeCommunicationStateDisabled Disable network communication between virtual machines. + InterNodeCommunicationStateDisabled InterNodeCommunicationState = "Disabled" + // InterNodeCommunicationStateEnabled Enable network communication between virtual machines. + InterNodeCommunicationStateEnabled InterNodeCommunicationState = "Enabled" +) + +// PossibleInterNodeCommunicationStateValues returns an array of possible values for the InterNodeCommunicationState const type. +func PossibleInterNodeCommunicationStateValues() []InterNodeCommunicationState { + return []InterNodeCommunicationState{InterNodeCommunicationStateDisabled, InterNodeCommunicationStateEnabled} +} + +// IPAddressProvisioningType enumerates the values for ip address provisioning type. +type IPAddressProvisioningType string + +const ( + // IPAddressProvisioningTypeBatchManaged A public IP will be created and managed by Batch. There may be + // multiple public IPs depending on the size of the Pool. + IPAddressProvisioningTypeBatchManaged IPAddressProvisioningType = "BatchManaged" + // IPAddressProvisioningTypeNoPublicIPAddresses No public IP Address will be created for the Compute Nodes + // in the Pool. + IPAddressProvisioningTypeNoPublicIPAddresses IPAddressProvisioningType = "NoPublicIPAddresses" + // IPAddressProvisioningTypeUserManaged Public IPs are provided by the user and will be used to provision + // the Compute Nodes. + IPAddressProvisioningTypeUserManaged IPAddressProvisioningType = "UserManaged" +) + +// PossibleIPAddressProvisioningTypeValues returns an array of possible values for the IPAddressProvisioningType const type. +func PossibleIPAddressProvisioningTypeValues() []IPAddressProvisioningType { + return []IPAddressProvisioningType{IPAddressProvisioningTypeBatchManaged, IPAddressProvisioningTypeNoPublicIPAddresses, IPAddressProvisioningTypeUserManaged} +} + +// KeySource enumerates the values for key source. +type KeySource string + +const ( + // KeySourceMicrosoftBatch Batch creates and manages the encryption keys used to protect the account data. + KeySourceMicrosoftBatch KeySource = "Microsoft.Batch" + // KeySourceMicrosoftKeyVault The encryption keys used to protect the account data are stored in an + // external key vault. If this is set then the Batch Account identity must be set to `SystemAssigned` and a + // valid Key Identifier must also be supplied under the keyVaultProperties. + KeySourceMicrosoftKeyVault KeySource = "Microsoft.KeyVault" +) + +// PossibleKeySourceValues returns an array of possible values for the KeySource const type. +func PossibleKeySourceValues() []KeySource { + return []KeySource{KeySourceMicrosoftBatch, KeySourceMicrosoftKeyVault} +} + +// LoginMode enumerates the values for login mode. +type LoginMode string + +const ( + // LoginModeBatch The LOGON32_LOGON_BATCH Win32 login mode. The batch login mode is recommended for long + // running parallel processes. + LoginModeBatch LoginMode = "Batch" + // LoginModeInteractive The LOGON32_LOGON_INTERACTIVE Win32 login mode. Some applications require having + // permissions associated with the interactive login mode. If this is the case for an application used in + // your task, then this option is recommended. + LoginModeInteractive LoginMode = "Interactive" +) + +// PossibleLoginModeValues returns an array of possible values for the LoginMode const type. +func PossibleLoginModeValues() []LoginMode { + return []LoginMode{LoginModeBatch, LoginModeInteractive} +} + +// NameAvailabilityReason enumerates the values for name availability reason. +type NameAvailabilityReason string + +const ( + // NameAvailabilityReasonAlreadyExists The requested name is already in use. + NameAvailabilityReasonAlreadyExists NameAvailabilityReason = "AlreadyExists" + // NameAvailabilityReasonInvalid The requested name is invalid. + NameAvailabilityReasonInvalid NameAvailabilityReason = "Invalid" +) + +// PossibleNameAvailabilityReasonValues returns an array of possible values for the NameAvailabilityReason const type. +func PossibleNameAvailabilityReasonValues() []NameAvailabilityReason { + return []NameAvailabilityReason{NameAvailabilityReasonAlreadyExists, NameAvailabilityReasonInvalid} +} + +// NetworkSecurityGroupRuleAccess enumerates the values for network security group rule access. +type NetworkSecurityGroupRuleAccess string + +const ( + // NetworkSecurityGroupRuleAccessAllow Allow access. + NetworkSecurityGroupRuleAccessAllow NetworkSecurityGroupRuleAccess = "Allow" + // NetworkSecurityGroupRuleAccessDeny Deny access. + NetworkSecurityGroupRuleAccessDeny NetworkSecurityGroupRuleAccess = "Deny" +) + +// PossibleNetworkSecurityGroupRuleAccessValues returns an array of possible values for the NetworkSecurityGroupRuleAccess const type. +func PossibleNetworkSecurityGroupRuleAccessValues() []NetworkSecurityGroupRuleAccess { + return []NetworkSecurityGroupRuleAccess{NetworkSecurityGroupRuleAccessAllow, NetworkSecurityGroupRuleAccessDeny} +} + +// NodePlacementPolicyType enumerates the values for node placement policy type. +type NodePlacementPolicyType string + +const ( + // NodePlacementPolicyTypeRegional All nodes in the pool will be allocated in the same region. + NodePlacementPolicyTypeRegional NodePlacementPolicyType = "Regional" + // NodePlacementPolicyTypeZonal Nodes in the pool will be spread across different zones with best effort + // balancing. + NodePlacementPolicyTypeZonal NodePlacementPolicyType = "Zonal" +) + +// PossibleNodePlacementPolicyTypeValues returns an array of possible values for the NodePlacementPolicyType const type. +func PossibleNodePlacementPolicyTypeValues() []NodePlacementPolicyType { + return []NodePlacementPolicyType{NodePlacementPolicyTypeRegional, NodePlacementPolicyTypeZonal} +} + +// PackageState enumerates the values for package state. +type PackageState string + +const ( + // PackageStateActive The application package is ready for use. + PackageStateActive PackageState = "Active" + // PackageStatePending The application package has been created but has not yet been activated. + PackageStatePending PackageState = "Pending" +) + +// PossiblePackageStateValues returns an array of possible values for the PackageState const type. +func PossiblePackageStateValues() []PackageState { + return []PackageState{PackageStateActive, PackageStatePending} +} + +// PoolAllocationMode enumerates the values for pool allocation mode. +type PoolAllocationMode string + +const ( + // PoolAllocationModeBatchService Pools will be allocated in subscriptions owned by the Batch service. + PoolAllocationModeBatchService PoolAllocationMode = "BatchService" + // PoolAllocationModeUserSubscription Pools will be allocated in a subscription owned by the user. + PoolAllocationModeUserSubscription PoolAllocationMode = "UserSubscription" +) + +// PossiblePoolAllocationModeValues returns an array of possible values for the PoolAllocationMode const type. +func PossiblePoolAllocationModeValues() []PoolAllocationMode { + return []PoolAllocationMode{PoolAllocationModeBatchService, PoolAllocationModeUserSubscription} +} + +// PoolIdentityType enumerates the values for pool identity type. +type PoolIdentityType string + +const ( + // PoolIdentityTypeNone Batch pool has no identity associated with it. Setting `None` in update pool will + // remove existing identities. + PoolIdentityTypeNone PoolIdentityType = "None" + // PoolIdentityTypeUserAssigned Batch pool has user assigned identities with it. + PoolIdentityTypeUserAssigned PoolIdentityType = "UserAssigned" +) + +// PossiblePoolIdentityTypeValues returns an array of possible values for the PoolIdentityType const type. +func PossiblePoolIdentityTypeValues() []PoolIdentityType { + return []PoolIdentityType{PoolIdentityTypeNone, PoolIdentityTypeUserAssigned} +} + +// PoolProvisioningState enumerates the values for pool provisioning state. +type PoolProvisioningState string + +const ( + // PoolProvisioningStateDeleting The user has requested that the pool be deleted, but the delete operation + // has not yet completed. + PoolProvisioningStateDeleting PoolProvisioningState = "Deleting" + // PoolProvisioningStateSucceeded The pool is available to run tasks subject to the availability of compute + // nodes. + PoolProvisioningStateSucceeded PoolProvisioningState = "Succeeded" +) + +// PossiblePoolProvisioningStateValues returns an array of possible values for the PoolProvisioningState const type. +func PossiblePoolProvisioningStateValues() []PoolProvisioningState { + return []PoolProvisioningState{PoolProvisioningStateDeleting, PoolProvisioningStateSucceeded} +} + +// PrivateEndpointConnectionProvisioningState enumerates the values for private endpoint connection +// provisioning state. +type PrivateEndpointConnectionProvisioningState string + +const ( + // PrivateEndpointConnectionProvisioningStateFailed The user requested that the connection be updated and + // it failed. You may retry the update operation. + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + // PrivateEndpointConnectionProvisioningStateSucceeded The connection status is final and is ready for use + // if Status is Approved. + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" + // PrivateEndpointConnectionProvisioningStateUpdating The user has requested that the connection status be + // updated, but the update operation has not yet completed. You may not reference the connection when + // connecting the Batch account. + PrivateEndpointConnectionProvisioningStateUpdating PrivateEndpointConnectionProvisioningState = "Updating" +) + +// PossiblePrivateEndpointConnectionProvisioningStateValues returns an array of possible values for the PrivateEndpointConnectionProvisioningState const type. +func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { + return []PrivateEndpointConnectionProvisioningState{PrivateEndpointConnectionProvisioningStateFailed, PrivateEndpointConnectionProvisioningStateSucceeded, PrivateEndpointConnectionProvisioningStateUpdating} +} + +// PrivateLinkServiceConnectionStatus enumerates the values for private link service connection status. +type PrivateLinkServiceConnectionStatus string + +const ( + // PrivateLinkServiceConnectionStatusApproved The private endpoint connection is approved and can be used + // to access Batch account + PrivateLinkServiceConnectionStatusApproved PrivateLinkServiceConnectionStatus = "Approved" + // PrivateLinkServiceConnectionStatusDisconnected The private endpoint connection is disconnected and + // cannot be used to access Batch account + PrivateLinkServiceConnectionStatusDisconnected PrivateLinkServiceConnectionStatus = "Disconnected" + // PrivateLinkServiceConnectionStatusPending The private endpoint connection is pending and cannot be used + // to access Batch account + PrivateLinkServiceConnectionStatusPending PrivateLinkServiceConnectionStatus = "Pending" + // PrivateLinkServiceConnectionStatusRejected The private endpoint connection is rejected and cannot be + // used to access Batch account + PrivateLinkServiceConnectionStatusRejected PrivateLinkServiceConnectionStatus = "Rejected" +) + +// PossiblePrivateLinkServiceConnectionStatusValues returns an array of possible values for the PrivateLinkServiceConnectionStatus const type. +func PossiblePrivateLinkServiceConnectionStatusValues() []PrivateLinkServiceConnectionStatus { + return []PrivateLinkServiceConnectionStatus{PrivateLinkServiceConnectionStatusApproved, PrivateLinkServiceConnectionStatusDisconnected, PrivateLinkServiceConnectionStatusPending, PrivateLinkServiceConnectionStatusRejected} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateCancelled The last operation for the account is cancelled. + ProvisioningStateCancelled ProvisioningState = "Cancelled" + // ProvisioningStateCreating The account is being created. + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleting The account is being deleted. + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed The last operation for the account is failed. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateInvalid The account is in an invalid state. + ProvisioningStateInvalid ProvisioningState = "Invalid" + // ProvisioningStateSucceeded The account has been created and is ready for use. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateCancelled, ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateInvalid, ProvisioningStateSucceeded} +} + +// PublicNetworkAccessType enumerates the values for public network access type. +type PublicNetworkAccessType string + +const ( + // PublicNetworkAccessTypeDisabled Disables public connectivity and enables private connectivity to Azure + // Batch Service through private endpoint resource. + PublicNetworkAccessTypeDisabled PublicNetworkAccessType = "Disabled" + // PublicNetworkAccessTypeEnabled Enables connectivity to Azure Batch through public DNS. + PublicNetworkAccessTypeEnabled PublicNetworkAccessType = "Enabled" +) + +// PossiblePublicNetworkAccessTypeValues returns an array of possible values for the PublicNetworkAccessType const type. +func PossiblePublicNetworkAccessTypeValues() []PublicNetworkAccessType { + return []PublicNetworkAccessType{PublicNetworkAccessTypeDisabled, PublicNetworkAccessTypeEnabled} +} + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // ResourceIdentityTypeNone Batch account has no identity associated with it. Setting `None` in update + // account will remove existing identities. + ResourceIdentityTypeNone ResourceIdentityType = "None" + // ResourceIdentityTypeSystemAssigned Batch account has a system assigned identity with it. + ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" + // ResourceIdentityTypeUserAssigned Batch account has user assigned identities with it. + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" +) + +// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, ResourceIdentityTypeUserAssigned} +} + +// StorageAccountType enumerates the values for storage account type. +type StorageAccountType string + +const ( + // StorageAccountTypePremiumLRS The data disk should use premium locally redundant storage. + StorageAccountTypePremiumLRS StorageAccountType = "Premium_LRS" + // StorageAccountTypeStandardLRS The data disk should use standard locally redundant storage. + StorageAccountTypeStandardLRS StorageAccountType = "Standard_LRS" +) + +// PossibleStorageAccountTypeValues returns an array of possible values for the StorageAccountType const type. +func PossibleStorageAccountTypeValues() []StorageAccountType { + return []StorageAccountType{StorageAccountTypePremiumLRS, StorageAccountTypeStandardLRS} +} diff --git a/services/batch/mgmt/2022-01-01/batch/location.go b/services/batch/mgmt/2022-01-01/batch/location.go new file mode 100644 index 000000000000..725202832bb4 --- /dev/null +++ b/services/batch/mgmt/2022-01-01/batch/location.go @@ -0,0 +1,440 @@ +package batch + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// LocationClient is the batch Client +type LocationClient struct { + BaseClient +} + +// NewLocationClient creates an instance of the LocationClient client. +func NewLocationClient(subscriptionID string) LocationClient { + return NewLocationClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLocationClientWithBaseURI creates an instance of the LocationClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewLocationClientWithBaseURI(baseURI string, subscriptionID string) LocationClient { + return LocationClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckNameAvailability checks whether the Batch account name is available in the specified region. +// Parameters: +// locationName - the desired region for the name check. +// parameters - properties needed to check the availability of a name. +func (client LocationClient) CheckNameAvailability(ctx context.Context, locationName string, parameters CheckNameAvailabilityParameters) (result CheckNameAvailabilityResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.CheckNameAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.LocationClient", "CheckNameAvailability", err.Error()) + } + + req, err := client.CheckNameAvailabilityPreparer(ctx, locationName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.LocationClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.LocationClient", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.LocationClient", "CheckNameAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client LocationClient) CheckNameAvailabilityPreparer(ctx context.Context, locationName string, parameters CheckNameAvailabilityParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "locationName": autorest.Encode("path", locationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/checkNameAvailability", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client LocationClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client LocationClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetQuotas gets the Batch service quotas for the specified subscription at the given location. +// Parameters: +// locationName - the region for which to retrieve Batch service quotas. +func (client LocationClient) GetQuotas(ctx context.Context, locationName string) (result LocationQuota, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.GetQuotas") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetQuotasPreparer(ctx, locationName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.LocationClient", "GetQuotas", nil, "Failure preparing request") + return + } + + resp, err := client.GetQuotasSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.LocationClient", "GetQuotas", resp, "Failure sending request") + return + } + + result, err = client.GetQuotasResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.LocationClient", "GetQuotas", resp, "Failure responding to request") + return + } + + return +} + +// GetQuotasPreparer prepares the GetQuotas request. +func (client LocationClient) GetQuotasPreparer(ctx context.Context, locationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "locationName": autorest.Encode("path", locationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/quotas", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetQuotasSender sends the GetQuotas request. The method will close the +// http.Response Body if it receives an error. +func (client LocationClient) GetQuotasSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetQuotasResponder handles the response to the GetQuotas request. The method always +// closes the http.Response Body. +func (client LocationClient) GetQuotasResponder(resp *http.Response) (result LocationQuota, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSupportedCloudServiceSkus gets the list of Batch supported Cloud Service VM sizes available at the given +// location. +// Parameters: +// locationName - the region for which to retrieve Batch service supported SKUs. +// maxresults - the maximum number of items to return in the response. +// filter - oData filter expression. Valid properties for filtering are "familyName". +func (client LocationClient) ListSupportedCloudServiceSkus(ctx context.Context, locationName string, maxresults *int32, filter string) (result SupportedSkusResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.ListSupportedCloudServiceSkus") + defer func() { + sc := -1 + if result.ssr.Response.Response != nil { + sc = result.ssr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listSupportedCloudServiceSkusNextResults + req, err := client.ListSupportedCloudServiceSkusPreparer(ctx, locationName, maxresults, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.LocationClient", "ListSupportedCloudServiceSkus", nil, "Failure preparing request") + return + } + + resp, err := client.ListSupportedCloudServiceSkusSender(req) + if err != nil { + result.ssr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.LocationClient", "ListSupportedCloudServiceSkus", resp, "Failure sending request") + return + } + + result.ssr, err = client.ListSupportedCloudServiceSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.LocationClient", "ListSupportedCloudServiceSkus", resp, "Failure responding to request") + return + } + if result.ssr.hasNextLink() && result.ssr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListSupportedCloudServiceSkusPreparer prepares the ListSupportedCloudServiceSkus request. +func (client LocationClient) ListSupportedCloudServiceSkusPreparer(ctx context.Context, locationName string, maxresults *int32, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "locationName": autorest.Encode("path", locationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/cloudServiceSkus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSupportedCloudServiceSkusSender sends the ListSupportedCloudServiceSkus request. The method will close the +// http.Response Body if it receives an error. +func (client LocationClient) ListSupportedCloudServiceSkusSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSupportedCloudServiceSkusResponder handles the response to the ListSupportedCloudServiceSkus request. The method always +// closes the http.Response Body. +func (client LocationClient) ListSupportedCloudServiceSkusResponder(resp *http.Response) (result SupportedSkusResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listSupportedCloudServiceSkusNextResults retrieves the next set of results, if any. +func (client LocationClient) listSupportedCloudServiceSkusNextResults(ctx context.Context, lastResults SupportedSkusResult) (result SupportedSkusResult, err error) { + req, err := lastResults.supportedSkusResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.LocationClient", "listSupportedCloudServiceSkusNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSupportedCloudServiceSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.LocationClient", "listSupportedCloudServiceSkusNextResults", resp, "Failure sending next results request") + } + result, err = client.ListSupportedCloudServiceSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.LocationClient", "listSupportedCloudServiceSkusNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListSupportedCloudServiceSkusComplete enumerates all values, automatically crossing page boundaries as required. +func (client LocationClient) ListSupportedCloudServiceSkusComplete(ctx context.Context, locationName string, maxresults *int32, filter string) (result SupportedSkusResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.ListSupportedCloudServiceSkus") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListSupportedCloudServiceSkus(ctx, locationName, maxresults, filter) + return +} + +// ListSupportedVirtualMachineSkus gets the list of Batch supported Virtual Machine VM sizes available at the given +// location. +// Parameters: +// locationName - the region for which to retrieve Batch service supported SKUs. +// maxresults - the maximum number of items to return in the response. +// filter - oData filter expression. Valid properties for filtering are "familyName". +func (client LocationClient) ListSupportedVirtualMachineSkus(ctx context.Context, locationName string, maxresults *int32, filter string) (result SupportedSkusResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.ListSupportedVirtualMachineSkus") + defer func() { + sc := -1 + if result.ssr.Response.Response != nil { + sc = result.ssr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listSupportedVirtualMachineSkusNextResults + req, err := client.ListSupportedVirtualMachineSkusPreparer(ctx, locationName, maxresults, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.LocationClient", "ListSupportedVirtualMachineSkus", nil, "Failure preparing request") + return + } + + resp, err := client.ListSupportedVirtualMachineSkusSender(req) + if err != nil { + result.ssr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.LocationClient", "ListSupportedVirtualMachineSkus", resp, "Failure sending request") + return + } + + result.ssr, err = client.ListSupportedVirtualMachineSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.LocationClient", "ListSupportedVirtualMachineSkus", resp, "Failure responding to request") + return + } + if result.ssr.hasNextLink() && result.ssr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListSupportedVirtualMachineSkusPreparer prepares the ListSupportedVirtualMachineSkus request. +func (client LocationClient) ListSupportedVirtualMachineSkusPreparer(ctx context.Context, locationName string, maxresults *int32, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "locationName": autorest.Encode("path", locationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/virtualMachineSkus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSupportedVirtualMachineSkusSender sends the ListSupportedVirtualMachineSkus request. The method will close the +// http.Response Body if it receives an error. +func (client LocationClient) ListSupportedVirtualMachineSkusSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSupportedVirtualMachineSkusResponder handles the response to the ListSupportedVirtualMachineSkus request. The method always +// closes the http.Response Body. +func (client LocationClient) ListSupportedVirtualMachineSkusResponder(resp *http.Response) (result SupportedSkusResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listSupportedVirtualMachineSkusNextResults retrieves the next set of results, if any. +func (client LocationClient) listSupportedVirtualMachineSkusNextResults(ctx context.Context, lastResults SupportedSkusResult) (result SupportedSkusResult, err error) { + req, err := lastResults.supportedSkusResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.LocationClient", "listSupportedVirtualMachineSkusNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSupportedVirtualMachineSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.LocationClient", "listSupportedVirtualMachineSkusNextResults", resp, "Failure sending next results request") + } + result, err = client.ListSupportedVirtualMachineSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.LocationClient", "listSupportedVirtualMachineSkusNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListSupportedVirtualMachineSkusComplete enumerates all values, automatically crossing page boundaries as required. +func (client LocationClient) ListSupportedVirtualMachineSkusComplete(ctx context.Context, locationName string, maxresults *int32, filter string) (result SupportedSkusResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.ListSupportedVirtualMachineSkus") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListSupportedVirtualMachineSkus(ctx, locationName, maxresults, filter) + return +} diff --git a/services/batch/mgmt/2022-01-01/batch/models.go b/services/batch/mgmt/2022-01-01/batch/models.go new file mode 100644 index 000000000000..58e84aa89932 --- /dev/null +++ b/services/batch/mgmt/2022-01-01/batch/models.go @@ -0,0 +1,4075 @@ +package batch + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch" + +// Account contains information about an Azure Batch account. +type Account struct { + autorest.Response `json:"-"` + // AccountProperties - The properties associated with the account. + *AccountProperties `json:"properties,omitempty"` + // Identity - The identity of the Batch account. + Identity *AccountIdentity `json:"identity,omitempty"` + // ID - READ-ONLY; The ID of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Location - READ-ONLY; The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - READ-ONLY; The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Account. +func (a Account) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if a.AccountProperties != nil { + objectMap["properties"] = a.AccountProperties + } + if a.Identity != nil { + objectMap["identity"] = a.Identity + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Account struct. +func (a *Account) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var accountProperties AccountProperties + err = json.Unmarshal(*v, &accountProperties) + if err != nil { + return err + } + a.AccountProperties = &accountProperties + } + case "identity": + if v != nil { + var identity AccountIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + a.Identity = &identity + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + a.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + a.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + a.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + a.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + a.Tags = tags + } + } + } + + return nil +} + +// AccountCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AccountCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AccountClient) (Account, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AccountCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AccountCreateFuture.Result. +func (future *AccountCreateFuture) result(client AccountClient) (a Account, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + a.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("batch.AccountCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent { + a, err = client.CreateResponder(a.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountCreateFuture", "Result", a.Response.Response, "Failure responding to request") + } + } + return +} + +// AccountCreateParameters parameters supplied to the Create operation. +type AccountCreateParameters struct { + // Location - The region in which to create the account. + Location *string `json:"location,omitempty"` + // Tags - The user-specified tags associated with the account. + Tags map[string]*string `json:"tags"` + // AccountCreateProperties - The properties of the Batch account. + *AccountCreateProperties `json:"properties,omitempty"` + // Identity - The identity of the Batch account. + Identity *AccountIdentity `json:"identity,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountCreateParameters. +func (acp AccountCreateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if acp.Location != nil { + objectMap["location"] = acp.Location + } + if acp.Tags != nil { + objectMap["tags"] = acp.Tags + } + if acp.AccountCreateProperties != nil { + objectMap["properties"] = acp.AccountCreateProperties + } + if acp.Identity != nil { + objectMap["identity"] = acp.Identity + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AccountCreateParameters struct. +func (acp *AccountCreateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + acp.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + acp.Tags = tags + } + case "properties": + if v != nil { + var accountCreateProperties AccountCreateProperties + err = json.Unmarshal(*v, &accountCreateProperties) + if err != nil { + return err + } + acp.AccountCreateProperties = &accountCreateProperties + } + case "identity": + if v != nil { + var identity AccountIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + acp.Identity = &identity + } + } + } + + return nil +} + +// AccountCreateProperties the properties of a Batch account. +type AccountCreateProperties struct { + // AutoStorage - The properties related to the auto-storage account. + AutoStorage *AutoStorageBaseProperties `json:"autoStorage,omitempty"` + // PoolAllocationMode - The pool allocation mode also affects how clients may authenticate to the Batch Service API. If the mode is BatchService, clients may authenticate using access keys or Azure Active Directory. If the mode is UserSubscription, clients must use Azure Active Directory. The default is BatchService. Possible values include: 'PoolAllocationModeBatchService', 'PoolAllocationModeUserSubscription' + PoolAllocationMode PoolAllocationMode `json:"poolAllocationMode,omitempty"` + // KeyVaultReference - A reference to the Azure key vault associated with the Batch account. + KeyVaultReference *KeyVaultReference `json:"keyVaultReference,omitempty"` + // PublicNetworkAccess - If not specified, the default value is 'enabled'. Possible values include: 'PublicNetworkAccessTypeEnabled', 'PublicNetworkAccessTypeDisabled' + PublicNetworkAccess PublicNetworkAccessType `json:"publicNetworkAccess,omitempty"` + // Encryption - Configures how customer data is encrypted inside the Batch account. By default, accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can be used instead. + Encryption *EncryptionProperties `json:"encryption,omitempty"` + // AllowedAuthenticationModes - List of allowed authentication modes for the Batch account that can be used to authenticate with the data plane. This does not affect authentication with the control plane. + AllowedAuthenticationModes *[]AuthenticationMode `json:"allowedAuthenticationModes,omitempty"` +} + +// AccountDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AccountDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AccountClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AccountDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AccountDeleteFuture.Result. +func (future *AccountDeleteFuture) result(client AccountClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("batch.AccountDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AccountIdentity the identity of the Batch account, if configured. This is used when the user specifies +// 'Microsoft.KeyVault' as their Batch account encryption configuration or when `ManagedIdentity` is +// selected as the auto-storage authentication mode. +type AccountIdentity struct { + // PrincipalID - READ-ONLY; The principal id of the Batch account. This property will only be provided for a system assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant id associated with the Batch account. This property will only be provided for a system assigned identity. + TenantID *string `json:"tenantId,omitempty"` + // Type - The type of identity used for the Batch account. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeNone' + Type ResourceIdentityType `json:"type,omitempty"` + // UserAssignedIdentities - The list of user identities associated with the Batch account. + UserAssignedIdentities map[string]*UserAssignedIdentities `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for AccountIdentity. +func (ai AccountIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ai.Type != "" { + objectMap["type"] = ai.Type + } + if ai.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = ai.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// AccountKeys a set of Azure Batch account keys. +type AccountKeys struct { + autorest.Response `json:"-"` + // AccountName - READ-ONLY; The Batch account name. + AccountName *string `json:"accountName,omitempty"` + // Primary - READ-ONLY; The primary key associated with the account. + Primary *string `json:"primary,omitempty"` + // Secondary - READ-ONLY; The secondary key associated with the account. + Secondary *string `json:"secondary,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountKeys. +func (ak AccountKeys) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AccountListResult values returned by the List operation. +type AccountListResult struct { + autorest.Response `json:"-"` + // Value - The collection of Batch accounts returned by the listing operation. + Value *[]Account `json:"value,omitempty"` + // NextLink - The continuation token. + NextLink *string `json:"nextLink,omitempty"` +} + +// AccountListResultIterator provides access to a complete listing of Account values. +type AccountListResultIterator struct { + i int + page AccountListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AccountListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AccountListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AccountListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AccountListResultIterator) Response() AccountListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AccountListResultIterator) Value() Account { + if !iter.page.NotDone() { + return Account{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AccountListResultIterator type. +func NewAccountListResultIterator(page AccountListResultPage) AccountListResultIterator { + return AccountListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (alr AccountListResult) IsEmpty() bool { + return alr.Value == nil || len(*alr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (alr AccountListResult) hasNextLink() bool { + return alr.NextLink != nil && len(*alr.NextLink) != 0 +} + +// accountListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (alr AccountListResult) accountListResultPreparer(ctx context.Context) (*http.Request, error) { + if !alr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(alr.NextLink))) +} + +// AccountListResultPage contains a page of Account values. +type AccountListResultPage struct { + fn func(context.Context, AccountListResult) (AccountListResult, error) + alr AccountListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AccountListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.alr) + if err != nil { + return err + } + page.alr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AccountListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AccountListResultPage) NotDone() bool { + return !page.alr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AccountListResultPage) Response() AccountListResult { + return page.alr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AccountListResultPage) Values() []Account { + if page.alr.IsEmpty() { + return nil + } + return *page.alr.Value +} + +// Creates a new instance of the AccountListResultPage type. +func NewAccountListResultPage(cur AccountListResult, getNextPage func(context.Context, AccountListResult) (AccountListResult, error)) AccountListResultPage { + return AccountListResultPage{ + fn: getNextPage, + alr: cur, + } +} + +// AccountProperties account specific properties. +type AccountProperties struct { + // AccountEndpoint - READ-ONLY; The account endpoint used to interact with the Batch service. + AccountEndpoint *string `json:"accountEndpoint,omitempty"` + // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateInvalid', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCancelled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // PoolAllocationMode - READ-ONLY; Possible values include: 'PoolAllocationModeBatchService', 'PoolAllocationModeUserSubscription' + PoolAllocationMode PoolAllocationMode `json:"poolAllocationMode,omitempty"` + // KeyVaultReference - READ-ONLY + KeyVaultReference *KeyVaultReference `json:"keyVaultReference,omitempty"` + // PublicNetworkAccess - READ-ONLY; If not specified, the default value is 'enabled'. Possible values include: 'PublicNetworkAccessTypeEnabled', 'PublicNetworkAccessTypeDisabled' + PublicNetworkAccess PublicNetworkAccessType `json:"publicNetworkAccess,omitempty"` + // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections associated with the Batch account + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + // AutoStorage - READ-ONLY + AutoStorage *AutoStorageProperties `json:"autoStorage,omitempty"` + // Encryption - READ-ONLY; Configures how customer data is encrypted inside the Batch account. By default, accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can be used instead. + Encryption *EncryptionProperties `json:"encryption,omitempty"` + // DedicatedCoreQuota - READ-ONLY; For accounts with PoolAllocationMode set to UserSubscription, quota is managed on the subscription so this value is not returned. + DedicatedCoreQuota *int32 `json:"dedicatedCoreQuota,omitempty"` + // LowPriorityCoreQuota - READ-ONLY; For accounts with PoolAllocationMode set to UserSubscription, quota is managed on the subscription so this value is not returned. + LowPriorityCoreQuota *int32 `json:"lowPriorityCoreQuota,omitempty"` + // DedicatedCoreQuotaPerVMFamily - READ-ONLY; A list of the dedicated core quota per Virtual Machine family for the Batch account. For accounts with PoolAllocationMode set to UserSubscription, quota is managed on the subscription so this value is not returned. + DedicatedCoreQuotaPerVMFamily *[]VirtualMachineFamilyCoreQuota `json:"dedicatedCoreQuotaPerVMFamily,omitempty"` + // DedicatedCoreQuotaPerVMFamilyEnforced - READ-ONLY; Batch is transitioning its core quota system for dedicated cores to be enforced per Virtual Machine family. During this transitional phase, the dedicated core quota per Virtual Machine family may not yet be enforced. If this flag is false, dedicated core quota is enforced via the old dedicatedCoreQuota property on the account and does not consider Virtual Machine family. If this flag is true, dedicated core quota is enforced via the dedicatedCoreQuotaPerVMFamily property on the account, and the old dedicatedCoreQuota does not apply. + DedicatedCoreQuotaPerVMFamilyEnforced *bool `json:"dedicatedCoreQuotaPerVMFamilyEnforced,omitempty"` + // PoolQuota - READ-ONLY + PoolQuota *int32 `json:"poolQuota,omitempty"` + // ActiveJobAndJobScheduleQuota - READ-ONLY + ActiveJobAndJobScheduleQuota *int32 `json:"activeJobAndJobScheduleQuota,omitempty"` + // AllowedAuthenticationModes - READ-ONLY; List of allowed authentication modes for the Batch account that can be used to authenticate with the data plane. This does not affect authentication with the control plane. + AllowedAuthenticationModes *[]AuthenticationMode `json:"allowedAuthenticationModes,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountProperties. +func (ap AccountProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AccountRegenerateKeyParameters parameters supplied to the RegenerateKey operation. +type AccountRegenerateKeyParameters struct { + // KeyName - The type of account key to regenerate. Possible values include: 'AccountKeyTypePrimary', 'AccountKeyTypeSecondary' + KeyName AccountKeyType `json:"keyName,omitempty"` +} + +// AccountUpdateParameters parameters for updating an Azure Batch account. +type AccountUpdateParameters struct { + // Tags - The user-specified tags associated with the account. + Tags map[string]*string `json:"tags"` + // AccountUpdateProperties - The properties of the account. + *AccountUpdateProperties `json:"properties,omitempty"` + // Identity - The identity of the Batch account. + Identity *AccountIdentity `json:"identity,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountUpdateParameters. +func (aup AccountUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aup.Tags != nil { + objectMap["tags"] = aup.Tags + } + if aup.AccountUpdateProperties != nil { + objectMap["properties"] = aup.AccountUpdateProperties + } + if aup.Identity != nil { + objectMap["identity"] = aup.Identity + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AccountUpdateParameters struct. +func (aup *AccountUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + aup.Tags = tags + } + case "properties": + if v != nil { + var accountUpdateProperties AccountUpdateProperties + err = json.Unmarshal(*v, &accountUpdateProperties) + if err != nil { + return err + } + aup.AccountUpdateProperties = &accountUpdateProperties + } + case "identity": + if v != nil { + var identity AccountIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + aup.Identity = &identity + } + } + } + + return nil +} + +// AccountUpdateProperties the properties of a Batch account. +type AccountUpdateProperties struct { + // AutoStorage - The properties related to the auto-storage account. + AutoStorage *AutoStorageBaseProperties `json:"autoStorage,omitempty"` + // Encryption - Configures how customer data is encrypted inside the Batch account. By default, accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can be used instead. + Encryption *EncryptionProperties `json:"encryption,omitempty"` + // AllowedAuthenticationModes - List of allowed authentication modes for the Batch account that can be used to authenticate with the data plane. This does not affect authentication with the control plane. + AllowedAuthenticationModes *[]AuthenticationMode `json:"allowedAuthenticationModes,omitempty"` +} + +// ActivateApplicationPackageParameters parameters for an activating an application package. +type ActivateApplicationPackageParameters struct { + // Format - The format of the application package binary file. + Format *string `json:"format,omitempty"` +} + +// Application contains information about an application in a Batch account. +type Application struct { + autorest.Response `json:"-"` + // ApplicationProperties - The properties associated with the Application. + *ApplicationProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The ID of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for Application. +func (a Application) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if a.ApplicationProperties != nil { + objectMap["properties"] = a.ApplicationProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Application struct. +func (a *Application) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationProperties ApplicationProperties + err = json.Unmarshal(*v, &applicationProperties) + if err != nil { + return err + } + a.ApplicationProperties = &applicationProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + a.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + a.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + a.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + a.Etag = &etag + } + } + } + + return nil +} + +// ApplicationPackage an application package which represents a particular version of an application. +type ApplicationPackage struct { + autorest.Response `json:"-"` + // ApplicationPackageProperties - The properties associated with the Application Package. + *ApplicationPackageProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The ID of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationPackage. +func (ap ApplicationPackage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ap.ApplicationPackageProperties != nil { + objectMap["properties"] = ap.ApplicationPackageProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationPackage struct. +func (ap *ApplicationPackage) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationPackageProperties ApplicationPackageProperties + err = json.Unmarshal(*v, &applicationPackageProperties) + if err != nil { + return err + } + ap.ApplicationPackageProperties = &applicationPackageProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ap.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ap.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ap.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ap.Etag = &etag + } + } + } + + return nil +} + +// ApplicationPackageProperties properties of an application package +type ApplicationPackageProperties struct { + // State - READ-ONLY; The current state of the application package. Possible values include: 'PackageStatePending', 'PackageStateActive' + State PackageState `json:"state,omitempty"` + // Format - READ-ONLY; The format of the application package, if the package is active. + Format *string `json:"format,omitempty"` + // StorageURL - READ-ONLY; The URL for the application package in Azure Storage. + StorageURL *string `json:"storageUrl,omitempty"` + // StorageURLExpiry - READ-ONLY; The UTC time at which the Azure Storage URL will expire. + StorageURLExpiry *date.Time `json:"storageUrlExpiry,omitempty"` + // LastActivationTime - READ-ONLY; The time at which the package was last activated, if the package is active. + LastActivationTime *date.Time `json:"lastActivationTime,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationPackageProperties. +func (app ApplicationPackageProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ApplicationPackageReference ... +type ApplicationPackageReference struct { + ID *string `json:"id,omitempty"` + // Version - If this is omitted, and no default version is specified for this application, the request fails with the error code InvalidApplicationPackageReferences. If you are calling the REST API directly, the HTTP status code is 409. + Version *string `json:"version,omitempty"` +} + +// ApplicationProperties the properties associated with the Application. +type ApplicationProperties struct { + // DisplayName - The display name for the application. + DisplayName *string `json:"displayName,omitempty"` + // AllowUpdates - A value indicating whether packages within the application may be overwritten using the same version string. + AllowUpdates *bool `json:"allowUpdates,omitempty"` + // DefaultVersion - The package to use if a client requests the application but does not specify a version. This property can only be set to the name of an existing package. + DefaultVersion *string `json:"defaultVersion,omitempty"` +} + +// AutoScaleRun ... +type AutoScaleRun struct { + EvaluationTime *date.Time `json:"evaluationTime,omitempty"` + // Results - Each variable value is returned in the form $variable=value, and variables are separated by semicolons. + Results *string `json:"results,omitempty"` + Error *AutoScaleRunError `json:"error,omitempty"` +} + +// AutoScaleRunError ... +type AutoScaleRunError struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + Details *[]AutoScaleRunError `json:"details,omitempty"` +} + +// AutoScaleSettings ... +type AutoScaleSettings struct { + Formula *string `json:"formula,omitempty"` + // EvaluationInterval - If omitted, the default value is 15 minutes (PT15M). + EvaluationInterval *string `json:"evaluationInterval,omitempty"` +} + +// AutoStorageBaseProperties the properties related to the auto-storage account. +type AutoStorageBaseProperties struct { + // StorageAccountID - The resource ID of the storage account to be used for auto-storage account. + StorageAccountID *string `json:"storageAccountId,omitempty"` + // AuthenticationMode - The authentication mode which the Batch service will use to manage the auto-storage account. Possible values include: 'AutoStorageAuthenticationModeStorageKeys', 'AutoStorageAuthenticationModeBatchAccountManagedIdentity' + AuthenticationMode AutoStorageAuthenticationMode `json:"authenticationMode,omitempty"` + // NodeIdentityReference - The identity referenced here must be assigned to pools which have compute nodes that need access to auto-storage. + NodeIdentityReference *ComputeNodeIdentityReference `json:"nodeIdentityReference,omitempty"` +} + +// AutoStorageProperties contains information about the auto-storage account associated with a Batch +// account. +type AutoStorageProperties struct { + // LastKeySync - The UTC time at which storage keys were last synchronized with the Batch account. + LastKeySync *date.Time `json:"lastKeySync,omitempty"` + // StorageAccountID - The resource ID of the storage account to be used for auto-storage account. + StorageAccountID *string `json:"storageAccountId,omitempty"` + // AuthenticationMode - The authentication mode which the Batch service will use to manage the auto-storage account. Possible values include: 'AutoStorageAuthenticationModeStorageKeys', 'AutoStorageAuthenticationModeBatchAccountManagedIdentity' + AuthenticationMode AutoStorageAuthenticationMode `json:"authenticationMode,omitempty"` + // NodeIdentityReference - The identity referenced here must be assigned to pools which have compute nodes that need access to auto-storage. + NodeIdentityReference *ComputeNodeIdentityReference `json:"nodeIdentityReference,omitempty"` +} + +// AutoUserSpecification ... +type AutoUserSpecification struct { + // Scope - The default value is Pool. If the pool is running Windows a value of Task should be specified if stricter isolation between tasks is required. For example, if the task mutates the registry in a way which could impact other tasks, or if certificates have been specified on the pool which should not be accessible by normal tasks but should be accessible by start tasks. Possible values include: 'AutoUserScopeTask', 'AutoUserScopePool' + Scope AutoUserScope `json:"scope,omitempty"` + // ElevationLevel - The default value is nonAdmin. Possible values include: 'ElevationLevelNonAdmin', 'ElevationLevelAdmin' + ElevationLevel ElevationLevel `json:"elevationLevel,omitempty"` +} + +// AzureBlobFileSystemConfiguration ... +type AzureBlobFileSystemConfiguration struct { + AccountName *string `json:"accountName,omitempty"` + ContainerName *string `json:"containerName,omitempty"` + // AccountKey - This property is mutually exclusive with both sasKey and identity; exactly one must be specified. + AccountKey *string `json:"accountKey,omitempty"` + // SasKey - This property is mutually exclusive with both accountKey and identity; exactly one must be specified. + SasKey *string `json:"sasKey,omitempty"` + // BlobfuseOptions - These are 'net use' options in Windows and 'mount' options in Linux. + BlobfuseOptions *string `json:"blobfuseOptions,omitempty"` + // RelativeMountPath - All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + RelativeMountPath *string `json:"relativeMountPath,omitempty"` + // IdentityReference - This property is mutually exclusive with both accountKey and sasKey; exactly one must be specified. + IdentityReference *ComputeNodeIdentityReference `json:"identityReference,omitempty"` +} + +// AzureFileShareConfiguration ... +type AzureFileShareConfiguration struct { + AccountName *string `json:"accountName,omitempty"` + // AzureFileURL - This is of the form 'https://{account}.file.core.windows.net/'. + AzureFileURL *string `json:"azureFileUrl,omitempty"` + AccountKey *string `json:"accountKey,omitempty"` + // RelativeMountPath - All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + RelativeMountPath *string `json:"relativeMountPath,omitempty"` + // MountOptions - These are 'net use' options in Windows and 'mount' options in Linux. + MountOptions *string `json:"mountOptions,omitempty"` +} + +// Certificate contains information about a certificate. +type Certificate struct { + autorest.Response `json:"-"` + // CertificateProperties - The properties associated with the certificate. + *CertificateProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The ID of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for Certificate. +func (c Certificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if c.CertificateProperties != nil { + objectMap["properties"] = c.CertificateProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Certificate struct. +func (c *Certificate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var certificateProperties CertificateProperties + err = json.Unmarshal(*v, &certificateProperties) + if err != nil { + return err + } + c.CertificateProperties = &certificateProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + c.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + c.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + c.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + c.Etag = &etag + } + } + } + + return nil +} + +// CertificateBaseProperties base certificate properties. +type CertificateBaseProperties struct { + // ThumbprintAlgorithm - This must match the first portion of the certificate name. Currently required to be 'SHA1'. + ThumbprintAlgorithm *string `json:"thumbprintAlgorithm,omitempty"` + // Thumbprint - This must match the thumbprint from the name. + Thumbprint *string `json:"thumbprint,omitempty"` + // Format - The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx. Possible values include: 'CertificateFormatPfx', 'CertificateFormatCer' + Format CertificateFormat `json:"format,omitempty"` +} + +// CertificateCreateOrUpdateParameters contains information about a certificate. +type CertificateCreateOrUpdateParameters struct { + // CertificateCreateOrUpdateProperties - The properties associated with the certificate. + *CertificateCreateOrUpdateProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The ID of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for CertificateCreateOrUpdateParameters. +func (ccoup CertificateCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ccoup.CertificateCreateOrUpdateProperties != nil { + objectMap["properties"] = ccoup.CertificateCreateOrUpdateProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for CertificateCreateOrUpdateParameters struct. +func (ccoup *CertificateCreateOrUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var certificateCreateOrUpdateProperties CertificateCreateOrUpdateProperties + err = json.Unmarshal(*v, &certificateCreateOrUpdateProperties) + if err != nil { + return err + } + ccoup.CertificateCreateOrUpdateProperties = &certificateCreateOrUpdateProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ccoup.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ccoup.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ccoup.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ccoup.Etag = &etag + } + } + } + + return nil +} + +// CertificateCreateOrUpdateProperties certificate properties for create operations +type CertificateCreateOrUpdateProperties struct { + // Data - The maximum size is 10KB. + Data *string `json:"data,omitempty"` + // Password - This must not be specified if the certificate format is Cer. + Password *string `json:"password,omitempty"` + // ThumbprintAlgorithm - This must match the first portion of the certificate name. Currently required to be 'SHA1'. + ThumbprintAlgorithm *string `json:"thumbprintAlgorithm,omitempty"` + // Thumbprint - This must match the thumbprint from the name. + Thumbprint *string `json:"thumbprint,omitempty"` + // Format - The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx. Possible values include: 'CertificateFormatPfx', 'CertificateFormatCer' + Format CertificateFormat `json:"format,omitempty"` +} + +// CertificateDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type CertificateDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CertificateClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CertificateDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for CertificateDeleteFuture.Result. +func (future *CertificateDeleteFuture) result(client CertificateClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("batch.CertificateDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// CertificateProperties certificate properties. +type CertificateProperties struct { + // ProvisioningState - READ-ONLY; Possible values include: 'CertificateProvisioningStateSucceeded', 'CertificateProvisioningStateDeleting', 'CertificateProvisioningStateFailed' + ProvisioningState CertificateProvisioningState `json:"provisioningState,omitempty"` + // ProvisioningStateTransitionTime - READ-ONLY + ProvisioningStateTransitionTime *date.Time `json:"provisioningStateTransitionTime,omitempty"` + // PreviousProvisioningState - READ-ONLY; The previous provisioned state of the resource. Possible values include: 'CertificateProvisioningStateSucceeded', 'CertificateProvisioningStateDeleting', 'CertificateProvisioningStateFailed' + PreviousProvisioningState CertificateProvisioningState `json:"previousProvisioningState,omitempty"` + // PreviousProvisioningStateTransitionTime - READ-ONLY + PreviousProvisioningStateTransitionTime *date.Time `json:"previousProvisioningStateTransitionTime,omitempty"` + // PublicData - READ-ONLY; The public key of the certificate. + PublicData *string `json:"publicData,omitempty"` + // DeleteCertificateError - READ-ONLY; This is only returned when the certificate provisioningState is 'Failed'. + DeleteCertificateError *DeleteCertificateError `json:"deleteCertificateError,omitempty"` + // ThumbprintAlgorithm - This must match the first portion of the certificate name. Currently required to be 'SHA1'. + ThumbprintAlgorithm *string `json:"thumbprintAlgorithm,omitempty"` + // Thumbprint - This must match the thumbprint from the name. + Thumbprint *string `json:"thumbprint,omitempty"` + // Format - The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx. Possible values include: 'CertificateFormatPfx', 'CertificateFormatCer' + Format CertificateFormat `json:"format,omitempty"` +} + +// MarshalJSON is the custom marshaler for CertificateProperties. +func (cp CertificateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cp.ThumbprintAlgorithm != nil { + objectMap["thumbprintAlgorithm"] = cp.ThumbprintAlgorithm + } + if cp.Thumbprint != nil { + objectMap["thumbprint"] = cp.Thumbprint + } + if cp.Format != "" { + objectMap["format"] = cp.Format + } + return json.Marshal(objectMap) +} + +// CertificateReference ... +type CertificateReference struct { + ID *string `json:"id,omitempty"` + // StoreLocation - The default value is currentUser. This property is applicable only for pools configured with Windows nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows image reference). For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. Possible values include: 'CertificateStoreLocationCurrentUser', 'CertificateStoreLocationLocalMachine' + StoreLocation CertificateStoreLocation `json:"storeLocation,omitempty"` + // StoreName - This property is applicable only for pools configured with Windows nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows image reference). Common store names include: My, Root, CA, Trust, Disallowed, TrustedPeople, TrustedPublisher, AuthRoot, AddressBook, but any custom store name can also be used. The default value is My. + StoreName *string `json:"storeName,omitempty"` + Visibility *[]CertificateVisibility `json:"visibility,omitempty"` +} + +// CheckNameAvailabilityParameters parameters for a check name availability request. +type CheckNameAvailabilityParameters struct { + // Name - The name to check for availability + Name *string `json:"name,omitempty"` + // Type - The resource type. + Type *string `json:"type,omitempty"` +} + +// CheckNameAvailabilityResult the CheckNameAvailability operation response. +type CheckNameAvailabilityResult struct { + autorest.Response `json:"-"` + // NameAvailable - READ-ONLY; Gets a boolean value that indicates whether the name is available for you to use. If true, the name is available. If false, the name has already been taken or invalid and cannot be used. + NameAvailable *bool `json:"nameAvailable,omitempty"` + // Reason - READ-ONLY; Gets the reason that a Batch account name could not be used. The Reason element is only returned if NameAvailable is false. Possible values include: 'NameAvailabilityReasonInvalid', 'NameAvailabilityReasonAlreadyExists' + Reason NameAvailabilityReason `json:"reason,omitempty"` + // Message - READ-ONLY; Gets an error message explaining the Reason value in more detail. + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for CheckNameAvailabilityResult. +func (cnar CheckNameAvailabilityResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CIFSMountConfiguration ... +type CIFSMountConfiguration struct { + Username *string `json:"username,omitempty"` + Source *string `json:"source,omitempty"` + // RelativeMountPath - All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + RelativeMountPath *string `json:"relativeMountPath,omitempty"` + // MountOptions - These are 'net use' options in Windows and 'mount' options in Linux. + MountOptions *string `json:"mountOptions,omitempty"` + Password *string `json:"password,omitempty"` +} + +// CloudError an error response from the Batch service. +type CloudError struct { + // Error - The body of the error response. + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody an error response from the Batch service. +type CloudErrorBody struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + // Target - The target of the particular error. For example, the name of the property in error. + Target *string `json:"target,omitempty"` + // Details - A list of additional details about the error. + Details *[]CloudErrorBody `json:"details,omitempty"` +} + +// CloudServiceConfiguration ... +type CloudServiceConfiguration struct { + // OsFamily - Possible values are: 2 - OS Family 2, equivalent to Windows Server 2008 R2 SP1. 3 - OS Family 3, equivalent to Windows Server 2012. 4 - OS Family 4, equivalent to Windows Server 2012 R2. 5 - OS Family 5, equivalent to Windows Server 2016. 6 - OS Family 6, equivalent to Windows Server 2019. For more information, see Azure Guest OS Releases (https://azure.microsoft.com/documentation/articles/cloud-services-guestos-update-matrix/#releases). + OsFamily *string `json:"osFamily,omitempty"` + // OsVersion - The default value is * which specifies the latest operating system version for the specified OS family. + OsVersion *string `json:"osVersion,omitempty"` +} + +// ComputeNodeIdentityReference the reference to a user assigned identity associated with the Batch pool +// which a compute node will use. +type ComputeNodeIdentityReference struct { + // ResourceID - The ARM resource id of the user assigned identity. + ResourceID *string `json:"resourceId,omitempty"` +} + +// ContainerConfiguration ... +type ContainerConfiguration struct { + Type *string `json:"type,omitempty"` + // ContainerImageNames - This is the full image reference, as would be specified to "docker pull". An image will be sourced from the default Docker registry unless the image is fully qualified with an alternative registry. + ContainerImageNames *[]string `json:"containerImageNames,omitempty"` + // ContainerRegistries - If any images must be downloaded from a private registry which requires credentials, then those credentials must be provided here. + ContainerRegistries *[]ContainerRegistry `json:"containerRegistries,omitempty"` +} + +// ContainerRegistry ... +type ContainerRegistry struct { + UserName *string `json:"username,omitempty"` + Password *string `json:"password,omitempty"` + // RegistryServer - If omitted, the default is "docker.io". + RegistryServer *string `json:"registryServer,omitempty"` + IdentityReference *ComputeNodeIdentityReference `json:"identityReference,omitempty"` +} + +// DataDisk settings which will be used by the data disks associated to Compute Nodes in the Pool. When +// using attached data disks, you need to mount and format the disks from within a VM to use them. +type DataDisk struct { + // Lun - The lun is used to uniquely identify each data disk. If attaching multiple disks, each should have a distinct lun. The value must be between 0 and 63, inclusive. + Lun *int32 `json:"lun,omitempty"` + // Caching - Values are: + // none - The caching mode for the disk is not enabled. + // readOnly - The caching mode for the disk is read only. + // readWrite - The caching mode for the disk is read and write. + // The default value for caching is none. For information about the caching options see: https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/. Possible values include: 'CachingTypeNone', 'CachingTypeReadOnly', 'CachingTypeReadWrite' + Caching CachingType `json:"caching,omitempty"` + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + // StorageAccountType - If omitted, the default is "Standard_LRS". Values are: + // Standard_LRS - The data disk should use standard locally redundant storage. + // Premium_LRS - The data disk should use premium locally redundant storage. Possible values include: 'StorageAccountTypeStandardLRS', 'StorageAccountTypePremiumLRS' + StorageAccountType StorageAccountType `json:"storageAccountType,omitempty"` +} + +// DeleteCertificateError an error response from the Batch service. +type DeleteCertificateError struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + // Target - The target of the particular error. For example, the name of the property in error. + Target *string `json:"target,omitempty"` + // Details - A list of additional details about the error. + Details *[]DeleteCertificateError `json:"details,omitempty"` +} + +// DeploymentConfiguration ... +type DeploymentConfiguration struct { + // CloudServiceConfiguration - This property and virtualMachineConfiguration are mutually exclusive and one of the properties must be specified. This property cannot be specified if the Batch account was created with its poolAllocationMode property set to 'UserSubscription'. + CloudServiceConfiguration *CloudServiceConfiguration `json:"cloudServiceConfiguration,omitempty"` + // VirtualMachineConfiguration - This property and cloudServiceConfiguration are mutually exclusive and one of the properties must be specified. + VirtualMachineConfiguration *VirtualMachineConfiguration `json:"virtualMachineConfiguration,omitempty"` +} + +// DetectorListResult values returned by the List operation. +type DetectorListResult struct { + autorest.Response `json:"-"` + // Value - The collection of Batch account detectors returned by the listing operation. + Value *[]DetectorResponse `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// DetectorListResultIterator provides access to a complete listing of DetectorResponse values. +type DetectorListResultIterator struct { + i int + page DetectorListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DetectorListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DetectorListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DetectorListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DetectorListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DetectorListResultIterator) Response() DetectorListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DetectorListResultIterator) Value() DetectorResponse { + if !iter.page.NotDone() { + return DetectorResponse{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DetectorListResultIterator type. +func NewDetectorListResultIterator(page DetectorListResultPage) DetectorListResultIterator { + return DetectorListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dlr DetectorListResult) IsEmpty() bool { + return dlr.Value == nil || len(*dlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dlr DetectorListResult) hasNextLink() bool { + return dlr.NextLink != nil && len(*dlr.NextLink) != 0 +} + +// detectorListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dlr DetectorListResult) detectorListResultPreparer(ctx context.Context) (*http.Request, error) { + if !dlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dlr.NextLink))) +} + +// DetectorListResultPage contains a page of DetectorResponse values. +type DetectorListResultPage struct { + fn func(context.Context, DetectorListResult) (DetectorListResult, error) + dlr DetectorListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DetectorListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DetectorListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.dlr) + if err != nil { + return err + } + page.dlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DetectorListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DetectorListResultPage) NotDone() bool { + return !page.dlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DetectorListResultPage) Response() DetectorListResult { + return page.dlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DetectorListResultPage) Values() []DetectorResponse { + if page.dlr.IsEmpty() { + return nil + } + return *page.dlr.Value +} + +// Creates a new instance of the DetectorListResultPage type. +func NewDetectorListResultPage(cur DetectorListResult, getNextPage func(context.Context, DetectorListResult) (DetectorListResult, error)) DetectorListResultPage { + return DetectorListResultPage{ + fn: getNextPage, + dlr: cur, + } +} + +// DetectorResponse contains the information for a detector. +type DetectorResponse struct { + autorest.Response `json:"-"` + // DetectorResponseProperties - The properties associated with the detector. + *DetectorResponseProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The ID of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for DetectorResponse. +func (dr DetectorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dr.DetectorResponseProperties != nil { + objectMap["properties"] = dr.DetectorResponseProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DetectorResponse struct. +func (dr *DetectorResponse) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var detectorResponseProperties DetectorResponseProperties + err = json.Unmarshal(*v, &detectorResponseProperties) + if err != nil { + return err + } + dr.DetectorResponseProperties = &detectorResponseProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dr.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + dr.Etag = &etag + } + } + } + + return nil +} + +// DetectorResponseProperties detector response properties. +type DetectorResponseProperties struct { + // Value - A base64 encoded string that represents the content of a detector. + Value *string `json:"value,omitempty"` +} + +// DiffDiskSettings ... +type DiffDiskSettings struct { + // Placement - This property can be used by user in the request to choose which location the operating system should be in. e.g., cache disk space for Ephemeral OS disk provisioning. For more information on Ephemeral OS disk size requirements, please refer to Ephemeral OS disk size requirements for Windows VMs at https://docs.microsoft.com/en-us/azure/virtual-machines/windows/ephemeral-os-disks#size-requirements and Linux VMs at https://docs.microsoft.com/en-us/azure/virtual-machines/linux/ephemeral-os-disks#size-requirements. Possible values include: 'DiffDiskPlacementCacheDisk' + Placement DiffDiskPlacement `json:"placement,omitempty"` +} + +// DiskEncryptionConfiguration the disk encryption configuration applied on compute nodes in the pool. Disk +// encryption configuration is not supported on Linux pool created with Virtual Machine Image or Shared +// Image Gallery Image. +type DiskEncryptionConfiguration struct { + // Targets - On Linux pool, only "TemporaryDisk" is supported; on Windows pool, "OsDisk" and "TemporaryDisk" must be specified. + Targets *[]DiskEncryptionTarget `json:"targets,omitempty"` +} + +// EncryptionProperties configures how customer data is encrypted inside the Batch account. By default, +// accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can +// be used instead. +type EncryptionProperties struct { + // KeySource - Type of the key source. Possible values include: 'KeySourceMicrosoftBatch', 'KeySourceMicrosoftKeyVault' + KeySource KeySource `json:"keySource,omitempty"` + // KeyVaultProperties - Additional details when using Microsoft.KeyVault + KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` +} + +// EndpointDependency a domain name and connection details used to access a dependency. +type EndpointDependency struct { + // DomainName - READ-ONLY; The domain name of the dependency. Domain names may be fully qualified or may contain a * wildcard. + DomainName *string `json:"domainName,omitempty"` + // Description - READ-ONLY; Human-readable supplemental information about the dependency and when it is applicable. + Description *string `json:"description,omitempty"` + // EndpointDetails - READ-ONLY; The list of connection details for this endpoint. + EndpointDetails *[]EndpointDetail `json:"endpointDetails,omitempty"` +} + +// MarshalJSON is the custom marshaler for EndpointDependency. +func (ed EndpointDependency) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// EndpointDetail details about the connection between the Batch service and the endpoint. +type EndpointDetail struct { + // Port - READ-ONLY; The port an endpoint is connected to. + Port *int32 `json:"port,omitempty"` +} + +// MarshalJSON is the custom marshaler for EndpointDetail. +func (ed EndpointDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// EnvironmentSetting ... +type EnvironmentSetting struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +// FixedScaleSettings ... +type FixedScaleSettings struct { + // ResizeTimeout - The default value is 15 minutes. Timeout values use ISO 8601 format. For example, use PT10M for 10 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service rejects the request with an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + ResizeTimeout *string `json:"resizeTimeout,omitempty"` + // TargetDedicatedNodes - At least one of targetDedicatedNodes, targetLowPriorityNodes must be set. + TargetDedicatedNodes *int32 `json:"targetDedicatedNodes,omitempty"` + // TargetLowPriorityNodes - At least one of targetDedicatedNodes, targetLowPriorityNodes must be set. + TargetLowPriorityNodes *int32 `json:"targetLowPriorityNodes,omitempty"` + // NodeDeallocationOption - If omitted, the default value is Requeue. Possible values include: 'ComputeNodeDeallocationOptionRequeue', 'ComputeNodeDeallocationOptionTerminate', 'ComputeNodeDeallocationOptionTaskCompletion', 'ComputeNodeDeallocationOptionRetainedData' + NodeDeallocationOption ComputeNodeDeallocationOption `json:"nodeDeallocationOption,omitempty"` +} + +// ImageReference ... +type ImageReference struct { + // Publisher - For example, Canonical or MicrosoftWindowsServer. + Publisher *string `json:"publisher,omitempty"` + // Offer - For example, UbuntuServer or WindowsServer. + Offer *string `json:"offer,omitempty"` + // Sku - For example, 18.04-LTS or 2022-datacenter. + Sku *string `json:"sku,omitempty"` + // Version - A value of 'latest' can be specified to select the latest version of an image. If omitted, the default is 'latest'. + Version *string `json:"version,omitempty"` + // ID - This property is mutually exclusive with other properties. The Shared Image Gallery image must have replicas in the same region as the Azure Batch account. For information about the firewall settings for the Batch node agent to communicate with the Batch service see https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration. + ID *string `json:"id,omitempty"` +} + +// InboundNatPool ... +type InboundNatPool struct { + // Name - The name must be unique within a Batch pool, can contain letters, numbers, underscores, periods, and hyphens. Names must start with a letter or number, must end with a letter, number, or underscore, and cannot exceed 77 characters. If any invalid values are provided the request fails with HTTP status code 400. + Name *string `json:"name,omitempty"` + // Protocol - Possible values include: 'InboundEndpointProtocolTCP', 'InboundEndpointProtocolUDP' + Protocol InboundEndpointProtocol `json:"protocol,omitempty"` + // BackendPort - This must be unique within a Batch pool. Acceptable values are between 1 and 65535 except for 22, 3389, 29876 and 29877 as these are reserved. If any reserved values are provided the request fails with HTTP status code 400. + BackendPort *int32 `json:"backendPort,omitempty"` + // FrontendPortRangeStart - Acceptable values range between 1 and 65534 except ports from 50000 to 55000 which are reserved. All ranges within a pool must be distinct and cannot overlap. If any reserved or overlapping values are provided the request fails with HTTP status code 400. + FrontendPortRangeStart *int32 `json:"frontendPortRangeStart,omitempty"` + // FrontendPortRangeEnd - Acceptable values range between 1 and 65534 except ports from 50000 to 55000 which are reserved by the Batch service. All ranges within a pool must be distinct and cannot overlap. If any reserved or overlapping values are provided the request fails with HTTP status code 400. + FrontendPortRangeEnd *int32 `json:"frontendPortRangeEnd,omitempty"` + // NetworkSecurityGroupRules - The maximum number of rules that can be specified across all the endpoints on a Batch pool is 25. If no network security group rules are specified, a default rule will be created to allow inbound access to the specified backendPort. If the maximum number of network security group rules is exceeded the request fails with HTTP status code 400. + NetworkSecurityGroupRules *[]NetworkSecurityGroupRule `json:"networkSecurityGroupRules,omitempty"` +} + +// KeyVaultProperties keyVault configuration when using an encryption KeySource of Microsoft.KeyVault. +type KeyVaultProperties struct { + // KeyIdentifier - Full path to the versioned secret. Example https://mykeyvault.vault.azure.net/keys/testkey/6e34a81fef704045975661e297a4c053. To be usable the following prerequisites must be met: + // The Batch Account has a System Assigned identity + // The account identity has been granted Key/Get, Key/Unwrap and Key/Wrap permissions + // The KeyVault has soft-delete and purge protection enabled + KeyIdentifier *string `json:"keyIdentifier,omitempty"` +} + +// KeyVaultReference identifies the Azure key vault associated with a Batch account. +type KeyVaultReference struct { + // ID - The resource ID of the Azure key vault associated with the Batch account. + ID *string `json:"id,omitempty"` + // URL - The URL of the Azure key vault associated with the Batch account. + URL *string `json:"url,omitempty"` +} + +// LinuxUserConfiguration ... +type LinuxUserConfiguration struct { + // UID - The uid and gid properties must be specified together or not at all. If not specified the underlying operating system picks the uid. + UID *int32 `json:"uid,omitempty"` + // Gid - The uid and gid properties must be specified together or not at all. If not specified the underlying operating system picks the gid. + Gid *int32 `json:"gid,omitempty"` + // SSHPrivateKey - The private key must not be password protected. The private key is used to automatically configure asymmetric-key based authentication for SSH between nodes in a Linux pool when the pool's enableInterNodeCommunication property is true (it is ignored if enableInterNodeCommunication is false). It does this by placing the key pair into the user's .ssh directory. If not specified, password-less SSH is not configured between nodes (no modification of the user's .ssh directory is done). + SSHPrivateKey *string `json:"sshPrivateKey,omitempty"` +} + +// ListApplicationPackagesResult the result of performing list application packages. +type ListApplicationPackagesResult struct { + autorest.Response `json:"-"` + // Value - The list of application packages. + Value *[]ApplicationPackage `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListApplicationPackagesResultIterator provides access to a complete listing of ApplicationPackage +// values. +type ListApplicationPackagesResultIterator struct { + i int + page ListApplicationPackagesResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListApplicationPackagesResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListApplicationPackagesResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListApplicationPackagesResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListApplicationPackagesResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListApplicationPackagesResultIterator) Response() ListApplicationPackagesResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListApplicationPackagesResultIterator) Value() ApplicationPackage { + if !iter.page.NotDone() { + return ApplicationPackage{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListApplicationPackagesResultIterator type. +func NewListApplicationPackagesResultIterator(page ListApplicationPackagesResultPage) ListApplicationPackagesResultIterator { + return ListApplicationPackagesResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lapr ListApplicationPackagesResult) IsEmpty() bool { + return lapr.Value == nil || len(*lapr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lapr ListApplicationPackagesResult) hasNextLink() bool { + return lapr.NextLink != nil && len(*lapr.NextLink) != 0 +} + +// listApplicationPackagesResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lapr ListApplicationPackagesResult) listApplicationPackagesResultPreparer(ctx context.Context) (*http.Request, error) { + if !lapr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lapr.NextLink))) +} + +// ListApplicationPackagesResultPage contains a page of ApplicationPackage values. +type ListApplicationPackagesResultPage struct { + fn func(context.Context, ListApplicationPackagesResult) (ListApplicationPackagesResult, error) + lapr ListApplicationPackagesResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListApplicationPackagesResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListApplicationPackagesResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lapr) + if err != nil { + return err + } + page.lapr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListApplicationPackagesResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListApplicationPackagesResultPage) NotDone() bool { + return !page.lapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListApplicationPackagesResultPage) Response() ListApplicationPackagesResult { + return page.lapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListApplicationPackagesResultPage) Values() []ApplicationPackage { + if page.lapr.IsEmpty() { + return nil + } + return *page.lapr.Value +} + +// Creates a new instance of the ListApplicationPackagesResultPage type. +func NewListApplicationPackagesResultPage(cur ListApplicationPackagesResult, getNextPage func(context.Context, ListApplicationPackagesResult) (ListApplicationPackagesResult, error)) ListApplicationPackagesResultPage { + return ListApplicationPackagesResultPage{ + fn: getNextPage, + lapr: cur, + } +} + +// ListApplicationsResult the result of performing list applications. +type ListApplicationsResult struct { + autorest.Response `json:"-"` + // Value - The list of applications. + Value *[]Application `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListApplicationsResultIterator provides access to a complete listing of Application values. +type ListApplicationsResultIterator struct { + i int + page ListApplicationsResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListApplicationsResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListApplicationsResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListApplicationsResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListApplicationsResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListApplicationsResultIterator) Response() ListApplicationsResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListApplicationsResultIterator) Value() Application { + if !iter.page.NotDone() { + return Application{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListApplicationsResultIterator type. +func NewListApplicationsResultIterator(page ListApplicationsResultPage) ListApplicationsResultIterator { + return ListApplicationsResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lar ListApplicationsResult) IsEmpty() bool { + return lar.Value == nil || len(*lar.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lar ListApplicationsResult) hasNextLink() bool { + return lar.NextLink != nil && len(*lar.NextLink) != 0 +} + +// listApplicationsResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lar ListApplicationsResult) listApplicationsResultPreparer(ctx context.Context) (*http.Request, error) { + if !lar.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lar.NextLink))) +} + +// ListApplicationsResultPage contains a page of Application values. +type ListApplicationsResultPage struct { + fn func(context.Context, ListApplicationsResult) (ListApplicationsResult, error) + lar ListApplicationsResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListApplicationsResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListApplicationsResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lar) + if err != nil { + return err + } + page.lar = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListApplicationsResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListApplicationsResultPage) NotDone() bool { + return !page.lar.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListApplicationsResultPage) Response() ListApplicationsResult { + return page.lar +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListApplicationsResultPage) Values() []Application { + if page.lar.IsEmpty() { + return nil + } + return *page.lar.Value +} + +// Creates a new instance of the ListApplicationsResultPage type. +func NewListApplicationsResultPage(cur ListApplicationsResult, getNextPage func(context.Context, ListApplicationsResult) (ListApplicationsResult, error)) ListApplicationsResultPage { + return ListApplicationsResultPage{ + fn: getNextPage, + lar: cur, + } +} + +// ListCertificatesResult values returned by the List operation. +type ListCertificatesResult struct { + autorest.Response `json:"-"` + // Value - The collection of returned certificates. + Value *[]Certificate `json:"value,omitempty"` + // NextLink - The continuation token. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListCertificatesResultIterator provides access to a complete listing of Certificate values. +type ListCertificatesResultIterator struct { + i int + page ListCertificatesResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListCertificatesResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListCertificatesResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListCertificatesResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListCertificatesResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListCertificatesResultIterator) Response() ListCertificatesResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListCertificatesResultIterator) Value() Certificate { + if !iter.page.NotDone() { + return Certificate{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListCertificatesResultIterator type. +func NewListCertificatesResultIterator(page ListCertificatesResultPage) ListCertificatesResultIterator { + return ListCertificatesResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lcr ListCertificatesResult) IsEmpty() bool { + return lcr.Value == nil || len(*lcr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lcr ListCertificatesResult) hasNextLink() bool { + return lcr.NextLink != nil && len(*lcr.NextLink) != 0 +} + +// listCertificatesResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lcr ListCertificatesResult) listCertificatesResultPreparer(ctx context.Context) (*http.Request, error) { + if !lcr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lcr.NextLink))) +} + +// ListCertificatesResultPage contains a page of Certificate values. +type ListCertificatesResultPage struct { + fn func(context.Context, ListCertificatesResult) (ListCertificatesResult, error) + lcr ListCertificatesResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListCertificatesResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListCertificatesResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lcr) + if err != nil { + return err + } + page.lcr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListCertificatesResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListCertificatesResultPage) NotDone() bool { + return !page.lcr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListCertificatesResultPage) Response() ListCertificatesResult { + return page.lcr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListCertificatesResultPage) Values() []Certificate { + if page.lcr.IsEmpty() { + return nil + } + return *page.lcr.Value +} + +// Creates a new instance of the ListCertificatesResultPage type. +func NewListCertificatesResultPage(cur ListCertificatesResult, getNextPage func(context.Context, ListCertificatesResult) (ListCertificatesResult, error)) ListCertificatesResultPage { + return ListCertificatesResultPage{ + fn: getNextPage, + lcr: cur, + } +} + +// ListPoolsResult values returned by the List operation. +type ListPoolsResult struct { + autorest.Response `json:"-"` + // Value - The collection of returned pools. + Value *[]Pool `json:"value,omitempty"` + // NextLink - The continuation token. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListPoolsResultIterator provides access to a complete listing of Pool values. +type ListPoolsResultIterator struct { + i int + page ListPoolsResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListPoolsResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListPoolsResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListPoolsResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListPoolsResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListPoolsResultIterator) Response() ListPoolsResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListPoolsResultIterator) Value() Pool { + if !iter.page.NotDone() { + return Pool{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListPoolsResultIterator type. +func NewListPoolsResultIterator(page ListPoolsResultPage) ListPoolsResultIterator { + return ListPoolsResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lpr ListPoolsResult) IsEmpty() bool { + return lpr.Value == nil || len(*lpr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lpr ListPoolsResult) hasNextLink() bool { + return lpr.NextLink != nil && len(*lpr.NextLink) != 0 +} + +// listPoolsResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lpr ListPoolsResult) listPoolsResultPreparer(ctx context.Context) (*http.Request, error) { + if !lpr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lpr.NextLink))) +} + +// ListPoolsResultPage contains a page of Pool values. +type ListPoolsResultPage struct { + fn func(context.Context, ListPoolsResult) (ListPoolsResult, error) + lpr ListPoolsResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListPoolsResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListPoolsResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lpr) + if err != nil { + return err + } + page.lpr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListPoolsResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListPoolsResultPage) NotDone() bool { + return !page.lpr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListPoolsResultPage) Response() ListPoolsResult { + return page.lpr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListPoolsResultPage) Values() []Pool { + if page.lpr.IsEmpty() { + return nil + } + return *page.lpr.Value +} + +// Creates a new instance of the ListPoolsResultPage type. +func NewListPoolsResultPage(cur ListPoolsResult, getNextPage func(context.Context, ListPoolsResult) (ListPoolsResult, error)) ListPoolsResultPage { + return ListPoolsResultPage{ + fn: getNextPage, + lpr: cur, + } +} + +// ListPrivateEndpointConnectionsResult values returned by the List operation. +type ListPrivateEndpointConnectionsResult struct { + autorest.Response `json:"-"` + // Value - The collection of returned private endpoint connection. + Value *[]PrivateEndpointConnection `json:"value,omitempty"` + // NextLink - The continuation token. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListPrivateEndpointConnectionsResultIterator provides access to a complete listing of +// PrivateEndpointConnection values. +type ListPrivateEndpointConnectionsResultIterator struct { + i int + page ListPrivateEndpointConnectionsResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListPrivateEndpointConnectionsResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListPrivateEndpointConnectionsResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListPrivateEndpointConnectionsResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListPrivateEndpointConnectionsResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListPrivateEndpointConnectionsResultIterator) Response() ListPrivateEndpointConnectionsResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListPrivateEndpointConnectionsResultIterator) Value() PrivateEndpointConnection { + if !iter.page.NotDone() { + return PrivateEndpointConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListPrivateEndpointConnectionsResultIterator type. +func NewListPrivateEndpointConnectionsResultIterator(page ListPrivateEndpointConnectionsResultPage) ListPrivateEndpointConnectionsResultIterator { + return ListPrivateEndpointConnectionsResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lpecr ListPrivateEndpointConnectionsResult) IsEmpty() bool { + return lpecr.Value == nil || len(*lpecr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lpecr ListPrivateEndpointConnectionsResult) hasNextLink() bool { + return lpecr.NextLink != nil && len(*lpecr.NextLink) != 0 +} + +// listPrivateEndpointConnectionsResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lpecr ListPrivateEndpointConnectionsResult) listPrivateEndpointConnectionsResultPreparer(ctx context.Context) (*http.Request, error) { + if !lpecr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lpecr.NextLink))) +} + +// ListPrivateEndpointConnectionsResultPage contains a page of PrivateEndpointConnection values. +type ListPrivateEndpointConnectionsResultPage struct { + fn func(context.Context, ListPrivateEndpointConnectionsResult) (ListPrivateEndpointConnectionsResult, error) + lpecr ListPrivateEndpointConnectionsResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListPrivateEndpointConnectionsResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListPrivateEndpointConnectionsResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lpecr) + if err != nil { + return err + } + page.lpecr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListPrivateEndpointConnectionsResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListPrivateEndpointConnectionsResultPage) NotDone() bool { + return !page.lpecr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListPrivateEndpointConnectionsResultPage) Response() ListPrivateEndpointConnectionsResult { + return page.lpecr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListPrivateEndpointConnectionsResultPage) Values() []PrivateEndpointConnection { + if page.lpecr.IsEmpty() { + return nil + } + return *page.lpecr.Value +} + +// Creates a new instance of the ListPrivateEndpointConnectionsResultPage type. +func NewListPrivateEndpointConnectionsResultPage(cur ListPrivateEndpointConnectionsResult, getNextPage func(context.Context, ListPrivateEndpointConnectionsResult) (ListPrivateEndpointConnectionsResult, error)) ListPrivateEndpointConnectionsResultPage { + return ListPrivateEndpointConnectionsResultPage{ + fn: getNextPage, + lpecr: cur, + } +} + +// ListPrivateLinkResourcesResult values returned by the List operation. +type ListPrivateLinkResourcesResult struct { + autorest.Response `json:"-"` + // Value - The collection of returned private link resources. + Value *[]PrivateLinkResource `json:"value,omitempty"` + // NextLink - The continuation token. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListPrivateLinkResourcesResultIterator provides access to a complete listing of PrivateLinkResource +// values. +type ListPrivateLinkResourcesResultIterator struct { + i int + page ListPrivateLinkResourcesResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListPrivateLinkResourcesResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListPrivateLinkResourcesResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListPrivateLinkResourcesResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListPrivateLinkResourcesResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListPrivateLinkResourcesResultIterator) Response() ListPrivateLinkResourcesResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListPrivateLinkResourcesResultIterator) Value() PrivateLinkResource { + if !iter.page.NotDone() { + return PrivateLinkResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListPrivateLinkResourcesResultIterator type. +func NewListPrivateLinkResourcesResultIterator(page ListPrivateLinkResourcesResultPage) ListPrivateLinkResourcesResultIterator { + return ListPrivateLinkResourcesResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lplrr ListPrivateLinkResourcesResult) IsEmpty() bool { + return lplrr.Value == nil || len(*lplrr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lplrr ListPrivateLinkResourcesResult) hasNextLink() bool { + return lplrr.NextLink != nil && len(*lplrr.NextLink) != 0 +} + +// listPrivateLinkResourcesResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lplrr ListPrivateLinkResourcesResult) listPrivateLinkResourcesResultPreparer(ctx context.Context) (*http.Request, error) { + if !lplrr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lplrr.NextLink))) +} + +// ListPrivateLinkResourcesResultPage contains a page of PrivateLinkResource values. +type ListPrivateLinkResourcesResultPage struct { + fn func(context.Context, ListPrivateLinkResourcesResult) (ListPrivateLinkResourcesResult, error) + lplrr ListPrivateLinkResourcesResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListPrivateLinkResourcesResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListPrivateLinkResourcesResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lplrr) + if err != nil { + return err + } + page.lplrr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListPrivateLinkResourcesResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListPrivateLinkResourcesResultPage) NotDone() bool { + return !page.lplrr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListPrivateLinkResourcesResultPage) Response() ListPrivateLinkResourcesResult { + return page.lplrr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListPrivateLinkResourcesResultPage) Values() []PrivateLinkResource { + if page.lplrr.IsEmpty() { + return nil + } + return *page.lplrr.Value +} + +// Creates a new instance of the ListPrivateLinkResourcesResultPage type. +func NewListPrivateLinkResourcesResultPage(cur ListPrivateLinkResourcesResult, getNextPage func(context.Context, ListPrivateLinkResourcesResult) (ListPrivateLinkResourcesResult, error)) ListPrivateLinkResourcesResultPage { + return ListPrivateLinkResourcesResultPage{ + fn: getNextPage, + lplrr: cur, + } +} + +// LocationQuota quotas associated with a Batch region for a particular subscription. +type LocationQuota struct { + autorest.Response `json:"-"` + // AccountQuota - READ-ONLY; The number of Batch accounts that may be created under the subscription in the specified region. + AccountQuota *int32 `json:"accountQuota,omitempty"` +} + +// MarshalJSON is the custom marshaler for LocationQuota. +func (lq LocationQuota) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// MetadataItem the Batch service does not assign any meaning to this metadata; it is solely for the use of +// user code. +type MetadataItem struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +// MountConfiguration ... +type MountConfiguration struct { + // AzureBlobFileSystemConfiguration - This property is mutually exclusive with all other properties. + AzureBlobFileSystemConfiguration *AzureBlobFileSystemConfiguration `json:"azureBlobFileSystemConfiguration,omitempty"` + // NfsMountConfiguration - This property is mutually exclusive with all other properties. + NfsMountConfiguration *NFSMountConfiguration `json:"nfsMountConfiguration,omitempty"` + // CifsMountConfiguration - This property is mutually exclusive with all other properties. + CifsMountConfiguration *CIFSMountConfiguration `json:"cifsMountConfiguration,omitempty"` + // AzureFileShareConfiguration - This property is mutually exclusive with all other properties. + AzureFileShareConfiguration *AzureFileShareConfiguration `json:"azureFileShareConfiguration,omitempty"` +} + +// NetworkConfiguration the network configuration for a pool. +type NetworkConfiguration struct { + // SubnetID - The virtual network must be in the same region and subscription as the Azure Batch account. The specified subnet should have enough free IP addresses to accommodate the number of nodes in the pool. If the subnet doesn't have enough free IP addresses, the pool will partially allocate compute nodes and a resize error will occur. The 'MicrosoftAzureBatch' service principal must have the 'Classic Virtual Machine Contributor' Role-Based Access Control (RBAC) role for the specified VNet. The specified subnet must allow communication from the Azure Batch service to be able to schedule tasks on the compute nodes. This can be verified by checking if the specified VNet has any associated Network Security Groups (NSG). If communication to the compute nodes in the specified subnet is denied by an NSG, then the Batch service will set the state of the compute nodes to unusable. If the specified VNet has any associated Network Security Groups (NSG), then a few reserved system ports must be enabled for inbound communication. For pools created with a virtual machine configuration, enable ports 29876 and 29877, as well as port 22 for Linux and port 3389 for Windows. For pools created with a cloud service configuration, enable ports 10100, 20100, and 30100. Also enable outbound connections to Azure Storage on port 443. For cloudServiceConfiguration pools, only 'classic' VNETs are supported. For more details see: https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration + SubnetID *string `json:"subnetId,omitempty"` + // DynamicVNetAssignmentScope - Possible values include: 'DynamicVNetAssignmentScopeNone', 'DynamicVNetAssignmentScopeJob' + DynamicVNetAssignmentScope DynamicVNetAssignmentScope `json:"dynamicVNetAssignmentScope,omitempty"` + // EndpointConfiguration - Pool endpoint configuration is only supported on pools with the virtualMachineConfiguration property. + EndpointConfiguration *PoolEndpointConfiguration `json:"endpointConfiguration,omitempty"` + // PublicIPAddressConfiguration - This property is only supported on Pools with the virtualMachineConfiguration property. + PublicIPAddressConfiguration *PublicIPAddressConfiguration `json:"publicIPAddressConfiguration,omitempty"` +} + +// NetworkSecurityGroupRule ... +type NetworkSecurityGroupRule struct { + // Priority - Priorities within a pool must be unique and are evaluated in order of priority. The lower the number the higher the priority. For example, rules could be specified with order numbers of 150, 250, and 350. The rule with the order number of 150 takes precedence over the rule that has an order of 250. Allowed priorities are 150 to 4096. If any reserved or duplicate values are provided the request fails with HTTP status code 400. + Priority *int32 `json:"priority,omitempty"` + // Access - Possible values include: 'NetworkSecurityGroupRuleAccessAllow', 'NetworkSecurityGroupRuleAccessDeny' + Access NetworkSecurityGroupRuleAccess `json:"access,omitempty"` + // SourceAddressPrefix - Valid values are a single IP address (i.e. 10.10.10.10), IP subnet (i.e. 192.168.1.0/24), default tag, or * (for all addresses). If any other values are provided the request fails with HTTP status code 400. + SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"` + // SourcePortRanges - Valid values are '*' (for all ports 0 - 65535) or arrays of ports or port ranges (i.e. 100-200). The ports should in the range of 0 to 65535 and the port ranges or ports can't overlap. If any other values are provided the request fails with HTTP status code 400. Default value will be *. + SourcePortRanges *[]string `json:"sourcePortRanges,omitempty"` +} + +// NFSMountConfiguration ... +type NFSMountConfiguration struct { + Source *string `json:"source,omitempty"` + // RelativeMountPath - All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + RelativeMountPath *string `json:"relativeMountPath,omitempty"` + // MountOptions - These are 'net use' options in Windows and 'mount' options in Linux. + MountOptions *string `json:"mountOptions,omitempty"` +} + +// NodePlacementConfiguration allocation configuration used by Batch Service to provision the nodes. +type NodePlacementConfiguration struct { + // Policy - Allocation policy used by Batch Service to provision the nodes. If not specified, Batch will use the regional policy. Possible values include: 'NodePlacementPolicyTypeRegional', 'NodePlacementPolicyTypeZonal' + Policy NodePlacementPolicyType `json:"policy,omitempty"` +} + +// Operation ... +type Operation struct { + // Name - This is of the format {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // IsDataAction - Indicates whether the operation is a data action + IsDataAction *bool `json:"isDataAction,omitempty"` + Display *OperationDisplay `json:"display,omitempty"` + Origin *string `json:"origin,omitempty"` + Properties interface{} `json:"properties,omitempty"` +} + +// OperationDisplay ... +type OperationDisplay struct { + Provider *string `json:"provider,omitempty"` + // Operation - For example: read, write, delete, or listKeys/action + Operation *string `json:"operation,omitempty"` + Resource *string `json:"resource,omitempty"` + Description *string `json:"description,omitempty"` +} + +// OperationListResult ... +type OperationListResult struct { + autorest.Response `json:"-"` + Value *[]Operation `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultIterator provides access to a complete listing of Operation values. +type OperationListResultIterator struct { + i int + page OperationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationListResultIterator) Response() OperationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationListResultIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationListResultIterator type. +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return OperationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OperationListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (olr OperationListResult) hasNextLink() bool { + return olr.NextLink != nil && len(*olr.NextLink) != 0 +} + +// operationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !olr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationListResultPage contains a page of Operation values. +type OperationListResultPage struct { + fn func(context.Context, OperationListResult) (OperationListResult, error) + olr OperationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.olr) + if err != nil { + return err + } + page.olr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListResultPage) Response() OperationListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListResultPage) Values() []Operation { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OperationListResultPage type. +func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return OperationListResultPage{ + fn: getNextPage, + olr: cur, + } +} + +// OSDisk ... +type OSDisk struct { + EphemeralOSDiskSettings *DiffDiskSettings `json:"ephemeralOSDiskSettings,omitempty"` +} + +// OutboundEnvironmentEndpoint a collection of related endpoints from the same service for which the Batch +// service requires outbound access. +type OutboundEnvironmentEndpoint struct { + // Category - READ-ONLY; The type of service that the Batch service connects to. + Category *string `json:"category,omitempty"` + // Endpoints - READ-ONLY; The endpoints for this service to which the Batch service makes outbound calls. + Endpoints *[]EndpointDependency `json:"endpoints,omitempty"` +} + +// MarshalJSON is the custom marshaler for OutboundEnvironmentEndpoint. +func (oee OutboundEnvironmentEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OutboundEnvironmentEndpointCollection values returned by the List operation. +type OutboundEnvironmentEndpointCollection struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; The collection of outbound network dependency endpoints returned by the listing operation. + Value *[]OutboundEnvironmentEndpoint `json:"value,omitempty"` + // NextLink - The continuation token. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for OutboundEnvironmentEndpointCollection. +func (oeec OutboundEnvironmentEndpointCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if oeec.NextLink != nil { + objectMap["nextLink"] = oeec.NextLink + } + return json.Marshal(objectMap) +} + +// OutboundEnvironmentEndpointCollectionIterator provides access to a complete listing of +// OutboundEnvironmentEndpoint values. +type OutboundEnvironmentEndpointCollectionIterator struct { + i int + page OutboundEnvironmentEndpointCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OutboundEnvironmentEndpointCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OutboundEnvironmentEndpointCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OutboundEnvironmentEndpointCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OutboundEnvironmentEndpointCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OutboundEnvironmentEndpointCollectionIterator) Response() OutboundEnvironmentEndpointCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OutboundEnvironmentEndpointCollectionIterator) Value() OutboundEnvironmentEndpoint { + if !iter.page.NotDone() { + return OutboundEnvironmentEndpoint{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OutboundEnvironmentEndpointCollectionIterator type. +func NewOutboundEnvironmentEndpointCollectionIterator(page OutboundEnvironmentEndpointCollectionPage) OutboundEnvironmentEndpointCollectionIterator { + return OutboundEnvironmentEndpointCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (oeec OutboundEnvironmentEndpointCollection) IsEmpty() bool { + return oeec.Value == nil || len(*oeec.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (oeec OutboundEnvironmentEndpointCollection) hasNextLink() bool { + return oeec.NextLink != nil && len(*oeec.NextLink) != 0 +} + +// outboundEnvironmentEndpointCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (oeec OutboundEnvironmentEndpointCollection) outboundEnvironmentEndpointCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !oeec.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(oeec.NextLink))) +} + +// OutboundEnvironmentEndpointCollectionPage contains a page of OutboundEnvironmentEndpoint values. +type OutboundEnvironmentEndpointCollectionPage struct { + fn func(context.Context, OutboundEnvironmentEndpointCollection) (OutboundEnvironmentEndpointCollection, error) + oeec OutboundEnvironmentEndpointCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OutboundEnvironmentEndpointCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OutboundEnvironmentEndpointCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.oeec) + if err != nil { + return err + } + page.oeec = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OutboundEnvironmentEndpointCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OutboundEnvironmentEndpointCollectionPage) NotDone() bool { + return !page.oeec.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OutboundEnvironmentEndpointCollectionPage) Response() OutboundEnvironmentEndpointCollection { + return page.oeec +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OutboundEnvironmentEndpointCollectionPage) Values() []OutboundEnvironmentEndpoint { + if page.oeec.IsEmpty() { + return nil + } + return *page.oeec.Value +} + +// Creates a new instance of the OutboundEnvironmentEndpointCollectionPage type. +func NewOutboundEnvironmentEndpointCollectionPage(cur OutboundEnvironmentEndpointCollection, getNextPage func(context.Context, OutboundEnvironmentEndpointCollection) (OutboundEnvironmentEndpointCollection, error)) OutboundEnvironmentEndpointCollectionPage { + return OutboundEnvironmentEndpointCollectionPage{ + fn: getNextPage, + oeec: cur, + } +} + +// Pool contains information about a pool. +type Pool struct { + autorest.Response `json:"-"` + // PoolProperties - The properties associated with the pool. + *PoolProperties `json:"properties,omitempty"` + // Identity - The type of identity used for the Batch Pool. + Identity *PoolIdentity `json:"identity,omitempty"` + // ID - READ-ONLY; The ID of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for Pool. +func (p Pool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if p.PoolProperties != nil { + objectMap["properties"] = p.PoolProperties + } + if p.Identity != nil { + objectMap["identity"] = p.Identity + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Pool struct. +func (p *Pool) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var poolProperties PoolProperties + err = json.Unmarshal(*v, &poolProperties) + if err != nil { + return err + } + p.PoolProperties = &poolProperties + } + case "identity": + if v != nil { + var identity PoolIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + p.Identity = &identity + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + p.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + p.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + p.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + p.Etag = &etag + } + } + } + + return nil +} + +// PoolDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type PoolDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PoolClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PoolDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PoolDeleteFuture.Result. +func (future *PoolDeleteFuture) result(client PoolClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("batch.PoolDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PoolEndpointConfiguration ... +type PoolEndpointConfiguration struct { + // InboundNatPools - The maximum number of inbound NAT pools per Batch pool is 5. If the maximum number of inbound NAT pools is exceeded the request fails with HTTP status code 400. This cannot be specified if the IPAddressProvisioningType is NoPublicIPAddresses. + InboundNatPools *[]InboundNatPool `json:"inboundNatPools,omitempty"` +} + +// PoolIdentity the identity of the Batch pool, if configured. If the pool identity is updated during +// update an existing pool, only the new vms which are created after the pool shrinks to 0 will have the +// updated identities +type PoolIdentity struct { + // Type - The type of identity used for the Batch Pool. Possible values include: 'PoolIdentityTypeUserAssigned', 'PoolIdentityTypeNone' + Type PoolIdentityType `json:"type,omitempty"` + // UserAssignedIdentities - The list of user identities associated with the Batch pool. + UserAssignedIdentities map[string]*UserAssignedIdentities `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for PoolIdentity. +func (pi PoolIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pi.Type != "" { + objectMap["type"] = pi.Type + } + if pi.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = pi.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// PoolProperties pool properties. +type PoolProperties struct { + // DisplayName - The display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. + DisplayName *string `json:"displayName,omitempty"` + // LastModified - READ-ONLY; This is the last time at which the pool level data, such as the targetDedicatedNodes or autoScaleSettings, changed. It does not factor in node-level changes such as a compute node changing state. + LastModified *date.Time `json:"lastModified,omitempty"` + // CreationTime - READ-ONLY + CreationTime *date.Time `json:"creationTime,omitempty"` + // ProvisioningState - READ-ONLY; Possible values include: 'PoolProvisioningStateSucceeded', 'PoolProvisioningStateDeleting' + ProvisioningState PoolProvisioningState `json:"provisioningState,omitempty"` + // ProvisioningStateTransitionTime - READ-ONLY + ProvisioningStateTransitionTime *date.Time `json:"provisioningStateTransitionTime,omitempty"` + // AllocationState - READ-ONLY; Possible values include: 'AllocationStateSteady', 'AllocationStateResizing', 'AllocationStateStopping' + AllocationState AllocationState `json:"allocationState,omitempty"` + // AllocationStateTransitionTime - READ-ONLY + AllocationStateTransitionTime *date.Time `json:"allocationStateTransitionTime,omitempty"` + // VMSize - For information about available sizes of virtual machines for Cloud Services pools (pools created with cloudServiceConfiguration), see Sizes for Cloud Services (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). Batch supports all Cloud Services VM sizes except ExtraSmall. For information about available VM sizes for pools using images from the Virtual Machines Marketplace (pools created with virtualMachineConfiguration) see Sizes for Virtual Machines (Linux) (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) or Sizes for Virtual Machines (Windows) (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). Batch supports all Azure VM sizes except STANDARD_A0 and those with premium storage (STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 series). + VMSize *string `json:"vmSize,omitempty"` + // DeploymentConfiguration - Using CloudServiceConfiguration specifies that the nodes should be creating using Azure Cloud Services (PaaS), while VirtualMachineConfiguration uses Azure Virtual Machines (IaaS). + DeploymentConfiguration *DeploymentConfiguration `json:"deploymentConfiguration,omitempty"` + // CurrentDedicatedNodes - READ-ONLY + CurrentDedicatedNodes *int32 `json:"currentDedicatedNodes,omitempty"` + // CurrentLowPriorityNodes - READ-ONLY + CurrentLowPriorityNodes *int32 `json:"currentLowPriorityNodes,omitempty"` + ScaleSettings *ScaleSettings `json:"scaleSettings,omitempty"` + // AutoScaleRun - READ-ONLY; This property is set only if the pool automatically scales, i.e. autoScaleSettings are used. + AutoScaleRun *AutoScaleRun `json:"autoScaleRun,omitempty"` + // InterNodeCommunication - This imposes restrictions on which nodes can be assigned to the pool. Enabling this value can reduce the chance of the requested number of nodes to be allocated in the pool. If not specified, this value defaults to 'Disabled'. Possible values include: 'InterNodeCommunicationStateEnabled', 'InterNodeCommunicationStateDisabled' + InterNodeCommunication InterNodeCommunicationState `json:"interNodeCommunication,omitempty"` + NetworkConfiguration *NetworkConfiguration `json:"networkConfiguration,omitempty"` + // TaskSlotsPerNode - The default value is 1. The maximum value is the smaller of 4 times the number of cores of the vmSize of the pool or 256. + TaskSlotsPerNode *int32 `json:"taskSlotsPerNode,omitempty"` + // TaskSchedulingPolicy - If not specified, the default is spread. + TaskSchedulingPolicy *TaskSchedulingPolicy `json:"taskSchedulingPolicy,omitempty"` + UserAccounts *[]UserAccount `json:"userAccounts,omitempty"` + // Metadata - The Batch service does not assign any meaning to metadata; it is solely for the use of user code. + Metadata *[]MetadataItem `json:"metadata,omitempty"` + // StartTask - In an PATCH (update) operation, this property can be set to an empty object to remove the start task from the pool. + StartTask *StartTask `json:"startTask,omitempty"` + // Certificates - For Windows compute nodes, the Batch service installs the certificates to the specified certificate store and location. For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. + Certificates *[]CertificateReference `json:"certificates,omitempty"` + // ApplicationPackages - Changes to application package references affect all new compute nodes joining the pool, but do not affect compute nodes that are already in the pool until they are rebooted or reimaged. There is a maximum of 10 application package references on any given pool. + ApplicationPackages *[]ApplicationPackageReference `json:"applicationPackages,omitempty"` + // ApplicationLicenses - The list of application licenses must be a subset of available Batch service application licenses. If a license is requested which is not supported, pool creation will fail. + ApplicationLicenses *[]string `json:"applicationLicenses,omitempty"` + // ResizeOperationStatus - READ-ONLY + ResizeOperationStatus *ResizeOperationStatus `json:"resizeOperationStatus,omitempty"` + // MountConfiguration - This supports Azure Files, NFS, CIFS/SMB, and Blobfuse. + MountConfiguration *[]MountConfiguration `json:"mountConfiguration,omitempty"` +} + +// MarshalJSON is the custom marshaler for PoolProperties. +func (pp PoolProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pp.DisplayName != nil { + objectMap["displayName"] = pp.DisplayName + } + if pp.VMSize != nil { + objectMap["vmSize"] = pp.VMSize + } + if pp.DeploymentConfiguration != nil { + objectMap["deploymentConfiguration"] = pp.DeploymentConfiguration + } + if pp.ScaleSettings != nil { + objectMap["scaleSettings"] = pp.ScaleSettings + } + if pp.InterNodeCommunication != "" { + objectMap["interNodeCommunication"] = pp.InterNodeCommunication + } + if pp.NetworkConfiguration != nil { + objectMap["networkConfiguration"] = pp.NetworkConfiguration + } + if pp.TaskSlotsPerNode != nil { + objectMap["taskSlotsPerNode"] = pp.TaskSlotsPerNode + } + if pp.TaskSchedulingPolicy != nil { + objectMap["taskSchedulingPolicy"] = pp.TaskSchedulingPolicy + } + if pp.UserAccounts != nil { + objectMap["userAccounts"] = pp.UserAccounts + } + if pp.Metadata != nil { + objectMap["metadata"] = pp.Metadata + } + if pp.StartTask != nil { + objectMap["startTask"] = pp.StartTask + } + if pp.Certificates != nil { + objectMap["certificates"] = pp.Certificates + } + if pp.ApplicationPackages != nil { + objectMap["applicationPackages"] = pp.ApplicationPackages + } + if pp.ApplicationLicenses != nil { + objectMap["applicationLicenses"] = pp.ApplicationLicenses + } + if pp.MountConfiguration != nil { + objectMap["mountConfiguration"] = pp.MountConfiguration + } + return json.Marshal(objectMap) +} + +// PrivateEndpoint the private endpoint of the private endpoint connection. +type PrivateEndpoint struct { + // ID - READ-ONLY + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpoint. +func (peVar PrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PrivateEndpointConnection contains information about a private link resource. +type PrivateEndpointConnection struct { + autorest.Response `json:"-"` + // PrivateEndpointConnectionProperties - The properties associated with the private endpoint connection. + *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The ID of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnection. +func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pec.PrivateEndpointConnectionProperties != nil { + objectMap["properties"] = pec.PrivateEndpointConnectionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. +func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateEndpointConnectionProperties PrivateEndpointConnectionProperties + err = json.Unmarshal(*v, &privateEndpointConnectionProperties) + if err != nil { + return err + } + pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pec.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pec.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pec.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + pec.Etag = &etag + } + } + } + + return nil +} + +// PrivateEndpointConnectionProperties private endpoint connection properties. +type PrivateEndpointConnectionProperties struct { + // ProvisioningState - READ-ONLY; Possible values include: 'PrivateEndpointConnectionProvisioningStateSucceeded', 'PrivateEndpointConnectionProvisioningStateUpdating', 'PrivateEndpointConnectionProvisioningStateFailed' + ProvisioningState PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties. +func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pecp.PrivateEndpoint != nil { + objectMap["privateEndpoint"] = pecp.PrivateEndpoint + } + if pecp.PrivateLinkServiceConnectionState != nil { + objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState + } + return json.Marshal(objectMap) +} + +// PrivateEndpointConnectionUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateEndpointConnectionUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateEndpointConnectionClient) (PrivateEndpointConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateEndpointConnectionUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateEndpointConnectionUpdateFuture.Result. +func (future *PrivateEndpointConnectionUpdateFuture) result(client PrivateEndpointConnectionClient) (pec PrivateEndpointConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pec.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("batch.PrivateEndpointConnectionUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { + pec, err = client.UpdateResponder(pec.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") + } + } + return +} + +// PrivateLinkResource contains information about a private link resource. +type PrivateLinkResource struct { + autorest.Response `json:"-"` + // PrivateLinkResourceProperties - The properties associated with the private link resource. + *PrivateLinkResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The ID of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkResource. +func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plr.PrivateLinkResourceProperties != nil { + objectMap["properties"] = plr.PrivateLinkResourceProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct. +func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateLinkResourceProperties PrivateLinkResourceProperties + err = json.Unmarshal(*v, &privateLinkResourceProperties) + if err != nil { + return err + } + plr.PrivateLinkResourceProperties = &privateLinkResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + plr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + plr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + plr.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + plr.Etag = &etag + } + } + } + + return nil +} + +// PrivateLinkResourceProperties private link resource properties. +type PrivateLinkResourceProperties struct { + // GroupID - READ-ONLY; The group id is used to establish the private link connection. + GroupID *string `json:"groupId,omitempty"` + // RequiredMembers - READ-ONLY + RequiredMembers *[]string `json:"requiredMembers,omitempty"` + // RequiredZoneNames - READ-ONLY + RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. +func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PrivateLinkServiceConnectionState the private link service connection state of the private endpoint +// connection +type PrivateLinkServiceConnectionState struct { + // Status - Possible values include: 'PrivateLinkServiceConnectionStatusApproved', 'PrivateLinkServiceConnectionStatusPending', 'PrivateLinkServiceConnectionStatusRejected', 'PrivateLinkServiceConnectionStatusDisconnected' + Status PrivateLinkServiceConnectionStatus `json:"status,omitempty"` + Description *string `json:"description,omitempty"` + // ActionRequired - READ-ONLY + ActionRequired *string `json:"actionRequired,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionState. +func (plscs PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plscs.Status != "" { + objectMap["status"] = plscs.Status + } + if plscs.Description != nil { + objectMap["description"] = plscs.Description + } + return json.Marshal(objectMap) +} + +// ProxyResource a definition of an Azure resource. +type ProxyResource struct { + // ID - READ-ONLY; The ID of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PublicIPAddressConfiguration the public IP Address configuration of the networking configuration of a +// Pool. +type PublicIPAddressConfiguration struct { + // Provision - The default value is BatchManaged. Possible values include: 'IPAddressProvisioningTypeBatchManaged', 'IPAddressProvisioningTypeUserManaged', 'IPAddressProvisioningTypeNoPublicIPAddresses' + Provision IPAddressProvisioningType `json:"provision,omitempty"` + // IPAddressIds - The number of IPs specified here limits the maximum size of the Pool - 100 dedicated nodes or 100 Spot/low-priority nodes can be allocated for each public IP. For example, a pool needing 250 dedicated VMs would need at least 3 public IPs specified. Each element of this collection is of the form: /subscriptions/{subscription}/resourceGroups/{group}/providers/Microsoft.Network/publicIPAddresses/{ip}. + IPAddressIds *[]string `json:"ipAddressIds,omitempty"` +} + +// ResizeError ... +type ResizeError struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + Details *[]ResizeError `json:"details,omitempty"` +} + +// ResizeOperationStatus describes either the current operation (if the pool AllocationState is Resizing) +// or the previously completed operation (if the AllocationState is Steady). +type ResizeOperationStatus struct { + TargetDedicatedNodes *int32 `json:"targetDedicatedNodes,omitempty"` + TargetLowPriorityNodes *int32 `json:"targetLowPriorityNodes,omitempty"` + // ResizeTimeout - The default value is 15 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + ResizeTimeout *string `json:"resizeTimeout,omitempty"` + // NodeDeallocationOption - The default value is requeue. Possible values include: 'ComputeNodeDeallocationOptionRequeue', 'ComputeNodeDeallocationOptionTerminate', 'ComputeNodeDeallocationOptionTaskCompletion', 'ComputeNodeDeallocationOptionRetainedData' + NodeDeallocationOption ComputeNodeDeallocationOption `json:"nodeDeallocationOption,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + // Errors - This property is set only if an error occurred during the last pool resize, and only when the pool allocationState is Steady. + Errors *[]ResizeError `json:"errors,omitempty"` +} + +// Resource a definition of an Azure resource. +type Resource struct { + // ID - READ-ONLY; The ID of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Location - READ-ONLY; The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - READ-ONLY; The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceFile ... +type ResourceFile struct { + // AutoStorageContainerName - The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. + AutoStorageContainerName *string `json:"autoStorageContainerName,omitempty"` + // StorageContainerURL - The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. This URL must be readable and listable from compute nodes. There are three ways to get such a URL for a container in Azure storage: include a Shared Access Signature (SAS) granting read and list permissions on the container, use a managed identity with read and list permissions, or set the ACL for the container to allow public access. + StorageContainerURL *string `json:"storageContainerUrl,omitempty"` + // HTTPURL - The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. If the URL points to Azure Blob Storage, it must be readable from compute nodes. There are three ways to get such a URL for a blob in Azure storage: include a Shared Access Signature (SAS) granting read permissions on the blob, use a managed identity with read permission, or set the ACL for the blob or its container to allow public access. + HTTPURL *string `json:"httpUrl,omitempty"` + // BlobPrefix - The property is valid only when autoStorageContainerName or storageContainerUrl is used. This prefix can be a partial filename or a subdirectory. If a prefix is not specified, all the files in the container will be downloaded. + BlobPrefix *string `json:"blobPrefix,omitempty"` + // FilePath - If the httpUrl property is specified, the filePath is required and describes the path which the file will be downloaded to, including the filename. Otherwise, if the autoStorageContainerName or storageContainerUrl property is specified, filePath is optional and is the directory to download the files to. In the case where filePath is used as a directory, any directory structure already associated with the input data will be retained in full and appended to the specified filePath directory. The specified relative path cannot break out of the task's working directory (for example by using '..'). + FilePath *string `json:"filePath,omitempty"` + // FileMode - This property applies only to files being downloaded to Linux compute nodes. It will be ignored if it is specified for a resourceFile which will be downloaded to a Windows node. If this property is not specified for a Linux node, then a default value of 0770 is applied to the file. + FileMode *string `json:"fileMode,omitempty"` + IdentityReference *ComputeNodeIdentityReference `json:"identityReference,omitempty"` +} + +// ScaleSettings defines the desired size of the pool. This can either be 'fixedScale' where the requested +// targetDedicatedNodes is specified, or 'autoScale' which defines a formula which is periodically +// reevaluated. If this property is not specified, the pool will have a fixed scale with 0 +// targetDedicatedNodes. +type ScaleSettings struct { + // FixedScale - This property and autoScale are mutually exclusive and one of the properties must be specified. + FixedScale *FixedScaleSettings `json:"fixedScale,omitempty"` + // AutoScale - This property and fixedScale are mutually exclusive and one of the properties must be specified. + AutoScale *AutoScaleSettings `json:"autoScale,omitempty"` +} + +// SkuCapability a SKU capability, such as the number of cores. +type SkuCapability struct { + // Name - READ-ONLY; The name of the feature. + Name *string `json:"name,omitempty"` + // Value - READ-ONLY; The value of the feature. + Value *string `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for SkuCapability. +func (sc SkuCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// StartTask in some cases the start task may be re-run even though the node was not rebooted. Due to this, +// start tasks should be idempotent and exit gracefully if the setup they're performing has already been +// done. Special care should be taken to avoid start tasks which create breakaway process or install/launch +// services from the start task working directory, as this will block Batch from being able to re-run the +// start task. +type StartTask struct { + // CommandLine - The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. Required if any other properties of the startTask are specified. + CommandLine *string `json:"commandLine,omitempty"` + ResourceFiles *[]ResourceFile `json:"resourceFiles,omitempty"` + EnvironmentSettings *[]EnvironmentSetting `json:"environmentSettings,omitempty"` + // UserIdentity - If omitted, the task runs as a non-administrative user unique to the task. + UserIdentity *UserIdentity `json:"userIdentity,omitempty"` + // MaxTaskRetryCount - The Batch service retries a task if its exit code is nonzero. Note that this value specifically controls the number of retries. The Batch service will try the task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries the task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry the task. If the maximum retry count is -1, the Batch service retries the task without limit, however this is not recommended for a start task or any task. The default value is 0 (no retries). + MaxTaskRetryCount *int32 `json:"maxTaskRetryCount,omitempty"` + // WaitForSuccess - If true and the start task fails on a compute node, the Batch service retries the start task up to its maximum retry count (maxTaskRetryCount). If the task has still not completed successfully after all retries, then the Batch service marks the compute node unusable, and will not schedule tasks to it. This condition can be detected via the node state and scheduling error detail. If false, the Batch service will not wait for the start task to complete. In this case, other tasks can start executing on the compute node while the start task is still running; and even if the start task fails, new tasks will continue to be scheduled on the node. The default is true. + WaitForSuccess *bool `json:"waitForSuccess,omitempty"` + // ContainerSettings - When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all task environment variables are mapped into the container, and the task command line is executed in the container. + ContainerSettings *TaskContainerSettings `json:"containerSettings,omitempty"` +} + +// SupportedSku describes a Batch supported SKU. +type SupportedSku struct { + // Name - READ-ONLY; The name of the SKU. + Name *string `json:"name,omitempty"` + // FamilyName - READ-ONLY; The family name of the SKU. + FamilyName *string `json:"familyName,omitempty"` + // Capabilities - READ-ONLY; A collection of capabilities which this SKU supports. + Capabilities *[]SkuCapability `json:"capabilities,omitempty"` +} + +// MarshalJSON is the custom marshaler for SupportedSku. +func (ss SupportedSku) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SupportedSkusResult the Batch List supported SKUs operation response. +type SupportedSkusResult struct { + autorest.Response `json:"-"` + // Value - The list of SKUs available for the Batch service in the location. + Value *[]SupportedSku `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SupportedSkusResult. +func (ssr SupportedSkusResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssr.Value != nil { + objectMap["value"] = ssr.Value + } + return json.Marshal(objectMap) +} + +// SupportedSkusResultIterator provides access to a complete listing of SupportedSku values. +type SupportedSkusResultIterator struct { + i int + page SupportedSkusResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SupportedSkusResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SupportedSkusResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SupportedSkusResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SupportedSkusResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SupportedSkusResultIterator) Response() SupportedSkusResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SupportedSkusResultIterator) Value() SupportedSku { + if !iter.page.NotDone() { + return SupportedSku{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SupportedSkusResultIterator type. +func NewSupportedSkusResultIterator(page SupportedSkusResultPage) SupportedSkusResultIterator { + return SupportedSkusResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ssr SupportedSkusResult) IsEmpty() bool { + return ssr.Value == nil || len(*ssr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ssr SupportedSkusResult) hasNextLink() bool { + return ssr.NextLink != nil && len(*ssr.NextLink) != 0 +} + +// supportedSkusResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ssr SupportedSkusResult) supportedSkusResultPreparer(ctx context.Context) (*http.Request, error) { + if !ssr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ssr.NextLink))) +} + +// SupportedSkusResultPage contains a page of SupportedSku values. +type SupportedSkusResultPage struct { + fn func(context.Context, SupportedSkusResult) (SupportedSkusResult, error) + ssr SupportedSkusResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SupportedSkusResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SupportedSkusResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ssr) + if err != nil { + return err + } + page.ssr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SupportedSkusResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SupportedSkusResultPage) NotDone() bool { + return !page.ssr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SupportedSkusResultPage) Response() SupportedSkusResult { + return page.ssr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SupportedSkusResultPage) Values() []SupportedSku { + if page.ssr.IsEmpty() { + return nil + } + return *page.ssr.Value +} + +// Creates a new instance of the SupportedSkusResultPage type. +func NewSupportedSkusResultPage(cur SupportedSkusResult, getNextPage func(context.Context, SupportedSkusResult) (SupportedSkusResult, error)) SupportedSkusResultPage { + return SupportedSkusResultPage{ + fn: getNextPage, + ssr: cur, + } +} + +// TaskContainerSettings ... +type TaskContainerSettings struct { + // ContainerRunOptions - These additional options are supplied as arguments to the "docker create" command, in addition to those controlled by the Batch Service. + ContainerRunOptions *string `json:"containerRunOptions,omitempty"` + // ImageName - This is the full image reference, as would be specified to "docker pull". If no tag is provided as part of the image name, the tag ":latest" is used as a default. + ImageName *string `json:"imageName,omitempty"` + // Registry - This setting can be omitted if was already provided at pool creation. + Registry *ContainerRegistry `json:"registry,omitempty"` + // WorkingDirectory - Possible values include: 'ContainerWorkingDirectoryTaskWorkingDirectory', 'ContainerWorkingDirectoryContainerImageDefault' + WorkingDirectory ContainerWorkingDirectory `json:"workingDirectory,omitempty"` +} + +// TaskSchedulingPolicy ... +type TaskSchedulingPolicy struct { + // NodeFillType - Possible values include: 'ComputeNodeFillTypeSpread', 'ComputeNodeFillTypePack' + NodeFillType ComputeNodeFillType `json:"nodeFillType,omitempty"` +} + +// UserAccount ... +type UserAccount struct { + Name *string `json:"name,omitempty"` + Password *string `json:"password,omitempty"` + // ElevationLevel - nonAdmin - The auto user is a standard user without elevated access. admin - The auto user is a user with elevated access and operates with full Administrator permissions. The default value is nonAdmin. Possible values include: 'ElevationLevelNonAdmin', 'ElevationLevelAdmin' + ElevationLevel ElevationLevel `json:"elevationLevel,omitempty"` + // LinuxUserConfiguration - This property is ignored if specified on a Windows pool. If not specified, the user is created with the default options. + LinuxUserConfiguration *LinuxUserConfiguration `json:"linuxUserConfiguration,omitempty"` + // WindowsUserConfiguration - This property can only be specified if the user is on a Windows pool. If not specified and on a Windows pool, the user is created with the default options. + WindowsUserConfiguration *WindowsUserConfiguration `json:"windowsUserConfiguration,omitempty"` +} + +// UserAssignedIdentities the list of associated user identities. +type UserAssignedIdentities struct { + // PrincipalID - READ-ONLY; The principal id of user assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // ClientID - READ-ONLY; The client id of user assigned identity. + ClientID *string `json:"clientId,omitempty"` +} + +// MarshalJSON is the custom marshaler for UserAssignedIdentities. +func (uai UserAssignedIdentities) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// UserIdentity specify either the userName or autoUser property, but not both. +type UserIdentity struct { + // UserName - The userName and autoUser properties are mutually exclusive; you must specify one but not both. + UserName *string `json:"userName,omitempty"` + // AutoUser - The userName and autoUser properties are mutually exclusive; you must specify one but not both. + AutoUser *AutoUserSpecification `json:"autoUser,omitempty"` +} + +// VirtualMachineConfiguration ... +type VirtualMachineConfiguration struct { + ImageReference *ImageReference `json:"imageReference,omitempty"` + // NodeAgentSkuID - The Batch node agent is a program that runs on each node in the pool, and provides the command-and-control interface between the node and the Batch service. There are different implementations of the node agent, known as SKUs, for different operating systems. You must specify a node agent SKU which matches the selected image reference. To get the list of supported node agent SKUs along with their list of verified image references, see the 'List supported node agent SKUs' operation. + NodeAgentSkuID *string `json:"nodeAgentSkuId,omitempty"` + // WindowsConfiguration - This property must not be specified if the imageReference specifies a Linux OS image. + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` + // DataDisks - This property must be specified if the compute nodes in the pool need to have empty data disks attached to them. + DataDisks *[]DataDisk `json:"dataDisks,omitempty"` + // LicenseType - This only applies to images that contain the Windows operating system, and should only be used when you hold valid on-premises licenses for the nodes which will be deployed. If omitted, no on-premises licensing discount is applied. Values are: + // Windows_Server - The on-premises license is for Windows Server. + // Windows_Client - The on-premises license is for Windows Client. + LicenseType *string `json:"licenseType,omitempty"` + // ContainerConfiguration - If specified, setup is performed on each node in the pool to allow tasks to run in containers. All regular tasks and job manager tasks run on this pool must specify the containerSettings property, and all other tasks may specify it. + ContainerConfiguration *ContainerConfiguration `json:"containerConfiguration,omitempty"` + // DiskEncryptionConfiguration - If specified, encryption is performed on each node in the pool during node provisioning. + DiskEncryptionConfiguration *DiskEncryptionConfiguration `json:"diskEncryptionConfiguration,omitempty"` + // NodePlacementConfiguration - This configuration will specify rules on how nodes in the pool will be physically allocated. + NodePlacementConfiguration *NodePlacementConfiguration `json:"nodePlacementConfiguration,omitempty"` + // Extensions - If specified, the extensions mentioned in this configuration will be installed on each node. + Extensions *[]VMExtension `json:"extensions,omitempty"` + // OsDisk - Contains configuration for ephemeral OSDisk settings. + OsDisk *OSDisk `json:"osDisk,omitempty"` +} + +// VirtualMachineFamilyCoreQuota a VM Family and its associated core quota for the Batch account. +type VirtualMachineFamilyCoreQuota struct { + // Name - READ-ONLY; The Virtual Machine family name. + Name *string `json:"name,omitempty"` + // CoreQuota - READ-ONLY; The core quota for the VM family for the Batch account. + CoreQuota *int32 `json:"coreQuota,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualMachineFamilyCoreQuota. +func (vmfcq VirtualMachineFamilyCoreQuota) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// VMExtension ... +type VMExtension struct { + Name *string `json:"name,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` + // AutoUpgradeMinorVersion - Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + Settings interface{} `json:"settings,omitempty"` + // ProtectedSettings - The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + ProtectedSettings interface{} `json:"protectedSettings,omitempty"` + // ProvisionAfterExtensions - Collection of extension names after which this extension needs to be provisioned. + ProvisionAfterExtensions *[]string `json:"provisionAfterExtensions,omitempty"` +} + +// WindowsConfiguration ... +type WindowsConfiguration struct { + // EnableAutomaticUpdates - If omitted, the default value is true. + EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"` +} + +// WindowsUserConfiguration ... +type WindowsUserConfiguration struct { + // LoginMode - Specifies login mode for the user. The default value for VirtualMachineConfiguration pools is interactive mode and for CloudServiceConfiguration pools is batch mode. Possible values include: 'LoginModeBatch', 'LoginModeInteractive' + LoginMode LoginMode `json:"loginMode,omitempty"` +} diff --git a/services/batch/mgmt/2022-01-01/batch/operations.go b/services/batch/mgmt/2022-01-01/batch/operations.go new file mode 100644 index 000000000000..eb2366d7cadf --- /dev/null +++ b/services/batch/mgmt/2022-01-01/batch/operations.go @@ -0,0 +1,140 @@ +package batch + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the batch Client +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists available operations for the Microsoft.Batch provider +func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.olr.Response.Response != nil { + sc = result.olr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.olr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.olr.hasNextLink() && result.olr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Batch/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.operationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/batch/mgmt/2022-01-01/batch/pool.go b/services/batch/mgmt/2022-01-01/batch/pool.go new file mode 100644 index 000000000000..8b8c2f7c85bc --- /dev/null +++ b/services/batch/mgmt/2022-01-01/batch/pool.go @@ -0,0 +1,786 @@ +package batch + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PoolClient is the batch Client +type PoolClient struct { + BaseClient +} + +// NewPoolClient creates an instance of the PoolClient client. +func NewPoolClient(subscriptionID string) PoolClient { + return NewPoolClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPoolClientWithBaseURI creates an instance of the PoolClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewPoolClientWithBaseURI(baseURI string, subscriptionID string) PoolClient { + return PoolClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new pool inside the specified account. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// poolName - the pool name. This must be unique within the account. +// parameters - additional parameters for pool creation. +// ifMatch - the entity state (ETag) version of the pool to update. A value of "*" can be used to apply the +// operation only if the pool already exists. If omitted, this operation will always be applied. +// ifNoneMatch - set to '*' to allow a new pool to be created, but to prevent updating an existing pool. Other +// values will be ignored. +func (client PoolClient) Create(ctx context.Context, resourceGroupName string, accountName string, poolName string, parameters Pool, ifMatch string, ifNoneMatch string) (result Pool, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.PoolProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.DeploymentConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.DeploymentConfiguration.CloudServiceConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.DeploymentConfiguration.CloudServiceConfiguration.OsFamily", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.PoolProperties.DeploymentConfiguration.VirtualMachineConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.DeploymentConfiguration.VirtualMachineConfiguration.ImageReference", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.PoolProperties.DeploymentConfiguration.VirtualMachineConfiguration.NodeAgentSkuID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.PoolProperties.DeploymentConfiguration.VirtualMachineConfiguration.ContainerConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.DeploymentConfiguration.VirtualMachineConfiguration.ContainerConfiguration.Type", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + }}, + {Target: "parameters.PoolProperties.ScaleSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.ScaleSettings.AutoScale", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.ScaleSettings.AutoScale.Formula", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "parameters.PoolProperties.AutoScaleRun", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.AutoScaleRun.EvaluationTime", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.PoolProperties.AutoScaleRun.Error", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.AutoScaleRun.Error.Code", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.PoolProperties.AutoScaleRun.Error.Message", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + {Target: "parameters.PoolProperties.NetworkConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.NetworkConfiguration.EndpointConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.NetworkConfiguration.EndpointConfiguration.InboundNatPools", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "parameters.PoolProperties.StartTask", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.StartTask.ContainerSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.StartTask.ContainerSettings.ImageName", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + }}}}}); err != nil { + return result, validation.NewError("batch.PoolClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, poolName, parameters, ifMatch, ifNoneMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client PoolClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, parameters Pool, ifMatch string, ifNoneMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client PoolClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client PoolClient) CreateResponder(resp *http.Response) (result Pool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified pool. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// poolName - the pool name. This must be unique within the account. +func (client PoolClient) Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result PoolDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.PoolClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, poolName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PoolClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PoolClient) DeleteSender(req *http.Request) (future PoolDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PoolClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DisableAutoScale disables automatic scaling for a pool. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// poolName - the pool name. This must be unique within the account. +func (client PoolClient) DisableAutoScale(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result Pool, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.DisableAutoScale") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.PoolClient", "DisableAutoScale", err.Error()) + } + + req, err := client.DisableAutoScalePreparer(ctx, resourceGroupName, accountName, poolName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "DisableAutoScale", nil, "Failure preparing request") + return + } + + resp, err := client.DisableAutoScaleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.PoolClient", "DisableAutoScale", resp, "Failure sending request") + return + } + + result, err = client.DisableAutoScaleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "DisableAutoScale", resp, "Failure responding to request") + return + } + + return +} + +// DisableAutoScalePreparer prepares the DisableAutoScale request. +func (client PoolClient) DisableAutoScalePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/disableAutoScale", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DisableAutoScaleSender sends the DisableAutoScale request. The method will close the +// http.Response Body if it receives an error. +func (client PoolClient) DisableAutoScaleSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DisableAutoScaleResponder handles the response to the DisableAutoScale request. The method always +// closes the http.Response Body. +func (client PoolClient) DisableAutoScaleResponder(resp *http.Response) (result Pool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets information about the specified pool. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// poolName - the pool name. This must be unique within the account. +func (client PoolClient) Get(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result Pool, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.PoolClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, poolName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PoolClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PoolClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PoolClient) GetResponder(resp *http.Response) (result Pool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByBatchAccount lists all of the pools in the specified account. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// maxresults - the maximum number of items to return in the response. +// selectParameter - comma separated list of properties that should be returned. e.g. +// "properties/provisioningState". Only top level properties under properties/ are valid for selection. +// filter - oData filter expression. Valid properties for filtering are: +// +// name +// properties/allocationState +// properties/allocationStateTransitionTime +// properties/creationTime +// properties/provisioningState +// properties/provisioningStateTransitionTime +// properties/lastModified +// properties/vmSize +// properties/interNodeCommunication +// properties/scaleSettings/autoScale +// properties/scaleSettings/fixedScale +func (client PoolClient) ListByBatchAccount(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (result ListPoolsResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.ListByBatchAccount") + defer func() { + sc := -1 + if result.lpr.Response.Response != nil { + sc = result.lpr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.PoolClient", "ListByBatchAccount", err.Error()) + } + + result.fn = client.listByBatchAccountNextResults + req, err := client.ListByBatchAccountPreparer(ctx, resourceGroupName, accountName, maxresults, selectParameter, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "ListByBatchAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByBatchAccountSender(req) + if err != nil { + result.lpr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.PoolClient", "ListByBatchAccount", resp, "Failure sending request") + return + } + + result.lpr, err = client.ListByBatchAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "ListByBatchAccount", resp, "Failure responding to request") + return + } + if result.lpr.hasNextLink() && result.lpr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByBatchAccountPreparer prepares the ListByBatchAccount request. +func (client PoolClient) ListByBatchAccountPreparer(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByBatchAccountSender sends the ListByBatchAccount request. The method will close the +// http.Response Body if it receives an error. +func (client PoolClient) ListByBatchAccountSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByBatchAccountResponder handles the response to the ListByBatchAccount request. The method always +// closes the http.Response Body. +func (client PoolClient) ListByBatchAccountResponder(resp *http.Response) (result ListPoolsResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByBatchAccountNextResults retrieves the next set of results, if any. +func (client PoolClient) listByBatchAccountNextResults(ctx context.Context, lastResults ListPoolsResult) (result ListPoolsResult, err error) { + req, err := lastResults.listPoolsResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.PoolClient", "listByBatchAccountNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByBatchAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.PoolClient", "listByBatchAccountNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByBatchAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "listByBatchAccountNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByBatchAccountComplete enumerates all values, automatically crossing page boundaries as required. +func (client PoolClient) ListByBatchAccountComplete(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (result ListPoolsResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.ListByBatchAccount") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByBatchAccount(ctx, resourceGroupName, accountName, maxresults, selectParameter, filter) + return +} + +// StopResize this does not restore the pool to its previous state before the resize operation: it only stops any +// further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the +// number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state +// changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this +// API can also be used to halt the initial sizing of the pool when it is created. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// poolName - the pool name. This must be unique within the account. +func (client PoolClient) StopResize(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result Pool, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.StopResize") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.PoolClient", "StopResize", err.Error()) + } + + req, err := client.StopResizePreparer(ctx, resourceGroupName, accountName, poolName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "StopResize", nil, "Failure preparing request") + return + } + + resp, err := client.StopResizeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.PoolClient", "StopResize", resp, "Failure sending request") + return + } + + result, err = client.StopResizeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "StopResize", resp, "Failure responding to request") + return + } + + return +} + +// StopResizePreparer prepares the StopResize request. +func (client PoolClient) StopResizePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/stopResize", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopResizeSender sends the StopResize request. The method will close the +// http.Response Body if it receives an error. +func (client PoolClient) StopResizeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// StopResizeResponder handles the response to the StopResize request. The method always +// closes the http.Response Body. +func (client PoolClient) StopResizeResponder(resp *http.Response) (result Pool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates the properties of an existing pool. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// poolName - the pool name. This must be unique within the account. +// parameters - pool properties that should be updated. Properties that are supplied will be updated, any +// property not supplied will be unchanged. +// ifMatch - the entity state (ETag) version of the pool to update. This value can be omitted or set to "*" to +// apply the operation unconditionally. +func (client PoolClient) Update(ctx context.Context, resourceGroupName string, accountName string, poolName string, parameters Pool, ifMatch string) (result Pool, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.PoolClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, poolName, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client PoolClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, parameters Pool, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client PoolClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client PoolClient) UpdateResponder(resp *http.Response) (result Pool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/batch/mgmt/2022-01-01/batch/privateendpointconnection.go b/services/batch/mgmt/2022-01-01/batch/privateendpointconnection.go new file mode 100644 index 000000000000..61441bead880 --- /dev/null +++ b/services/batch/mgmt/2022-01-01/batch/privateendpointconnection.go @@ -0,0 +1,358 @@ +package batch + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateEndpointConnectionClient is the batch Client +type PrivateEndpointConnectionClient struct { + BaseClient +} + +// NewPrivateEndpointConnectionClient creates an instance of the PrivateEndpointConnectionClient client. +func NewPrivateEndpointConnectionClient(subscriptionID string) PrivateEndpointConnectionClient { + return NewPrivateEndpointConnectionClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateEndpointConnectionClientWithBaseURI creates an instance of the PrivateEndpointConnectionClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewPrivateEndpointConnectionClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionClient { + return PrivateEndpointConnectionClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets information about the specified private endpoint connection. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// privateEndpointConnectionName - the private endpoint connection name. This must be unique within the +// account. +func (client PrivateEndpointConnectionClient) Get(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: privateEndpointConnectionName, + Constraints: []validation.Constraint{{Target: "privateEndpointConnectionName", Name: validation.MaxLength, Rule: 101, Chain: nil}, + {Target: "privateEndpointConnectionName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "privateEndpointConnectionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+\.?[a-fA-F0-9-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.PrivateEndpointConnectionClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateEndpointConnectionClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByBatchAccount lists all of the private endpoint connections in the specified account. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// maxresults - the maximum number of items to return in the response. +func (client PrivateEndpointConnectionClient) ListByBatchAccount(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result ListPrivateEndpointConnectionsResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionClient.ListByBatchAccount") + defer func() { + sc := -1 + if result.lpecr.Response.Response != nil { + sc = result.lpecr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.PrivateEndpointConnectionClient", "ListByBatchAccount", err.Error()) + } + + result.fn = client.listByBatchAccountNextResults + req, err := client.ListByBatchAccountPreparer(ctx, resourceGroupName, accountName, maxresults) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "ListByBatchAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByBatchAccountSender(req) + if err != nil { + result.lpecr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "ListByBatchAccount", resp, "Failure sending request") + return + } + + result.lpecr, err = client.ListByBatchAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "ListByBatchAccount", resp, "Failure responding to request") + return + } + if result.lpecr.hasNextLink() && result.lpecr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByBatchAccountPreparer prepares the ListByBatchAccount request. +func (client PrivateEndpointConnectionClient) ListByBatchAccountPreparer(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByBatchAccountSender sends the ListByBatchAccount request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionClient) ListByBatchAccountSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByBatchAccountResponder handles the response to the ListByBatchAccount request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionClient) ListByBatchAccountResponder(resp *http.Response) (result ListPrivateEndpointConnectionsResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByBatchAccountNextResults retrieves the next set of results, if any. +func (client PrivateEndpointConnectionClient) listByBatchAccountNextResults(ctx context.Context, lastResults ListPrivateEndpointConnectionsResult) (result ListPrivateEndpointConnectionsResult, err error) { + req, err := lastResults.listPrivateEndpointConnectionsResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "listByBatchAccountNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByBatchAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "listByBatchAccountNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByBatchAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "listByBatchAccountNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByBatchAccountComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateEndpointConnectionClient) ListByBatchAccountComplete(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result ListPrivateEndpointConnectionsResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionClient.ListByBatchAccount") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByBatchAccount(ctx, resourceGroupName, accountName, maxresults) + return +} + +// Update updates the properties of an existing private endpoint connection. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// privateEndpointConnectionName - the private endpoint connection name. This must be unique within the +// account. +// parameters - privateEndpointConnection properties that should be updated. Properties that are supplied will +// be updated, any property not supplied will be unchanged. +// ifMatch - the state (ETag) version of the private endpoint connection to update. This value can be omitted +// or set to "*" to apply the operation unconditionally. +func (client PrivateEndpointConnectionClient) Update(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, ifMatch string) (result PrivateEndpointConnectionUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: privateEndpointConnectionName, + Constraints: []validation.Constraint{{Target: "privateEndpointConnectionName", Name: validation.MaxLength, Rule: 101, Chain: nil}, + {Target: "privateEndpointConnectionName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "privateEndpointConnectionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+\.?[a-fA-F0-9-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.PrivateEndpointConnectionClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client PrivateEndpointConnectionClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionClient) UpdateSender(req *http.Request) (future PrivateEndpointConnectionUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionClient) UpdateResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/batch/mgmt/2022-01-01/batch/privatelinkresource.go b/services/batch/mgmt/2022-01-01/batch/privatelinkresource.go new file mode 100644 index 000000000000..74d5e5c5a284 --- /dev/null +++ b/services/batch/mgmt/2022-01-01/batch/privatelinkresource.go @@ -0,0 +1,253 @@ +package batch + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateLinkResourceClient is the batch Client +type PrivateLinkResourceClient struct { + BaseClient +} + +// NewPrivateLinkResourceClient creates an instance of the PrivateLinkResourceClient client. +func NewPrivateLinkResourceClient(subscriptionID string) PrivateLinkResourceClient { + return NewPrivateLinkResourceClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateLinkResourceClientWithBaseURI creates an instance of the PrivateLinkResourceClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewPrivateLinkResourceClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourceClient { + return PrivateLinkResourceClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets information about the specified private link resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// privateLinkResourceName - the private link resource name. This must be unique within the account. +func (client PrivateLinkResourceClient) Get(ctx context.Context, resourceGroupName string, accountName string, privateLinkResourceName string) (result PrivateLinkResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: privateLinkResourceName, + Constraints: []validation.Constraint{{Target: "privateLinkResourceName", Name: validation.MaxLength, Rule: 101, Chain: nil}, + {Target: "privateLinkResourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "privateLinkResourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+\.?[a-fA-F0-9-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.PrivateLinkResourceClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, privateLinkResourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateLinkResourceClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, privateLinkResourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "privateLinkResourceName": autorest.Encode("path", privateLinkResourceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources/{privateLinkResourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkResourceClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PrivateLinkResourceClient) GetResponder(resp *http.Response) (result PrivateLinkResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByBatchAccount lists all of the private link resources in the specified account. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// maxresults - the maximum number of items to return in the response. +func (client PrivateLinkResourceClient) ListByBatchAccount(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result ListPrivateLinkResourcesResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceClient.ListByBatchAccount") + defer func() { + sc := -1 + if result.lplrr.Response.Response != nil { + sc = result.lplrr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.PrivateLinkResourceClient", "ListByBatchAccount", err.Error()) + } + + result.fn = client.listByBatchAccountNextResults + req, err := client.ListByBatchAccountPreparer(ctx, resourceGroupName, accountName, maxresults) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "ListByBatchAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByBatchAccountSender(req) + if err != nil { + result.lplrr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "ListByBatchAccount", resp, "Failure sending request") + return + } + + result.lplrr, err = client.ListByBatchAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "ListByBatchAccount", resp, "Failure responding to request") + return + } + if result.lplrr.hasNextLink() && result.lplrr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByBatchAccountPreparer prepares the ListByBatchAccount request. +func (client PrivateLinkResourceClient) ListByBatchAccountPreparer(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByBatchAccountSender sends the ListByBatchAccount request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkResourceClient) ListByBatchAccountSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByBatchAccountResponder handles the response to the ListByBatchAccount request. The method always +// closes the http.Response Body. +func (client PrivateLinkResourceClient) ListByBatchAccountResponder(resp *http.Response) (result ListPrivateLinkResourcesResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByBatchAccountNextResults retrieves the next set of results, if any. +func (client PrivateLinkResourceClient) listByBatchAccountNextResults(ctx context.Context, lastResults ListPrivateLinkResourcesResult) (result ListPrivateLinkResourcesResult, err error) { + req, err := lastResults.listPrivateLinkResourcesResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "listByBatchAccountNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByBatchAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "listByBatchAccountNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByBatchAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "listByBatchAccountNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByBatchAccountComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateLinkResourceClient) ListByBatchAccountComplete(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result ListPrivateLinkResourcesResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceClient.ListByBatchAccount") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByBatchAccount(ctx, resourceGroupName, accountName, maxresults) + return +} diff --git a/services/batch/mgmt/2022-01-01/batch/version.go b/services/batch/mgmt/2022-01-01/batch/version.go new file mode 100644 index 000000000000..d8de98dcf60e --- /dev/null +++ b/services/batch/mgmt/2022-01-01/batch/version.go @@ -0,0 +1,19 @@ +package batch + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights 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. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " batch/2022-01-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/cdn/mgmt/2021-06-01/cdn/CHANGELOG.md b/services/cdn/mgmt/2021-06-01/cdn/CHANGELOG.md new file mode 100644 index 000000000000..52911e4cc5e4 --- /dev/null +++ b/services/cdn/mgmt/2021-06-01/cdn/CHANGELOG.md @@ -0,0 +1,2 @@ +# Change History + diff --git a/services/cdn/mgmt/2021-06-01/cdn/_meta.json b/services/cdn/mgmt/2021-06-01/cdn/_meta.json new file mode 100644 index 000000000000..32850ce6dba4 --- /dev/null +++ b/services/cdn/mgmt/2021-06-01/cdn/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "162460648e39b3cd20ef3d302008add138e90223", + "readme": "/_/azure-rest-api-specs/specification/cdn/resource-manager/readme.md", + "tag": "package-2021-06", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-06 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/cdn/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" + } +} \ No newline at end of file diff --git a/services/cdn/mgmt/2021-06-01/cdn/afdcustomdomains.go b/services/cdn/mgmt/2021-06-01/cdn/afdcustomdomains.go new file mode 100644 index 000000000000..55532707b5f3 --- /dev/null +++ b/services/cdn/mgmt/2021-06-01/cdn/afdcustomdomains.go @@ -0,0 +1,616 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AFDCustomDomainsClient is the cdn Management Client +type AFDCustomDomainsClient struct { + BaseClient +} + +// NewAFDCustomDomainsClient creates an instance of the AFDCustomDomainsClient client. +func NewAFDCustomDomainsClient(subscriptionID string) AFDCustomDomainsClient { + return NewAFDCustomDomainsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAFDCustomDomainsClientWithBaseURI creates an instance of the AFDCustomDomainsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewAFDCustomDomainsClientWithBaseURI(baseURI string, subscriptionID string) AFDCustomDomainsClient { + return AFDCustomDomainsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new domain within the specified profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// customDomainName - name of the domain under the profile which is unique globally +// customDomain - domain properties +func (client AFDCustomDomainsClient) Create(ctx context.Context, resourceGroupName string, profileName string, customDomainName string, customDomain AFDDomain) (result AFDCustomDomainsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDCustomDomainsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: customDomain, + Constraints: []validation.Constraint{{Target: "customDomain.AFDDomainProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "customDomain.AFDDomainProperties.HostName", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("cdn.AFDCustomDomainsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, profileName, customDomainName, customDomain) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client AFDCustomDomainsClient) CreatePreparer(ctx context.Context, resourceGroupName string, profileName string, customDomainName string, customDomain AFDDomain) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customDomainName": autorest.Encode("path", customDomainName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}", pathParameters), + autorest.WithJSON(customDomain), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client AFDCustomDomainsClient) CreateSender(req *http.Request) (future AFDCustomDomainsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client AFDCustomDomainsClient) CreateResponder(resp *http.Response) (result AFDDomain, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing AzureFrontDoor domain with the specified domain name under the specified subscription, +// resource group and profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// customDomainName - name of the domain under the profile which is unique globally. +func (client AFDCustomDomainsClient) Delete(ctx context.Context, resourceGroupName string, profileName string, customDomainName string) (result AFDCustomDomainsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDCustomDomainsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDCustomDomainsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName, customDomainName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AFDCustomDomainsClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string, customDomainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customDomainName": autorest.Encode("path", customDomainName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AFDCustomDomainsClient) DeleteSender(req *http.Request) (future AFDCustomDomainsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AFDCustomDomainsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an existing AzureFrontDoor domain with the specified domain name under the specified subscription, resource +// group and profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// customDomainName - name of the domain under the profile which is unique globally. +func (client AFDCustomDomainsClient) Get(ctx context.Context, resourceGroupName string, profileName string, customDomainName string) (result AFDDomain, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDCustomDomainsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDCustomDomainsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName, customDomainName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AFDCustomDomainsClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, customDomainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customDomainName": autorest.Encode("path", customDomainName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AFDCustomDomainsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AFDCustomDomainsClient) GetResponder(resp *http.Response) (result AFDDomain, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByProfile lists existing AzureFrontDoor domains. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile or CDN profile which +// is unique within the resource group. +func (client AFDCustomDomainsClient) ListByProfile(ctx context.Context, resourceGroupName string, profileName string) (result AFDDomainListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDCustomDomainsClient.ListByProfile") + defer func() { + sc := -1 + if result.adlr.Response.Response != nil { + sc = result.adlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDCustomDomainsClient", "ListByProfile", err.Error()) + } + + result.fn = client.listByProfileNextResults + req, err := client.ListByProfilePreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "ListByProfile", nil, "Failure preparing request") + return + } + + resp, err := client.ListByProfileSender(req) + if err != nil { + result.adlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "ListByProfile", resp, "Failure sending request") + return + } + + result.adlr, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "ListByProfile", resp, "Failure responding to request") + return + } + if result.adlr.hasNextLink() && result.adlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByProfilePreparer prepares the ListByProfile request. +func (client AFDCustomDomainsClient) ListByProfilePreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByProfileSender sends the ListByProfile request. The method will close the +// http.Response Body if it receives an error. +func (client AFDCustomDomainsClient) ListByProfileSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByProfileResponder handles the response to the ListByProfile request. The method always +// closes the http.Response Body. +func (client AFDCustomDomainsClient) ListByProfileResponder(resp *http.Response) (result AFDDomainListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByProfileNextResults retrieves the next set of results, if any. +func (client AFDCustomDomainsClient) listByProfileNextResults(ctx context.Context, lastResults AFDDomainListResult) (result AFDDomainListResult, err error) { + req, err := lastResults.aFDDomainListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "listByProfileNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByProfileSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "listByProfileNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "listByProfileNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByProfileComplete enumerates all values, automatically crossing page boundaries as required. +func (client AFDCustomDomainsClient) ListByProfileComplete(ctx context.Context, resourceGroupName string, profileName string) (result AFDDomainListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDCustomDomainsClient.ListByProfile") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByProfile(ctx, resourceGroupName, profileName) + return +} + +// RefreshValidationToken updates the domain validation token. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// customDomainName - name of the domain under the profile which is unique globally. +func (client AFDCustomDomainsClient) RefreshValidationToken(ctx context.Context, resourceGroupName string, profileName string, customDomainName string) (result AFDCustomDomainsRefreshValidationTokenFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDCustomDomainsClient.RefreshValidationToken") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDCustomDomainsClient", "RefreshValidationToken", err.Error()) + } + + req, err := client.RefreshValidationTokenPreparer(ctx, resourceGroupName, profileName, customDomainName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "RefreshValidationToken", nil, "Failure preparing request") + return + } + + result, err = client.RefreshValidationTokenSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "RefreshValidationToken", result.Response(), "Failure sending request") + return + } + + return +} + +// RefreshValidationTokenPreparer prepares the RefreshValidationToken request. +func (client AFDCustomDomainsClient) RefreshValidationTokenPreparer(ctx context.Context, resourceGroupName string, profileName string, customDomainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customDomainName": autorest.Encode("path", customDomainName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}/refreshValidationToken", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RefreshValidationTokenSender sends the RefreshValidationToken request. The method will close the +// http.Response Body if it receives an error. +func (client AFDCustomDomainsClient) RefreshValidationTokenSender(req *http.Request) (future AFDCustomDomainsRefreshValidationTokenFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RefreshValidationTokenResponder handles the response to the RefreshValidationToken request. The method always +// closes the http.Response Body. +func (client AFDCustomDomainsClient) RefreshValidationTokenResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update updates an existing domain within a profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// customDomainName - name of the domain under the profile which is unique globally +// customDomainUpdateProperties - domain properties +func (client AFDCustomDomainsClient) Update(ctx context.Context, resourceGroupName string, profileName string, customDomainName string, customDomainUpdateProperties AFDDomainUpdateParameters) (result AFDCustomDomainsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDCustomDomainsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDCustomDomainsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, profileName, customDomainName, customDomainUpdateProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AFDCustomDomainsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, customDomainName string, customDomainUpdateProperties AFDDomainUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customDomainName": autorest.Encode("path", customDomainName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}", pathParameters), + autorest.WithJSON(customDomainUpdateProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AFDCustomDomainsClient) UpdateSender(req *http.Request) (future AFDCustomDomainsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AFDCustomDomainsClient) UpdateResponder(resp *http.Response) (result AFDDomain, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/cdn/mgmt/2021-06-01/cdn/afdendpoints.go b/services/cdn/mgmt/2021-06-01/cdn/afdendpoints.go new file mode 100644 index 000000000000..eee6e78a71e7 --- /dev/null +++ b/services/cdn/mgmt/2021-06-01/cdn/afdendpoints.go @@ -0,0 +1,844 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AFDEndpointsClient is the cdn Management Client +type AFDEndpointsClient struct { + BaseClient +} + +// NewAFDEndpointsClient creates an instance of the AFDEndpointsClient client. +func NewAFDEndpointsClient(subscriptionID string) AFDEndpointsClient { + return NewAFDEndpointsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAFDEndpointsClientWithBaseURI creates an instance of the AFDEndpointsClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAFDEndpointsClientWithBaseURI(baseURI string, subscriptionID string) AFDEndpointsClient { + return AFDEndpointsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new AzureFrontDoor endpoint with the specified endpoint name under the specified subscription, +// resource group and profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// endpoint - endpoint properties +func (client AFDEndpointsClient) Create(ctx context.Context, resourceGroupName string, profileName string, endpointName string, endpoint AFDEndpoint) (result AFDEndpointsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDEndpointsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDEndpointsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, profileName, endpointName, endpoint) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client AFDEndpointsClient) CreatePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, endpoint AFDEndpoint) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}", pathParameters), + autorest.WithJSON(endpoint), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client AFDEndpointsClient) CreateSender(req *http.Request) (future AFDEndpointsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client AFDEndpointsClient) CreateResponder(resp *http.Response) (result AFDEndpoint, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing AzureFrontDoor endpoint with the specified endpoint name under the specified +// subscription, resource group and profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +func (client AFDEndpointsClient) Delete(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result AFDEndpointsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDEndpointsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDEndpointsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AFDEndpointsClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AFDEndpointsClient) DeleteSender(req *http.Request) (future AFDEndpointsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AFDEndpointsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an existing AzureFrontDoor endpoint with the specified endpoint name under the specified subscription, +// resource group and profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +func (client AFDEndpointsClient) Get(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result AFDEndpoint, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDEndpointsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDEndpointsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AFDEndpointsClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AFDEndpointsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AFDEndpointsClient) GetResponder(resp *http.Response) (result AFDEndpoint, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByProfile lists existing AzureFrontDoor endpoints. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +func (client AFDEndpointsClient) ListByProfile(ctx context.Context, resourceGroupName string, profileName string) (result AFDEndpointListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDEndpointsClient.ListByProfile") + defer func() { + sc := -1 + if result.aelr.Response.Response != nil { + sc = result.aelr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDEndpointsClient", "ListByProfile", err.Error()) + } + + result.fn = client.listByProfileNextResults + req, err := client.ListByProfilePreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "ListByProfile", nil, "Failure preparing request") + return + } + + resp, err := client.ListByProfileSender(req) + if err != nil { + result.aelr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "ListByProfile", resp, "Failure sending request") + return + } + + result.aelr, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "ListByProfile", resp, "Failure responding to request") + return + } + if result.aelr.hasNextLink() && result.aelr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByProfilePreparer prepares the ListByProfile request. +func (client AFDEndpointsClient) ListByProfilePreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByProfileSender sends the ListByProfile request. The method will close the +// http.Response Body if it receives an error. +func (client AFDEndpointsClient) ListByProfileSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByProfileResponder handles the response to the ListByProfile request. The method always +// closes the http.Response Body. +func (client AFDEndpointsClient) ListByProfileResponder(resp *http.Response) (result AFDEndpointListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByProfileNextResults retrieves the next set of results, if any. +func (client AFDEndpointsClient) listByProfileNextResults(ctx context.Context, lastResults AFDEndpointListResult) (result AFDEndpointListResult, err error) { + req, err := lastResults.aFDEndpointListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "listByProfileNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByProfileSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "listByProfileNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "listByProfileNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByProfileComplete enumerates all values, automatically crossing page boundaries as required. +func (client AFDEndpointsClient) ListByProfileComplete(ctx context.Context, resourceGroupName string, profileName string) (result AFDEndpointListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDEndpointsClient.ListByProfile") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByProfile(ctx, resourceGroupName, profileName) + return +} + +// ListResourceUsage checks the quota and actual usage of endpoints under the given CDN profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +func (client AFDEndpointsClient) ListResourceUsage(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result UsagesListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDEndpointsClient.ListResourceUsage") + defer func() { + sc := -1 + if result.ulr.Response.Response != nil { + sc = result.ulr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDEndpointsClient", "ListResourceUsage", err.Error()) + } + + result.fn = client.listResourceUsageNextResults + req, err := client.ListResourceUsagePreparer(ctx, resourceGroupName, profileName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "ListResourceUsage", nil, "Failure preparing request") + return + } + + resp, err := client.ListResourceUsageSender(req) + if err != nil { + result.ulr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "ListResourceUsage", resp, "Failure sending request") + return + } + + result.ulr, err = client.ListResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "ListResourceUsage", resp, "Failure responding to request") + return + } + if result.ulr.hasNextLink() && result.ulr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListResourceUsagePreparer prepares the ListResourceUsage request. +func (client AFDEndpointsClient) ListResourceUsagePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListResourceUsageSender sends the ListResourceUsage request. The method will close the +// http.Response Body if it receives an error. +func (client AFDEndpointsClient) ListResourceUsageSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResourceUsageResponder handles the response to the ListResourceUsage request. The method always +// closes the http.Response Body. +func (client AFDEndpointsClient) ListResourceUsageResponder(resp *http.Response) (result UsagesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listResourceUsageNextResults retrieves the next set of results, if any. +func (client AFDEndpointsClient) listResourceUsageNextResults(ctx context.Context, lastResults UsagesListResult) (result UsagesListResult, err error) { + req, err := lastResults.usagesListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "listResourceUsageNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListResourceUsageSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "listResourceUsageNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "listResourceUsageNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListResourceUsageComplete enumerates all values, automatically crossing page boundaries as required. +func (client AFDEndpointsClient) ListResourceUsageComplete(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result UsagesListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDEndpointsClient.ListResourceUsage") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListResourceUsage(ctx, resourceGroupName, profileName, endpointName) + return +} + +// PurgeContent removes a content from AzureFrontDoor. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// contents - the list of paths to the content and the list of linked domains to be purged. Path can be a full +// URL, e.g. '/pictures/city.png' which removes a single file, or a directory with a wildcard, e.g. +// '/pictures/*' which removes all folders and files in the directory. +func (client AFDEndpointsClient) PurgeContent(ctx context.Context, resourceGroupName string, profileName string, endpointName string, contents AfdPurgeParameters) (result AFDEndpointsPurgeContentFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDEndpointsClient.PurgeContent") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: contents, + Constraints: []validation.Constraint{{Target: "contents.ContentPaths", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDEndpointsClient", "PurgeContent", err.Error()) + } + + req, err := client.PurgeContentPreparer(ctx, resourceGroupName, profileName, endpointName, contents) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "PurgeContent", nil, "Failure preparing request") + return + } + + result, err = client.PurgeContentSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "PurgeContent", result.Response(), "Failure sending request") + return + } + + return +} + +// PurgeContentPreparer prepares the PurgeContent request. +func (client AFDEndpointsClient) PurgeContentPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, contents AfdPurgeParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/purge", pathParameters), + autorest.WithJSON(contents), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PurgeContentSender sends the PurgeContent request. The method will close the +// http.Response Body if it receives an error. +func (client AFDEndpointsClient) PurgeContentSender(req *http.Request) (future AFDEndpointsPurgeContentFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// PurgeContentResponder handles the response to the PurgeContent request. The method always +// closes the http.Response Body. +func (client AFDEndpointsClient) PurgeContentResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update updates an existing AzureFrontDoor endpoint with the specified endpoint name under the specified +// subscription, resource group and profile. Only tags can be updated after creating an endpoint. To update origins, +// use the Update Origin operation. To update origin groups, use the Update Origin group operation. To update domains, +// use the Update Custom Domain operation. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// endpointUpdateProperties - endpoint update properties +func (client AFDEndpointsClient) Update(ctx context.Context, resourceGroupName string, profileName string, endpointName string, endpointUpdateProperties AFDEndpointUpdateParameters) (result AFDEndpointsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDEndpointsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDEndpointsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, profileName, endpointName, endpointUpdateProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AFDEndpointsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, endpointUpdateProperties AFDEndpointUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}", pathParameters), + autorest.WithJSON(endpointUpdateProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AFDEndpointsClient) UpdateSender(req *http.Request) (future AFDEndpointsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AFDEndpointsClient) UpdateResponder(resp *http.Response) (result AFDEndpoint, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ValidateCustomDomain validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// customDomainProperties - custom domain to be validated. +func (client AFDEndpointsClient) ValidateCustomDomain(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainProperties ValidateCustomDomainInput) (result ValidateCustomDomainOutput, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDEndpointsClient.ValidateCustomDomain") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: customDomainProperties, + Constraints: []validation.Constraint{{Target: "customDomainProperties.HostName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDEndpointsClient", "ValidateCustomDomain", err.Error()) + } + + req, err := client.ValidateCustomDomainPreparer(ctx, resourceGroupName, profileName, endpointName, customDomainProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "ValidateCustomDomain", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateCustomDomainSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "ValidateCustomDomain", resp, "Failure sending request") + return + } + + result, err = client.ValidateCustomDomainResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "ValidateCustomDomain", resp, "Failure responding to request") + return + } + + return +} + +// ValidateCustomDomainPreparer prepares the ValidateCustomDomain request. +func (client AFDEndpointsClient) ValidateCustomDomainPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainProperties ValidateCustomDomainInput) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/validateCustomDomain", pathParameters), + autorest.WithJSON(customDomainProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateCustomDomainSender sends the ValidateCustomDomain request. The method will close the +// http.Response Body if it receives an error. +func (client AFDEndpointsClient) ValidateCustomDomainSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ValidateCustomDomainResponder handles the response to the ValidateCustomDomain request. The method always +// closes the http.Response Body. +func (client AFDEndpointsClient) ValidateCustomDomainResponder(resp *http.Response) (result ValidateCustomDomainOutput, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/cdn/mgmt/2021-06-01/cdn/afdorigingroups.go b/services/cdn/mgmt/2021-06-01/cdn/afdorigingroups.go new file mode 100644 index 000000000000..486e003e6d86 --- /dev/null +++ b/services/cdn/mgmt/2021-06-01/cdn/afdorigingroups.go @@ -0,0 +1,663 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AFDOriginGroupsClient is the cdn Management Client +type AFDOriginGroupsClient struct { + BaseClient +} + +// NewAFDOriginGroupsClient creates an instance of the AFDOriginGroupsClient client. +func NewAFDOriginGroupsClient(subscriptionID string) AFDOriginGroupsClient { + return NewAFDOriginGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAFDOriginGroupsClientWithBaseURI creates an instance of the AFDOriginGroupsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAFDOriginGroupsClientWithBaseURI(baseURI string, subscriptionID string) AFDOriginGroupsClient { + return AFDOriginGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new origin group within the specified profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// originGroupName - name of the origin group which is unique within the endpoint. +// originGroup - origin group properties +func (client AFDOriginGroupsClient) Create(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originGroup AFDOriginGroup) (result AFDOriginGroupsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginGroupsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: originGroup, + Constraints: []validation.Constraint{{Target: "originGroup.AFDOriginGroupProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "originGroup.AFDOriginGroupProperties.HealthProbeSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "originGroup.AFDOriginGroupProperties.HealthProbeSettings.ProbeIntervalInSeconds", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "originGroup.AFDOriginGroupProperties.HealthProbeSettings.ProbeIntervalInSeconds", Name: validation.InclusiveMaximum, Rule: int64(255), Chain: nil}, + {Target: "originGroup.AFDOriginGroupProperties.HealthProbeSettings.ProbeIntervalInSeconds", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}, + }}, + {Target: "originGroup.AFDOriginGroupProperties.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "originGroup.AFDOriginGroupProperties.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes", Name: validation.InclusiveMaximum, Rule: int64(50), Chain: nil}, + {Target: "originGroup.AFDOriginGroupProperties.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("cdn.AFDOriginGroupsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, profileName, originGroupName, originGroup) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client AFDOriginGroupsClient) CreatePreparer(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originGroup AFDOriginGroup) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "originGroupName": autorest.Encode("path", originGroupName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}", pathParameters), + autorest.WithJSON(originGroup), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client AFDOriginGroupsClient) CreateSender(req *http.Request) (future AFDOriginGroupsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client AFDOriginGroupsClient) CreateResponder(resp *http.Response) (result AFDOriginGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing origin group within a profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// originGroupName - name of the origin group which is unique within the profile. +func (client AFDOriginGroupsClient) Delete(ctx context.Context, resourceGroupName string, profileName string, originGroupName string) (result AFDOriginGroupsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginGroupsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDOriginGroupsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName, originGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AFDOriginGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string, originGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "originGroupName": autorest.Encode("path", originGroupName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AFDOriginGroupsClient) DeleteSender(req *http.Request) (future AFDOriginGroupsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AFDOriginGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an existing origin group within a profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// originGroupName - name of the origin group which is unique within the endpoint. +func (client AFDOriginGroupsClient) Get(ctx context.Context, resourceGroupName string, profileName string, originGroupName string) (result AFDOriginGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginGroupsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDOriginGroupsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName, originGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AFDOriginGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, originGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "originGroupName": autorest.Encode("path", originGroupName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AFDOriginGroupsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AFDOriginGroupsClient) GetResponder(resp *http.Response) (result AFDOriginGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByProfile lists all of the existing origin groups within a profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +func (client AFDOriginGroupsClient) ListByProfile(ctx context.Context, resourceGroupName string, profileName string) (result AFDOriginGroupListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginGroupsClient.ListByProfile") + defer func() { + sc := -1 + if result.aoglr.Response.Response != nil { + sc = result.aoglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDOriginGroupsClient", "ListByProfile", err.Error()) + } + + result.fn = client.listByProfileNextResults + req, err := client.ListByProfilePreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "ListByProfile", nil, "Failure preparing request") + return + } + + resp, err := client.ListByProfileSender(req) + if err != nil { + result.aoglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "ListByProfile", resp, "Failure sending request") + return + } + + result.aoglr, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "ListByProfile", resp, "Failure responding to request") + return + } + if result.aoglr.hasNextLink() && result.aoglr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByProfilePreparer prepares the ListByProfile request. +func (client AFDOriginGroupsClient) ListByProfilePreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByProfileSender sends the ListByProfile request. The method will close the +// http.Response Body if it receives an error. +func (client AFDOriginGroupsClient) ListByProfileSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByProfileResponder handles the response to the ListByProfile request. The method always +// closes the http.Response Body. +func (client AFDOriginGroupsClient) ListByProfileResponder(resp *http.Response) (result AFDOriginGroupListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByProfileNextResults retrieves the next set of results, if any. +func (client AFDOriginGroupsClient) listByProfileNextResults(ctx context.Context, lastResults AFDOriginGroupListResult) (result AFDOriginGroupListResult, err error) { + req, err := lastResults.aFDOriginGroupListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "listByProfileNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByProfileSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "listByProfileNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "listByProfileNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByProfileComplete enumerates all values, automatically crossing page boundaries as required. +func (client AFDOriginGroupsClient) ListByProfileComplete(ctx context.Context, resourceGroupName string, profileName string) (result AFDOriginGroupListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginGroupsClient.ListByProfile") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByProfile(ctx, resourceGroupName, profileName) + return +} + +// ListResourceUsage checks the quota and actual usage of endpoints under the given CDN profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// originGroupName - name of the origin group which is unique within the endpoint. +func (client AFDOriginGroupsClient) ListResourceUsage(ctx context.Context, resourceGroupName string, profileName string, originGroupName string) (result UsagesListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginGroupsClient.ListResourceUsage") + defer func() { + sc := -1 + if result.ulr.Response.Response != nil { + sc = result.ulr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDOriginGroupsClient", "ListResourceUsage", err.Error()) + } + + result.fn = client.listResourceUsageNextResults + req, err := client.ListResourceUsagePreparer(ctx, resourceGroupName, profileName, originGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "ListResourceUsage", nil, "Failure preparing request") + return + } + + resp, err := client.ListResourceUsageSender(req) + if err != nil { + result.ulr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "ListResourceUsage", resp, "Failure sending request") + return + } + + result.ulr, err = client.ListResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "ListResourceUsage", resp, "Failure responding to request") + return + } + if result.ulr.hasNextLink() && result.ulr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListResourceUsagePreparer prepares the ListResourceUsage request. +func (client AFDOriginGroupsClient) ListResourceUsagePreparer(ctx context.Context, resourceGroupName string, profileName string, originGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "originGroupName": autorest.Encode("path", originGroupName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListResourceUsageSender sends the ListResourceUsage request. The method will close the +// http.Response Body if it receives an error. +func (client AFDOriginGroupsClient) ListResourceUsageSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResourceUsageResponder handles the response to the ListResourceUsage request. The method always +// closes the http.Response Body. +func (client AFDOriginGroupsClient) ListResourceUsageResponder(resp *http.Response) (result UsagesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listResourceUsageNextResults retrieves the next set of results, if any. +func (client AFDOriginGroupsClient) listResourceUsageNextResults(ctx context.Context, lastResults UsagesListResult) (result UsagesListResult, err error) { + req, err := lastResults.usagesListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "listResourceUsageNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListResourceUsageSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "listResourceUsageNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "listResourceUsageNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListResourceUsageComplete enumerates all values, automatically crossing page boundaries as required. +func (client AFDOriginGroupsClient) ListResourceUsageComplete(ctx context.Context, resourceGroupName string, profileName string, originGroupName string) (result UsagesListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginGroupsClient.ListResourceUsage") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListResourceUsage(ctx, resourceGroupName, profileName, originGroupName) + return +} + +// Update updates an existing origin group within a profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// originGroupName - name of the origin group which is unique within the profile. +// originGroupUpdateProperties - origin group properties +func (client AFDOriginGroupsClient) Update(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originGroupUpdateProperties AFDOriginGroupUpdateParameters) (result AFDOriginGroupsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginGroupsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDOriginGroupsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, profileName, originGroupName, originGroupUpdateProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AFDOriginGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originGroupUpdateProperties AFDOriginGroupUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "originGroupName": autorest.Encode("path", originGroupName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}", pathParameters), + autorest.WithJSON(originGroupUpdateProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AFDOriginGroupsClient) UpdateSender(req *http.Request) (future AFDOriginGroupsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AFDOriginGroupsClient) UpdateResponder(resp *http.Response) (result AFDOriginGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/cdn/mgmt/2021-06-01/cdn/afdorigins.go b/services/cdn/mgmt/2021-06-01/cdn/afdorigins.go new file mode 100644 index 000000000000..06702c2b3806 --- /dev/null +++ b/services/cdn/mgmt/2021-06-01/cdn/afdorigins.go @@ -0,0 +1,551 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AFDOriginsClient is the cdn Management Client +type AFDOriginsClient struct { + BaseClient +} + +// NewAFDOriginsClient creates an instance of the AFDOriginsClient client. +func NewAFDOriginsClient(subscriptionID string) AFDOriginsClient { + return NewAFDOriginsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAFDOriginsClientWithBaseURI creates an instance of the AFDOriginsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAFDOriginsClientWithBaseURI(baseURI string, subscriptionID string) AFDOriginsClient { + return AFDOriginsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new origin within the specified origin group. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// originGroupName - name of the origin group which is unique within the profile. +// originName - name of the origin that is unique within the profile. +// origin - origin properties +func (client AFDOriginsClient) Create(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originName string, origin AFDOrigin) (result AFDOriginsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: origin, + Constraints: []validation.Constraint{{Target: "origin.AFDOriginProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "origin.AFDOriginProperties.HostName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "origin.AFDOriginProperties.HTTPPort", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "origin.AFDOriginProperties.HTTPPort", Name: validation.InclusiveMaximum, Rule: int64(65535), Chain: nil}, + {Target: "origin.AFDOriginProperties.HTTPPort", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}, + {Target: "origin.AFDOriginProperties.HTTPSPort", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "origin.AFDOriginProperties.HTTPSPort", Name: validation.InclusiveMaximum, Rule: int64(65535), Chain: nil}, + {Target: "origin.AFDOriginProperties.HTTPSPort", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}, + {Target: "origin.AFDOriginProperties.Priority", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "origin.AFDOriginProperties.Priority", Name: validation.InclusiveMaximum, Rule: int64(5), Chain: nil}, + {Target: "origin.AFDOriginProperties.Priority", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}, + {Target: "origin.AFDOriginProperties.Weight", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "origin.AFDOriginProperties.Weight", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, + {Target: "origin.AFDOriginProperties.Weight", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("cdn.AFDOriginsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, profileName, originGroupName, originName, origin) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client AFDOriginsClient) CreatePreparer(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originName string, origin AFDOrigin) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "originGroupName": autorest.Encode("path", originGroupName), + "originName": autorest.Encode("path", originName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}", pathParameters), + autorest.WithJSON(origin), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client AFDOriginsClient) CreateSender(req *http.Request) (future AFDOriginsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client AFDOriginsClient) CreateResponder(resp *http.Response) (result AFDOrigin, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing origin within an origin group. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// originGroupName - name of the origin group which is unique within the profile. +// originName - name of the origin which is unique within the profile. +func (client AFDOriginsClient) Delete(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originName string) (result AFDOriginsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDOriginsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName, originGroupName, originName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AFDOriginsClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "originGroupName": autorest.Encode("path", originGroupName), + "originName": autorest.Encode("path", originName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AFDOriginsClient) DeleteSender(req *http.Request) (future AFDOriginsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AFDOriginsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an existing origin within an origin group. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// originGroupName - name of the origin group which is unique within the profile. +// originName - name of the origin which is unique within the profile. +func (client AFDOriginsClient) Get(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originName string) (result AFDOrigin, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDOriginsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName, originGroupName, originName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AFDOriginsClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "originGroupName": autorest.Encode("path", originGroupName), + "originName": autorest.Encode("path", originName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AFDOriginsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AFDOriginsClient) GetResponder(resp *http.Response) (result AFDOrigin, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByOriginGroup lists all of the existing origins within an origin group. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// originGroupName - name of the origin group which is unique within the profile. +func (client AFDOriginsClient) ListByOriginGroup(ctx context.Context, resourceGroupName string, profileName string, originGroupName string) (result AFDOriginListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginsClient.ListByOriginGroup") + defer func() { + sc := -1 + if result.aolr.Response.Response != nil { + sc = result.aolr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDOriginsClient", "ListByOriginGroup", err.Error()) + } + + result.fn = client.listByOriginGroupNextResults + req, err := client.ListByOriginGroupPreparer(ctx, resourceGroupName, profileName, originGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "ListByOriginGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByOriginGroupSender(req) + if err != nil { + result.aolr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "ListByOriginGroup", resp, "Failure sending request") + return + } + + result.aolr, err = client.ListByOriginGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "ListByOriginGroup", resp, "Failure responding to request") + return + } + if result.aolr.hasNextLink() && result.aolr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByOriginGroupPreparer prepares the ListByOriginGroup request. +func (client AFDOriginsClient) ListByOriginGroupPreparer(ctx context.Context, resourceGroupName string, profileName string, originGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "originGroupName": autorest.Encode("path", originGroupName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByOriginGroupSender sends the ListByOriginGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AFDOriginsClient) ListByOriginGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByOriginGroupResponder handles the response to the ListByOriginGroup request. The method always +// closes the http.Response Body. +func (client AFDOriginsClient) ListByOriginGroupResponder(resp *http.Response) (result AFDOriginListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByOriginGroupNextResults retrieves the next set of results, if any. +func (client AFDOriginsClient) listByOriginGroupNextResults(ctx context.Context, lastResults AFDOriginListResult) (result AFDOriginListResult, err error) { + req, err := lastResults.aFDOriginListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "listByOriginGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByOriginGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "listByOriginGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByOriginGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "listByOriginGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByOriginGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client AFDOriginsClient) ListByOriginGroupComplete(ctx context.Context, resourceGroupName string, profileName string, originGroupName string) (result AFDOriginListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginsClient.ListByOriginGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByOriginGroup(ctx, resourceGroupName, profileName, originGroupName) + return +} + +// Update updates an existing origin within an origin group. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// originGroupName - name of the origin group which is unique within the profile. +// originName - name of the origin which is unique within the profile. +// originUpdateProperties - origin properties +func (client AFDOriginsClient) Update(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originName string, originUpdateProperties AFDOriginUpdateParameters) (result AFDOriginsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDOriginsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, profileName, originGroupName, originName, originUpdateProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AFDOriginsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originName string, originUpdateProperties AFDOriginUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "originGroupName": autorest.Encode("path", originGroupName), + "originName": autorest.Encode("path", originName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}", pathParameters), + autorest.WithJSON(originUpdateProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AFDOriginsClient) UpdateSender(req *http.Request) (future AFDOriginsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AFDOriginsClient) UpdateResponder(resp *http.Response) (result AFDOrigin, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/cdn/mgmt/2021-06-01/cdn/afdprofiles.go b/services/cdn/mgmt/2021-06-01/cdn/afdprofiles.go new file mode 100644 index 000000000000..25f3434c4600 --- /dev/null +++ b/services/cdn/mgmt/2021-06-01/cdn/afdprofiles.go @@ -0,0 +1,249 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AFDProfilesClient is the cdn Management Client +type AFDProfilesClient struct { + BaseClient +} + +// NewAFDProfilesClient creates an instance of the AFDProfilesClient client. +func NewAFDProfilesClient(subscriptionID string) AFDProfilesClient { + return NewAFDProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAFDProfilesClientWithBaseURI creates an instance of the AFDProfilesClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAFDProfilesClientWithBaseURI(baseURI string, subscriptionID string) AFDProfilesClient { + return AFDProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckHostNameAvailability validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium or CDN profile which is +// unique within the resource group. +// checkHostNameAvailabilityInput - custom domain to be validated. +func (client AFDProfilesClient) CheckHostNameAvailability(ctx context.Context, resourceGroupName string, profileName string, checkHostNameAvailabilityInput CheckHostNameAvailabilityInput) (result CheckNameAvailabilityOutput, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDProfilesClient.CheckHostNameAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: checkHostNameAvailabilityInput, + Constraints: []validation.Constraint{{Target: "checkHostNameAvailabilityInput.HostName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDProfilesClient", "CheckHostNameAvailability", err.Error()) + } + + req, err := client.CheckHostNameAvailabilityPreparer(ctx, resourceGroupName, profileName, checkHostNameAvailabilityInput) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDProfilesClient", "CheckHostNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckHostNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.AFDProfilesClient", "CheckHostNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckHostNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDProfilesClient", "CheckHostNameAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckHostNameAvailabilityPreparer prepares the CheckHostNameAvailability request. +func (client AFDProfilesClient) CheckHostNameAvailabilityPreparer(ctx context.Context, resourceGroupName string, profileName string, checkHostNameAvailabilityInput CheckHostNameAvailabilityInput) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/checkHostNameAvailability", pathParameters), + autorest.WithJSON(checkHostNameAvailabilityInput), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckHostNameAvailabilitySender sends the CheckHostNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client AFDProfilesClient) CheckHostNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckHostNameAvailabilityResponder handles the response to the CheckHostNameAvailability request. The method always +// closes the http.Response Body. +func (client AFDProfilesClient) CheckHostNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityOutput, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListResourceUsage checks the quota and actual usage of endpoints under the given CDN profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium or CDN profile which is +// unique within the resource group. +func (client AFDProfilesClient) ListResourceUsage(ctx context.Context, resourceGroupName string, profileName string) (result UsagesListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDProfilesClient.ListResourceUsage") + defer func() { + sc := -1 + if result.ulr.Response.Response != nil { + sc = result.ulr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDProfilesClient", "ListResourceUsage", err.Error()) + } + + result.fn = client.listResourceUsageNextResults + req, err := client.ListResourceUsagePreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDProfilesClient", "ListResourceUsage", nil, "Failure preparing request") + return + } + + resp, err := client.ListResourceUsageSender(req) + if err != nil { + result.ulr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.AFDProfilesClient", "ListResourceUsage", resp, "Failure sending request") + return + } + + result.ulr, err = client.ListResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDProfilesClient", "ListResourceUsage", resp, "Failure responding to request") + return + } + if result.ulr.hasNextLink() && result.ulr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListResourceUsagePreparer prepares the ListResourceUsage request. +func (client AFDProfilesClient) ListResourceUsagePreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListResourceUsageSender sends the ListResourceUsage request. The method will close the +// http.Response Body if it receives an error. +func (client AFDProfilesClient) ListResourceUsageSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResourceUsageResponder handles the response to the ListResourceUsage request. The method always +// closes the http.Response Body. +func (client AFDProfilesClient) ListResourceUsageResponder(resp *http.Response) (result UsagesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listResourceUsageNextResults retrieves the next set of results, if any. +func (client AFDProfilesClient) listResourceUsageNextResults(ctx context.Context, lastResults UsagesListResult) (result UsagesListResult, err error) { + req, err := lastResults.usagesListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.AFDProfilesClient", "listResourceUsageNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListResourceUsageSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.AFDProfilesClient", "listResourceUsageNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDProfilesClient", "listResourceUsageNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListResourceUsageComplete enumerates all values, automatically crossing page boundaries as required. +func (client AFDProfilesClient) ListResourceUsageComplete(ctx context.Context, resourceGroupName string, profileName string) (result UsagesListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDProfilesClient.ListResourceUsage") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListResourceUsage(ctx, resourceGroupName, profileName) + return +} diff --git a/services/cdn/mgmt/2021-06-01/cdn/cdnapi/interfaces.go b/services/cdn/mgmt/2021-06-01/cdn/cdnapi/interfaces.go new file mode 100644 index 000000000000..c75feafeea78 --- /dev/null +++ b/services/cdn/mgmt/2021-06-01/cdn/cdnapi/interfaces.go @@ -0,0 +1,285 @@ +package cdnapi + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" +) + +// BaseClientAPI contains the set of methods on the BaseClient type. +type BaseClientAPI interface { + CheckEndpointNameAvailability(ctx context.Context, checkEndpointNameAvailabilityInput cdn.CheckEndpointNameAvailabilityInput, resourceGroupName string) (result cdn.CheckEndpointNameAvailabilityOutput, err error) + CheckNameAvailability(ctx context.Context, checkNameAvailabilityInput cdn.CheckNameAvailabilityInput) (result cdn.CheckNameAvailabilityOutput, err error) + CheckNameAvailabilityWithSubscription(ctx context.Context, checkNameAvailabilityInput cdn.CheckNameAvailabilityInput) (result cdn.CheckNameAvailabilityOutput, err error) + ValidateProbe(ctx context.Context, validateProbeInput cdn.ValidateProbeInput) (result cdn.ValidateProbeOutput, err error) +} + +var _ BaseClientAPI = (*cdn.BaseClient)(nil) + +// AFDProfilesClientAPI contains the set of methods on the AFDProfilesClient type. +type AFDProfilesClientAPI interface { + CheckHostNameAvailability(ctx context.Context, resourceGroupName string, profileName string, checkHostNameAvailabilityInput cdn.CheckHostNameAvailabilityInput) (result cdn.CheckNameAvailabilityOutput, err error) + ListResourceUsage(ctx context.Context, resourceGroupName string, profileName string) (result cdn.UsagesListResultPage, err error) + ListResourceUsageComplete(ctx context.Context, resourceGroupName string, profileName string) (result cdn.UsagesListResultIterator, err error) +} + +var _ AFDProfilesClientAPI = (*cdn.AFDProfilesClient)(nil) + +// AFDCustomDomainsClientAPI contains the set of methods on the AFDCustomDomainsClient type. +type AFDCustomDomainsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, profileName string, customDomainName string, customDomain cdn.AFDDomain) (result cdn.AFDCustomDomainsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, profileName string, customDomainName string) (result cdn.AFDCustomDomainsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, profileName string, customDomainName string) (result cdn.AFDDomain, err error) + ListByProfile(ctx context.Context, resourceGroupName string, profileName string) (result cdn.AFDDomainListResultPage, err error) + ListByProfileComplete(ctx context.Context, resourceGroupName string, profileName string) (result cdn.AFDDomainListResultIterator, err error) + RefreshValidationToken(ctx context.Context, resourceGroupName string, profileName string, customDomainName string) (result cdn.AFDCustomDomainsRefreshValidationTokenFuture, err error) + Update(ctx context.Context, resourceGroupName string, profileName string, customDomainName string, customDomainUpdateProperties cdn.AFDDomainUpdateParameters) (result cdn.AFDCustomDomainsUpdateFuture, err error) +} + +var _ AFDCustomDomainsClientAPI = (*cdn.AFDCustomDomainsClient)(nil) + +// AFDEndpointsClientAPI contains the set of methods on the AFDEndpointsClient type. +type AFDEndpointsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, profileName string, endpointName string, endpoint cdn.AFDEndpoint) (result cdn.AFDEndpointsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result cdn.AFDEndpointsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result cdn.AFDEndpoint, err error) + ListByProfile(ctx context.Context, resourceGroupName string, profileName string) (result cdn.AFDEndpointListResultPage, err error) + ListByProfileComplete(ctx context.Context, resourceGroupName string, profileName string) (result cdn.AFDEndpointListResultIterator, err error) + ListResourceUsage(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result cdn.UsagesListResultPage, err error) + ListResourceUsageComplete(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result cdn.UsagesListResultIterator, err error) + PurgeContent(ctx context.Context, resourceGroupName string, profileName string, endpointName string, contents cdn.AfdPurgeParameters) (result cdn.AFDEndpointsPurgeContentFuture, err error) + Update(ctx context.Context, resourceGroupName string, profileName string, endpointName string, endpointUpdateProperties cdn.AFDEndpointUpdateParameters) (result cdn.AFDEndpointsUpdateFuture, err error) + ValidateCustomDomain(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainProperties cdn.ValidateCustomDomainInput) (result cdn.ValidateCustomDomainOutput, err error) +} + +var _ AFDEndpointsClientAPI = (*cdn.AFDEndpointsClient)(nil) + +// AFDOriginGroupsClientAPI contains the set of methods on the AFDOriginGroupsClient type. +type AFDOriginGroupsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originGroup cdn.AFDOriginGroup) (result cdn.AFDOriginGroupsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, profileName string, originGroupName string) (result cdn.AFDOriginGroupsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, profileName string, originGroupName string) (result cdn.AFDOriginGroup, err error) + ListByProfile(ctx context.Context, resourceGroupName string, profileName string) (result cdn.AFDOriginGroupListResultPage, err error) + ListByProfileComplete(ctx context.Context, resourceGroupName string, profileName string) (result cdn.AFDOriginGroupListResultIterator, err error) + ListResourceUsage(ctx context.Context, resourceGroupName string, profileName string, originGroupName string) (result cdn.UsagesListResultPage, err error) + ListResourceUsageComplete(ctx context.Context, resourceGroupName string, profileName string, originGroupName string) (result cdn.UsagesListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originGroupUpdateProperties cdn.AFDOriginGroupUpdateParameters) (result cdn.AFDOriginGroupsUpdateFuture, err error) +} + +var _ AFDOriginGroupsClientAPI = (*cdn.AFDOriginGroupsClient)(nil) + +// AFDOriginsClientAPI contains the set of methods on the AFDOriginsClient type. +type AFDOriginsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originName string, origin cdn.AFDOrigin) (result cdn.AFDOriginsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originName string) (result cdn.AFDOriginsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originName string) (result cdn.AFDOrigin, err error) + ListByOriginGroup(ctx context.Context, resourceGroupName string, profileName string, originGroupName string) (result cdn.AFDOriginListResultPage, err error) + ListByOriginGroupComplete(ctx context.Context, resourceGroupName string, profileName string, originGroupName string) (result cdn.AFDOriginListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originName string, originUpdateProperties cdn.AFDOriginUpdateParameters) (result cdn.AFDOriginsUpdateFuture, err error) +} + +var _ AFDOriginsClientAPI = (*cdn.AFDOriginsClient)(nil) + +// RoutesClientAPI contains the set of methods on the RoutesClient type. +type RoutesClientAPI interface { + Create(ctx context.Context, resourceGroupName string, profileName string, endpointName string, routeName string, route cdn.Route) (result cdn.RoutesCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, profileName string, endpointName string, routeName string) (result cdn.RoutesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, profileName string, endpointName string, routeName string) (result cdn.Route, err error) + ListByEndpoint(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result cdn.RouteListResultPage, err error) + ListByEndpointComplete(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result cdn.RouteListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, profileName string, endpointName string, routeName string, routeUpdateProperties cdn.RouteUpdateParameters) (result cdn.RoutesUpdateFuture, err error) +} + +var _ RoutesClientAPI = (*cdn.RoutesClient)(nil) + +// RuleSetsClientAPI contains the set of methods on the RuleSetsClient type. +type RuleSetsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (result cdn.RuleSet, err error) + Delete(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (result cdn.RuleSetsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (result cdn.RuleSet, err error) + ListByProfile(ctx context.Context, resourceGroupName string, profileName string) (result cdn.RuleSetListResultPage, err error) + ListByProfileComplete(ctx context.Context, resourceGroupName string, profileName string) (result cdn.RuleSetListResultIterator, err error) + ListResourceUsage(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (result cdn.UsagesListResultPage, err error) + ListResourceUsageComplete(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (result cdn.UsagesListResultIterator, err error) +} + +var _ RuleSetsClientAPI = (*cdn.RuleSetsClient)(nil) + +// RulesClientAPI contains the set of methods on the RulesClient type. +type RulesClientAPI interface { + Create(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string, ruleName string, rule cdn.Rule) (result cdn.RulesCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string, ruleName string) (result cdn.RulesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string, ruleName string) (result cdn.Rule, err error) + ListByRuleSet(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (result cdn.RuleListResultPage, err error) + ListByRuleSetComplete(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (result cdn.RuleListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string, ruleName string, ruleUpdateProperties cdn.RuleUpdateParameters) (result cdn.RulesUpdateFuture, err error) +} + +var _ RulesClientAPI = (*cdn.RulesClient)(nil) + +// SecurityPoliciesClientAPI contains the set of methods on the SecurityPoliciesClient type. +type SecurityPoliciesClientAPI interface { + Create(ctx context.Context, resourceGroupName string, profileName string, securityPolicyName string, securityPolicy cdn.SecurityPolicy) (result cdn.SecurityPoliciesCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, profileName string, securityPolicyName string) (result cdn.SecurityPoliciesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, profileName string, securityPolicyName string) (result cdn.SecurityPolicy, err error) + ListByProfile(ctx context.Context, resourceGroupName string, profileName string) (result cdn.SecurityPolicyListResultPage, err error) + ListByProfileComplete(ctx context.Context, resourceGroupName string, profileName string) (result cdn.SecurityPolicyListResultIterator, err error) + Patch(ctx context.Context, resourceGroupName string, profileName string, securityPolicyName string, securityPolicyUpdateProperties cdn.SecurityPolicyUpdateParameters) (result cdn.SecurityPoliciesPatchFuture, err error) +} + +var _ SecurityPoliciesClientAPI = (*cdn.SecurityPoliciesClient)(nil) + +// SecretsClientAPI contains the set of methods on the SecretsClient type. +type SecretsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, profileName string, secretName string, secret cdn.Secret) (result cdn.SecretsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, profileName string, secretName string) (result cdn.SecretsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, profileName string, secretName string) (result cdn.Secret, err error) + ListByProfile(ctx context.Context, resourceGroupName string, profileName string) (result cdn.SecretListResultPage, err error) + ListByProfileComplete(ctx context.Context, resourceGroupName string, profileName string) (result cdn.SecretListResultIterator, err error) +} + +var _ SecretsClientAPI = (*cdn.SecretsClient)(nil) + +// ValidateClientAPI contains the set of methods on the ValidateClient type. +type ValidateClientAPI interface { + SecretMethod(ctx context.Context, validateSecretInput cdn.ValidateSecretInput) (result cdn.ValidateSecretOutput, err error) +} + +var _ ValidateClientAPI = (*cdn.ValidateClient)(nil) + +// LogAnalyticsClientAPI contains the set of methods on the LogAnalyticsClient type. +type LogAnalyticsClientAPI interface { + GetLogAnalyticsLocations(ctx context.Context, resourceGroupName string, profileName string) (result cdn.ContinentsResponse, err error) + GetLogAnalyticsMetrics(ctx context.Context, resourceGroupName string, profileName string, metrics []cdn.LogMetric, dateTimeBegin date.Time, dateTimeEnd date.Time, granularity cdn.LogMetricsGranularity, customDomains []string, protocols []string, groupBy []cdn.LogMetricsGroupBy, continents []string, countryOrRegions []string) (result cdn.MetricsResponse, err error) + GetLogAnalyticsRankings(ctx context.Context, resourceGroupName string, profileName string, rankings []cdn.LogRanking, metrics []cdn.LogRankingMetric, maxRanking int32, dateTimeBegin date.Time, dateTimeEnd date.Time, customDomains []string) (result cdn.RankingsResponse, err error) + GetLogAnalyticsResources(ctx context.Context, resourceGroupName string, profileName string) (result cdn.ResourcesResponse, err error) + GetWafLogAnalyticsMetrics(ctx context.Context, resourceGroupName string, profileName string, metrics []cdn.WafMetric, dateTimeBegin date.Time, dateTimeEnd date.Time, granularity cdn.WafGranularity, actions []cdn.WafAction, groupBy []cdn.WafRankingGroupBy, ruleTypes []cdn.WafRuleType) (result cdn.WafMetricsResponse, err error) + GetWafLogAnalyticsRankings(ctx context.Context, resourceGroupName string, profileName string, metrics []cdn.WafMetric, dateTimeBegin date.Time, dateTimeEnd date.Time, maxRanking int32, rankings []cdn.WafRankingType, actions []cdn.WafAction, ruleTypes []cdn.WafRuleType) (result cdn.WafRankingsResponse, err error) +} + +var _ LogAnalyticsClientAPI = (*cdn.LogAnalyticsClient)(nil) + +// ProfilesClientAPI contains the set of methods on the ProfilesClient type. +type ProfilesClientAPI interface { + Create(ctx context.Context, resourceGroupName string, profileName string, profile cdn.Profile) (result cdn.ProfilesCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, profileName string) (result cdn.ProfilesDeleteFuture, err error) + GenerateSsoURI(ctx context.Context, resourceGroupName string, profileName string) (result cdn.SsoURI, err error) + Get(ctx context.Context, resourceGroupName string, profileName string) (result cdn.Profile, err error) + List(ctx context.Context) (result cdn.ProfileListResultPage, err error) + ListComplete(ctx context.Context) (result cdn.ProfileListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result cdn.ProfileListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result cdn.ProfileListResultIterator, err error) + ListResourceUsage(ctx context.Context, resourceGroupName string, profileName string) (result cdn.ResourceUsageListResultPage, err error) + ListResourceUsageComplete(ctx context.Context, resourceGroupName string, profileName string) (result cdn.ResourceUsageListResultIterator, err error) + ListSupportedOptimizationTypes(ctx context.Context, resourceGroupName string, profileName string) (result cdn.SupportedOptimizationTypesListResult, err error) + Update(ctx context.Context, resourceGroupName string, profileName string, profileUpdateParameters cdn.ProfileUpdateParameters) (result cdn.ProfilesUpdateFuture, err error) +} + +var _ ProfilesClientAPI = (*cdn.ProfilesClient)(nil) + +// EndpointsClientAPI contains the set of methods on the EndpointsClient type. +type EndpointsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, profileName string, endpointName string, endpoint cdn.Endpoint) (result cdn.EndpointsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result cdn.EndpointsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result cdn.Endpoint, err error) + ListByProfile(ctx context.Context, resourceGroupName string, profileName string) (result cdn.EndpointListResultPage, err error) + ListByProfileComplete(ctx context.Context, resourceGroupName string, profileName string) (result cdn.EndpointListResultIterator, err error) + ListResourceUsage(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result cdn.ResourceUsageListResultPage, err error) + ListResourceUsageComplete(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result cdn.ResourceUsageListResultIterator, err error) + LoadContent(ctx context.Context, resourceGroupName string, profileName string, endpointName string, contentFilePaths cdn.LoadParameters) (result cdn.EndpointsLoadContentFuture, err error) + PurgeContent(ctx context.Context, resourceGroupName string, profileName string, endpointName string, contentFilePaths cdn.PurgeParameters) (result cdn.EndpointsPurgeContentFuture, err error) + Start(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result cdn.EndpointsStartFuture, err error) + Stop(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result cdn.EndpointsStopFuture, err error) + Update(ctx context.Context, resourceGroupName string, profileName string, endpointName string, endpointUpdateProperties cdn.EndpointUpdateParameters) (result cdn.EndpointsUpdateFuture, err error) + ValidateCustomDomain(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainProperties cdn.ValidateCustomDomainInput) (result cdn.ValidateCustomDomainOutput, err error) +} + +var _ EndpointsClientAPI = (*cdn.EndpointsClient)(nil) + +// OriginsClientAPI contains the set of methods on the OriginsClient type. +type OriginsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originName string, origin cdn.Origin) (result cdn.OriginsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originName string) (result cdn.OriginsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originName string) (result cdn.Origin, err error) + ListByEndpoint(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result cdn.OriginListResultPage, err error) + ListByEndpointComplete(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result cdn.OriginListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originName string, originUpdateProperties cdn.OriginUpdateParameters) (result cdn.OriginsUpdateFuture, err error) +} + +var _ OriginsClientAPI = (*cdn.OriginsClient)(nil) + +// OriginGroupsClientAPI contains the set of methods on the OriginGroupsClient type. +type OriginGroupsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originGroupName string, originGroup cdn.OriginGroup) (result cdn.OriginGroupsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originGroupName string) (result cdn.OriginGroupsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originGroupName string) (result cdn.OriginGroup, err error) + ListByEndpoint(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result cdn.OriginGroupListResultPage, err error) + ListByEndpointComplete(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result cdn.OriginGroupListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originGroupName string, originGroupUpdateProperties cdn.OriginGroupUpdateParameters) (result cdn.OriginGroupsUpdateFuture, err error) +} + +var _ OriginGroupsClientAPI = (*cdn.OriginGroupsClient)(nil) + +// CustomDomainsClientAPI contains the set of methods on the CustomDomainsClient type. +type CustomDomainsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainName string, customDomainProperties cdn.CustomDomainParameters) (result cdn.CustomDomainsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainName string) (result cdn.CustomDomainsDeleteFuture, err error) + DisableCustomHTTPS(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainName string) (result cdn.CustomDomain, err error) + EnableCustomHTTPS(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainName string, customDomainHTTPSParameters *cdn.BasicCustomDomainHTTPSParameters) (result cdn.CustomDomain, err error) + Get(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainName string) (result cdn.CustomDomain, err error) + ListByEndpoint(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result cdn.CustomDomainListResultPage, err error) + ListByEndpointComplete(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result cdn.CustomDomainListResultIterator, err error) +} + +var _ CustomDomainsClientAPI = (*cdn.CustomDomainsClient)(nil) + +// ResourceUsageClientAPI contains the set of methods on the ResourceUsageClient type. +type ResourceUsageClientAPI interface { + List(ctx context.Context) (result cdn.ResourceUsageListResultPage, err error) + ListComplete(ctx context.Context) (result cdn.ResourceUsageListResultIterator, err error) +} + +var _ ResourceUsageClientAPI = (*cdn.ResourceUsageClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result cdn.OperationsListResultPage, err error) + ListComplete(ctx context.Context) (result cdn.OperationsListResultIterator, err error) +} + +var _ OperationsClientAPI = (*cdn.OperationsClient)(nil) + +// EdgeNodesClientAPI contains the set of methods on the EdgeNodesClient type. +type EdgeNodesClientAPI interface { + List(ctx context.Context) (result cdn.EdgenodeResultPage, err error) + ListComplete(ctx context.Context) (result cdn.EdgenodeResultIterator, err error) +} + +var _ EdgeNodesClientAPI = (*cdn.EdgeNodesClient)(nil) + +// PoliciesClientAPI contains the set of methods on the PoliciesClient type. +type PoliciesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, policyName string, cdnWebApplicationFirewallPolicy cdn.WebApplicationFirewallPolicy) (result cdn.PoliciesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, policyName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, policyName string) (result cdn.WebApplicationFirewallPolicy, err error) + List(ctx context.Context, resourceGroupName string) (result cdn.WebApplicationFirewallPolicyListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result cdn.WebApplicationFirewallPolicyListIterator, err error) + Update(ctx context.Context, resourceGroupName string, policyName string, cdnWebApplicationFirewallPolicyPatchParameters cdn.WebApplicationFirewallPolicyPatchParameters) (result cdn.PoliciesUpdateFuture, err error) +} + +var _ PoliciesClientAPI = (*cdn.PoliciesClient)(nil) + +// ManagedRuleSetsClientAPI contains the set of methods on the ManagedRuleSetsClient type. +type ManagedRuleSetsClientAPI interface { + List(ctx context.Context) (result cdn.ManagedRuleSetDefinitionListPage, err error) + ListComplete(ctx context.Context) (result cdn.ManagedRuleSetDefinitionListIterator, err error) +} + +var _ ManagedRuleSetsClientAPI = (*cdn.ManagedRuleSetsClient)(nil) diff --git a/services/cdn/mgmt/2021-06-01/cdn/client.go b/services/cdn/mgmt/2021-06-01/cdn/client.go new file mode 100644 index 000000000000..17884e340869 --- /dev/null +++ b/services/cdn/mgmt/2021-06-01/cdn/client.go @@ -0,0 +1,377 @@ +// Package cdn implements the Azure ARM Cdn service API version 2021-06-01. +// +// Cdn Management Client +package cdn + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +const ( + // DefaultBaseURI is the default URI used for the service Cdn + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Cdn. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} + +// CheckEndpointNameAvailability check the availability of a resource name. This is needed for resources where name is +// globally unique, such as a afdx endpoint. +// Parameters: +// checkEndpointNameAvailabilityInput - input to check. +// resourceGroupName - name of the Resource group within the Azure subscription. +func (client BaseClient) CheckEndpointNameAvailability(ctx context.Context, checkEndpointNameAvailabilityInput CheckEndpointNameAvailabilityInput, resourceGroupName string) (result CheckEndpointNameAvailabilityOutput, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CheckEndpointNameAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: checkEndpointNameAvailabilityInput, + Constraints: []validation.Constraint{{Target: "checkEndpointNameAvailabilityInput.Name", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.BaseClient", "CheckEndpointNameAvailability", err.Error()) + } + + req, err := client.CheckEndpointNameAvailabilityPreparer(ctx, checkEndpointNameAvailabilityInput, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.BaseClient", "CheckEndpointNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckEndpointNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.BaseClient", "CheckEndpointNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckEndpointNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.BaseClient", "CheckEndpointNameAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckEndpointNameAvailabilityPreparer prepares the CheckEndpointNameAvailability request. +func (client BaseClient) CheckEndpointNameAvailabilityPreparer(ctx context.Context, checkEndpointNameAvailabilityInput CheckEndpointNameAvailabilityInput, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/checkEndpointNameAvailability", pathParameters), + autorest.WithJSON(checkEndpointNameAvailabilityInput), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckEndpointNameAvailabilitySender sends the CheckEndpointNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) CheckEndpointNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckEndpointNameAvailabilityResponder handles the response to the CheckEndpointNameAvailability request. The method always +// closes the http.Response Body. +func (client BaseClient) CheckEndpointNameAvailabilityResponder(resp *http.Response) (result CheckEndpointNameAvailabilityOutput, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CheckNameAvailability check the availability of a resource name. This is needed for resources where name is globally +// unique, such as a CDN endpoint. +// Parameters: +// checkNameAvailabilityInput - input to check. +func (client BaseClient) CheckNameAvailability(ctx context.Context, checkNameAvailabilityInput CheckNameAvailabilityInput) (result CheckNameAvailabilityOutput, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CheckNameAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: checkNameAvailabilityInput, + Constraints: []validation.Constraint{{Target: "checkNameAvailabilityInput.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.BaseClient", "CheckNameAvailability", err.Error()) + } + + req, err := client.CheckNameAvailabilityPreparer(ctx, checkNameAvailabilityInput) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.BaseClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.BaseClient", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.BaseClient", "CheckNameAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client BaseClient) CheckNameAvailabilityPreparer(ctx context.Context, checkNameAvailabilityInput CheckNameAvailabilityInput) (*http.Request, error) { + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Cdn/checkNameAvailability"), + autorest.WithJSON(checkNameAvailabilityInput), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client BaseClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityOutput, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CheckNameAvailabilityWithSubscription check the availability of a resource name. This is needed for resources where +// name is globally unique, such as a CDN endpoint. +// Parameters: +// checkNameAvailabilityInput - input to check. +func (client BaseClient) CheckNameAvailabilityWithSubscription(ctx context.Context, checkNameAvailabilityInput CheckNameAvailabilityInput) (result CheckNameAvailabilityOutput, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CheckNameAvailabilityWithSubscription") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: checkNameAvailabilityInput, + Constraints: []validation.Constraint{{Target: "checkNameAvailabilityInput.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.BaseClient", "CheckNameAvailabilityWithSubscription", err.Error()) + } + + req, err := client.CheckNameAvailabilityWithSubscriptionPreparer(ctx, checkNameAvailabilityInput) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.BaseClient", "CheckNameAvailabilityWithSubscription", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilityWithSubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.BaseClient", "CheckNameAvailabilityWithSubscription", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityWithSubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.BaseClient", "CheckNameAvailabilityWithSubscription", resp, "Failure responding to request") + return + } + + return +} + +// CheckNameAvailabilityWithSubscriptionPreparer prepares the CheckNameAvailabilityWithSubscription request. +func (client BaseClient) CheckNameAvailabilityWithSubscriptionPreparer(ctx context.Context, checkNameAvailabilityInput CheckNameAvailabilityInput) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkNameAvailability", pathParameters), + autorest.WithJSON(checkNameAvailabilityInput), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckNameAvailabilityWithSubscriptionSender sends the CheckNameAvailabilityWithSubscription request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) CheckNameAvailabilityWithSubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckNameAvailabilityWithSubscriptionResponder handles the response to the CheckNameAvailabilityWithSubscription request. The method always +// closes the http.Response Body. +func (client BaseClient) CheckNameAvailabilityWithSubscriptionResponder(resp *http.Response) (result CheckNameAvailabilityOutput, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ValidateProbe check if the probe path is a valid path and the file can be accessed. Probe path is the path to a file +// hosted on the origin server to help accelerate the delivery of dynamic content via the CDN endpoint. This path is +// relative to the origin path specified in the endpoint configuration. +// Parameters: +// validateProbeInput - input to check. +func (client BaseClient) ValidateProbe(ctx context.Context, validateProbeInput ValidateProbeInput) (result ValidateProbeOutput, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ValidateProbe") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: validateProbeInput, + Constraints: []validation.Constraint{{Target: "validateProbeInput.ProbeURL", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.BaseClient", "ValidateProbe", err.Error()) + } + + req, err := client.ValidateProbePreparer(ctx, validateProbeInput) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.BaseClient", "ValidateProbe", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateProbeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.BaseClient", "ValidateProbe", resp, "Failure sending request") + return + } + + result, err = client.ValidateProbeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.BaseClient", "ValidateProbe", resp, "Failure responding to request") + return + } + + return +} + +// ValidateProbePreparer prepares the ValidateProbe request. +func (client BaseClient) ValidateProbePreparer(ctx context.Context, validateProbeInput ValidateProbeInput) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/validateProbe", pathParameters), + autorest.WithJSON(validateProbeInput), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateProbeSender sends the ValidateProbe request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) ValidateProbeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ValidateProbeResponder handles the response to the ValidateProbe request. The method always +// closes the http.Response Body. +func (client BaseClient) ValidateProbeResponder(resp *http.Response) (result ValidateProbeOutput, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/cdn/mgmt/2021-06-01/cdn/customdomains.go b/services/cdn/mgmt/2021-06-01/cdn/customdomains.go new file mode 100644 index 000000000000..3ebf37f57630 --- /dev/null +++ b/services/cdn/mgmt/2021-06-01/cdn/customdomains.go @@ -0,0 +1,620 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// CustomDomainsClient is the cdn Management Client +type CustomDomainsClient struct { + BaseClient +} + +// NewCustomDomainsClient creates an instance of the CustomDomainsClient client. +func NewCustomDomainsClient(subscriptionID string) CustomDomainsClient { + return NewCustomDomainsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCustomDomainsClientWithBaseURI creates an instance of the CustomDomainsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewCustomDomainsClientWithBaseURI(baseURI string, subscriptionID string) CustomDomainsClient { + return CustomDomainsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new custom domain within an endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// customDomainName - name of the custom domain within an endpoint. +// customDomainProperties - properties required to create a new custom domain. +func (client CustomDomainsClient) Create(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainName string, customDomainProperties CustomDomainParameters) (result CustomDomainsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: customDomainProperties, + Constraints: []validation.Constraint{{Target: "customDomainProperties.CustomDomainPropertiesParameters", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "customDomainProperties.CustomDomainPropertiesParameters.HostName", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("cdn.CustomDomainsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, profileName, endpointName, customDomainName, customDomainProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client CustomDomainsClient) CreatePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainName string, customDomainProperties CustomDomainParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customDomainName": autorest.Encode("path", customDomainName), + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}", pathParameters), + autorest.WithJSON(customDomainProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client CustomDomainsClient) CreateSender(req *http.Request) (future CustomDomainsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client CustomDomainsClient) CreateResponder(resp *http.Response) (result CustomDomain, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing custom domain within an endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// customDomainName - name of the custom domain within an endpoint. +func (client CustomDomainsClient) Delete(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainName string) (result CustomDomainsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.CustomDomainsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName, endpointName, customDomainName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client CustomDomainsClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customDomainName": autorest.Encode("path", customDomainName), + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client CustomDomainsClient) DeleteSender(req *http.Request) (future CustomDomainsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client CustomDomainsClient) DeleteResponder(resp *http.Response) (result CustomDomain, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DisableCustomHTTPS disable https delivery of the custom domain. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// customDomainName - name of the custom domain within an endpoint. +func (client CustomDomainsClient) DisableCustomHTTPS(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainName string) (result CustomDomain, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.DisableCustomHTTPS") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.CustomDomainsClient", "DisableCustomHTTPS", err.Error()) + } + + req, err := client.DisableCustomHTTPSPreparer(ctx, resourceGroupName, profileName, endpointName, customDomainName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "DisableCustomHTTPS", nil, "Failure preparing request") + return + } + + resp, err := client.DisableCustomHTTPSSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "DisableCustomHTTPS", resp, "Failure sending request") + return + } + + result, err = client.DisableCustomHTTPSResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "DisableCustomHTTPS", resp, "Failure responding to request") + return + } + + return +} + +// DisableCustomHTTPSPreparer prepares the DisableCustomHTTPS request. +func (client CustomDomainsClient) DisableCustomHTTPSPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customDomainName": autorest.Encode("path", customDomainName), + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/disableCustomHttps", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DisableCustomHTTPSSender sends the DisableCustomHTTPS request. The method will close the +// http.Response Body if it receives an error. +func (client CustomDomainsClient) DisableCustomHTTPSSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DisableCustomHTTPSResponder handles the response to the DisableCustomHTTPS request. The method always +// closes the http.Response Body. +func (client CustomDomainsClient) DisableCustomHTTPSResponder(resp *http.Response) (result CustomDomain, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// EnableCustomHTTPS enable https delivery of the custom domain. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// customDomainName - name of the custom domain within an endpoint. +// customDomainHTTPSParameters - the configuration specifying how to enable HTTPS for the custom domain - using +// CDN managed certificate or user's own certificate. If not specified, enabling ssl uses CDN managed +// certificate by default. +func (client CustomDomainsClient) EnableCustomHTTPS(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainName string, customDomainHTTPSParameters *BasicCustomDomainHTTPSParameters) (result CustomDomain, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.EnableCustomHTTPS") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.CustomDomainsClient", "EnableCustomHTTPS", err.Error()) + } + + req, err := client.EnableCustomHTTPSPreparer(ctx, resourceGroupName, profileName, endpointName, customDomainName, customDomainHTTPSParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "EnableCustomHTTPS", nil, "Failure preparing request") + return + } + + resp, err := client.EnableCustomHTTPSSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "EnableCustomHTTPS", resp, "Failure sending request") + return + } + + result, err = client.EnableCustomHTTPSResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "EnableCustomHTTPS", resp, "Failure responding to request") + return + } + + return +} + +// EnableCustomHTTPSPreparer prepares the EnableCustomHTTPS request. +func (client CustomDomainsClient) EnableCustomHTTPSPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainName string, customDomainHTTPSParameters *BasicCustomDomainHTTPSParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customDomainName": autorest.Encode("path", customDomainName), + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/enableCustomHttps", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if customDomainHTTPSParameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(customDomainHTTPSParameters)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// EnableCustomHTTPSSender sends the EnableCustomHTTPS request. The method will close the +// http.Response Body if it receives an error. +func (client CustomDomainsClient) EnableCustomHTTPSSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// EnableCustomHTTPSResponder handles the response to the EnableCustomHTTPS request. The method always +// closes the http.Response Body. +func (client CustomDomainsClient) EnableCustomHTTPSResponder(resp *http.Response) (result CustomDomain, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets an existing custom domain within an endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// customDomainName - name of the custom domain within an endpoint. +func (client CustomDomainsClient) Get(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainName string) (result CustomDomain, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.CustomDomainsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName, endpointName, customDomainName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client CustomDomainsClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customDomainName": autorest.Encode("path", customDomainName), + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client CustomDomainsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client CustomDomainsClient) GetResponder(resp *http.Response) (result CustomDomain, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByEndpoint lists all of the existing custom domains within an endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +func (client CustomDomainsClient) ListByEndpoint(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result CustomDomainListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.ListByEndpoint") + defer func() { + sc := -1 + if result.cdlr.Response.Response != nil { + sc = result.cdlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.CustomDomainsClient", "ListByEndpoint", err.Error()) + } + + result.fn = client.listByEndpointNextResults + req, err := client.ListByEndpointPreparer(ctx, resourceGroupName, profileName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "ListByEndpoint", nil, "Failure preparing request") + return + } + + resp, err := client.ListByEndpointSender(req) + if err != nil { + result.cdlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "ListByEndpoint", resp, "Failure sending request") + return + } + + result.cdlr, err = client.ListByEndpointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "ListByEndpoint", resp, "Failure responding to request") + return + } + if result.cdlr.hasNextLink() && result.cdlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByEndpointPreparer prepares the ListByEndpoint request. +func (client CustomDomainsClient) ListByEndpointPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByEndpointSender sends the ListByEndpoint request. The method will close the +// http.Response Body if it receives an error. +func (client CustomDomainsClient) ListByEndpointSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByEndpointResponder handles the response to the ListByEndpoint request. The method always +// closes the http.Response Body. +func (client CustomDomainsClient) ListByEndpointResponder(resp *http.Response) (result CustomDomainListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByEndpointNextResults retrieves the next set of results, if any. +func (client CustomDomainsClient) listByEndpointNextResults(ctx context.Context, lastResults CustomDomainListResult) (result CustomDomainListResult, err error) { + req, err := lastResults.customDomainListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "listByEndpointNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByEndpointSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "listByEndpointNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByEndpointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "listByEndpointNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByEndpointComplete enumerates all values, automatically crossing page boundaries as required. +func (client CustomDomainsClient) ListByEndpointComplete(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result CustomDomainListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.ListByEndpoint") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByEndpoint(ctx, resourceGroupName, profileName, endpointName) + return +} diff --git a/services/cdn/mgmt/2021-06-01/cdn/edgenodes.go b/services/cdn/mgmt/2021-06-01/cdn/edgenodes.go new file mode 100644 index 000000000000..a58d06ec279e --- /dev/null +++ b/services/cdn/mgmt/2021-06-01/cdn/edgenodes.go @@ -0,0 +1,140 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// EdgeNodesClient is the cdn Management Client +type EdgeNodesClient struct { + BaseClient +} + +// NewEdgeNodesClient creates an instance of the EdgeNodesClient client. +func NewEdgeNodesClient(subscriptionID string) EdgeNodesClient { + return NewEdgeNodesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEdgeNodesClientWithBaseURI creates an instance of the EdgeNodesClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewEdgeNodesClientWithBaseURI(baseURI string, subscriptionID string) EdgeNodesClient { + return EdgeNodesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List edgenodes are the global Point of Presence (POP) locations used to deliver CDN content to end users. +func (client EdgeNodesClient) List(ctx context.Context) (result EdgenodeResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EdgeNodesClient.List") + defer func() { + sc := -1 + if result.er.Response.Response != nil { + sc = result.er.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.er.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "List", resp, "Failure sending request") + return + } + + result.er, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "List", resp, "Failure responding to request") + return + } + if result.er.hasNextLink() && result.er.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client EdgeNodesClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Cdn/edgenodes"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client EdgeNodesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client EdgeNodesClient) ListResponder(resp *http.Response) (result EdgenodeResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client EdgeNodesClient) listNextResults(ctx context.Context, lastResults EdgenodeResult) (result EdgenodeResult, err error) { + req, err := lastResults.edgenodeResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client EdgeNodesClient) ListComplete(ctx context.Context) (result EdgenodeResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EdgeNodesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/cdn/mgmt/2021-06-01/cdn/endpoints.go b/services/cdn/mgmt/2021-06-01/cdn/endpoints.go new file mode 100644 index 000000000000..98cee37c72a1 --- /dev/null +++ b/services/cdn/mgmt/2021-06-01/cdn/endpoints.go @@ -0,0 +1,1111 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// EndpointsClient is the cdn Management Client +type EndpointsClient struct { + BaseClient +} + +// NewEndpointsClient creates an instance of the EndpointsClient client. +func NewEndpointsClient(subscriptionID string) EndpointsClient { + return NewEndpointsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEndpointsClientWithBaseURI creates an instance of the EndpointsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewEndpointsClientWithBaseURI(baseURI string, subscriptionID string) EndpointsClient { + return EndpointsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new CDN endpoint with the specified endpoint name under the specified subscription, resource group +// and profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// endpoint - endpoint properties +func (client EndpointsClient) Create(ctx context.Context, resourceGroupName string, profileName string, endpointName string, endpoint Endpoint) (result EndpointsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: endpoint, + Constraints: []validation.Constraint{{Target: "endpoint.EndpointProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "endpoint.EndpointProperties.Origins", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("cdn.EndpointsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, profileName, endpointName, endpoint) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client EndpointsClient) CreatePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, endpoint Endpoint) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}", pathParameters), + autorest.WithJSON(endpoint), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) CreateSender(req *http.Request) (future EndpointsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client EndpointsClient) CreateResponder(resp *http.Response) (result Endpoint, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing CDN endpoint with the specified endpoint name under the specified subscription, resource +// group and profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +func (client EndpointsClient) Delete(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result EndpointsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.EndpointsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client EndpointsClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) DeleteSender(req *http.Request) (future EndpointsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client EndpointsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an existing CDN endpoint with the specified endpoint name under the specified subscription, resource group +// and profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +func (client EndpointsClient) Get(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result Endpoint, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.EndpointsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client EndpointsClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client EndpointsClient) GetResponder(resp *http.Response) (result Endpoint, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByProfile lists existing CDN endpoints. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +func (client EndpointsClient) ListByProfile(ctx context.Context, resourceGroupName string, profileName string) (result EndpointListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.ListByProfile") + defer func() { + sc := -1 + if result.elr.Response.Response != nil { + sc = result.elr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.EndpointsClient", "ListByProfile", err.Error()) + } + + result.fn = client.listByProfileNextResults + req, err := client.ListByProfilePreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListByProfile", nil, "Failure preparing request") + return + } + + resp, err := client.ListByProfileSender(req) + if err != nil { + result.elr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListByProfile", resp, "Failure sending request") + return + } + + result.elr, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListByProfile", resp, "Failure responding to request") + return + } + if result.elr.hasNextLink() && result.elr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByProfilePreparer prepares the ListByProfile request. +func (client EndpointsClient) ListByProfilePreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByProfileSender sends the ListByProfile request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) ListByProfileSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByProfileResponder handles the response to the ListByProfile request. The method always +// closes the http.Response Body. +func (client EndpointsClient) ListByProfileResponder(resp *http.Response) (result EndpointListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByProfileNextResults retrieves the next set of results, if any. +func (client EndpointsClient) listByProfileNextResults(ctx context.Context, lastResults EndpointListResult) (result EndpointListResult, err error) { + req, err := lastResults.endpointListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "listByProfileNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByProfileSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "listByProfileNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "listByProfileNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByProfileComplete enumerates all values, automatically crossing page boundaries as required. +func (client EndpointsClient) ListByProfileComplete(ctx context.Context, resourceGroupName string, profileName string) (result EndpointListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.ListByProfile") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByProfile(ctx, resourceGroupName, profileName) + return +} + +// ListResourceUsage checks the quota and usage of geo filters and custom domains under the given endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +func (client EndpointsClient) ListResourceUsage(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result ResourceUsageListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.ListResourceUsage") + defer func() { + sc := -1 + if result.rulr.Response.Response != nil { + sc = result.rulr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.EndpointsClient", "ListResourceUsage", err.Error()) + } + + result.fn = client.listResourceUsageNextResults + req, err := client.ListResourceUsagePreparer(ctx, resourceGroupName, profileName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListResourceUsage", nil, "Failure preparing request") + return + } + + resp, err := client.ListResourceUsageSender(req) + if err != nil { + result.rulr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListResourceUsage", resp, "Failure sending request") + return + } + + result.rulr, err = client.ListResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListResourceUsage", resp, "Failure responding to request") + return + } + if result.rulr.hasNextLink() && result.rulr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListResourceUsagePreparer prepares the ListResourceUsage request. +func (client EndpointsClient) ListResourceUsagePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/checkResourceUsage", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListResourceUsageSender sends the ListResourceUsage request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) ListResourceUsageSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResourceUsageResponder handles the response to the ListResourceUsage request. The method always +// closes the http.Response Body. +func (client EndpointsClient) ListResourceUsageResponder(resp *http.Response) (result ResourceUsageListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listResourceUsageNextResults retrieves the next set of results, if any. +func (client EndpointsClient) listResourceUsageNextResults(ctx context.Context, lastResults ResourceUsageListResult) (result ResourceUsageListResult, err error) { + req, err := lastResults.resourceUsageListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "listResourceUsageNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListResourceUsageSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "listResourceUsageNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "listResourceUsageNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListResourceUsageComplete enumerates all values, automatically crossing page boundaries as required. +func (client EndpointsClient) ListResourceUsageComplete(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result ResourceUsageListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.ListResourceUsage") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListResourceUsage(ctx, resourceGroupName, profileName, endpointName) + return +} + +// LoadContent pre-loads a content to CDN. Available for Verizon Profiles. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// contentFilePaths - the path to the content to be loaded. Path should be a full URL, e.g. +// ‘/pictures/city.png' which loads a single file +func (client EndpointsClient) LoadContent(ctx context.Context, resourceGroupName string, profileName string, endpointName string, contentFilePaths LoadParameters) (result EndpointsLoadContentFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.LoadContent") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: contentFilePaths, + Constraints: []validation.Constraint{{Target: "contentFilePaths.ContentPaths", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.EndpointsClient", "LoadContent", err.Error()) + } + + req, err := client.LoadContentPreparer(ctx, resourceGroupName, profileName, endpointName, contentFilePaths) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "LoadContent", nil, "Failure preparing request") + return + } + + result, err = client.LoadContentSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "LoadContent", result.Response(), "Failure sending request") + return + } + + return +} + +// LoadContentPreparer prepares the LoadContent request. +func (client EndpointsClient) LoadContentPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, contentFilePaths LoadParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/load", pathParameters), + autorest.WithJSON(contentFilePaths), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// LoadContentSender sends the LoadContent request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) LoadContentSender(req *http.Request) (future EndpointsLoadContentFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// LoadContentResponder handles the response to the LoadContent request. The method always +// closes the http.Response Body. +func (client EndpointsClient) LoadContentResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// PurgeContent removes a content from CDN. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// contentFilePaths - the path to the content to be purged. Path can be a full URL, e.g. '/pictures/city.png' +// which removes a single file, or a directory with a wildcard, e.g. '/pictures/*' which removes all folders +// and files in the directory. +func (client EndpointsClient) PurgeContent(ctx context.Context, resourceGroupName string, profileName string, endpointName string, contentFilePaths PurgeParameters) (result EndpointsPurgeContentFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.PurgeContent") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: contentFilePaths, + Constraints: []validation.Constraint{{Target: "contentFilePaths.ContentPaths", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.EndpointsClient", "PurgeContent", err.Error()) + } + + req, err := client.PurgeContentPreparer(ctx, resourceGroupName, profileName, endpointName, contentFilePaths) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "PurgeContent", nil, "Failure preparing request") + return + } + + result, err = client.PurgeContentSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "PurgeContent", result.Response(), "Failure sending request") + return + } + + return +} + +// PurgeContentPreparer prepares the PurgeContent request. +func (client EndpointsClient) PurgeContentPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, contentFilePaths PurgeParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/purge", pathParameters), + autorest.WithJSON(contentFilePaths), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PurgeContentSender sends the PurgeContent request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) PurgeContentSender(req *http.Request) (future EndpointsPurgeContentFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// PurgeContentResponder handles the response to the PurgeContent request. The method always +// closes the http.Response Body. +func (client EndpointsClient) PurgeContentResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Start starts an existing CDN endpoint that is on a stopped state. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +func (client EndpointsClient) Start(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result EndpointsStartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.Start") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.EndpointsClient", "Start", err.Error()) + } + + req, err := client.StartPreparer(ctx, resourceGroupName, profileName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Start", nil, "Failure preparing request") + return + } + + result, err = client.StartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Start", result.Response(), "Failure sending request") + return + } + + return +} + +// StartPreparer prepares the Start request. +func (client EndpointsClient) StartPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) StartSender(req *http.Request) (future EndpointsStartFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client EndpointsClient) StartResponder(resp *http.Response) (result Endpoint, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Stop stops an existing running CDN endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +func (client EndpointsClient) Stop(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result EndpointsStopFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.Stop") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.EndpointsClient", "Stop", err.Error()) + } + + req, err := client.StopPreparer(ctx, resourceGroupName, profileName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Stop", nil, "Failure preparing request") + return + } + + result, err = client.StopSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Stop", result.Response(), "Failure sending request") + return + } + + return +} + +// StopPreparer prepares the Stop request. +func (client EndpointsClient) StopPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) StopSender(req *http.Request) (future EndpointsStopFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client EndpointsClient) StopResponder(resp *http.Response) (result Endpoint, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates an existing CDN endpoint with the specified endpoint name under the specified subscription, resource +// group and profile. Only tags can be updated after creating an endpoint. To update origins, use the Update Origin +// operation. To update origin groups, use the Update Origin group operation. To update custom domains, use the Update +// Custom Domain operation. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// endpointUpdateProperties - endpoint update properties +func (client EndpointsClient) Update(ctx context.Context, resourceGroupName string, profileName string, endpointName string, endpointUpdateProperties EndpointUpdateParameters) (result EndpointsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.EndpointsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, profileName, endpointName, endpointUpdateProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client EndpointsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, endpointUpdateProperties EndpointUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}", pathParameters), + autorest.WithJSON(endpointUpdateProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) UpdateSender(req *http.Request) (future EndpointsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client EndpointsClient) UpdateResponder(resp *http.Response) (result Endpoint, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ValidateCustomDomain validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// customDomainProperties - custom domain to be validated. +func (client EndpointsClient) ValidateCustomDomain(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainProperties ValidateCustomDomainInput) (result ValidateCustomDomainOutput, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.ValidateCustomDomain") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: customDomainProperties, + Constraints: []validation.Constraint{{Target: "customDomainProperties.HostName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.EndpointsClient", "ValidateCustomDomain", err.Error()) + } + + req, err := client.ValidateCustomDomainPreparer(ctx, resourceGroupName, profileName, endpointName, customDomainProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ValidateCustomDomain", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateCustomDomainSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ValidateCustomDomain", resp, "Failure sending request") + return + } + + result, err = client.ValidateCustomDomainResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ValidateCustomDomain", resp, "Failure responding to request") + return + } + + return +} + +// ValidateCustomDomainPreparer prepares the ValidateCustomDomain request. +func (client EndpointsClient) ValidateCustomDomainPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainProperties ValidateCustomDomainInput) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/validateCustomDomain", pathParameters), + autorest.WithJSON(customDomainProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateCustomDomainSender sends the ValidateCustomDomain request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) ValidateCustomDomainSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ValidateCustomDomainResponder handles the response to the ValidateCustomDomain request. The method always +// closes the http.Response Body. +func (client EndpointsClient) ValidateCustomDomainResponder(resp *http.Response) (result ValidateCustomDomainOutput, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/cdn/mgmt/2021-06-01/cdn/enums.go b/services/cdn/mgmt/2021-06-01/cdn/enums.go new file mode 100644 index 000000000000..bbffccad629f --- /dev/null +++ b/services/cdn/mgmt/2021-06-01/cdn/enums.go @@ -0,0 +1,1923 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights 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. + +// ActionType enumerates the values for action type. +type ActionType string + +const ( + // ActionTypeAllow ... + ActionTypeAllow ActionType = "Allow" + // ActionTypeBlock ... + ActionTypeBlock ActionType = "Block" + // ActionTypeLog ... + ActionTypeLog ActionType = "Log" + // ActionTypeRedirect ... + ActionTypeRedirect ActionType = "Redirect" +) + +// PossibleActionTypeValues returns an array of possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ActionTypeAllow, ActionTypeBlock, ActionTypeLog, ActionTypeRedirect} +} + +// AfdCertificateType enumerates the values for afd certificate type. +type AfdCertificateType string + +const ( + // AfdCertificateTypeAzureFirstPartyManagedCertificate ... + AfdCertificateTypeAzureFirstPartyManagedCertificate AfdCertificateType = "AzureFirstPartyManagedCertificate" + // AfdCertificateTypeCustomerCertificate ... + AfdCertificateTypeCustomerCertificate AfdCertificateType = "CustomerCertificate" + // AfdCertificateTypeManagedCertificate ... + AfdCertificateTypeManagedCertificate AfdCertificateType = "ManagedCertificate" +) + +// PossibleAfdCertificateTypeValues returns an array of possible values for the AfdCertificateType const type. +func PossibleAfdCertificateTypeValues() []AfdCertificateType { + return []AfdCertificateType{AfdCertificateTypeAzureFirstPartyManagedCertificate, AfdCertificateTypeCustomerCertificate, AfdCertificateTypeManagedCertificate} +} + +// AFDEndpointProtocols enumerates the values for afd endpoint protocols. +type AFDEndpointProtocols string + +const ( + // AFDEndpointProtocolsHTTP ... + AFDEndpointProtocolsHTTP AFDEndpointProtocols = "Http" + // AFDEndpointProtocolsHTTPS ... + AFDEndpointProtocolsHTTPS AFDEndpointProtocols = "Https" +) + +// PossibleAFDEndpointProtocolsValues returns an array of possible values for the AFDEndpointProtocols const type. +func PossibleAFDEndpointProtocolsValues() []AFDEndpointProtocols { + return []AFDEndpointProtocols{AFDEndpointProtocolsHTTP, AFDEndpointProtocolsHTTPS} +} + +// AfdMinimumTLSVersion enumerates the values for afd minimum tls version. +type AfdMinimumTLSVersion string + +const ( + // AfdMinimumTLSVersionTLS10 ... + AfdMinimumTLSVersionTLS10 AfdMinimumTLSVersion = "TLS10" + // AfdMinimumTLSVersionTLS12 ... + AfdMinimumTLSVersionTLS12 AfdMinimumTLSVersion = "TLS12" +) + +// PossibleAfdMinimumTLSVersionValues returns an array of possible values for the AfdMinimumTLSVersion const type. +func PossibleAfdMinimumTLSVersionValues() []AfdMinimumTLSVersion { + return []AfdMinimumTLSVersion{AfdMinimumTLSVersionTLS10, AfdMinimumTLSVersionTLS12} +} + +// AfdProvisioningState enumerates the values for afd provisioning state. +type AfdProvisioningState string + +const ( + // AfdProvisioningStateCreating ... + AfdProvisioningStateCreating AfdProvisioningState = "Creating" + // AfdProvisioningStateDeleting ... + AfdProvisioningStateDeleting AfdProvisioningState = "Deleting" + // AfdProvisioningStateFailed ... + AfdProvisioningStateFailed AfdProvisioningState = "Failed" + // AfdProvisioningStateSucceeded ... + AfdProvisioningStateSucceeded AfdProvisioningState = "Succeeded" + // AfdProvisioningStateUpdating ... + AfdProvisioningStateUpdating AfdProvisioningState = "Updating" +) + +// PossibleAfdProvisioningStateValues returns an array of possible values for the AfdProvisioningState const type. +func PossibleAfdProvisioningStateValues() []AfdProvisioningState { + return []AfdProvisioningState{AfdProvisioningStateCreating, AfdProvisioningStateDeleting, AfdProvisioningStateFailed, AfdProvisioningStateSucceeded, AfdProvisioningStateUpdating} +} + +// AfdQueryStringCachingBehavior enumerates the values for afd query string caching behavior. +type AfdQueryStringCachingBehavior string + +const ( + // AfdQueryStringCachingBehaviorIgnoreQueryString ... + AfdQueryStringCachingBehaviorIgnoreQueryString AfdQueryStringCachingBehavior = "IgnoreQueryString" + // AfdQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings ... + AfdQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings AfdQueryStringCachingBehavior = "IgnoreSpecifiedQueryStrings" + // AfdQueryStringCachingBehaviorIncludeSpecifiedQueryStrings ... + AfdQueryStringCachingBehaviorIncludeSpecifiedQueryStrings AfdQueryStringCachingBehavior = "IncludeSpecifiedQueryStrings" + // AfdQueryStringCachingBehaviorUseQueryString ... + AfdQueryStringCachingBehaviorUseQueryString AfdQueryStringCachingBehavior = "UseQueryString" +) + +// PossibleAfdQueryStringCachingBehaviorValues returns an array of possible values for the AfdQueryStringCachingBehavior const type. +func PossibleAfdQueryStringCachingBehaviorValues() []AfdQueryStringCachingBehavior { + return []AfdQueryStringCachingBehavior{AfdQueryStringCachingBehaviorIgnoreQueryString, AfdQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings, AfdQueryStringCachingBehaviorIncludeSpecifiedQueryStrings, AfdQueryStringCachingBehaviorUseQueryString} +} + +// Algorithm enumerates the values for algorithm. +type Algorithm string + +const ( + // AlgorithmSHA256 ... + AlgorithmSHA256 Algorithm = "SHA256" +) + +// PossibleAlgorithmValues returns an array of possible values for the Algorithm const type. +func PossibleAlgorithmValues() []Algorithm { + return []Algorithm{AlgorithmSHA256} +} + +// AutoGeneratedDomainNameLabelScope enumerates the values for auto generated domain name label scope. +type AutoGeneratedDomainNameLabelScope string + +const ( + // AutoGeneratedDomainNameLabelScopeNoReuse ... + AutoGeneratedDomainNameLabelScopeNoReuse AutoGeneratedDomainNameLabelScope = "NoReuse" + // AutoGeneratedDomainNameLabelScopeResourceGroupReuse ... + AutoGeneratedDomainNameLabelScopeResourceGroupReuse AutoGeneratedDomainNameLabelScope = "ResourceGroupReuse" + // AutoGeneratedDomainNameLabelScopeSubscriptionReuse ... + AutoGeneratedDomainNameLabelScopeSubscriptionReuse AutoGeneratedDomainNameLabelScope = "SubscriptionReuse" + // AutoGeneratedDomainNameLabelScopeTenantReuse ... + AutoGeneratedDomainNameLabelScopeTenantReuse AutoGeneratedDomainNameLabelScope = "TenantReuse" +) + +// PossibleAutoGeneratedDomainNameLabelScopeValues returns an array of possible values for the AutoGeneratedDomainNameLabelScope const type. +func PossibleAutoGeneratedDomainNameLabelScopeValues() []AutoGeneratedDomainNameLabelScope { + return []AutoGeneratedDomainNameLabelScope{AutoGeneratedDomainNameLabelScopeNoReuse, AutoGeneratedDomainNameLabelScopeResourceGroupReuse, AutoGeneratedDomainNameLabelScopeSubscriptionReuse, AutoGeneratedDomainNameLabelScopeTenantReuse} +} + +// CacheBehavior enumerates the values for cache behavior. +type CacheBehavior string + +const ( + // CacheBehaviorBypassCache ... + CacheBehaviorBypassCache CacheBehavior = "BypassCache" + // CacheBehaviorOverride ... + CacheBehaviorOverride CacheBehavior = "Override" + // CacheBehaviorSetIfMissing ... + CacheBehaviorSetIfMissing CacheBehavior = "SetIfMissing" +) + +// PossibleCacheBehaviorValues returns an array of possible values for the CacheBehavior const type. +func PossibleCacheBehaviorValues() []CacheBehavior { + return []CacheBehavior{CacheBehaviorBypassCache, CacheBehaviorOverride, CacheBehaviorSetIfMissing} +} + +// CertificateSource enumerates the values for certificate source. +type CertificateSource string + +const ( + // CertificateSourceAzureKeyVault ... + CertificateSourceAzureKeyVault CertificateSource = "AzureKeyVault" + // CertificateSourceCdn ... + CertificateSourceCdn CertificateSource = "Cdn" + // CertificateSourceCustomDomainHTTPSParameters ... + CertificateSourceCustomDomainHTTPSParameters CertificateSource = "CustomDomainHttpsParameters" +) + +// PossibleCertificateSourceValues returns an array of possible values for the CertificateSource const type. +func PossibleCertificateSourceValues() []CertificateSource { + return []CertificateSource{CertificateSourceAzureKeyVault, CertificateSourceCdn, CertificateSourceCustomDomainHTTPSParameters} +} + +// CertificateType enumerates the values for certificate type. +type CertificateType string + +const ( + // CertificateTypeDedicated ... + CertificateTypeDedicated CertificateType = "Dedicated" + // CertificateTypeShared ... + CertificateTypeShared CertificateType = "Shared" +) + +// PossibleCertificateTypeValues returns an array of possible values for the CertificateType const type. +func PossibleCertificateTypeValues() []CertificateType { + return []CertificateType{CertificateTypeDedicated, CertificateTypeShared} +} + +// ClientPortOperator enumerates the values for client port operator. +type ClientPortOperator string + +const ( + // ClientPortOperatorAny ... + ClientPortOperatorAny ClientPortOperator = "Any" + // ClientPortOperatorBeginsWith ... + ClientPortOperatorBeginsWith ClientPortOperator = "BeginsWith" + // ClientPortOperatorContains ... + ClientPortOperatorContains ClientPortOperator = "Contains" + // ClientPortOperatorEndsWith ... + ClientPortOperatorEndsWith ClientPortOperator = "EndsWith" + // ClientPortOperatorEqual ... + ClientPortOperatorEqual ClientPortOperator = "Equal" + // ClientPortOperatorGreaterThan ... + ClientPortOperatorGreaterThan ClientPortOperator = "GreaterThan" + // ClientPortOperatorGreaterThanOrEqual ... + ClientPortOperatorGreaterThanOrEqual ClientPortOperator = "GreaterThanOrEqual" + // ClientPortOperatorLessThan ... + ClientPortOperatorLessThan ClientPortOperator = "LessThan" + // ClientPortOperatorLessThanOrEqual ... + ClientPortOperatorLessThanOrEqual ClientPortOperator = "LessThanOrEqual" + // ClientPortOperatorRegEx ... + ClientPortOperatorRegEx ClientPortOperator = "RegEx" +) + +// PossibleClientPortOperatorValues returns an array of possible values for the ClientPortOperator const type. +func PossibleClientPortOperatorValues() []ClientPortOperator { + return []ClientPortOperator{ClientPortOperatorAny, ClientPortOperatorBeginsWith, ClientPortOperatorContains, ClientPortOperatorEndsWith, ClientPortOperatorEqual, ClientPortOperatorGreaterThan, ClientPortOperatorGreaterThanOrEqual, ClientPortOperatorLessThan, ClientPortOperatorLessThanOrEqual, ClientPortOperatorRegEx} +} + +// CookiesOperator enumerates the values for cookies operator. +type CookiesOperator string + +const ( + // CookiesOperatorAny ... + CookiesOperatorAny CookiesOperator = "Any" + // CookiesOperatorBeginsWith ... + CookiesOperatorBeginsWith CookiesOperator = "BeginsWith" + // CookiesOperatorContains ... + CookiesOperatorContains CookiesOperator = "Contains" + // CookiesOperatorEndsWith ... + CookiesOperatorEndsWith CookiesOperator = "EndsWith" + // CookiesOperatorEqual ... + CookiesOperatorEqual CookiesOperator = "Equal" + // CookiesOperatorGreaterThan ... + CookiesOperatorGreaterThan CookiesOperator = "GreaterThan" + // CookiesOperatorGreaterThanOrEqual ... + CookiesOperatorGreaterThanOrEqual CookiesOperator = "GreaterThanOrEqual" + // CookiesOperatorLessThan ... + CookiesOperatorLessThan CookiesOperator = "LessThan" + // CookiesOperatorLessThanOrEqual ... + CookiesOperatorLessThanOrEqual CookiesOperator = "LessThanOrEqual" + // CookiesOperatorRegEx ... + CookiesOperatorRegEx CookiesOperator = "RegEx" +) + +// PossibleCookiesOperatorValues returns an array of possible values for the CookiesOperator const type. +func PossibleCookiesOperatorValues() []CookiesOperator { + return []CookiesOperator{CookiesOperatorAny, CookiesOperatorBeginsWith, CookiesOperatorContains, CookiesOperatorEndsWith, CookiesOperatorEqual, CookiesOperatorGreaterThan, CookiesOperatorGreaterThanOrEqual, CookiesOperatorLessThan, CookiesOperatorLessThanOrEqual, CookiesOperatorRegEx} +} + +// CustomDomainResourceState enumerates the values for custom domain resource state. +type CustomDomainResourceState string + +const ( + // CustomDomainResourceStateActive ... + CustomDomainResourceStateActive CustomDomainResourceState = "Active" + // CustomDomainResourceStateCreating ... + CustomDomainResourceStateCreating CustomDomainResourceState = "Creating" + // CustomDomainResourceStateDeleting ... + CustomDomainResourceStateDeleting CustomDomainResourceState = "Deleting" +) + +// PossibleCustomDomainResourceStateValues returns an array of possible values for the CustomDomainResourceState const type. +func PossibleCustomDomainResourceStateValues() []CustomDomainResourceState { + return []CustomDomainResourceState{CustomDomainResourceStateActive, CustomDomainResourceStateCreating, CustomDomainResourceStateDeleting} +} + +// CustomHTTPSProvisioningState enumerates the values for custom https provisioning state. +type CustomHTTPSProvisioningState string + +const ( + // CustomHTTPSProvisioningStateDisabled ... + CustomHTTPSProvisioningStateDisabled CustomHTTPSProvisioningState = "Disabled" + // CustomHTTPSProvisioningStateDisabling ... + CustomHTTPSProvisioningStateDisabling CustomHTTPSProvisioningState = "Disabling" + // CustomHTTPSProvisioningStateEnabled ... + CustomHTTPSProvisioningStateEnabled CustomHTTPSProvisioningState = "Enabled" + // CustomHTTPSProvisioningStateEnabling ... + CustomHTTPSProvisioningStateEnabling CustomHTTPSProvisioningState = "Enabling" + // CustomHTTPSProvisioningStateFailed ... + CustomHTTPSProvisioningStateFailed CustomHTTPSProvisioningState = "Failed" +) + +// PossibleCustomHTTPSProvisioningStateValues returns an array of possible values for the CustomHTTPSProvisioningState const type. +func PossibleCustomHTTPSProvisioningStateValues() []CustomHTTPSProvisioningState { + return []CustomHTTPSProvisioningState{CustomHTTPSProvisioningStateDisabled, CustomHTTPSProvisioningStateDisabling, CustomHTTPSProvisioningStateEnabled, CustomHTTPSProvisioningStateEnabling, CustomHTTPSProvisioningStateFailed} +} + +// CustomHTTPSProvisioningSubstate enumerates the values for custom https provisioning substate. +type CustomHTTPSProvisioningSubstate string + +const ( + // CustomHTTPSProvisioningSubstateCertificateDeleted ... + CustomHTTPSProvisioningSubstateCertificateDeleted CustomHTTPSProvisioningSubstate = "CertificateDeleted" + // CustomHTTPSProvisioningSubstateCertificateDeployed ... + CustomHTTPSProvisioningSubstateCertificateDeployed CustomHTTPSProvisioningSubstate = "CertificateDeployed" + // CustomHTTPSProvisioningSubstateDeletingCertificate ... + CustomHTTPSProvisioningSubstateDeletingCertificate CustomHTTPSProvisioningSubstate = "DeletingCertificate" + // CustomHTTPSProvisioningSubstateDeployingCertificate ... + CustomHTTPSProvisioningSubstateDeployingCertificate CustomHTTPSProvisioningSubstate = "DeployingCertificate" + // CustomHTTPSProvisioningSubstateDomainControlValidationRequestApproved ... + CustomHTTPSProvisioningSubstateDomainControlValidationRequestApproved CustomHTTPSProvisioningSubstate = "DomainControlValidationRequestApproved" + // CustomHTTPSProvisioningSubstateDomainControlValidationRequestRejected ... + CustomHTTPSProvisioningSubstateDomainControlValidationRequestRejected CustomHTTPSProvisioningSubstate = "DomainControlValidationRequestRejected" + // CustomHTTPSProvisioningSubstateDomainControlValidationRequestTimedOut ... + CustomHTTPSProvisioningSubstateDomainControlValidationRequestTimedOut CustomHTTPSProvisioningSubstate = "DomainControlValidationRequestTimedOut" + // CustomHTTPSProvisioningSubstateIssuingCertificate ... + CustomHTTPSProvisioningSubstateIssuingCertificate CustomHTTPSProvisioningSubstate = "IssuingCertificate" + // CustomHTTPSProvisioningSubstatePendingDomainControlValidationREquestApproval ... + CustomHTTPSProvisioningSubstatePendingDomainControlValidationREquestApproval CustomHTTPSProvisioningSubstate = "PendingDomainControlValidationREquestApproval" + // CustomHTTPSProvisioningSubstateSubmittingDomainControlValidationRequest ... + CustomHTTPSProvisioningSubstateSubmittingDomainControlValidationRequest CustomHTTPSProvisioningSubstate = "SubmittingDomainControlValidationRequest" +) + +// PossibleCustomHTTPSProvisioningSubstateValues returns an array of possible values for the CustomHTTPSProvisioningSubstate const type. +func PossibleCustomHTTPSProvisioningSubstateValues() []CustomHTTPSProvisioningSubstate { + return []CustomHTTPSProvisioningSubstate{CustomHTTPSProvisioningSubstateCertificateDeleted, CustomHTTPSProvisioningSubstateCertificateDeployed, CustomHTTPSProvisioningSubstateDeletingCertificate, CustomHTTPSProvisioningSubstateDeployingCertificate, CustomHTTPSProvisioningSubstateDomainControlValidationRequestApproved, CustomHTTPSProvisioningSubstateDomainControlValidationRequestRejected, CustomHTTPSProvisioningSubstateDomainControlValidationRequestTimedOut, CustomHTTPSProvisioningSubstateIssuingCertificate, CustomHTTPSProvisioningSubstatePendingDomainControlValidationREquestApproval, CustomHTTPSProvisioningSubstateSubmittingDomainControlValidationRequest} +} + +// CustomRuleEnabledState enumerates the values for custom rule enabled state. +type CustomRuleEnabledState string + +const ( + // CustomRuleEnabledStateDisabled ... + CustomRuleEnabledStateDisabled CustomRuleEnabledState = "Disabled" + // CustomRuleEnabledStateEnabled ... + CustomRuleEnabledStateEnabled CustomRuleEnabledState = "Enabled" +) + +// PossibleCustomRuleEnabledStateValues returns an array of possible values for the CustomRuleEnabledState const type. +func PossibleCustomRuleEnabledStateValues() []CustomRuleEnabledState { + return []CustomRuleEnabledState{CustomRuleEnabledStateDisabled, CustomRuleEnabledStateEnabled} +} + +// DeploymentStatus enumerates the values for deployment status. +type DeploymentStatus string + +const ( + // DeploymentStatusFailed ... + DeploymentStatusFailed DeploymentStatus = "Failed" + // DeploymentStatusInProgress ... + DeploymentStatusInProgress DeploymentStatus = "InProgress" + // DeploymentStatusNotStarted ... + DeploymentStatusNotStarted DeploymentStatus = "NotStarted" + // DeploymentStatusSucceeded ... + DeploymentStatusSucceeded DeploymentStatus = "Succeeded" +) + +// PossibleDeploymentStatusValues returns an array of possible values for the DeploymentStatus const type. +func PossibleDeploymentStatusValues() []DeploymentStatus { + return []DeploymentStatus{DeploymentStatusFailed, DeploymentStatusInProgress, DeploymentStatusNotStarted, DeploymentStatusSucceeded} +} + +// DestinationProtocol enumerates the values for destination protocol. +type DestinationProtocol string + +const ( + // DestinationProtocolHTTP ... + DestinationProtocolHTTP DestinationProtocol = "Http" + // DestinationProtocolHTTPS ... + DestinationProtocolHTTPS DestinationProtocol = "Https" + // DestinationProtocolMatchRequest ... + DestinationProtocolMatchRequest DestinationProtocol = "MatchRequest" +) + +// PossibleDestinationProtocolValues returns an array of possible values for the DestinationProtocol const type. +func PossibleDestinationProtocolValues() []DestinationProtocol { + return []DestinationProtocol{DestinationProtocolHTTP, DestinationProtocolHTTPS, DestinationProtocolMatchRequest} +} + +// DomainValidationState enumerates the values for domain validation state. +type DomainValidationState string + +const ( + // DomainValidationStateApproved ... + DomainValidationStateApproved DomainValidationState = "Approved" + // DomainValidationStateInternalError ... + DomainValidationStateInternalError DomainValidationState = "InternalError" + // DomainValidationStatePending ... + DomainValidationStatePending DomainValidationState = "Pending" + // DomainValidationStatePendingRevalidation ... + DomainValidationStatePendingRevalidation DomainValidationState = "PendingRevalidation" + // DomainValidationStateRefreshingValidationToken ... + DomainValidationStateRefreshingValidationToken DomainValidationState = "RefreshingValidationToken" + // DomainValidationStateRejected ... + DomainValidationStateRejected DomainValidationState = "Rejected" + // DomainValidationStateSubmitting ... + DomainValidationStateSubmitting DomainValidationState = "Submitting" + // DomainValidationStateTimedOut ... + DomainValidationStateTimedOut DomainValidationState = "TimedOut" + // DomainValidationStateUnknown ... + DomainValidationStateUnknown DomainValidationState = "Unknown" +) + +// PossibleDomainValidationStateValues returns an array of possible values for the DomainValidationState const type. +func PossibleDomainValidationStateValues() []DomainValidationState { + return []DomainValidationState{DomainValidationStateApproved, DomainValidationStateInternalError, DomainValidationStatePending, DomainValidationStatePendingRevalidation, DomainValidationStateRefreshingValidationToken, DomainValidationStateRejected, DomainValidationStateSubmitting, DomainValidationStateTimedOut, DomainValidationStateUnknown} +} + +// EnabledState enumerates the values for enabled state. +type EnabledState string + +const ( + // EnabledStateDisabled ... + EnabledStateDisabled EnabledState = "Disabled" + // EnabledStateEnabled ... + EnabledStateEnabled EnabledState = "Enabled" +) + +// PossibleEnabledStateValues returns an array of possible values for the EnabledState const type. +func PossibleEnabledStateValues() []EnabledState { + return []EnabledState{EnabledStateDisabled, EnabledStateEnabled} +} + +// EndpointResourceState enumerates the values for endpoint resource state. +type EndpointResourceState string + +const ( + // EndpointResourceStateCreating ... + EndpointResourceStateCreating EndpointResourceState = "Creating" + // EndpointResourceStateDeleting ... + EndpointResourceStateDeleting EndpointResourceState = "Deleting" + // EndpointResourceStateRunning ... + EndpointResourceStateRunning EndpointResourceState = "Running" + // EndpointResourceStateStarting ... + EndpointResourceStateStarting EndpointResourceState = "Starting" + // EndpointResourceStateStopped ... + EndpointResourceStateStopped EndpointResourceState = "Stopped" + // EndpointResourceStateStopping ... + EndpointResourceStateStopping EndpointResourceState = "Stopping" +) + +// PossibleEndpointResourceStateValues returns an array of possible values for the EndpointResourceState const type. +func PossibleEndpointResourceStateValues() []EndpointResourceState { + return []EndpointResourceState{EndpointResourceStateCreating, EndpointResourceStateDeleting, EndpointResourceStateRunning, EndpointResourceStateStarting, EndpointResourceStateStopped, EndpointResourceStateStopping} +} + +// ForwardingProtocol enumerates the values for forwarding protocol. +type ForwardingProtocol string + +const ( + // ForwardingProtocolHTTPOnly ... + ForwardingProtocolHTTPOnly ForwardingProtocol = "HttpOnly" + // ForwardingProtocolHTTPSOnly ... + ForwardingProtocolHTTPSOnly ForwardingProtocol = "HttpsOnly" + // ForwardingProtocolMatchRequest ... + ForwardingProtocolMatchRequest ForwardingProtocol = "MatchRequest" +) + +// PossibleForwardingProtocolValues returns an array of possible values for the ForwardingProtocol const type. +func PossibleForwardingProtocolValues() []ForwardingProtocol { + return []ForwardingProtocol{ForwardingProtocolHTTPOnly, ForwardingProtocolHTTPSOnly, ForwardingProtocolMatchRequest} +} + +// GeoFilterActions enumerates the values for geo filter actions. +type GeoFilterActions string + +const ( + // GeoFilterActionsAllow ... + GeoFilterActionsAllow GeoFilterActions = "Allow" + // GeoFilterActionsBlock ... + GeoFilterActionsBlock GeoFilterActions = "Block" +) + +// PossibleGeoFilterActionsValues returns an array of possible values for the GeoFilterActions const type. +func PossibleGeoFilterActionsValues() []GeoFilterActions { + return []GeoFilterActions{GeoFilterActionsAllow, GeoFilterActionsBlock} +} + +// Granularity enumerates the values for granularity. +type Granularity string + +const ( + // GranularityP1D ... + GranularityP1D Granularity = "P1D" + // GranularityPT1H ... + GranularityPT1H Granularity = "PT1H" + // GranularityPT5M ... + GranularityPT5M Granularity = "PT5M" +) + +// PossibleGranularityValues returns an array of possible values for the Granularity const type. +func PossibleGranularityValues() []Granularity { + return []Granularity{GranularityP1D, GranularityPT1H, GranularityPT5M} +} + +// Granularity1 enumerates the values for granularity 1. +type Granularity1 string + +const ( + // Granularity1P1D ... + Granularity1P1D Granularity1 = "P1D" + // Granularity1PT1H ... + Granularity1PT1H Granularity1 = "PT1H" + // Granularity1PT5M ... + Granularity1PT5M Granularity1 = "PT5M" +) + +// PossibleGranularity1Values returns an array of possible values for the Granularity1 const type. +func PossibleGranularity1Values() []Granularity1 { + return []Granularity1{Granularity1P1D, Granularity1PT1H, Granularity1PT5M} +} + +// HeaderAction enumerates the values for header action. +type HeaderAction string + +const ( + // HeaderActionAppend ... + HeaderActionAppend HeaderAction = "Append" + // HeaderActionDelete ... + HeaderActionDelete HeaderAction = "Delete" + // HeaderActionOverwrite ... + HeaderActionOverwrite HeaderAction = "Overwrite" +) + +// PossibleHeaderActionValues returns an array of possible values for the HeaderAction const type. +func PossibleHeaderActionValues() []HeaderAction { + return []HeaderAction{HeaderActionAppend, HeaderActionDelete, HeaderActionOverwrite} +} + +// HealthProbeRequestType enumerates the values for health probe request type. +type HealthProbeRequestType string + +const ( + // HealthProbeRequestTypeGET ... + HealthProbeRequestTypeGET HealthProbeRequestType = "GET" + // HealthProbeRequestTypeHEAD ... + HealthProbeRequestTypeHEAD HealthProbeRequestType = "HEAD" + // HealthProbeRequestTypeNotSet ... + HealthProbeRequestTypeNotSet HealthProbeRequestType = "NotSet" +) + +// PossibleHealthProbeRequestTypeValues returns an array of possible values for the HealthProbeRequestType const type. +func PossibleHealthProbeRequestTypeValues() []HealthProbeRequestType { + return []HealthProbeRequestType{HealthProbeRequestTypeGET, HealthProbeRequestTypeHEAD, HealthProbeRequestTypeNotSet} +} + +// HostNameOperator enumerates the values for host name operator. +type HostNameOperator string + +const ( + // HostNameOperatorAny ... + HostNameOperatorAny HostNameOperator = "Any" + // HostNameOperatorBeginsWith ... + HostNameOperatorBeginsWith HostNameOperator = "BeginsWith" + // HostNameOperatorContains ... + HostNameOperatorContains HostNameOperator = "Contains" + // HostNameOperatorEndsWith ... + HostNameOperatorEndsWith HostNameOperator = "EndsWith" + // HostNameOperatorEqual ... + HostNameOperatorEqual HostNameOperator = "Equal" + // HostNameOperatorGreaterThan ... + HostNameOperatorGreaterThan HostNameOperator = "GreaterThan" + // HostNameOperatorGreaterThanOrEqual ... + HostNameOperatorGreaterThanOrEqual HostNameOperator = "GreaterThanOrEqual" + // HostNameOperatorLessThan ... + HostNameOperatorLessThan HostNameOperator = "LessThan" + // HostNameOperatorLessThanOrEqual ... + HostNameOperatorLessThanOrEqual HostNameOperator = "LessThanOrEqual" + // HostNameOperatorRegEx ... + HostNameOperatorRegEx HostNameOperator = "RegEx" +) + +// PossibleHostNameOperatorValues returns an array of possible values for the HostNameOperator const type. +func PossibleHostNameOperatorValues() []HostNameOperator { + return []HostNameOperator{HostNameOperatorAny, HostNameOperatorBeginsWith, HostNameOperatorContains, HostNameOperatorEndsWith, HostNameOperatorEqual, HostNameOperatorGreaterThan, HostNameOperatorGreaterThanOrEqual, HostNameOperatorLessThan, HostNameOperatorLessThanOrEqual, HostNameOperatorRegEx} +} + +// HTTPSRedirect enumerates the values for https redirect. +type HTTPSRedirect string + +const ( + // HTTPSRedirectDisabled ... + HTTPSRedirectDisabled HTTPSRedirect = "Disabled" + // HTTPSRedirectEnabled ... + HTTPSRedirectEnabled HTTPSRedirect = "Enabled" +) + +// PossibleHTTPSRedirectValues returns an array of possible values for the HTTPSRedirect const type. +func PossibleHTTPSRedirectValues() []HTTPSRedirect { + return []HTTPSRedirect{HTTPSRedirectDisabled, HTTPSRedirectEnabled} +} + +// IdentityType enumerates the values for identity type. +type IdentityType string + +const ( + // IdentityTypeApplication ... + IdentityTypeApplication IdentityType = "application" + // IdentityTypeKey ... + IdentityTypeKey IdentityType = "key" + // IdentityTypeManagedIdentity ... + IdentityTypeManagedIdentity IdentityType = "managedIdentity" + // IdentityTypeUser ... + IdentityTypeUser IdentityType = "user" +) + +// PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. +func PossibleIdentityTypeValues() []IdentityType { + return []IdentityType{IdentityTypeApplication, IdentityTypeKey, IdentityTypeManagedIdentity, IdentityTypeUser} +} + +// LinkToDefaultDomain enumerates the values for link to default domain. +type LinkToDefaultDomain string + +const ( + // LinkToDefaultDomainDisabled ... + LinkToDefaultDomainDisabled LinkToDefaultDomain = "Disabled" + // LinkToDefaultDomainEnabled ... + LinkToDefaultDomainEnabled LinkToDefaultDomain = "Enabled" +) + +// PossibleLinkToDefaultDomainValues returns an array of possible values for the LinkToDefaultDomain const type. +func PossibleLinkToDefaultDomainValues() []LinkToDefaultDomain { + return []LinkToDefaultDomain{LinkToDefaultDomainDisabled, LinkToDefaultDomainEnabled} +} + +// LogMetric enumerates the values for log metric. +type LogMetric string + +const ( + // LogMetricClientRequestBandwidth ... + LogMetricClientRequestBandwidth LogMetric = "clientRequestBandwidth" + // LogMetricClientRequestCount ... + LogMetricClientRequestCount LogMetric = "clientRequestCount" + // LogMetricClientRequestTraffic ... + LogMetricClientRequestTraffic LogMetric = "clientRequestTraffic" + // LogMetricOriginRequestBandwidth ... + LogMetricOriginRequestBandwidth LogMetric = "originRequestBandwidth" + // LogMetricOriginRequestTraffic ... + LogMetricOriginRequestTraffic LogMetric = "originRequestTraffic" + // LogMetricTotalLatency ... + LogMetricTotalLatency LogMetric = "totalLatency" +) + +// PossibleLogMetricValues returns an array of possible values for the LogMetric const type. +func PossibleLogMetricValues() []LogMetric { + return []LogMetric{LogMetricClientRequestBandwidth, LogMetricClientRequestCount, LogMetricClientRequestTraffic, LogMetricOriginRequestBandwidth, LogMetricOriginRequestTraffic, LogMetricTotalLatency} +} + +// LogMetricsGranularity enumerates the values for log metrics granularity. +type LogMetricsGranularity string + +const ( + // LogMetricsGranularityP1D ... + LogMetricsGranularityP1D LogMetricsGranularity = "P1D" + // LogMetricsGranularityPT1H ... + LogMetricsGranularityPT1H LogMetricsGranularity = "PT1H" + // LogMetricsGranularityPT5M ... + LogMetricsGranularityPT5M LogMetricsGranularity = "PT5M" +) + +// PossibleLogMetricsGranularityValues returns an array of possible values for the LogMetricsGranularity const type. +func PossibleLogMetricsGranularityValues() []LogMetricsGranularity { + return []LogMetricsGranularity{LogMetricsGranularityP1D, LogMetricsGranularityPT1H, LogMetricsGranularityPT5M} +} + +// LogMetricsGroupBy enumerates the values for log metrics group by. +type LogMetricsGroupBy string + +const ( + // LogMetricsGroupByCacheStatus ... + LogMetricsGroupByCacheStatus LogMetricsGroupBy = "cacheStatus" + // LogMetricsGroupByCountryOrRegion ... + LogMetricsGroupByCountryOrRegion LogMetricsGroupBy = "countryOrRegion" + // LogMetricsGroupByCustomDomain ... + LogMetricsGroupByCustomDomain LogMetricsGroupBy = "customDomain" + // LogMetricsGroupByHTTPStatusCode ... + LogMetricsGroupByHTTPStatusCode LogMetricsGroupBy = "httpStatusCode" + // LogMetricsGroupByProtocol ... + LogMetricsGroupByProtocol LogMetricsGroupBy = "protocol" +) + +// PossibleLogMetricsGroupByValues returns an array of possible values for the LogMetricsGroupBy const type. +func PossibleLogMetricsGroupByValues() []LogMetricsGroupBy { + return []LogMetricsGroupBy{LogMetricsGroupByCacheStatus, LogMetricsGroupByCountryOrRegion, LogMetricsGroupByCustomDomain, LogMetricsGroupByHTTPStatusCode, LogMetricsGroupByProtocol} +} + +// LogRanking enumerates the values for log ranking. +type LogRanking string + +const ( + // LogRankingBrowser ... + LogRankingBrowser LogRanking = "browser" + // LogRankingCountryOrRegion ... + LogRankingCountryOrRegion LogRanking = "countryOrRegion" + // LogRankingReferrer ... + LogRankingReferrer LogRanking = "referrer" + // LogRankingURL ... + LogRankingURL LogRanking = "url" + // LogRankingUserAgent ... + LogRankingUserAgent LogRanking = "userAgent" +) + +// PossibleLogRankingValues returns an array of possible values for the LogRanking const type. +func PossibleLogRankingValues() []LogRanking { + return []LogRanking{LogRankingBrowser, LogRankingCountryOrRegion, LogRankingReferrer, LogRankingURL, LogRankingUserAgent} +} + +// LogRankingMetric enumerates the values for log ranking metric. +type LogRankingMetric string + +const ( + // LogRankingMetricClientRequestCount ... + LogRankingMetricClientRequestCount LogRankingMetric = "clientRequestCount" + // LogRankingMetricClientRequestTraffic ... + LogRankingMetricClientRequestTraffic LogRankingMetric = "clientRequestTraffic" + // LogRankingMetricErrorCount ... + LogRankingMetricErrorCount LogRankingMetric = "errorCount" + // LogRankingMetricHitCount ... + LogRankingMetricHitCount LogRankingMetric = "hitCount" + // LogRankingMetricMissCount ... + LogRankingMetricMissCount LogRankingMetric = "missCount" + // LogRankingMetricUserErrorCount ... + LogRankingMetricUserErrorCount LogRankingMetric = "userErrorCount" +) + +// PossibleLogRankingMetricValues returns an array of possible values for the LogRankingMetric const type. +func PossibleLogRankingMetricValues() []LogRankingMetric { + return []LogRankingMetric{LogRankingMetricClientRequestCount, LogRankingMetricClientRequestTraffic, LogRankingMetricErrorCount, LogRankingMetricHitCount, LogRankingMetricMissCount, LogRankingMetricUserErrorCount} +} + +// ManagedRuleEnabledState enumerates the values for managed rule enabled state. +type ManagedRuleEnabledState string + +const ( + // ManagedRuleEnabledStateDisabled ... + ManagedRuleEnabledStateDisabled ManagedRuleEnabledState = "Disabled" + // ManagedRuleEnabledStateEnabled ... + ManagedRuleEnabledStateEnabled ManagedRuleEnabledState = "Enabled" +) + +// PossibleManagedRuleEnabledStateValues returns an array of possible values for the ManagedRuleEnabledState const type. +func PossibleManagedRuleEnabledStateValues() []ManagedRuleEnabledState { + return []ManagedRuleEnabledState{ManagedRuleEnabledStateDisabled, ManagedRuleEnabledStateEnabled} +} + +// MatchProcessingBehavior enumerates the values for match processing behavior. +type MatchProcessingBehavior string + +const ( + // MatchProcessingBehaviorContinue ... + MatchProcessingBehaviorContinue MatchProcessingBehavior = "Continue" + // MatchProcessingBehaviorStop ... + MatchProcessingBehaviorStop MatchProcessingBehavior = "Stop" +) + +// PossibleMatchProcessingBehaviorValues returns an array of possible values for the MatchProcessingBehavior const type. +func PossibleMatchProcessingBehaviorValues() []MatchProcessingBehavior { + return []MatchProcessingBehavior{MatchProcessingBehaviorContinue, MatchProcessingBehaviorStop} +} + +// MinimumTLSVersion enumerates the values for minimum tls version. +type MinimumTLSVersion string + +const ( + // MinimumTLSVersionNone ... + MinimumTLSVersionNone MinimumTLSVersion = "None" + // MinimumTLSVersionTLS10 ... + MinimumTLSVersionTLS10 MinimumTLSVersion = "TLS10" + // MinimumTLSVersionTLS12 ... + MinimumTLSVersionTLS12 MinimumTLSVersion = "TLS12" +) + +// PossibleMinimumTLSVersionValues returns an array of possible values for the MinimumTLSVersion const type. +func PossibleMinimumTLSVersionValues() []MinimumTLSVersion { + return []MinimumTLSVersion{MinimumTLSVersionNone, MinimumTLSVersionTLS10, MinimumTLSVersionTLS12} +} + +// Name enumerates the values for name. +type Name string + +const ( + // NameClientPort ... + NameClientPort Name = "ClientPort" + // NameCookies ... + NameCookies Name = "Cookies" + // NameDeliveryRuleCondition ... + NameDeliveryRuleCondition Name = "DeliveryRuleCondition" + // NameHostName ... + NameHostName Name = "HostName" + // NameHTTPVersion ... + NameHTTPVersion Name = "HttpVersion" + // NameIsDevice ... + NameIsDevice Name = "IsDevice" + // NamePostArgs ... + NamePostArgs Name = "PostArgs" + // NameQueryString ... + NameQueryString Name = "QueryString" + // NameRemoteAddress ... + NameRemoteAddress Name = "RemoteAddress" + // NameRequestBody ... + NameRequestBody Name = "RequestBody" + // NameRequestHeader ... + NameRequestHeader Name = "RequestHeader" + // NameRequestMethod ... + NameRequestMethod Name = "RequestMethod" + // NameRequestScheme ... + NameRequestScheme Name = "RequestScheme" + // NameRequestURI ... + NameRequestURI Name = "RequestUri" + // NameServerPort ... + NameServerPort Name = "ServerPort" + // NameSocketAddr ... + NameSocketAddr Name = "SocketAddr" + // NameSslProtocol ... + NameSslProtocol Name = "SslProtocol" + // NameURLFileExtension ... + NameURLFileExtension Name = "UrlFileExtension" + // NameURLFileName ... + NameURLFileName Name = "UrlFileName" + // NameURLPath ... + NameURLPath Name = "UrlPath" +) + +// PossibleNameValues returns an array of possible values for the Name const type. +func PossibleNameValues() []Name { + return []Name{NameClientPort, NameCookies, NameDeliveryRuleCondition, NameHostName, NameHTTPVersion, NameIsDevice, NamePostArgs, NameQueryString, NameRemoteAddress, NameRequestBody, NameRequestHeader, NameRequestMethod, NameRequestScheme, NameRequestURI, NameServerPort, NameSocketAddr, NameSslProtocol, NameURLFileExtension, NameURLFileName, NameURLPath} +} + +// NameBasicDeliveryRuleAction enumerates the values for name basic delivery rule action. +type NameBasicDeliveryRuleAction string + +const ( + // NameBasicDeliveryRuleActionNameCacheExpiration ... + NameBasicDeliveryRuleActionNameCacheExpiration NameBasicDeliveryRuleAction = "CacheExpiration" + // NameBasicDeliveryRuleActionNameCacheKeyQueryString ... + NameBasicDeliveryRuleActionNameCacheKeyQueryString NameBasicDeliveryRuleAction = "CacheKeyQueryString" + // NameBasicDeliveryRuleActionNameDeliveryRuleAction ... + NameBasicDeliveryRuleActionNameDeliveryRuleAction NameBasicDeliveryRuleAction = "DeliveryRuleAction" + // NameBasicDeliveryRuleActionNameModifyRequestHeader ... + NameBasicDeliveryRuleActionNameModifyRequestHeader NameBasicDeliveryRuleAction = "ModifyRequestHeader" + // NameBasicDeliveryRuleActionNameModifyResponseHeader ... + NameBasicDeliveryRuleActionNameModifyResponseHeader NameBasicDeliveryRuleAction = "ModifyResponseHeader" + // NameBasicDeliveryRuleActionNameOriginGroupOverride ... + NameBasicDeliveryRuleActionNameOriginGroupOverride NameBasicDeliveryRuleAction = "OriginGroupOverride" + // NameBasicDeliveryRuleActionNameRouteConfigurationOverride ... + NameBasicDeliveryRuleActionNameRouteConfigurationOverride NameBasicDeliveryRuleAction = "RouteConfigurationOverride" + // NameBasicDeliveryRuleActionNameURLRedirect ... + NameBasicDeliveryRuleActionNameURLRedirect NameBasicDeliveryRuleAction = "UrlRedirect" + // NameBasicDeliveryRuleActionNameURLRewrite ... + NameBasicDeliveryRuleActionNameURLRewrite NameBasicDeliveryRuleAction = "UrlRewrite" + // NameBasicDeliveryRuleActionNameURLSigning ... + NameBasicDeliveryRuleActionNameURLSigning NameBasicDeliveryRuleAction = "UrlSigning" +) + +// PossibleNameBasicDeliveryRuleActionValues returns an array of possible values for the NameBasicDeliveryRuleAction const type. +func PossibleNameBasicDeliveryRuleActionValues() []NameBasicDeliveryRuleAction { + return []NameBasicDeliveryRuleAction{NameBasicDeliveryRuleActionNameCacheExpiration, NameBasicDeliveryRuleActionNameCacheKeyQueryString, NameBasicDeliveryRuleActionNameDeliveryRuleAction, NameBasicDeliveryRuleActionNameModifyRequestHeader, NameBasicDeliveryRuleActionNameModifyResponseHeader, NameBasicDeliveryRuleActionNameOriginGroupOverride, NameBasicDeliveryRuleActionNameRouteConfigurationOverride, NameBasicDeliveryRuleActionNameURLRedirect, NameBasicDeliveryRuleActionNameURLRewrite, NameBasicDeliveryRuleActionNameURLSigning} +} + +// Operator enumerates the values for operator. +type Operator string + +const ( + // OperatorAny ... + OperatorAny Operator = "Any" + // OperatorBeginsWith ... + OperatorBeginsWith Operator = "BeginsWith" + // OperatorContains ... + OperatorContains Operator = "Contains" + // OperatorEndsWith ... + OperatorEndsWith Operator = "EndsWith" + // OperatorEqual ... + OperatorEqual Operator = "Equal" + // OperatorGeoMatch ... + OperatorGeoMatch Operator = "GeoMatch" + // OperatorGreaterThan ... + OperatorGreaterThan Operator = "GreaterThan" + // OperatorGreaterThanOrEqual ... + OperatorGreaterThanOrEqual Operator = "GreaterThanOrEqual" + // OperatorIPMatch ... + OperatorIPMatch Operator = "IPMatch" + // OperatorLessThan ... + OperatorLessThan Operator = "LessThan" + // OperatorLessThanOrEqual ... + OperatorLessThanOrEqual Operator = "LessThanOrEqual" + // OperatorRegEx ... + OperatorRegEx Operator = "RegEx" +) + +// PossibleOperatorValues returns an array of possible values for the Operator const type. +func PossibleOperatorValues() []Operator { + return []Operator{OperatorAny, OperatorBeginsWith, OperatorContains, OperatorEndsWith, OperatorEqual, OperatorGeoMatch, OperatorGreaterThan, OperatorGreaterThanOrEqual, OperatorIPMatch, OperatorLessThan, OperatorLessThanOrEqual, OperatorRegEx} +} + +// OptimizationType enumerates the values for optimization type. +type OptimizationType string + +const ( + // OptimizationTypeDynamicSiteAcceleration ... + OptimizationTypeDynamicSiteAcceleration OptimizationType = "DynamicSiteAcceleration" + // OptimizationTypeGeneralMediaStreaming ... + OptimizationTypeGeneralMediaStreaming OptimizationType = "GeneralMediaStreaming" + // OptimizationTypeGeneralWebDelivery ... + OptimizationTypeGeneralWebDelivery OptimizationType = "GeneralWebDelivery" + // OptimizationTypeLargeFileDownload ... + OptimizationTypeLargeFileDownload OptimizationType = "LargeFileDownload" + // OptimizationTypeVideoOnDemandMediaStreaming ... + OptimizationTypeVideoOnDemandMediaStreaming OptimizationType = "VideoOnDemandMediaStreaming" +) + +// PossibleOptimizationTypeValues returns an array of possible values for the OptimizationType const type. +func PossibleOptimizationTypeValues() []OptimizationType { + return []OptimizationType{OptimizationTypeDynamicSiteAcceleration, OptimizationTypeGeneralMediaStreaming, OptimizationTypeGeneralWebDelivery, OptimizationTypeLargeFileDownload, OptimizationTypeVideoOnDemandMediaStreaming} +} + +// OriginGroupResourceState enumerates the values for origin group resource state. +type OriginGroupResourceState string + +const ( + // OriginGroupResourceStateActive ... + OriginGroupResourceStateActive OriginGroupResourceState = "Active" + // OriginGroupResourceStateCreating ... + OriginGroupResourceStateCreating OriginGroupResourceState = "Creating" + // OriginGroupResourceStateDeleting ... + OriginGroupResourceStateDeleting OriginGroupResourceState = "Deleting" +) + +// PossibleOriginGroupResourceStateValues returns an array of possible values for the OriginGroupResourceState const type. +func PossibleOriginGroupResourceStateValues() []OriginGroupResourceState { + return []OriginGroupResourceState{OriginGroupResourceStateActive, OriginGroupResourceStateCreating, OriginGroupResourceStateDeleting} +} + +// OriginResourceState enumerates the values for origin resource state. +type OriginResourceState string + +const ( + // OriginResourceStateActive ... + OriginResourceStateActive OriginResourceState = "Active" + // OriginResourceStateCreating ... + OriginResourceStateCreating OriginResourceState = "Creating" + // OriginResourceStateDeleting ... + OriginResourceStateDeleting OriginResourceState = "Deleting" +) + +// PossibleOriginResourceStateValues returns an array of possible values for the OriginResourceState const type. +func PossibleOriginResourceStateValues() []OriginResourceState { + return []OriginResourceState{OriginResourceStateActive, OriginResourceStateCreating, OriginResourceStateDeleting} +} + +// ParamIndicator enumerates the values for param indicator. +type ParamIndicator string + +const ( + // ParamIndicatorExpires ... + ParamIndicatorExpires ParamIndicator = "Expires" + // ParamIndicatorKeyID ... + ParamIndicatorKeyID ParamIndicator = "KeyId" + // ParamIndicatorSignature ... + ParamIndicatorSignature ParamIndicator = "Signature" +) + +// PossibleParamIndicatorValues returns an array of possible values for the ParamIndicator const type. +func PossibleParamIndicatorValues() []ParamIndicator { + return []ParamIndicator{ParamIndicatorExpires, ParamIndicatorKeyID, ParamIndicatorSignature} +} + +// PolicyEnabledState enumerates the values for policy enabled state. +type PolicyEnabledState string + +const ( + // PolicyEnabledStateDisabled ... + PolicyEnabledStateDisabled PolicyEnabledState = "Disabled" + // PolicyEnabledStateEnabled ... + PolicyEnabledStateEnabled PolicyEnabledState = "Enabled" +) + +// PossiblePolicyEnabledStateValues returns an array of possible values for the PolicyEnabledState const type. +func PossiblePolicyEnabledStateValues() []PolicyEnabledState { + return []PolicyEnabledState{PolicyEnabledStateDisabled, PolicyEnabledStateEnabled} +} + +// PolicyMode enumerates the values for policy mode. +type PolicyMode string + +const ( + // PolicyModeDetection ... + PolicyModeDetection PolicyMode = "Detection" + // PolicyModePrevention ... + PolicyModePrevention PolicyMode = "Prevention" +) + +// PossiblePolicyModeValues returns an array of possible values for the PolicyMode const type. +func PossiblePolicyModeValues() []PolicyMode { + return []PolicyMode{PolicyModeDetection, PolicyModePrevention} +} + +// PolicyResourceState enumerates the values for policy resource state. +type PolicyResourceState string + +const ( + // PolicyResourceStateCreating ... + PolicyResourceStateCreating PolicyResourceState = "Creating" + // PolicyResourceStateDeleting ... + PolicyResourceStateDeleting PolicyResourceState = "Deleting" + // PolicyResourceStateDisabled ... + PolicyResourceStateDisabled PolicyResourceState = "Disabled" + // PolicyResourceStateDisabling ... + PolicyResourceStateDisabling PolicyResourceState = "Disabling" + // PolicyResourceStateEnabled ... + PolicyResourceStateEnabled PolicyResourceState = "Enabled" + // PolicyResourceStateEnabling ... + PolicyResourceStateEnabling PolicyResourceState = "Enabling" +) + +// PossiblePolicyResourceStateValues returns an array of possible values for the PolicyResourceState const type. +func PossiblePolicyResourceStateValues() []PolicyResourceState { + return []PolicyResourceState{PolicyResourceStateCreating, PolicyResourceStateDeleting, PolicyResourceStateDisabled, PolicyResourceStateDisabling, PolicyResourceStateEnabled, PolicyResourceStateEnabling} +} + +// PostArgsOperator enumerates the values for post args operator. +type PostArgsOperator string + +const ( + // PostArgsOperatorAny ... + PostArgsOperatorAny PostArgsOperator = "Any" + // PostArgsOperatorBeginsWith ... + PostArgsOperatorBeginsWith PostArgsOperator = "BeginsWith" + // PostArgsOperatorContains ... + PostArgsOperatorContains PostArgsOperator = "Contains" + // PostArgsOperatorEndsWith ... + PostArgsOperatorEndsWith PostArgsOperator = "EndsWith" + // PostArgsOperatorEqual ... + PostArgsOperatorEqual PostArgsOperator = "Equal" + // PostArgsOperatorGreaterThan ... + PostArgsOperatorGreaterThan PostArgsOperator = "GreaterThan" + // PostArgsOperatorGreaterThanOrEqual ... + PostArgsOperatorGreaterThanOrEqual PostArgsOperator = "GreaterThanOrEqual" + // PostArgsOperatorLessThan ... + PostArgsOperatorLessThan PostArgsOperator = "LessThan" + // PostArgsOperatorLessThanOrEqual ... + PostArgsOperatorLessThanOrEqual PostArgsOperator = "LessThanOrEqual" + // PostArgsOperatorRegEx ... + PostArgsOperatorRegEx PostArgsOperator = "RegEx" +) + +// PossiblePostArgsOperatorValues returns an array of possible values for the PostArgsOperator const type. +func PossiblePostArgsOperatorValues() []PostArgsOperator { + return []PostArgsOperator{PostArgsOperatorAny, PostArgsOperatorBeginsWith, PostArgsOperatorContains, PostArgsOperatorEndsWith, PostArgsOperatorEqual, PostArgsOperatorGreaterThan, PostArgsOperatorGreaterThanOrEqual, PostArgsOperatorLessThan, PostArgsOperatorLessThanOrEqual, PostArgsOperatorRegEx} +} + +// PrivateEndpointStatus enumerates the values for private endpoint status. +type PrivateEndpointStatus string + +const ( + // PrivateEndpointStatusApproved ... + PrivateEndpointStatusApproved PrivateEndpointStatus = "Approved" + // PrivateEndpointStatusDisconnected ... + PrivateEndpointStatusDisconnected PrivateEndpointStatus = "Disconnected" + // PrivateEndpointStatusPending ... + PrivateEndpointStatusPending PrivateEndpointStatus = "Pending" + // PrivateEndpointStatusRejected ... + PrivateEndpointStatusRejected PrivateEndpointStatus = "Rejected" + // PrivateEndpointStatusTimeout ... + PrivateEndpointStatusTimeout PrivateEndpointStatus = "Timeout" +) + +// PossiblePrivateEndpointStatusValues returns an array of possible values for the PrivateEndpointStatus const type. +func PossiblePrivateEndpointStatusValues() []PrivateEndpointStatus { + return []PrivateEndpointStatus{PrivateEndpointStatusApproved, PrivateEndpointStatusDisconnected, PrivateEndpointStatusPending, PrivateEndpointStatusRejected, PrivateEndpointStatusTimeout} +} + +// ProbeProtocol enumerates the values for probe protocol. +type ProbeProtocol string + +const ( + // ProbeProtocolHTTP ... + ProbeProtocolHTTP ProbeProtocol = "Http" + // ProbeProtocolHTTPS ... + ProbeProtocolHTTPS ProbeProtocol = "Https" + // ProbeProtocolNotSet ... + ProbeProtocolNotSet ProbeProtocol = "NotSet" +) + +// PossibleProbeProtocolValues returns an array of possible values for the ProbeProtocol const type. +func PossibleProbeProtocolValues() []ProbeProtocol { + return []ProbeProtocol{ProbeProtocolHTTP, ProbeProtocolHTTPS, ProbeProtocolNotSet} +} + +// ProfileResourceState enumerates the values for profile resource state. +type ProfileResourceState string + +const ( + // ProfileResourceStateActive ... + ProfileResourceStateActive ProfileResourceState = "Active" + // ProfileResourceStateCreating ... + ProfileResourceStateCreating ProfileResourceState = "Creating" + // ProfileResourceStateDeleting ... + ProfileResourceStateDeleting ProfileResourceState = "Deleting" + // ProfileResourceStateDisabled ... + ProfileResourceStateDisabled ProfileResourceState = "Disabled" +) + +// PossibleProfileResourceStateValues returns an array of possible values for the ProfileResourceState const type. +func PossibleProfileResourceStateValues() []ProfileResourceState { + return []ProfileResourceState{ProfileResourceStateActive, ProfileResourceStateCreating, ProfileResourceStateDeleting, ProfileResourceStateDisabled} +} + +// ProtocolType enumerates the values for protocol type. +type ProtocolType string + +const ( + // ProtocolTypeIPBased ... + ProtocolTypeIPBased ProtocolType = "IPBased" + // ProtocolTypeServerNameIndication ... + ProtocolTypeServerNameIndication ProtocolType = "ServerNameIndication" +) + +// PossibleProtocolTypeValues returns an array of possible values for the ProtocolType const type. +func PossibleProtocolTypeValues() []ProtocolType { + return []ProtocolType{ProtocolTypeIPBased, ProtocolTypeServerNameIndication} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateCreating ... + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateCreating, ProvisioningStateFailed, ProvisioningStateSucceeded} +} + +// QueryStringBehavior enumerates the values for query string behavior. +type QueryStringBehavior string + +const ( + // QueryStringBehaviorExclude ... + QueryStringBehaviorExclude QueryStringBehavior = "Exclude" + // QueryStringBehaviorExcludeAll ... + QueryStringBehaviorExcludeAll QueryStringBehavior = "ExcludeAll" + // QueryStringBehaviorInclude ... + QueryStringBehaviorInclude QueryStringBehavior = "Include" + // QueryStringBehaviorIncludeAll ... + QueryStringBehaviorIncludeAll QueryStringBehavior = "IncludeAll" +) + +// PossibleQueryStringBehaviorValues returns an array of possible values for the QueryStringBehavior const type. +func PossibleQueryStringBehaviorValues() []QueryStringBehavior { + return []QueryStringBehavior{QueryStringBehaviorExclude, QueryStringBehaviorExcludeAll, QueryStringBehaviorInclude, QueryStringBehaviorIncludeAll} +} + +// QueryStringCachingBehavior enumerates the values for query string caching behavior. +type QueryStringCachingBehavior string + +const ( + // QueryStringCachingBehaviorBypassCaching ... + QueryStringCachingBehaviorBypassCaching QueryStringCachingBehavior = "BypassCaching" + // QueryStringCachingBehaviorIgnoreQueryString ... + QueryStringCachingBehaviorIgnoreQueryString QueryStringCachingBehavior = "IgnoreQueryString" + // QueryStringCachingBehaviorNotSet ... + QueryStringCachingBehaviorNotSet QueryStringCachingBehavior = "NotSet" + // QueryStringCachingBehaviorUseQueryString ... + QueryStringCachingBehaviorUseQueryString QueryStringCachingBehavior = "UseQueryString" +) + +// PossibleQueryStringCachingBehaviorValues returns an array of possible values for the QueryStringCachingBehavior const type. +func PossibleQueryStringCachingBehaviorValues() []QueryStringCachingBehavior { + return []QueryStringCachingBehavior{QueryStringCachingBehaviorBypassCaching, QueryStringCachingBehaviorIgnoreQueryString, QueryStringCachingBehaviorNotSet, QueryStringCachingBehaviorUseQueryString} +} + +// QueryStringOperator enumerates the values for query string operator. +type QueryStringOperator string + +const ( + // QueryStringOperatorAny ... + QueryStringOperatorAny QueryStringOperator = "Any" + // QueryStringOperatorBeginsWith ... + QueryStringOperatorBeginsWith QueryStringOperator = "BeginsWith" + // QueryStringOperatorContains ... + QueryStringOperatorContains QueryStringOperator = "Contains" + // QueryStringOperatorEndsWith ... + QueryStringOperatorEndsWith QueryStringOperator = "EndsWith" + // QueryStringOperatorEqual ... + QueryStringOperatorEqual QueryStringOperator = "Equal" + // QueryStringOperatorGreaterThan ... + QueryStringOperatorGreaterThan QueryStringOperator = "GreaterThan" + // QueryStringOperatorGreaterThanOrEqual ... + QueryStringOperatorGreaterThanOrEqual QueryStringOperator = "GreaterThanOrEqual" + // QueryStringOperatorLessThan ... + QueryStringOperatorLessThan QueryStringOperator = "LessThan" + // QueryStringOperatorLessThanOrEqual ... + QueryStringOperatorLessThanOrEqual QueryStringOperator = "LessThanOrEqual" + // QueryStringOperatorRegEx ... + QueryStringOperatorRegEx QueryStringOperator = "RegEx" +) + +// PossibleQueryStringOperatorValues returns an array of possible values for the QueryStringOperator const type. +func PossibleQueryStringOperatorValues() []QueryStringOperator { + return []QueryStringOperator{QueryStringOperatorAny, QueryStringOperatorBeginsWith, QueryStringOperatorContains, QueryStringOperatorEndsWith, QueryStringOperatorEqual, QueryStringOperatorGreaterThan, QueryStringOperatorGreaterThanOrEqual, QueryStringOperatorLessThan, QueryStringOperatorLessThanOrEqual, QueryStringOperatorRegEx} +} + +// RedirectType enumerates the values for redirect type. +type RedirectType string + +const ( + // RedirectTypeFound ... + RedirectTypeFound RedirectType = "Found" + // RedirectTypeMoved ... + RedirectTypeMoved RedirectType = "Moved" + // RedirectTypePermanentRedirect ... + RedirectTypePermanentRedirect RedirectType = "PermanentRedirect" + // RedirectTypeTemporaryRedirect ... + RedirectTypeTemporaryRedirect RedirectType = "TemporaryRedirect" +) + +// PossibleRedirectTypeValues returns an array of possible values for the RedirectType const type. +func PossibleRedirectTypeValues() []RedirectType { + return []RedirectType{RedirectTypeFound, RedirectTypeMoved, RedirectTypePermanentRedirect, RedirectTypeTemporaryRedirect} +} + +// RemoteAddressOperator enumerates the values for remote address operator. +type RemoteAddressOperator string + +const ( + // RemoteAddressOperatorAny ... + RemoteAddressOperatorAny RemoteAddressOperator = "Any" + // RemoteAddressOperatorGeoMatch ... + RemoteAddressOperatorGeoMatch RemoteAddressOperator = "GeoMatch" + // RemoteAddressOperatorIPMatch ... + RemoteAddressOperatorIPMatch RemoteAddressOperator = "IPMatch" +) + +// PossibleRemoteAddressOperatorValues returns an array of possible values for the RemoteAddressOperator const type. +func PossibleRemoteAddressOperatorValues() []RemoteAddressOperator { + return []RemoteAddressOperator{RemoteAddressOperatorAny, RemoteAddressOperatorGeoMatch, RemoteAddressOperatorIPMatch} +} + +// RequestBodyOperator enumerates the values for request body operator. +type RequestBodyOperator string + +const ( + // RequestBodyOperatorAny ... + RequestBodyOperatorAny RequestBodyOperator = "Any" + // RequestBodyOperatorBeginsWith ... + RequestBodyOperatorBeginsWith RequestBodyOperator = "BeginsWith" + // RequestBodyOperatorContains ... + RequestBodyOperatorContains RequestBodyOperator = "Contains" + // RequestBodyOperatorEndsWith ... + RequestBodyOperatorEndsWith RequestBodyOperator = "EndsWith" + // RequestBodyOperatorEqual ... + RequestBodyOperatorEqual RequestBodyOperator = "Equal" + // RequestBodyOperatorGreaterThan ... + RequestBodyOperatorGreaterThan RequestBodyOperator = "GreaterThan" + // RequestBodyOperatorGreaterThanOrEqual ... + RequestBodyOperatorGreaterThanOrEqual RequestBodyOperator = "GreaterThanOrEqual" + // RequestBodyOperatorLessThan ... + RequestBodyOperatorLessThan RequestBodyOperator = "LessThan" + // RequestBodyOperatorLessThanOrEqual ... + RequestBodyOperatorLessThanOrEqual RequestBodyOperator = "LessThanOrEqual" + // RequestBodyOperatorRegEx ... + RequestBodyOperatorRegEx RequestBodyOperator = "RegEx" +) + +// PossibleRequestBodyOperatorValues returns an array of possible values for the RequestBodyOperator const type. +func PossibleRequestBodyOperatorValues() []RequestBodyOperator { + return []RequestBodyOperator{RequestBodyOperatorAny, RequestBodyOperatorBeginsWith, RequestBodyOperatorContains, RequestBodyOperatorEndsWith, RequestBodyOperatorEqual, RequestBodyOperatorGreaterThan, RequestBodyOperatorGreaterThanOrEqual, RequestBodyOperatorLessThan, RequestBodyOperatorLessThanOrEqual, RequestBodyOperatorRegEx} +} + +// RequestHeaderOperator enumerates the values for request header operator. +type RequestHeaderOperator string + +const ( + // RequestHeaderOperatorAny ... + RequestHeaderOperatorAny RequestHeaderOperator = "Any" + // RequestHeaderOperatorBeginsWith ... + RequestHeaderOperatorBeginsWith RequestHeaderOperator = "BeginsWith" + // RequestHeaderOperatorContains ... + RequestHeaderOperatorContains RequestHeaderOperator = "Contains" + // RequestHeaderOperatorEndsWith ... + RequestHeaderOperatorEndsWith RequestHeaderOperator = "EndsWith" + // RequestHeaderOperatorEqual ... + RequestHeaderOperatorEqual RequestHeaderOperator = "Equal" + // RequestHeaderOperatorGreaterThan ... + RequestHeaderOperatorGreaterThan RequestHeaderOperator = "GreaterThan" + // RequestHeaderOperatorGreaterThanOrEqual ... + RequestHeaderOperatorGreaterThanOrEqual RequestHeaderOperator = "GreaterThanOrEqual" + // RequestHeaderOperatorLessThan ... + RequestHeaderOperatorLessThan RequestHeaderOperator = "LessThan" + // RequestHeaderOperatorLessThanOrEqual ... + RequestHeaderOperatorLessThanOrEqual RequestHeaderOperator = "LessThanOrEqual" + // RequestHeaderOperatorRegEx ... + RequestHeaderOperatorRegEx RequestHeaderOperator = "RegEx" +) + +// PossibleRequestHeaderOperatorValues returns an array of possible values for the RequestHeaderOperator const type. +func PossibleRequestHeaderOperatorValues() []RequestHeaderOperator { + return []RequestHeaderOperator{RequestHeaderOperatorAny, RequestHeaderOperatorBeginsWith, RequestHeaderOperatorContains, RequestHeaderOperatorEndsWith, RequestHeaderOperatorEqual, RequestHeaderOperatorGreaterThan, RequestHeaderOperatorGreaterThanOrEqual, RequestHeaderOperatorLessThan, RequestHeaderOperatorLessThanOrEqual, RequestHeaderOperatorRegEx} +} + +// RequestURIOperator enumerates the values for request uri operator. +type RequestURIOperator string + +const ( + // RequestURIOperatorAny ... + RequestURIOperatorAny RequestURIOperator = "Any" + // RequestURIOperatorBeginsWith ... + RequestURIOperatorBeginsWith RequestURIOperator = "BeginsWith" + // RequestURIOperatorContains ... + RequestURIOperatorContains RequestURIOperator = "Contains" + // RequestURIOperatorEndsWith ... + RequestURIOperatorEndsWith RequestURIOperator = "EndsWith" + // RequestURIOperatorEqual ... + RequestURIOperatorEqual RequestURIOperator = "Equal" + // RequestURIOperatorGreaterThan ... + RequestURIOperatorGreaterThan RequestURIOperator = "GreaterThan" + // RequestURIOperatorGreaterThanOrEqual ... + RequestURIOperatorGreaterThanOrEqual RequestURIOperator = "GreaterThanOrEqual" + // RequestURIOperatorLessThan ... + RequestURIOperatorLessThan RequestURIOperator = "LessThan" + // RequestURIOperatorLessThanOrEqual ... + RequestURIOperatorLessThanOrEqual RequestURIOperator = "LessThanOrEqual" + // RequestURIOperatorRegEx ... + RequestURIOperatorRegEx RequestURIOperator = "RegEx" +) + +// PossibleRequestURIOperatorValues returns an array of possible values for the RequestURIOperator const type. +func PossibleRequestURIOperatorValues() []RequestURIOperator { + return []RequestURIOperator{RequestURIOperatorAny, RequestURIOperatorBeginsWith, RequestURIOperatorContains, RequestURIOperatorEndsWith, RequestURIOperatorEqual, RequestURIOperatorGreaterThan, RequestURIOperatorGreaterThanOrEqual, RequestURIOperatorLessThan, RequestURIOperatorLessThanOrEqual, RequestURIOperatorRegEx} +} + +// ResourceType enumerates the values for resource type. +type ResourceType string + +const ( + // ResourceTypeMicrosoftCdnProfilesAfdEndpoints ... + ResourceTypeMicrosoftCdnProfilesAfdEndpoints ResourceType = "Microsoft.Cdn/Profiles/AfdEndpoints" + // ResourceTypeMicrosoftCdnProfilesEndpoints ... + ResourceTypeMicrosoftCdnProfilesEndpoints ResourceType = "Microsoft.Cdn/Profiles/Endpoints" +) + +// PossibleResourceTypeValues returns an array of possible values for the ResourceType const type. +func PossibleResourceTypeValues() []ResourceType { + return []ResourceType{ResourceTypeMicrosoftCdnProfilesAfdEndpoints, ResourceTypeMicrosoftCdnProfilesEndpoints} +} + +// ResponseBasedDetectedErrorTypes enumerates the values for response based detected error types. +type ResponseBasedDetectedErrorTypes string + +const ( + // ResponseBasedDetectedErrorTypesNone ... + ResponseBasedDetectedErrorTypesNone ResponseBasedDetectedErrorTypes = "None" + // ResponseBasedDetectedErrorTypesTCPAndHTTPErrors ... + ResponseBasedDetectedErrorTypesTCPAndHTTPErrors ResponseBasedDetectedErrorTypes = "TcpAndHttpErrors" + // ResponseBasedDetectedErrorTypesTCPErrorsOnly ... + ResponseBasedDetectedErrorTypesTCPErrorsOnly ResponseBasedDetectedErrorTypes = "TcpErrorsOnly" +) + +// PossibleResponseBasedDetectedErrorTypesValues returns an array of possible values for the ResponseBasedDetectedErrorTypes const type. +func PossibleResponseBasedDetectedErrorTypesValues() []ResponseBasedDetectedErrorTypes { + return []ResponseBasedDetectedErrorTypes{ResponseBasedDetectedErrorTypesNone, ResponseBasedDetectedErrorTypesTCPAndHTTPErrors, ResponseBasedDetectedErrorTypesTCPErrorsOnly} +} + +// RuleCacheBehavior enumerates the values for rule cache behavior. +type RuleCacheBehavior string + +const ( + // RuleCacheBehaviorHonorOrigin ... + RuleCacheBehaviorHonorOrigin RuleCacheBehavior = "HonorOrigin" + // RuleCacheBehaviorOverrideAlways ... + RuleCacheBehaviorOverrideAlways RuleCacheBehavior = "OverrideAlways" + // RuleCacheBehaviorOverrideIfOriginMissing ... + RuleCacheBehaviorOverrideIfOriginMissing RuleCacheBehavior = "OverrideIfOriginMissing" +) + +// PossibleRuleCacheBehaviorValues returns an array of possible values for the RuleCacheBehavior const type. +func PossibleRuleCacheBehaviorValues() []RuleCacheBehavior { + return []RuleCacheBehavior{RuleCacheBehaviorHonorOrigin, RuleCacheBehaviorOverrideAlways, RuleCacheBehaviorOverrideIfOriginMissing} +} + +// RuleIsCompressionEnabled enumerates the values for rule is compression enabled. +type RuleIsCompressionEnabled string + +const ( + // RuleIsCompressionEnabledDisabled ... + RuleIsCompressionEnabledDisabled RuleIsCompressionEnabled = "Disabled" + // RuleIsCompressionEnabledEnabled ... + RuleIsCompressionEnabledEnabled RuleIsCompressionEnabled = "Enabled" +) + +// PossibleRuleIsCompressionEnabledValues returns an array of possible values for the RuleIsCompressionEnabled const type. +func PossibleRuleIsCompressionEnabledValues() []RuleIsCompressionEnabled { + return []RuleIsCompressionEnabled{RuleIsCompressionEnabledDisabled, RuleIsCompressionEnabledEnabled} +} + +// RuleQueryStringCachingBehavior enumerates the values for rule query string caching behavior. +type RuleQueryStringCachingBehavior string + +const ( + // RuleQueryStringCachingBehaviorIgnoreQueryString ... + RuleQueryStringCachingBehaviorIgnoreQueryString RuleQueryStringCachingBehavior = "IgnoreQueryString" + // RuleQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings ... + RuleQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings RuleQueryStringCachingBehavior = "IgnoreSpecifiedQueryStrings" + // RuleQueryStringCachingBehaviorIncludeSpecifiedQueryStrings ... + RuleQueryStringCachingBehaviorIncludeSpecifiedQueryStrings RuleQueryStringCachingBehavior = "IncludeSpecifiedQueryStrings" + // RuleQueryStringCachingBehaviorUseQueryString ... + RuleQueryStringCachingBehaviorUseQueryString RuleQueryStringCachingBehavior = "UseQueryString" +) + +// PossibleRuleQueryStringCachingBehaviorValues returns an array of possible values for the RuleQueryStringCachingBehavior const type. +func PossibleRuleQueryStringCachingBehaviorValues() []RuleQueryStringCachingBehavior { + return []RuleQueryStringCachingBehavior{RuleQueryStringCachingBehaviorIgnoreQueryString, RuleQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings, RuleQueryStringCachingBehaviorIncludeSpecifiedQueryStrings, RuleQueryStringCachingBehaviorUseQueryString} +} + +// SecretType enumerates the values for secret type. +type SecretType string + +const ( + // SecretTypeAzureFirstPartyManagedCertificate ... + SecretTypeAzureFirstPartyManagedCertificate SecretType = "AzureFirstPartyManagedCertificate" + // SecretTypeCustomerCertificate ... + SecretTypeCustomerCertificate SecretType = "CustomerCertificate" + // SecretTypeManagedCertificate ... + SecretTypeManagedCertificate SecretType = "ManagedCertificate" + // SecretTypeURLSigningKey ... + SecretTypeURLSigningKey SecretType = "UrlSigningKey" +) + +// PossibleSecretTypeValues returns an array of possible values for the SecretType const type. +func PossibleSecretTypeValues() []SecretType { + return []SecretType{SecretTypeAzureFirstPartyManagedCertificate, SecretTypeCustomerCertificate, SecretTypeManagedCertificate, SecretTypeURLSigningKey} +} + +// ServerPortOperator enumerates the values for server port operator. +type ServerPortOperator string + +const ( + // ServerPortOperatorAny ... + ServerPortOperatorAny ServerPortOperator = "Any" + // ServerPortOperatorBeginsWith ... + ServerPortOperatorBeginsWith ServerPortOperator = "BeginsWith" + // ServerPortOperatorContains ... + ServerPortOperatorContains ServerPortOperator = "Contains" + // ServerPortOperatorEndsWith ... + ServerPortOperatorEndsWith ServerPortOperator = "EndsWith" + // ServerPortOperatorEqual ... + ServerPortOperatorEqual ServerPortOperator = "Equal" + // ServerPortOperatorGreaterThan ... + ServerPortOperatorGreaterThan ServerPortOperator = "GreaterThan" + // ServerPortOperatorGreaterThanOrEqual ... + ServerPortOperatorGreaterThanOrEqual ServerPortOperator = "GreaterThanOrEqual" + // ServerPortOperatorLessThan ... + ServerPortOperatorLessThan ServerPortOperator = "LessThan" + // ServerPortOperatorLessThanOrEqual ... + ServerPortOperatorLessThanOrEqual ServerPortOperator = "LessThanOrEqual" + // ServerPortOperatorRegEx ... + ServerPortOperatorRegEx ServerPortOperator = "RegEx" +) + +// PossibleServerPortOperatorValues returns an array of possible values for the ServerPortOperator const type. +func PossibleServerPortOperatorValues() []ServerPortOperator { + return []ServerPortOperator{ServerPortOperatorAny, ServerPortOperatorBeginsWith, ServerPortOperatorContains, ServerPortOperatorEndsWith, ServerPortOperatorEqual, ServerPortOperatorGreaterThan, ServerPortOperatorGreaterThanOrEqual, ServerPortOperatorLessThan, ServerPortOperatorLessThanOrEqual, ServerPortOperatorRegEx} +} + +// SharedPrivateLinkResourceStatus enumerates the values for shared private link resource status. +type SharedPrivateLinkResourceStatus string + +const ( + // SharedPrivateLinkResourceStatusApproved ... + SharedPrivateLinkResourceStatusApproved SharedPrivateLinkResourceStatus = "Approved" + // SharedPrivateLinkResourceStatusDisconnected ... + SharedPrivateLinkResourceStatusDisconnected SharedPrivateLinkResourceStatus = "Disconnected" + // SharedPrivateLinkResourceStatusPending ... + SharedPrivateLinkResourceStatusPending SharedPrivateLinkResourceStatus = "Pending" + // SharedPrivateLinkResourceStatusRejected ... + SharedPrivateLinkResourceStatusRejected SharedPrivateLinkResourceStatus = "Rejected" + // SharedPrivateLinkResourceStatusTimeout ... + SharedPrivateLinkResourceStatusTimeout SharedPrivateLinkResourceStatus = "Timeout" +) + +// PossibleSharedPrivateLinkResourceStatusValues returns an array of possible values for the SharedPrivateLinkResourceStatus const type. +func PossibleSharedPrivateLinkResourceStatusValues() []SharedPrivateLinkResourceStatus { + return []SharedPrivateLinkResourceStatus{SharedPrivateLinkResourceStatusApproved, SharedPrivateLinkResourceStatusDisconnected, SharedPrivateLinkResourceStatusPending, SharedPrivateLinkResourceStatusRejected, SharedPrivateLinkResourceStatusTimeout} +} + +// SkuName enumerates the values for sku name. +type SkuName string + +const ( + // SkuNameCustomVerizon ... + SkuNameCustomVerizon SkuName = "Custom_Verizon" + // SkuNamePremiumAzureFrontDoor ... + SkuNamePremiumAzureFrontDoor SkuName = "Premium_AzureFrontDoor" + // SkuNamePremiumVerizon ... + SkuNamePremiumVerizon SkuName = "Premium_Verizon" + // SkuNameStandard955BandWidthChinaCdn ... + SkuNameStandard955BandWidthChinaCdn SkuName = "Standard_955BandWidth_ChinaCdn" + // SkuNameStandardAkamai ... + SkuNameStandardAkamai SkuName = "Standard_Akamai" + // SkuNameStandardAvgBandWidthChinaCdn ... + SkuNameStandardAvgBandWidthChinaCdn SkuName = "Standard_AvgBandWidth_ChinaCdn" + // SkuNameStandardAzureFrontDoor ... + SkuNameStandardAzureFrontDoor SkuName = "Standard_AzureFrontDoor" + // SkuNameStandardChinaCdn ... + SkuNameStandardChinaCdn SkuName = "Standard_ChinaCdn" + // SkuNameStandardMicrosoft ... + SkuNameStandardMicrosoft SkuName = "Standard_Microsoft" + // SkuNameStandardPlus955BandWidthChinaCdn ... + SkuNameStandardPlus955BandWidthChinaCdn SkuName = "StandardPlus_955BandWidth_ChinaCdn" + // SkuNameStandardPlusAvgBandWidthChinaCdn ... + SkuNameStandardPlusAvgBandWidthChinaCdn SkuName = "StandardPlus_AvgBandWidth_ChinaCdn" + // SkuNameStandardPlusChinaCdn ... + SkuNameStandardPlusChinaCdn SkuName = "StandardPlus_ChinaCdn" + // SkuNameStandardVerizon ... + SkuNameStandardVerizon SkuName = "Standard_Verizon" +) + +// PossibleSkuNameValues returns an array of possible values for the SkuName const type. +func PossibleSkuNameValues() []SkuName { + return []SkuName{SkuNameCustomVerizon, SkuNamePremiumAzureFrontDoor, SkuNamePremiumVerizon, SkuNameStandard955BandWidthChinaCdn, SkuNameStandardAkamai, SkuNameStandardAvgBandWidthChinaCdn, SkuNameStandardAzureFrontDoor, SkuNameStandardChinaCdn, SkuNameStandardMicrosoft, SkuNameStandardPlus955BandWidthChinaCdn, SkuNameStandardPlusAvgBandWidthChinaCdn, SkuNameStandardPlusChinaCdn, SkuNameStandardVerizon} +} + +// SocketAddrOperator enumerates the values for socket addr operator. +type SocketAddrOperator string + +const ( + // SocketAddrOperatorAny ... + SocketAddrOperatorAny SocketAddrOperator = "Any" + // SocketAddrOperatorIPMatch ... + SocketAddrOperatorIPMatch SocketAddrOperator = "IPMatch" +) + +// PossibleSocketAddrOperatorValues returns an array of possible values for the SocketAddrOperator const type. +func PossibleSocketAddrOperatorValues() []SocketAddrOperator { + return []SocketAddrOperator{SocketAddrOperatorAny, SocketAddrOperatorIPMatch} +} + +// SslProtocol enumerates the values for ssl protocol. +type SslProtocol string + +const ( + // SslProtocolTLSv1 ... + SslProtocolTLSv1 SslProtocol = "TLSv1" + // SslProtocolTLSv11 ... + SslProtocolTLSv11 SslProtocol = "TLSv1.1" + // SslProtocolTLSv12 ... + SslProtocolTLSv12 SslProtocol = "TLSv1.2" +) + +// PossibleSslProtocolValues returns an array of possible values for the SslProtocol const type. +func PossibleSslProtocolValues() []SslProtocol { + return []SslProtocol{SslProtocolTLSv1, SslProtocolTLSv11, SslProtocolTLSv12} +} + +// Status enumerates the values for status. +type Status string + +const ( + // StatusAccessDenied ... + StatusAccessDenied Status = "AccessDenied" + // StatusCertificateExpired ... + StatusCertificateExpired Status = "CertificateExpired" + // StatusInvalid ... + StatusInvalid Status = "Invalid" + // StatusValid ... + StatusValid Status = "Valid" +) + +// PossibleStatusValues returns an array of possible values for the Status const type. +func PossibleStatusValues() []Status { + return []Status{StatusAccessDenied, StatusCertificateExpired, StatusInvalid, StatusValid} +} + +// Transform enumerates the values for transform. +type Transform string + +const ( + // TransformLowercase ... + TransformLowercase Transform = "Lowercase" + // TransformRemoveNulls ... + TransformRemoveNulls Transform = "RemoveNulls" + // TransformTrim ... + TransformTrim Transform = "Trim" + // TransformUppercase ... + TransformUppercase Transform = "Uppercase" + // TransformURLDecode ... + TransformURLDecode Transform = "UrlDecode" + // TransformURLEncode ... + TransformURLEncode Transform = "UrlEncode" +) + +// PossibleTransformValues returns an array of possible values for the Transform const type. +func PossibleTransformValues() []Transform { + return []Transform{TransformLowercase, TransformRemoveNulls, TransformTrim, TransformUppercase, TransformURLDecode, TransformURLEncode} +} + +// TransformType enumerates the values for transform type. +type TransformType string + +const ( + // TransformTypeLowercase ... + TransformTypeLowercase TransformType = "Lowercase" + // TransformTypeRemoveNulls ... + TransformTypeRemoveNulls TransformType = "RemoveNulls" + // TransformTypeTrim ... + TransformTypeTrim TransformType = "Trim" + // TransformTypeUppercase ... + TransformTypeUppercase TransformType = "Uppercase" + // TransformTypeURLDecode ... + TransformTypeURLDecode TransformType = "UrlDecode" + // TransformTypeURLEncode ... + TransformTypeURLEncode TransformType = "UrlEncode" +) + +// PossibleTransformTypeValues returns an array of possible values for the TransformType const type. +func PossibleTransformTypeValues() []TransformType { + return []TransformType{TransformTypeLowercase, TransformTypeRemoveNulls, TransformTypeTrim, TransformTypeUppercase, TransformTypeURLDecode, TransformTypeURLEncode} +} + +// Type enumerates the values for type. +type Type string + +const ( + // TypeSecurityPolicyPropertiesParameters ... + TypeSecurityPolicyPropertiesParameters Type = "SecurityPolicyPropertiesParameters" + // TypeWebApplicationFirewall ... + TypeWebApplicationFirewall Type = "WebApplicationFirewall" +) + +// PossibleTypeValues returns an array of possible values for the Type const type. +func PossibleTypeValues() []Type { + return []Type{TypeSecurityPolicyPropertiesParameters, TypeWebApplicationFirewall} +} + +// TypeBasicSecretParameters enumerates the values for type basic secret parameters. +type TypeBasicSecretParameters string + +const ( + // TypeBasicSecretParametersTypeAzureFirstPartyManagedCertificate ... + TypeBasicSecretParametersTypeAzureFirstPartyManagedCertificate TypeBasicSecretParameters = "AzureFirstPartyManagedCertificate" + // TypeBasicSecretParametersTypeCustomerCertificate ... + TypeBasicSecretParametersTypeCustomerCertificate TypeBasicSecretParameters = "CustomerCertificate" + // TypeBasicSecretParametersTypeManagedCertificate ... + TypeBasicSecretParametersTypeManagedCertificate TypeBasicSecretParameters = "ManagedCertificate" + // TypeBasicSecretParametersTypeSecretParameters ... + TypeBasicSecretParametersTypeSecretParameters TypeBasicSecretParameters = "SecretParameters" + // TypeBasicSecretParametersTypeURLSigningKey ... + TypeBasicSecretParametersTypeURLSigningKey TypeBasicSecretParameters = "UrlSigningKey" +) + +// PossibleTypeBasicSecretParametersValues returns an array of possible values for the TypeBasicSecretParameters const type. +func PossibleTypeBasicSecretParametersValues() []TypeBasicSecretParameters { + return []TypeBasicSecretParameters{TypeBasicSecretParametersTypeAzureFirstPartyManagedCertificate, TypeBasicSecretParametersTypeCustomerCertificate, TypeBasicSecretParametersTypeManagedCertificate, TypeBasicSecretParametersTypeSecretParameters, TypeBasicSecretParametersTypeURLSigningKey} +} + +// Unit enumerates the values for unit. +type Unit string + +const ( + // UnitBitsPerSecond ... + UnitBitsPerSecond Unit = "bitsPerSecond" + // UnitBytes ... + UnitBytes Unit = "bytes" + // UnitCount ... + UnitCount Unit = "count" + // UnitMilliSeconds ... + UnitMilliSeconds Unit = "milliSeconds" +) + +// PossibleUnitValues returns an array of possible values for the Unit const type. +func PossibleUnitValues() []Unit { + return []Unit{UnitBitsPerSecond, UnitBytes, UnitCount, UnitMilliSeconds} +} + +// Unit1 enumerates the values for unit 1. +type Unit1 string + +const ( + // Unit1Count ... + Unit1Count Unit1 = "count" +) + +// PossibleUnit1Values returns an array of possible values for the Unit1 const type. +func PossibleUnit1Values() []Unit1 { + return []Unit1{Unit1Count} +} + +// URLFileExtensionOperator enumerates the values for url file extension operator. +type URLFileExtensionOperator string + +const ( + // URLFileExtensionOperatorAny ... + URLFileExtensionOperatorAny URLFileExtensionOperator = "Any" + // URLFileExtensionOperatorBeginsWith ... + URLFileExtensionOperatorBeginsWith URLFileExtensionOperator = "BeginsWith" + // URLFileExtensionOperatorContains ... + URLFileExtensionOperatorContains URLFileExtensionOperator = "Contains" + // URLFileExtensionOperatorEndsWith ... + URLFileExtensionOperatorEndsWith URLFileExtensionOperator = "EndsWith" + // URLFileExtensionOperatorEqual ... + URLFileExtensionOperatorEqual URLFileExtensionOperator = "Equal" + // URLFileExtensionOperatorGreaterThan ... + URLFileExtensionOperatorGreaterThan URLFileExtensionOperator = "GreaterThan" + // URLFileExtensionOperatorGreaterThanOrEqual ... + URLFileExtensionOperatorGreaterThanOrEqual URLFileExtensionOperator = "GreaterThanOrEqual" + // URLFileExtensionOperatorLessThan ... + URLFileExtensionOperatorLessThan URLFileExtensionOperator = "LessThan" + // URLFileExtensionOperatorLessThanOrEqual ... + URLFileExtensionOperatorLessThanOrEqual URLFileExtensionOperator = "LessThanOrEqual" + // URLFileExtensionOperatorRegEx ... + URLFileExtensionOperatorRegEx URLFileExtensionOperator = "RegEx" +) + +// PossibleURLFileExtensionOperatorValues returns an array of possible values for the URLFileExtensionOperator const type. +func PossibleURLFileExtensionOperatorValues() []URLFileExtensionOperator { + return []URLFileExtensionOperator{URLFileExtensionOperatorAny, URLFileExtensionOperatorBeginsWith, URLFileExtensionOperatorContains, URLFileExtensionOperatorEndsWith, URLFileExtensionOperatorEqual, URLFileExtensionOperatorGreaterThan, URLFileExtensionOperatorGreaterThanOrEqual, URLFileExtensionOperatorLessThan, URLFileExtensionOperatorLessThanOrEqual, URLFileExtensionOperatorRegEx} +} + +// URLFileNameOperator enumerates the values for url file name operator. +type URLFileNameOperator string + +const ( + // URLFileNameOperatorAny ... + URLFileNameOperatorAny URLFileNameOperator = "Any" + // URLFileNameOperatorBeginsWith ... + URLFileNameOperatorBeginsWith URLFileNameOperator = "BeginsWith" + // URLFileNameOperatorContains ... + URLFileNameOperatorContains URLFileNameOperator = "Contains" + // URLFileNameOperatorEndsWith ... + URLFileNameOperatorEndsWith URLFileNameOperator = "EndsWith" + // URLFileNameOperatorEqual ... + URLFileNameOperatorEqual URLFileNameOperator = "Equal" + // URLFileNameOperatorGreaterThan ... + URLFileNameOperatorGreaterThan URLFileNameOperator = "GreaterThan" + // URLFileNameOperatorGreaterThanOrEqual ... + URLFileNameOperatorGreaterThanOrEqual URLFileNameOperator = "GreaterThanOrEqual" + // URLFileNameOperatorLessThan ... + URLFileNameOperatorLessThan URLFileNameOperator = "LessThan" + // URLFileNameOperatorLessThanOrEqual ... + URLFileNameOperatorLessThanOrEqual URLFileNameOperator = "LessThanOrEqual" + // URLFileNameOperatorRegEx ... + URLFileNameOperatorRegEx URLFileNameOperator = "RegEx" +) + +// PossibleURLFileNameOperatorValues returns an array of possible values for the URLFileNameOperator const type. +func PossibleURLFileNameOperatorValues() []URLFileNameOperator { + return []URLFileNameOperator{URLFileNameOperatorAny, URLFileNameOperatorBeginsWith, URLFileNameOperatorContains, URLFileNameOperatorEndsWith, URLFileNameOperatorEqual, URLFileNameOperatorGreaterThan, URLFileNameOperatorGreaterThanOrEqual, URLFileNameOperatorLessThan, URLFileNameOperatorLessThanOrEqual, URLFileNameOperatorRegEx} +} + +// URLPathOperator enumerates the values for url path operator. +type URLPathOperator string + +const ( + // URLPathOperatorAny ... + URLPathOperatorAny URLPathOperator = "Any" + // URLPathOperatorBeginsWith ... + URLPathOperatorBeginsWith URLPathOperator = "BeginsWith" + // URLPathOperatorContains ... + URLPathOperatorContains URLPathOperator = "Contains" + // URLPathOperatorEndsWith ... + URLPathOperatorEndsWith URLPathOperator = "EndsWith" + // URLPathOperatorEqual ... + URLPathOperatorEqual URLPathOperator = "Equal" + // URLPathOperatorGreaterThan ... + URLPathOperatorGreaterThan URLPathOperator = "GreaterThan" + // URLPathOperatorGreaterThanOrEqual ... + URLPathOperatorGreaterThanOrEqual URLPathOperator = "GreaterThanOrEqual" + // URLPathOperatorLessThan ... + URLPathOperatorLessThan URLPathOperator = "LessThan" + // URLPathOperatorLessThanOrEqual ... + URLPathOperatorLessThanOrEqual URLPathOperator = "LessThanOrEqual" + // URLPathOperatorRegEx ... + URLPathOperatorRegEx URLPathOperator = "RegEx" + // URLPathOperatorWildcard ... + URLPathOperatorWildcard URLPathOperator = "Wildcard" +) + +// PossibleURLPathOperatorValues returns an array of possible values for the URLPathOperator const type. +func PossibleURLPathOperatorValues() []URLPathOperator { + return []URLPathOperator{URLPathOperatorAny, URLPathOperatorBeginsWith, URLPathOperatorContains, URLPathOperatorEndsWith, URLPathOperatorEqual, URLPathOperatorGreaterThan, URLPathOperatorGreaterThanOrEqual, URLPathOperatorLessThan, URLPathOperatorLessThanOrEqual, URLPathOperatorRegEx, URLPathOperatorWildcard} +} + +// WafAction enumerates the values for waf action. +type WafAction string + +const ( + // WafActionAllow ... + WafActionAllow WafAction = "allow" + // WafActionBlock ... + WafActionBlock WafAction = "block" + // WafActionLog ... + WafActionLog WafAction = "log" + // WafActionRedirect ... + WafActionRedirect WafAction = "redirect" +) + +// PossibleWafActionValues returns an array of possible values for the WafAction const type. +func PossibleWafActionValues() []WafAction { + return []WafAction{WafActionAllow, WafActionBlock, WafActionLog, WafActionRedirect} +} + +// WafGranularity enumerates the values for waf granularity. +type WafGranularity string + +const ( + // WafGranularityP1D ... + WafGranularityP1D WafGranularity = "P1D" + // WafGranularityPT1H ... + WafGranularityPT1H WafGranularity = "PT1H" + // WafGranularityPT5M ... + WafGranularityPT5M WafGranularity = "PT5M" +) + +// PossibleWafGranularityValues returns an array of possible values for the WafGranularity const type. +func PossibleWafGranularityValues() []WafGranularity { + return []WafGranularity{WafGranularityP1D, WafGranularityPT1H, WafGranularityPT5M} +} + +// WafMatchVariable enumerates the values for waf match variable. +type WafMatchVariable string + +const ( + // WafMatchVariableCookies ... + WafMatchVariableCookies WafMatchVariable = "Cookies" + // WafMatchVariablePostArgs ... + WafMatchVariablePostArgs WafMatchVariable = "PostArgs" + // WafMatchVariableQueryString ... + WafMatchVariableQueryString WafMatchVariable = "QueryString" + // WafMatchVariableRemoteAddr ... + WafMatchVariableRemoteAddr WafMatchVariable = "RemoteAddr" + // WafMatchVariableRequestBody ... + WafMatchVariableRequestBody WafMatchVariable = "RequestBody" + // WafMatchVariableRequestHeader ... + WafMatchVariableRequestHeader WafMatchVariable = "RequestHeader" + // WafMatchVariableRequestMethod ... + WafMatchVariableRequestMethod WafMatchVariable = "RequestMethod" + // WafMatchVariableRequestURI ... + WafMatchVariableRequestURI WafMatchVariable = "RequestUri" + // WafMatchVariableSocketAddr ... + WafMatchVariableSocketAddr WafMatchVariable = "SocketAddr" +) + +// PossibleWafMatchVariableValues returns an array of possible values for the WafMatchVariable const type. +func PossibleWafMatchVariableValues() []WafMatchVariable { + return []WafMatchVariable{WafMatchVariableCookies, WafMatchVariablePostArgs, WafMatchVariableQueryString, WafMatchVariableRemoteAddr, WafMatchVariableRequestBody, WafMatchVariableRequestHeader, WafMatchVariableRequestMethod, WafMatchVariableRequestURI, WafMatchVariableSocketAddr} +} + +// WafMetric enumerates the values for waf metric. +type WafMetric string + +const ( + // WafMetricClientRequestCount ... + WafMetricClientRequestCount WafMetric = "clientRequestCount" +) + +// PossibleWafMetricValues returns an array of possible values for the WafMetric const type. +func PossibleWafMetricValues() []WafMetric { + return []WafMetric{WafMetricClientRequestCount} +} + +// WafRankingGroupBy enumerates the values for waf ranking group by. +type WafRankingGroupBy string + +const ( + // WafRankingGroupByCustomDomain ... + WafRankingGroupByCustomDomain WafRankingGroupBy = "customDomain" + // WafRankingGroupByHTTPStatusCode ... + WafRankingGroupByHTTPStatusCode WafRankingGroupBy = "httpStatusCode" +) + +// PossibleWafRankingGroupByValues returns an array of possible values for the WafRankingGroupBy const type. +func PossibleWafRankingGroupByValues() []WafRankingGroupBy { + return []WafRankingGroupBy{WafRankingGroupByCustomDomain, WafRankingGroupByHTTPStatusCode} +} + +// WafRankingType enumerates the values for waf ranking type. +type WafRankingType string + +const ( + // WafRankingTypeAction ... + WafRankingTypeAction WafRankingType = "action" + // WafRankingTypeClientIP ... + WafRankingTypeClientIP WafRankingType = "clientIp" + // WafRankingTypeCountryOrRegion ... + WafRankingTypeCountryOrRegion WafRankingType = "countryOrRegion" + // WafRankingTypeRuleGroup ... + WafRankingTypeRuleGroup WafRankingType = "ruleGroup" + // WafRankingTypeRuleID ... + WafRankingTypeRuleID WafRankingType = "ruleId" + // WafRankingTypeRuleType ... + WafRankingTypeRuleType WafRankingType = "ruleType" + // WafRankingTypeURL ... + WafRankingTypeURL WafRankingType = "url" + // WafRankingTypeUserAgent ... + WafRankingTypeUserAgent WafRankingType = "userAgent" +) + +// PossibleWafRankingTypeValues returns an array of possible values for the WafRankingType const type. +func PossibleWafRankingTypeValues() []WafRankingType { + return []WafRankingType{WafRankingTypeAction, WafRankingTypeClientIP, WafRankingTypeCountryOrRegion, WafRankingTypeRuleGroup, WafRankingTypeRuleID, WafRankingTypeRuleType, WafRankingTypeURL, WafRankingTypeUserAgent} +} + +// WafRuleType enumerates the values for waf rule type. +type WafRuleType string + +const ( + // WafRuleTypeBot ... + WafRuleTypeBot WafRuleType = "bot" + // WafRuleTypeCustom ... + WafRuleTypeCustom WafRuleType = "custom" + // WafRuleTypeManaged ... + WafRuleTypeManaged WafRuleType = "managed" +) + +// PossibleWafRuleTypeValues returns an array of possible values for the WafRuleType const type. +func PossibleWafRuleTypeValues() []WafRuleType { + return []WafRuleType{WafRuleTypeBot, WafRuleTypeCustom, WafRuleTypeManaged} +} diff --git a/services/cdn/mgmt/2021-06-01/cdn/loganalytics.go b/services/cdn/mgmt/2021-06-01/cdn/loganalytics.go new file mode 100644 index 000000000000..ab87d86ccc1f --- /dev/null +++ b/services/cdn/mgmt/2021-06-01/cdn/loganalytics.go @@ -0,0 +1,608 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// LogAnalyticsClient is the cdn Management Client +type LogAnalyticsClient struct { + BaseClient +} + +// NewLogAnalyticsClient creates an instance of the LogAnalyticsClient client. +func NewLogAnalyticsClient(subscriptionID string) LogAnalyticsClient { + return NewLogAnalyticsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLogAnalyticsClientWithBaseURI creates an instance of the LogAnalyticsClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewLogAnalyticsClientWithBaseURI(baseURI string, subscriptionID string) LogAnalyticsClient { + return LogAnalyticsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GetLogAnalyticsLocations get all available location names for AFD log analytics report. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. which is unique within the resource group. +func (client LogAnalyticsClient) GetLogAnalyticsLocations(ctx context.Context, resourceGroupName string, profileName string) (result ContinentsResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LogAnalyticsClient.GetLogAnalyticsLocations") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.LogAnalyticsClient", "GetLogAnalyticsLocations", err.Error()) + } + + req, err := client.GetLogAnalyticsLocationsPreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetLogAnalyticsLocations", nil, "Failure preparing request") + return + } + + resp, err := client.GetLogAnalyticsLocationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetLogAnalyticsLocations", resp, "Failure sending request") + return + } + + result, err = client.GetLogAnalyticsLocationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetLogAnalyticsLocations", resp, "Failure responding to request") + return + } + + return +} + +// GetLogAnalyticsLocationsPreparer prepares the GetLogAnalyticsLocations request. +func (client LogAnalyticsClient) GetLogAnalyticsLocationsPreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getLogAnalyticsLocations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetLogAnalyticsLocationsSender sends the GetLogAnalyticsLocations request. The method will close the +// http.Response Body if it receives an error. +func (client LogAnalyticsClient) GetLogAnalyticsLocationsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetLogAnalyticsLocationsResponder handles the response to the GetLogAnalyticsLocations request. The method always +// closes the http.Response Body. +func (client LogAnalyticsClient) GetLogAnalyticsLocationsResponder(resp *http.Response) (result ContinentsResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetLogAnalyticsMetrics get log report for AFD profile +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. which is unique within the resource group. +// granularity - +func (client LogAnalyticsClient) GetLogAnalyticsMetrics(ctx context.Context, resourceGroupName string, profileName string, metrics []LogMetric, dateTimeBegin date.Time, dateTimeEnd date.Time, granularity LogMetricsGranularity, customDomains []string, protocols []string, groupBy []LogMetricsGroupBy, continents []string, countryOrRegions []string) (result MetricsResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LogAnalyticsClient.GetLogAnalyticsMetrics") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: metrics, + Constraints: []validation.Constraint{{Target: "metrics", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: customDomains, + Constraints: []validation.Constraint{{Target: "customDomains", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: protocols, + Constraints: []validation.Constraint{{Target: "protocols", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.LogAnalyticsClient", "GetLogAnalyticsMetrics", err.Error()) + } + + req, err := client.GetLogAnalyticsMetricsPreparer(ctx, resourceGroupName, profileName, metrics, dateTimeBegin, dateTimeEnd, granularity, customDomains, protocols, groupBy, continents, countryOrRegions) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetLogAnalyticsMetrics", nil, "Failure preparing request") + return + } + + resp, err := client.GetLogAnalyticsMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetLogAnalyticsMetrics", resp, "Failure sending request") + return + } + + result, err = client.GetLogAnalyticsMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetLogAnalyticsMetrics", resp, "Failure responding to request") + return + } + + return +} + +// GetLogAnalyticsMetricsPreparer prepares the GetLogAnalyticsMetrics request. +func (client LogAnalyticsClient) GetLogAnalyticsMetricsPreparer(ctx context.Context, resourceGroupName string, profileName string, metrics []LogMetric, dateTimeBegin date.Time, dateTimeEnd date.Time, granularity LogMetricsGranularity, customDomains []string, protocols []string, groupBy []LogMetricsGroupBy, continents []string, countryOrRegions []string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "customDomains": customDomains, + "dateTimeBegin": autorest.Encode("query", dateTimeBegin), + "dateTimeEnd": autorest.Encode("query", dateTimeEnd), + "granularity": autorest.Encode("query", granularity), + "metrics": metrics, + "protocols": protocols, + } + if groupBy != nil && len(groupBy) > 0 { + queryParameters["groupBy"] = groupBy + } + if continents != nil && len(continents) > 0 { + queryParameters["continents"] = continents + } + if countryOrRegions != nil && len(countryOrRegions) > 0 { + queryParameters["countryOrRegions"] = countryOrRegions + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getLogAnalyticsMetrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetLogAnalyticsMetricsSender sends the GetLogAnalyticsMetrics request. The method will close the +// http.Response Body if it receives an error. +func (client LogAnalyticsClient) GetLogAnalyticsMetricsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetLogAnalyticsMetricsResponder handles the response to the GetLogAnalyticsMetrics request. The method always +// closes the http.Response Body. +func (client LogAnalyticsClient) GetLogAnalyticsMetricsResponder(resp *http.Response) (result MetricsResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetLogAnalyticsRankings get log analytics ranking report for AFD profile +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. which is unique within the resource group. +func (client LogAnalyticsClient) GetLogAnalyticsRankings(ctx context.Context, resourceGroupName string, profileName string, rankings []LogRanking, metrics []LogRankingMetric, maxRanking int32, dateTimeBegin date.Time, dateTimeEnd date.Time, customDomains []string) (result RankingsResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LogAnalyticsClient.GetLogAnalyticsRankings") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: rankings, + Constraints: []validation.Constraint{{Target: "rankings", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: metrics, + Constraints: []validation.Constraint{{Target: "metrics", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.LogAnalyticsClient", "GetLogAnalyticsRankings", err.Error()) + } + + req, err := client.GetLogAnalyticsRankingsPreparer(ctx, resourceGroupName, profileName, rankings, metrics, maxRanking, dateTimeBegin, dateTimeEnd, customDomains) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetLogAnalyticsRankings", nil, "Failure preparing request") + return + } + + resp, err := client.GetLogAnalyticsRankingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetLogAnalyticsRankings", resp, "Failure sending request") + return + } + + result, err = client.GetLogAnalyticsRankingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetLogAnalyticsRankings", resp, "Failure responding to request") + return + } + + return +} + +// GetLogAnalyticsRankingsPreparer prepares the GetLogAnalyticsRankings request. +func (client LogAnalyticsClient) GetLogAnalyticsRankingsPreparer(ctx context.Context, resourceGroupName string, profileName string, rankings []LogRanking, metrics []LogRankingMetric, maxRanking int32, dateTimeBegin date.Time, dateTimeEnd date.Time, customDomains []string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "dateTimeBegin": autorest.Encode("query", dateTimeBegin), + "dateTimeEnd": autorest.Encode("query", dateTimeEnd), + "maxRanking": autorest.Encode("query", maxRanking), + "metrics": metrics, + "rankings": rankings, + } + if customDomains != nil && len(customDomains) > 0 { + queryParameters["customDomains"] = customDomains + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getLogAnalyticsRankings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetLogAnalyticsRankingsSender sends the GetLogAnalyticsRankings request. The method will close the +// http.Response Body if it receives an error. +func (client LogAnalyticsClient) GetLogAnalyticsRankingsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetLogAnalyticsRankingsResponder handles the response to the GetLogAnalyticsRankings request. The method always +// closes the http.Response Body. +func (client LogAnalyticsClient) GetLogAnalyticsRankingsResponder(resp *http.Response) (result RankingsResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetLogAnalyticsResources get all endpoints and custom domains available for AFD log report +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. which is unique within the resource group. +func (client LogAnalyticsClient) GetLogAnalyticsResources(ctx context.Context, resourceGroupName string, profileName string) (result ResourcesResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LogAnalyticsClient.GetLogAnalyticsResources") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.LogAnalyticsClient", "GetLogAnalyticsResources", err.Error()) + } + + req, err := client.GetLogAnalyticsResourcesPreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetLogAnalyticsResources", nil, "Failure preparing request") + return + } + + resp, err := client.GetLogAnalyticsResourcesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetLogAnalyticsResources", resp, "Failure sending request") + return + } + + result, err = client.GetLogAnalyticsResourcesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetLogAnalyticsResources", resp, "Failure responding to request") + return + } + + return +} + +// GetLogAnalyticsResourcesPreparer prepares the GetLogAnalyticsResources request. +func (client LogAnalyticsClient) GetLogAnalyticsResourcesPreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getLogAnalyticsResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetLogAnalyticsResourcesSender sends the GetLogAnalyticsResources request. The method will close the +// http.Response Body if it receives an error. +func (client LogAnalyticsClient) GetLogAnalyticsResourcesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetLogAnalyticsResourcesResponder handles the response to the GetLogAnalyticsResources request. The method always +// closes the http.Response Body. +func (client LogAnalyticsClient) GetLogAnalyticsResourcesResponder(resp *http.Response) (result ResourcesResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetWafLogAnalyticsMetrics get Waf related log analytics report for AFD profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. which is unique within the resource group. +// granularity - +func (client LogAnalyticsClient) GetWafLogAnalyticsMetrics(ctx context.Context, resourceGroupName string, profileName string, metrics []WafMetric, dateTimeBegin date.Time, dateTimeEnd date.Time, granularity WafGranularity, actions []WafAction, groupBy []WafRankingGroupBy, ruleTypes []WafRuleType) (result WafMetricsResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LogAnalyticsClient.GetWafLogAnalyticsMetrics") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: metrics, + Constraints: []validation.Constraint{{Target: "metrics", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.LogAnalyticsClient", "GetWafLogAnalyticsMetrics", err.Error()) + } + + req, err := client.GetWafLogAnalyticsMetricsPreparer(ctx, resourceGroupName, profileName, metrics, dateTimeBegin, dateTimeEnd, granularity, actions, groupBy, ruleTypes) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetWafLogAnalyticsMetrics", nil, "Failure preparing request") + return + } + + resp, err := client.GetWafLogAnalyticsMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetWafLogAnalyticsMetrics", resp, "Failure sending request") + return + } + + result, err = client.GetWafLogAnalyticsMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetWafLogAnalyticsMetrics", resp, "Failure responding to request") + return + } + + return +} + +// GetWafLogAnalyticsMetricsPreparer prepares the GetWafLogAnalyticsMetrics request. +func (client LogAnalyticsClient) GetWafLogAnalyticsMetricsPreparer(ctx context.Context, resourceGroupName string, profileName string, metrics []WafMetric, dateTimeBegin date.Time, dateTimeEnd date.Time, granularity WafGranularity, actions []WafAction, groupBy []WafRankingGroupBy, ruleTypes []WafRuleType) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "dateTimeBegin": autorest.Encode("query", dateTimeBegin), + "dateTimeEnd": autorest.Encode("query", dateTimeEnd), + "granularity": autorest.Encode("query", granularity), + "metrics": metrics, + } + if actions != nil && len(actions) > 0 { + queryParameters["actions"] = actions + } + if groupBy != nil && len(groupBy) > 0 { + queryParameters["groupBy"] = groupBy + } + if ruleTypes != nil && len(ruleTypes) > 0 { + queryParameters["ruleTypes"] = ruleTypes + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getWafLogAnalyticsMetrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetWafLogAnalyticsMetricsSender sends the GetWafLogAnalyticsMetrics request. The method will close the +// http.Response Body if it receives an error. +func (client LogAnalyticsClient) GetWafLogAnalyticsMetricsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetWafLogAnalyticsMetricsResponder handles the response to the GetWafLogAnalyticsMetrics request. The method always +// closes the http.Response Body. +func (client LogAnalyticsClient) GetWafLogAnalyticsMetricsResponder(resp *http.Response) (result WafMetricsResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetWafLogAnalyticsRankings get WAF log analytics charts for AFD profile +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. which is unique within the resource group. +func (client LogAnalyticsClient) GetWafLogAnalyticsRankings(ctx context.Context, resourceGroupName string, profileName string, metrics []WafMetric, dateTimeBegin date.Time, dateTimeEnd date.Time, maxRanking int32, rankings []WafRankingType, actions []WafAction, ruleTypes []WafRuleType) (result WafRankingsResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LogAnalyticsClient.GetWafLogAnalyticsRankings") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: metrics, + Constraints: []validation.Constraint{{Target: "metrics", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: rankings, + Constraints: []validation.Constraint{{Target: "rankings", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.LogAnalyticsClient", "GetWafLogAnalyticsRankings", err.Error()) + } + + req, err := client.GetWafLogAnalyticsRankingsPreparer(ctx, resourceGroupName, profileName, metrics, dateTimeBegin, dateTimeEnd, maxRanking, rankings, actions, ruleTypes) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetWafLogAnalyticsRankings", nil, "Failure preparing request") + return + } + + resp, err := client.GetWafLogAnalyticsRankingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetWafLogAnalyticsRankings", resp, "Failure sending request") + return + } + + result, err = client.GetWafLogAnalyticsRankingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetWafLogAnalyticsRankings", resp, "Failure responding to request") + return + } + + return +} + +// GetWafLogAnalyticsRankingsPreparer prepares the GetWafLogAnalyticsRankings request. +func (client LogAnalyticsClient) GetWafLogAnalyticsRankingsPreparer(ctx context.Context, resourceGroupName string, profileName string, metrics []WafMetric, dateTimeBegin date.Time, dateTimeEnd date.Time, maxRanking int32, rankings []WafRankingType, actions []WafAction, ruleTypes []WafRuleType) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "dateTimeBegin": autorest.Encode("query", dateTimeBegin), + "dateTimeEnd": autorest.Encode("query", dateTimeEnd), + "maxRanking": autorest.Encode("query", maxRanking), + "metrics": metrics, + "rankings": rankings, + } + if actions != nil && len(actions) > 0 { + queryParameters["actions"] = actions + } + if ruleTypes != nil && len(ruleTypes) > 0 { + queryParameters["ruleTypes"] = ruleTypes + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getWafLogAnalyticsRankings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetWafLogAnalyticsRankingsSender sends the GetWafLogAnalyticsRankings request. The method will close the +// http.Response Body if it receives an error. +func (client LogAnalyticsClient) GetWafLogAnalyticsRankingsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetWafLogAnalyticsRankingsResponder handles the response to the GetWafLogAnalyticsRankings request. The method always +// closes the http.Response Body. +func (client LogAnalyticsClient) GetWafLogAnalyticsRankingsResponder(resp *http.Response) (result WafRankingsResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/cdn/mgmt/2021-06-01/cdn/managedrulesets.go b/services/cdn/mgmt/2021-06-01/cdn/managedrulesets.go new file mode 100644 index 000000000000..ef905ffaa799 --- /dev/null +++ b/services/cdn/mgmt/2021-06-01/cdn/managedrulesets.go @@ -0,0 +1,144 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ManagedRuleSetsClient is the cdn Management Client +type ManagedRuleSetsClient struct { + BaseClient +} + +// NewManagedRuleSetsClient creates an instance of the ManagedRuleSetsClient client. +func NewManagedRuleSetsClient(subscriptionID string) ManagedRuleSetsClient { + return NewManagedRuleSetsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewManagedRuleSetsClientWithBaseURI creates an instance of the ManagedRuleSetsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewManagedRuleSetsClientWithBaseURI(baseURI string, subscriptionID string) ManagedRuleSetsClient { + return ManagedRuleSetsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all available managed rule sets. +func (client ManagedRuleSetsClient) List(ctx context.Context) (result ManagedRuleSetDefinitionListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedRuleSetsClient.List") + defer func() { + sc := -1 + if result.mrsdl.Response.Response != nil { + sc = result.mrsdl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ManagedRuleSetsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.mrsdl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.ManagedRuleSetsClient", "List", resp, "Failure sending request") + return + } + + result.mrsdl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ManagedRuleSetsClient", "List", resp, "Failure responding to request") + return + } + if result.mrsdl.hasNextLink() && result.mrsdl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ManagedRuleSetsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/cdnWebApplicationFirewallManagedRuleSets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedRuleSetsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ManagedRuleSetsClient) ListResponder(resp *http.Response) (result ManagedRuleSetDefinitionList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ManagedRuleSetsClient) listNextResults(ctx context.Context, lastResults ManagedRuleSetDefinitionList) (result ManagedRuleSetDefinitionList, err error) { + req, err := lastResults.managedRuleSetDefinitionListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.ManagedRuleSetsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.ManagedRuleSetsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ManagedRuleSetsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ManagedRuleSetsClient) ListComplete(ctx context.Context) (result ManagedRuleSetDefinitionListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedRuleSetsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/cdn/mgmt/2021-06-01/cdn/models.go b/services/cdn/mgmt/2021-06-01/cdn/models.go new file mode 100644 index 000000000000..78382b6cd1e0 --- /dev/null +++ b/services/cdn/mgmt/2021-06-01/cdn/models.go @@ -0,0 +1,14642 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" + +// ActivatedResourceReference reference to another resource along with its state. +type ActivatedResourceReference struct { + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // IsActive - READ-ONLY; Whether the resource is active or inactive + IsActive *bool `json:"isActive,omitempty"` +} + +// MarshalJSON is the custom marshaler for ActivatedResourceReference. +func (arr ActivatedResourceReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if arr.ID != nil { + objectMap["id"] = arr.ID + } + return json.Marshal(objectMap) +} + +// AFDCustomDomainsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AFDCustomDomainsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AFDCustomDomainsClient) (AFDDomain, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AFDCustomDomainsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AFDCustomDomainsCreateFuture.Result. +func (future *AFDCustomDomainsCreateFuture) result(client AFDCustomDomainsClient) (ad AFDDomain, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ad.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.AFDCustomDomainsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ad.Response.Response, err = future.GetResult(sender); err == nil && ad.Response.Response.StatusCode != http.StatusNoContent { + ad, err = client.CreateResponder(ad.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsCreateFuture", "Result", ad.Response.Response, "Failure responding to request") + } + } + return +} + +// AFDCustomDomainsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AFDCustomDomainsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AFDCustomDomainsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AFDCustomDomainsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AFDCustomDomainsDeleteFuture.Result. +func (future *AFDCustomDomainsDeleteFuture) result(client AFDCustomDomainsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.AFDCustomDomainsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AFDCustomDomainsRefreshValidationTokenFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type AFDCustomDomainsRefreshValidationTokenFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AFDCustomDomainsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AFDCustomDomainsRefreshValidationTokenFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AFDCustomDomainsRefreshValidationTokenFuture.Result. +func (future *AFDCustomDomainsRefreshValidationTokenFuture) result(client AFDCustomDomainsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsRefreshValidationTokenFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.AFDCustomDomainsRefreshValidationTokenFuture") + return + } + ar.Response = future.Response() + return +} + +// AFDCustomDomainsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AFDCustomDomainsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AFDCustomDomainsClient) (AFDDomain, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AFDCustomDomainsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AFDCustomDomainsUpdateFuture.Result. +func (future *AFDCustomDomainsUpdateFuture) result(client AFDCustomDomainsClient) (ad AFDDomain, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ad.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.AFDCustomDomainsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ad.Response.Response, err = future.GetResult(sender); err == nil && ad.Response.Response.StatusCode != http.StatusNoContent { + ad, err = client.UpdateResponder(ad.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsUpdateFuture", "Result", ad.Response.Response, "Failure responding to request") + } + } + return +} + +// AFDDomain friendly domain name mapping to the endpoint hostname that the customer provides for branding +// purposes, e.g. www.contoso.com. +type AFDDomain struct { + autorest.Response `json:"-"` + *AFDDomainProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDDomain. +func (ad AFDDomain) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ad.AFDDomainProperties != nil { + objectMap["properties"] = ad.AFDDomainProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AFDDomain struct. +func (ad *AFDDomain) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var aFDDomainProperties AFDDomainProperties + err = json.Unmarshal(*v, &aFDDomainProperties) + if err != nil { + return err + } + ad.AFDDomainProperties = &aFDDomainProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ad.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ad.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ad.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + ad.SystemData = &systemData + } + } + } + + return nil +} + +// AFDDomainHTTPSParameters the JSON object that contains the properties to secure a domain. +type AFDDomainHTTPSParameters struct { + // CertificateType - Defines the source of the SSL certificate. Possible values include: 'AfdCertificateTypeCustomerCertificate', 'AfdCertificateTypeManagedCertificate', 'AfdCertificateTypeAzureFirstPartyManagedCertificate' + CertificateType AfdCertificateType `json:"certificateType,omitempty"` + // MinimumTLSVersion - TLS protocol version that will be used for Https. Possible values include: 'AfdMinimumTLSVersionTLS10', 'AfdMinimumTLSVersionTLS12' + MinimumTLSVersion AfdMinimumTLSVersion `json:"minimumTlsVersion,omitempty"` + // Secret - Resource reference to the secret. ie. subs/rg/profile/secret + Secret *ResourceReference `json:"secret,omitempty"` +} + +// AFDDomainListResult result of the request to list domains. It contains a list of domain objects and a +// URL link to get the next set of results. +type AFDDomainListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of AzureFrontDoor domains within a profile. + Value *[]AFDDomain `json:"value,omitempty"` + // NextLink - URL to get the next set of domain objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDDomainListResult. +func (adlr AFDDomainListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if adlr.NextLink != nil { + objectMap["nextLink"] = adlr.NextLink + } + return json.Marshal(objectMap) +} + +// AFDDomainListResultIterator provides access to a complete listing of AFDDomain values. +type AFDDomainListResultIterator struct { + i int + page AFDDomainListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AFDDomainListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDDomainListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AFDDomainListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AFDDomainListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AFDDomainListResultIterator) Response() AFDDomainListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AFDDomainListResultIterator) Value() AFDDomain { + if !iter.page.NotDone() { + return AFDDomain{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AFDDomainListResultIterator type. +func NewAFDDomainListResultIterator(page AFDDomainListResultPage) AFDDomainListResultIterator { + return AFDDomainListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (adlr AFDDomainListResult) IsEmpty() bool { + return adlr.Value == nil || len(*adlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (adlr AFDDomainListResult) hasNextLink() bool { + return adlr.NextLink != nil && len(*adlr.NextLink) != 0 +} + +// aFDDomainListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (adlr AFDDomainListResult) aFDDomainListResultPreparer(ctx context.Context) (*http.Request, error) { + if !adlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(adlr.NextLink))) +} + +// AFDDomainListResultPage contains a page of AFDDomain values. +type AFDDomainListResultPage struct { + fn func(context.Context, AFDDomainListResult) (AFDDomainListResult, error) + adlr AFDDomainListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AFDDomainListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDDomainListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.adlr) + if err != nil { + return err + } + page.adlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AFDDomainListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AFDDomainListResultPage) NotDone() bool { + return !page.adlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AFDDomainListResultPage) Response() AFDDomainListResult { + return page.adlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AFDDomainListResultPage) Values() []AFDDomain { + if page.adlr.IsEmpty() { + return nil + } + return *page.adlr.Value +} + +// Creates a new instance of the AFDDomainListResultPage type. +func NewAFDDomainListResultPage(cur AFDDomainListResult, getNextPage func(context.Context, AFDDomainListResult) (AFDDomainListResult, error)) AFDDomainListResultPage { + return AFDDomainListResultPage{ + fn: getNextPage, + adlr: cur, + } +} + +// AFDDomainProperties the JSON object that contains the properties of the domain to create. +type AFDDomainProperties struct { + // ProfileName - READ-ONLY; The name of the profile which holds the domain. + ProfileName *string `json:"profileName,omitempty"` + // TLSSettings - The configuration specifying how to enable HTTPS for the domain - using AzureFrontDoor managed certificate or user's own certificate. If not specified, enabling ssl uses AzureFrontDoor managed certificate by default. + TLSSettings *AFDDomainHTTPSParameters `json:"tlsSettings,omitempty"` + // AzureDNSZone - Resource reference to the Azure DNS zone + AzureDNSZone *ResourceReference `json:"azureDnsZone,omitempty"` + // PreValidatedCustomDomainResourceID - Resource reference to the Azure resource where custom domain ownership was prevalidated + PreValidatedCustomDomainResourceID *ResourceReference `json:"preValidatedCustomDomainResourceId,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning status. Possible values include: 'AfdProvisioningStateSucceeded', 'AfdProvisioningStateFailed', 'AfdProvisioningStateUpdating', 'AfdProvisioningStateDeleting', 'AfdProvisioningStateCreating' + ProvisioningState AfdProvisioningState `json:"provisioningState,omitempty"` + // DeploymentStatus - READ-ONLY; Possible values include: 'DeploymentStatusNotStarted', 'DeploymentStatusInProgress', 'DeploymentStatusSucceeded', 'DeploymentStatusFailed' + DeploymentStatus DeploymentStatus `json:"deploymentStatus,omitempty"` + // DomainValidationState - READ-ONLY; Provisioning substate shows the progress of custom HTTPS enabling/disabling process step by step. DCV stands for DomainControlValidation. Possible values include: 'DomainValidationStateUnknown', 'DomainValidationStateSubmitting', 'DomainValidationStatePending', 'DomainValidationStateRejected', 'DomainValidationStateTimedOut', 'DomainValidationStatePendingRevalidation', 'DomainValidationStateApproved', 'DomainValidationStateRefreshingValidationToken', 'DomainValidationStateInternalError' + DomainValidationState DomainValidationState `json:"domainValidationState,omitempty"` + // HostName - The host name of the domain. Must be a domain name. + HostName *string `json:"hostName,omitempty"` + // ValidationProperties - READ-ONLY; Values the customer needs to validate domain ownership + ValidationProperties *DomainValidationProperties `json:"validationProperties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDDomainProperties. +func (adp AFDDomainProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if adp.TLSSettings != nil { + objectMap["tlsSettings"] = adp.TLSSettings + } + if adp.AzureDNSZone != nil { + objectMap["azureDnsZone"] = adp.AzureDNSZone + } + if adp.PreValidatedCustomDomainResourceID != nil { + objectMap["preValidatedCustomDomainResourceId"] = adp.PreValidatedCustomDomainResourceID + } + if adp.HostName != nil { + objectMap["hostName"] = adp.HostName + } + return json.Marshal(objectMap) +} + +// AFDDomainUpdateParameters the domain JSON object required for domain creation or update. +type AFDDomainUpdateParameters struct { + *AFDDomainUpdatePropertiesParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDDomainUpdateParameters. +func (adup AFDDomainUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if adup.AFDDomainUpdatePropertiesParameters != nil { + objectMap["properties"] = adup.AFDDomainUpdatePropertiesParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AFDDomainUpdateParameters struct. +func (adup *AFDDomainUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var aFDDomainUpdatePropertiesParameters AFDDomainUpdatePropertiesParameters + err = json.Unmarshal(*v, &aFDDomainUpdatePropertiesParameters) + if err != nil { + return err + } + adup.AFDDomainUpdatePropertiesParameters = &aFDDomainUpdatePropertiesParameters + } + } + } + + return nil +} + +// AFDDomainUpdatePropertiesParameters the JSON object that contains the properties of the domain to +// create. +type AFDDomainUpdatePropertiesParameters struct { + // ProfileName - READ-ONLY; The name of the profile which holds the domain. + ProfileName *string `json:"profileName,omitempty"` + // TLSSettings - The configuration specifying how to enable HTTPS for the domain - using AzureFrontDoor managed certificate or user's own certificate. If not specified, enabling ssl uses AzureFrontDoor managed certificate by default. + TLSSettings *AFDDomainHTTPSParameters `json:"tlsSettings,omitempty"` + // AzureDNSZone - Resource reference to the Azure DNS zone + AzureDNSZone *ResourceReference `json:"azureDnsZone,omitempty"` + // PreValidatedCustomDomainResourceID - Resource reference to the Azure resource where custom domain ownership was prevalidated + PreValidatedCustomDomainResourceID *ResourceReference `json:"preValidatedCustomDomainResourceId,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDDomainUpdatePropertiesParameters. +func (adupp AFDDomainUpdatePropertiesParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if adupp.TLSSettings != nil { + objectMap["tlsSettings"] = adupp.TLSSettings + } + if adupp.AzureDNSZone != nil { + objectMap["azureDnsZone"] = adupp.AzureDNSZone + } + if adupp.PreValidatedCustomDomainResourceID != nil { + objectMap["preValidatedCustomDomainResourceId"] = adupp.PreValidatedCustomDomainResourceID + } + return json.Marshal(objectMap) +} + +// AFDEndpoint CDN endpoint is the entity within a CDN profile containing configuration information such as +// origin, protocol, content caching and delivery behavior. The AzureFrontDoor endpoint uses the URL format +// .azureedge.net. +type AFDEndpoint struct { + autorest.Response `json:"-"` + *AFDEndpointProperties `json:"properties,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDEndpoint. +func (ae AFDEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ae.AFDEndpointProperties != nil { + objectMap["properties"] = ae.AFDEndpointProperties + } + if ae.Location != nil { + objectMap["location"] = ae.Location + } + if ae.Tags != nil { + objectMap["tags"] = ae.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AFDEndpoint struct. +func (ae *AFDEndpoint) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var aFDEndpointProperties AFDEndpointProperties + err = json.Unmarshal(*v, &aFDEndpointProperties) + if err != nil { + return err + } + ae.AFDEndpointProperties = &aFDEndpointProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ae.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ae.Tags = tags + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ae.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ae.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ae.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + ae.SystemData = &systemData + } + } + } + + return nil +} + +// AFDEndpointListResult result of the request to list endpoints. It contains a list of endpoint objects +// and a URL link to get the next set of results. +type AFDEndpointListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of AzureFrontDoor endpoints within a profile + Value *[]AFDEndpoint `json:"value,omitempty"` + // NextLink - URL to get the next set of endpoint objects if there is any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDEndpointListResult. +func (aelr AFDEndpointListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aelr.NextLink != nil { + objectMap["nextLink"] = aelr.NextLink + } + return json.Marshal(objectMap) +} + +// AFDEndpointListResultIterator provides access to a complete listing of AFDEndpoint values. +type AFDEndpointListResultIterator struct { + i int + page AFDEndpointListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AFDEndpointListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDEndpointListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AFDEndpointListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AFDEndpointListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AFDEndpointListResultIterator) Response() AFDEndpointListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AFDEndpointListResultIterator) Value() AFDEndpoint { + if !iter.page.NotDone() { + return AFDEndpoint{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AFDEndpointListResultIterator type. +func NewAFDEndpointListResultIterator(page AFDEndpointListResultPage) AFDEndpointListResultIterator { + return AFDEndpointListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (aelr AFDEndpointListResult) IsEmpty() bool { + return aelr.Value == nil || len(*aelr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (aelr AFDEndpointListResult) hasNextLink() bool { + return aelr.NextLink != nil && len(*aelr.NextLink) != 0 +} + +// aFDEndpointListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (aelr AFDEndpointListResult) aFDEndpointListResultPreparer(ctx context.Context) (*http.Request, error) { + if !aelr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(aelr.NextLink))) +} + +// AFDEndpointListResultPage contains a page of AFDEndpoint values. +type AFDEndpointListResultPage struct { + fn func(context.Context, AFDEndpointListResult) (AFDEndpointListResult, error) + aelr AFDEndpointListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AFDEndpointListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDEndpointListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.aelr) + if err != nil { + return err + } + page.aelr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AFDEndpointListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AFDEndpointListResultPage) NotDone() bool { + return !page.aelr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AFDEndpointListResultPage) Response() AFDEndpointListResult { + return page.aelr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AFDEndpointListResultPage) Values() []AFDEndpoint { + if page.aelr.IsEmpty() { + return nil + } + return *page.aelr.Value +} + +// Creates a new instance of the AFDEndpointListResultPage type. +func NewAFDEndpointListResultPage(cur AFDEndpointListResult, getNextPage func(context.Context, AFDEndpointListResult) (AFDEndpointListResult, error)) AFDEndpointListResultPage { + return AFDEndpointListResultPage{ + fn: getNextPage, + aelr: cur, + } +} + +// AFDEndpointProperties the JSON object that contains the properties required to create an endpoint. +type AFDEndpointProperties struct { + // ProfileName - READ-ONLY; The name of the profile which holds the endpoint. + ProfileName *string `json:"profileName,omitempty"` + // EnabledState - Whether to enable use of this rule. Permitted values are 'Enabled' or 'Disabled'. Possible values include: 'EnabledStateEnabled', 'EnabledStateDisabled' + EnabledState EnabledState `json:"enabledState,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning status. Possible values include: 'AfdProvisioningStateSucceeded', 'AfdProvisioningStateFailed', 'AfdProvisioningStateUpdating', 'AfdProvisioningStateDeleting', 'AfdProvisioningStateCreating' + ProvisioningState AfdProvisioningState `json:"provisioningState,omitempty"` + // DeploymentStatus - READ-ONLY; Possible values include: 'DeploymentStatusNotStarted', 'DeploymentStatusInProgress', 'DeploymentStatusSucceeded', 'DeploymentStatusFailed' + DeploymentStatus DeploymentStatus `json:"deploymentStatus,omitempty"` + // HostName - READ-ONLY; The host name of the endpoint structured as {endpointName}.{DNSZone}, e.g. contoso.azureedge.net + HostName *string `json:"hostName,omitempty"` + // AutoGeneratedDomainNameLabelScope - Indicates the endpoint name reuse scope. The default value is TenantReuse. Possible values include: 'AutoGeneratedDomainNameLabelScopeTenantReuse', 'AutoGeneratedDomainNameLabelScopeSubscriptionReuse', 'AutoGeneratedDomainNameLabelScopeResourceGroupReuse', 'AutoGeneratedDomainNameLabelScopeNoReuse' + AutoGeneratedDomainNameLabelScope AutoGeneratedDomainNameLabelScope `json:"autoGeneratedDomainNameLabelScope,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDEndpointProperties. +func (aep AFDEndpointProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aep.EnabledState != "" { + objectMap["enabledState"] = aep.EnabledState + } + if aep.AutoGeneratedDomainNameLabelScope != "" { + objectMap["autoGeneratedDomainNameLabelScope"] = aep.AutoGeneratedDomainNameLabelScope + } + return json.Marshal(objectMap) +} + +// AFDEndpointPropertiesUpdateParameters the JSON object containing endpoint update parameters. +type AFDEndpointPropertiesUpdateParameters struct { + // ProfileName - READ-ONLY; The name of the profile which holds the endpoint. + ProfileName *string `json:"profileName,omitempty"` + // EnabledState - Whether to enable use of this rule. Permitted values are 'Enabled' or 'Disabled'. Possible values include: 'EnabledStateEnabled', 'EnabledStateDisabled' + EnabledState EnabledState `json:"enabledState,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDEndpointPropertiesUpdateParameters. +func (aepup AFDEndpointPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aepup.EnabledState != "" { + objectMap["enabledState"] = aepup.EnabledState + } + return json.Marshal(objectMap) +} + +// AFDEndpointsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AFDEndpointsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AFDEndpointsClient) (AFDEndpoint, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AFDEndpointsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AFDEndpointsCreateFuture.Result. +func (future *AFDEndpointsCreateFuture) result(client AFDEndpointsClient) (ae AFDEndpoint, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ae.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.AFDEndpointsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ae.Response.Response, err = future.GetResult(sender); err == nil && ae.Response.Response.StatusCode != http.StatusNoContent { + ae, err = client.CreateResponder(ae.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsCreateFuture", "Result", ae.Response.Response, "Failure responding to request") + } + } + return +} + +// AFDEndpointsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AFDEndpointsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AFDEndpointsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AFDEndpointsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AFDEndpointsDeleteFuture.Result. +func (future *AFDEndpointsDeleteFuture) result(client AFDEndpointsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.AFDEndpointsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AFDEndpointsPurgeContentFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AFDEndpointsPurgeContentFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AFDEndpointsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AFDEndpointsPurgeContentFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AFDEndpointsPurgeContentFuture.Result. +func (future *AFDEndpointsPurgeContentFuture) result(client AFDEndpointsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsPurgeContentFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.AFDEndpointsPurgeContentFuture") + return + } + ar.Response = future.Response() + return +} + +// AFDEndpointsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AFDEndpointsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AFDEndpointsClient) (AFDEndpoint, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AFDEndpointsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AFDEndpointsUpdateFuture.Result. +func (future *AFDEndpointsUpdateFuture) result(client AFDEndpointsClient) (ae AFDEndpoint, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ae.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.AFDEndpointsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ae.Response.Response, err = future.GetResult(sender); err == nil && ae.Response.Response.StatusCode != http.StatusNoContent { + ae, err = client.UpdateResponder(ae.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsUpdateFuture", "Result", ae.Response.Response, "Failure responding to request") + } + } + return +} + +// AFDEndpointUpdateParameters properties required to create or update an endpoint. +type AFDEndpointUpdateParameters struct { + // Tags - Endpoint tags. + Tags map[string]*string `json:"tags"` + *AFDEndpointPropertiesUpdateParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDEndpointUpdateParameters. +func (aeup AFDEndpointUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aeup.Tags != nil { + objectMap["tags"] = aeup.Tags + } + if aeup.AFDEndpointPropertiesUpdateParameters != nil { + objectMap["properties"] = aeup.AFDEndpointPropertiesUpdateParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AFDEndpointUpdateParameters struct. +func (aeup *AFDEndpointUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + aeup.Tags = tags + } + case "properties": + if v != nil { + var aFDEndpointPropertiesUpdateParameters AFDEndpointPropertiesUpdateParameters + err = json.Unmarshal(*v, &aFDEndpointPropertiesUpdateParameters) + if err != nil { + return err + } + aeup.AFDEndpointPropertiesUpdateParameters = &aFDEndpointPropertiesUpdateParameters + } + } + } + + return nil +} + +// AfdErrorResponse 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 AfdErrorResponse struct { + // Error - The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + +// AFDOrigin CDN origin is the source of the content being delivered via CDN. When the edge nodes +// represented by an endpoint do not have the requested content cached, they attempt to fetch it from one +// or more of the configured origins. +type AFDOrigin struct { + autorest.Response `json:"-"` + *AFDOriginProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDOrigin. +func (ao AFDOrigin) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ao.AFDOriginProperties != nil { + objectMap["properties"] = ao.AFDOriginProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AFDOrigin struct. +func (ao *AFDOrigin) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var aFDOriginProperties AFDOriginProperties + err = json.Unmarshal(*v, &aFDOriginProperties) + if err != nil { + return err + } + ao.AFDOriginProperties = &aFDOriginProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ao.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ao.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ao.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + ao.SystemData = &systemData + } + } + } + + return nil +} + +// AFDOriginGroup aFDOrigin group comprising of origins is used for load balancing to origins when the +// content cannot be served from CDN. +type AFDOriginGroup struct { + autorest.Response `json:"-"` + *AFDOriginGroupProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDOriginGroup. +func (aog AFDOriginGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aog.AFDOriginGroupProperties != nil { + objectMap["properties"] = aog.AFDOriginGroupProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AFDOriginGroup struct. +func (aog *AFDOriginGroup) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var aFDOriginGroupProperties AFDOriginGroupProperties + err = json.Unmarshal(*v, &aFDOriginGroupProperties) + if err != nil { + return err + } + aog.AFDOriginGroupProperties = &aFDOriginGroupProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + aog.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + aog.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + aog.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + aog.SystemData = &systemData + } + } + } + + return nil +} + +// AFDOriginGroupListResult result of the request to list origin groups. It contains a list of origin +// groups objects and a URL link to get the next set of results. +type AFDOriginGroupListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of CDN origin groups within an endpoint + Value *[]AFDOriginGroup `json:"value,omitempty"` + // NextLink - URL to get the next set of origin objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDOriginGroupListResult. +func (aoglr AFDOriginGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aoglr.NextLink != nil { + objectMap["nextLink"] = aoglr.NextLink + } + return json.Marshal(objectMap) +} + +// AFDOriginGroupListResultIterator provides access to a complete listing of AFDOriginGroup values. +type AFDOriginGroupListResultIterator struct { + i int + page AFDOriginGroupListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AFDOriginGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginGroupListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AFDOriginGroupListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AFDOriginGroupListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AFDOriginGroupListResultIterator) Response() AFDOriginGroupListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AFDOriginGroupListResultIterator) Value() AFDOriginGroup { + if !iter.page.NotDone() { + return AFDOriginGroup{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AFDOriginGroupListResultIterator type. +func NewAFDOriginGroupListResultIterator(page AFDOriginGroupListResultPage) AFDOriginGroupListResultIterator { + return AFDOriginGroupListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (aoglr AFDOriginGroupListResult) IsEmpty() bool { + return aoglr.Value == nil || len(*aoglr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (aoglr AFDOriginGroupListResult) hasNextLink() bool { + return aoglr.NextLink != nil && len(*aoglr.NextLink) != 0 +} + +// aFDOriginGroupListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (aoglr AFDOriginGroupListResult) aFDOriginGroupListResultPreparer(ctx context.Context) (*http.Request, error) { + if !aoglr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(aoglr.NextLink))) +} + +// AFDOriginGroupListResultPage contains a page of AFDOriginGroup values. +type AFDOriginGroupListResultPage struct { + fn func(context.Context, AFDOriginGroupListResult) (AFDOriginGroupListResult, error) + aoglr AFDOriginGroupListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AFDOriginGroupListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginGroupListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.aoglr) + if err != nil { + return err + } + page.aoglr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AFDOriginGroupListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AFDOriginGroupListResultPage) NotDone() bool { + return !page.aoglr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AFDOriginGroupListResultPage) Response() AFDOriginGroupListResult { + return page.aoglr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AFDOriginGroupListResultPage) Values() []AFDOriginGroup { + if page.aoglr.IsEmpty() { + return nil + } + return *page.aoglr.Value +} + +// Creates a new instance of the AFDOriginGroupListResultPage type. +func NewAFDOriginGroupListResultPage(cur AFDOriginGroupListResult, getNextPage func(context.Context, AFDOriginGroupListResult) (AFDOriginGroupListResult, error)) AFDOriginGroupListResultPage { + return AFDOriginGroupListResultPage{ + fn: getNextPage, + aoglr: cur, + } +} + +// AFDOriginGroupProperties the JSON object that contains the properties of the origin group. +type AFDOriginGroupProperties struct { + // ProfileName - READ-ONLY; The name of the profile which holds the origin group. + ProfileName *string `json:"profileName,omitempty"` + // LoadBalancingSettings - Load balancing settings for a backend pool + LoadBalancingSettings *LoadBalancingSettingsParameters `json:"loadBalancingSettings,omitempty"` + // HealthProbeSettings - Health probe settings to the origin that is used to determine the health of the origin. + HealthProbeSettings *HealthProbeParameters `json:"healthProbeSettings,omitempty"` + // TrafficRestorationTimeToHealedOrNewEndpointsInMinutes - Time in minutes to shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new endpoint is added. Default is 10 mins. This property is currently not supported. + TrafficRestorationTimeToHealedOrNewEndpointsInMinutes *int32 `json:"trafficRestorationTimeToHealedOrNewEndpointsInMinutes,omitempty"` + // SessionAffinityState - Whether to allow session affinity on this host. Valid options are 'Enabled' or 'Disabled'. Possible values include: 'EnabledStateEnabled', 'EnabledStateDisabled' + SessionAffinityState EnabledState `json:"sessionAffinityState,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning status. Possible values include: 'AfdProvisioningStateSucceeded', 'AfdProvisioningStateFailed', 'AfdProvisioningStateUpdating', 'AfdProvisioningStateDeleting', 'AfdProvisioningStateCreating' + ProvisioningState AfdProvisioningState `json:"provisioningState,omitempty"` + // DeploymentStatus - READ-ONLY; Possible values include: 'DeploymentStatusNotStarted', 'DeploymentStatusInProgress', 'DeploymentStatusSucceeded', 'DeploymentStatusFailed' + DeploymentStatus DeploymentStatus `json:"deploymentStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDOriginGroupProperties. +func (aogp AFDOriginGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aogp.LoadBalancingSettings != nil { + objectMap["loadBalancingSettings"] = aogp.LoadBalancingSettings + } + if aogp.HealthProbeSettings != nil { + objectMap["healthProbeSettings"] = aogp.HealthProbeSettings + } + if aogp.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes != nil { + objectMap["trafficRestorationTimeToHealedOrNewEndpointsInMinutes"] = aogp.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes + } + if aogp.SessionAffinityState != "" { + objectMap["sessionAffinityState"] = aogp.SessionAffinityState + } + return json.Marshal(objectMap) +} + +// AFDOriginGroupsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AFDOriginGroupsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AFDOriginGroupsClient) (AFDOriginGroup, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AFDOriginGroupsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AFDOriginGroupsCreateFuture.Result. +func (future *AFDOriginGroupsCreateFuture) result(client AFDOriginGroupsClient) (aog AFDOriginGroup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + aog.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.AFDOriginGroupsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if aog.Response.Response, err = future.GetResult(sender); err == nil && aog.Response.Response.StatusCode != http.StatusNoContent { + aog, err = client.CreateResponder(aog.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsCreateFuture", "Result", aog.Response.Response, "Failure responding to request") + } + } + return +} + +// AFDOriginGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AFDOriginGroupsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AFDOriginGroupsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AFDOriginGroupsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AFDOriginGroupsDeleteFuture.Result. +func (future *AFDOriginGroupsDeleteFuture) result(client AFDOriginGroupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.AFDOriginGroupsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AFDOriginGroupsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AFDOriginGroupsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AFDOriginGroupsClient) (AFDOriginGroup, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AFDOriginGroupsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AFDOriginGroupsUpdateFuture.Result. +func (future *AFDOriginGroupsUpdateFuture) result(client AFDOriginGroupsClient) (aog AFDOriginGroup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + aog.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.AFDOriginGroupsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if aog.Response.Response, err = future.GetResult(sender); err == nil && aog.Response.Response.StatusCode != http.StatusNoContent { + aog, err = client.UpdateResponder(aog.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsUpdateFuture", "Result", aog.Response.Response, "Failure responding to request") + } + } + return +} + +// AFDOriginGroupUpdateParameters aFDOrigin group properties needed for origin group creation or update. +type AFDOriginGroupUpdateParameters struct { + *AFDOriginGroupUpdatePropertiesParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDOriginGroupUpdateParameters. +func (aogup AFDOriginGroupUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aogup.AFDOriginGroupUpdatePropertiesParameters != nil { + objectMap["properties"] = aogup.AFDOriginGroupUpdatePropertiesParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AFDOriginGroupUpdateParameters struct. +func (aogup *AFDOriginGroupUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var aFDOriginGroupUpdatePropertiesParameters AFDOriginGroupUpdatePropertiesParameters + err = json.Unmarshal(*v, &aFDOriginGroupUpdatePropertiesParameters) + if err != nil { + return err + } + aogup.AFDOriginGroupUpdatePropertiesParameters = &aFDOriginGroupUpdatePropertiesParameters + } + } + } + + return nil +} + +// AFDOriginGroupUpdatePropertiesParameters the JSON object that contains the properties of the origin +// group. +type AFDOriginGroupUpdatePropertiesParameters struct { + // ProfileName - READ-ONLY; The name of the profile which holds the origin group. + ProfileName *string `json:"profileName,omitempty"` + // LoadBalancingSettings - Load balancing settings for a backend pool + LoadBalancingSettings *LoadBalancingSettingsParameters `json:"loadBalancingSettings,omitempty"` + // HealthProbeSettings - Health probe settings to the origin that is used to determine the health of the origin. + HealthProbeSettings *HealthProbeParameters `json:"healthProbeSettings,omitempty"` + // TrafficRestorationTimeToHealedOrNewEndpointsInMinutes - Time in minutes to shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new endpoint is added. Default is 10 mins. This property is currently not supported. + TrafficRestorationTimeToHealedOrNewEndpointsInMinutes *int32 `json:"trafficRestorationTimeToHealedOrNewEndpointsInMinutes,omitempty"` + // SessionAffinityState - Whether to allow session affinity on this host. Valid options are 'Enabled' or 'Disabled'. Possible values include: 'EnabledStateEnabled', 'EnabledStateDisabled' + SessionAffinityState EnabledState `json:"sessionAffinityState,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDOriginGroupUpdatePropertiesParameters. +func (aogupp AFDOriginGroupUpdatePropertiesParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aogupp.LoadBalancingSettings != nil { + objectMap["loadBalancingSettings"] = aogupp.LoadBalancingSettings + } + if aogupp.HealthProbeSettings != nil { + objectMap["healthProbeSettings"] = aogupp.HealthProbeSettings + } + if aogupp.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes != nil { + objectMap["trafficRestorationTimeToHealedOrNewEndpointsInMinutes"] = aogupp.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes + } + if aogupp.SessionAffinityState != "" { + objectMap["sessionAffinityState"] = aogupp.SessionAffinityState + } + return json.Marshal(objectMap) +} + +// AFDOriginListResult result of the request to list origins. It contains a list of origin objects and a +// URL link to get the next set of results. +type AFDOriginListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of CDN origins within an endpoint + Value *[]AFDOrigin `json:"value,omitempty"` + // NextLink - URL to get the next set of origin objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDOriginListResult. +func (aolr AFDOriginListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aolr.NextLink != nil { + objectMap["nextLink"] = aolr.NextLink + } + return json.Marshal(objectMap) +} + +// AFDOriginListResultIterator provides access to a complete listing of AFDOrigin values. +type AFDOriginListResultIterator struct { + i int + page AFDOriginListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AFDOriginListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AFDOriginListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AFDOriginListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AFDOriginListResultIterator) Response() AFDOriginListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AFDOriginListResultIterator) Value() AFDOrigin { + if !iter.page.NotDone() { + return AFDOrigin{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AFDOriginListResultIterator type. +func NewAFDOriginListResultIterator(page AFDOriginListResultPage) AFDOriginListResultIterator { + return AFDOriginListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (aolr AFDOriginListResult) IsEmpty() bool { + return aolr.Value == nil || len(*aolr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (aolr AFDOriginListResult) hasNextLink() bool { + return aolr.NextLink != nil && len(*aolr.NextLink) != 0 +} + +// aFDOriginListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (aolr AFDOriginListResult) aFDOriginListResultPreparer(ctx context.Context) (*http.Request, error) { + if !aolr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(aolr.NextLink))) +} + +// AFDOriginListResultPage contains a page of AFDOrigin values. +type AFDOriginListResultPage struct { + fn func(context.Context, AFDOriginListResult) (AFDOriginListResult, error) + aolr AFDOriginListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AFDOriginListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.aolr) + if err != nil { + return err + } + page.aolr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AFDOriginListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AFDOriginListResultPage) NotDone() bool { + return !page.aolr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AFDOriginListResultPage) Response() AFDOriginListResult { + return page.aolr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AFDOriginListResultPage) Values() []AFDOrigin { + if page.aolr.IsEmpty() { + return nil + } + return *page.aolr.Value +} + +// Creates a new instance of the AFDOriginListResultPage type. +func NewAFDOriginListResultPage(cur AFDOriginListResult, getNextPage func(context.Context, AFDOriginListResult) (AFDOriginListResult, error)) AFDOriginListResultPage { + return AFDOriginListResultPage{ + fn: getNextPage, + aolr: cur, + } +} + +// AFDOriginProperties the JSON object that contains the properties of the origin. +type AFDOriginProperties struct { + // OriginGroupName - READ-ONLY; The name of the origin group which contains this origin. + OriginGroupName *string `json:"originGroupName,omitempty"` + // AzureOrigin - Resource reference to the Azure origin resource. + AzureOrigin *ResourceReference `json:"azureOrigin,omitempty"` + // HostName - The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.This should be unique across all origins in an endpoint. + HostName *string `json:"hostName,omitempty"` + // HTTPPort - The value of the HTTP port. Must be between 1 and 65535. + HTTPPort *int32 `json:"httpPort,omitempty"` + // HTTPSPort - The value of the HTTPS port. Must be between 1 and 65535. + HTTPSPort *int32 `json:"httpsPort,omitempty"` + // OriginHostHeader - The host header value sent to the origin with each request. If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. This overrides the host header defined at Endpoint + OriginHostHeader *string `json:"originHostHeader,omitempty"` + // Priority - Priority of origin in given origin group for load balancing. Higher priorities will not be used for load balancing if any lower priority origin is healthy.Must be between 1 and 5 + Priority *int32 `json:"priority,omitempty"` + // Weight - Weight of the origin in given origin group for load balancing. Must be between 1 and 1000 + Weight *int32 `json:"weight,omitempty"` + // SharedPrivateLinkResource - The properties of the private link resource for private origin. + SharedPrivateLinkResource *SharedPrivateLinkResourceProperties `json:"sharedPrivateLinkResource,omitempty"` + // EnabledState - Whether to enable health probes to be made against backends defined under backendPools. Health probes can only be disabled if there is a single enabled backend in single enabled backend pool. Possible values include: 'EnabledStateEnabled', 'EnabledStateDisabled' + EnabledState EnabledState `json:"enabledState,omitempty"` + // EnforceCertificateNameCheck - Whether to enable certificate name check at origin level + EnforceCertificateNameCheck *bool `json:"enforceCertificateNameCheck,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning status. Possible values include: 'AfdProvisioningStateSucceeded', 'AfdProvisioningStateFailed', 'AfdProvisioningStateUpdating', 'AfdProvisioningStateDeleting', 'AfdProvisioningStateCreating' + ProvisioningState AfdProvisioningState `json:"provisioningState,omitempty"` + // DeploymentStatus - READ-ONLY; Possible values include: 'DeploymentStatusNotStarted', 'DeploymentStatusInProgress', 'DeploymentStatusSucceeded', 'DeploymentStatusFailed' + DeploymentStatus DeploymentStatus `json:"deploymentStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDOriginProperties. +func (aop AFDOriginProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aop.AzureOrigin != nil { + objectMap["azureOrigin"] = aop.AzureOrigin + } + if aop.HostName != nil { + objectMap["hostName"] = aop.HostName + } + if aop.HTTPPort != nil { + objectMap["httpPort"] = aop.HTTPPort + } + if aop.HTTPSPort != nil { + objectMap["httpsPort"] = aop.HTTPSPort + } + if aop.OriginHostHeader != nil { + objectMap["originHostHeader"] = aop.OriginHostHeader + } + if aop.Priority != nil { + objectMap["priority"] = aop.Priority + } + if aop.Weight != nil { + objectMap["weight"] = aop.Weight + } + if aop.SharedPrivateLinkResource != nil { + objectMap["sharedPrivateLinkResource"] = aop.SharedPrivateLinkResource + } + if aop.EnabledState != "" { + objectMap["enabledState"] = aop.EnabledState + } + if aop.EnforceCertificateNameCheck != nil { + objectMap["enforceCertificateNameCheck"] = aop.EnforceCertificateNameCheck + } + return json.Marshal(objectMap) +} + +// AFDOriginsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AFDOriginsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AFDOriginsClient) (AFDOrigin, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AFDOriginsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AFDOriginsCreateFuture.Result. +func (future *AFDOriginsCreateFuture) result(client AFDOriginsClient) (ao AFDOrigin, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ao.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.AFDOriginsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ao.Response.Response, err = future.GetResult(sender); err == nil && ao.Response.Response.StatusCode != http.StatusNoContent { + ao, err = client.CreateResponder(ao.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsCreateFuture", "Result", ao.Response.Response, "Failure responding to request") + } + } + return +} + +// AFDOriginsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AFDOriginsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AFDOriginsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AFDOriginsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AFDOriginsDeleteFuture.Result. +func (future *AFDOriginsDeleteFuture) result(client AFDOriginsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.AFDOriginsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AFDOriginsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AFDOriginsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AFDOriginsClient) (AFDOrigin, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AFDOriginsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AFDOriginsUpdateFuture.Result. +func (future *AFDOriginsUpdateFuture) result(client AFDOriginsClient) (ao AFDOrigin, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ao.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.AFDOriginsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ao.Response.Response, err = future.GetResult(sender); err == nil && ao.Response.Response.StatusCode != http.StatusNoContent { + ao, err = client.UpdateResponder(ao.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsUpdateFuture", "Result", ao.Response.Response, "Failure responding to request") + } + } + return +} + +// AFDOriginUpdateParameters aFDOrigin properties needed for origin update. +type AFDOriginUpdateParameters struct { + *AFDOriginUpdatePropertiesParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDOriginUpdateParameters. +func (aoup AFDOriginUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aoup.AFDOriginUpdatePropertiesParameters != nil { + objectMap["properties"] = aoup.AFDOriginUpdatePropertiesParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AFDOriginUpdateParameters struct. +func (aoup *AFDOriginUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var aFDOriginUpdatePropertiesParameters AFDOriginUpdatePropertiesParameters + err = json.Unmarshal(*v, &aFDOriginUpdatePropertiesParameters) + if err != nil { + return err + } + aoup.AFDOriginUpdatePropertiesParameters = &aFDOriginUpdatePropertiesParameters + } + } + } + + return nil +} + +// AFDOriginUpdatePropertiesParameters the JSON object that contains the properties of the origin. +type AFDOriginUpdatePropertiesParameters struct { + // OriginGroupName - READ-ONLY; The name of the origin group which contains this origin. + OriginGroupName *string `json:"originGroupName,omitempty"` + // AzureOrigin - Resource reference to the Azure origin resource. + AzureOrigin *ResourceReference `json:"azureOrigin,omitempty"` + // HostName - The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.This should be unique across all origins in an endpoint. + HostName *string `json:"hostName,omitempty"` + // HTTPPort - The value of the HTTP port. Must be between 1 and 65535. + HTTPPort *int32 `json:"httpPort,omitempty"` + // HTTPSPort - The value of the HTTPS port. Must be between 1 and 65535. + HTTPSPort *int32 `json:"httpsPort,omitempty"` + // OriginHostHeader - The host header value sent to the origin with each request. If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. This overrides the host header defined at Endpoint + OriginHostHeader *string `json:"originHostHeader,omitempty"` + // Priority - Priority of origin in given origin group for load balancing. Higher priorities will not be used for load balancing if any lower priority origin is healthy.Must be between 1 and 5 + Priority *int32 `json:"priority,omitempty"` + // Weight - Weight of the origin in given origin group for load balancing. Must be between 1 and 1000 + Weight *int32 `json:"weight,omitempty"` + // SharedPrivateLinkResource - The properties of the private link resource for private origin. + SharedPrivateLinkResource *SharedPrivateLinkResourceProperties `json:"sharedPrivateLinkResource,omitempty"` + // EnabledState - Whether to enable health probes to be made against backends defined under backendPools. Health probes can only be disabled if there is a single enabled backend in single enabled backend pool. Possible values include: 'EnabledStateEnabled', 'EnabledStateDisabled' + EnabledState EnabledState `json:"enabledState,omitempty"` + // EnforceCertificateNameCheck - Whether to enable certificate name check at origin level + EnforceCertificateNameCheck *bool `json:"enforceCertificateNameCheck,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDOriginUpdatePropertiesParameters. +func (aoupp AFDOriginUpdatePropertiesParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aoupp.AzureOrigin != nil { + objectMap["azureOrigin"] = aoupp.AzureOrigin + } + if aoupp.HostName != nil { + objectMap["hostName"] = aoupp.HostName + } + if aoupp.HTTPPort != nil { + objectMap["httpPort"] = aoupp.HTTPPort + } + if aoupp.HTTPSPort != nil { + objectMap["httpsPort"] = aoupp.HTTPSPort + } + if aoupp.OriginHostHeader != nil { + objectMap["originHostHeader"] = aoupp.OriginHostHeader + } + if aoupp.Priority != nil { + objectMap["priority"] = aoupp.Priority + } + if aoupp.Weight != nil { + objectMap["weight"] = aoupp.Weight + } + if aoupp.SharedPrivateLinkResource != nil { + objectMap["sharedPrivateLinkResource"] = aoupp.SharedPrivateLinkResource + } + if aoupp.EnabledState != "" { + objectMap["enabledState"] = aoupp.EnabledState + } + if aoupp.EnforceCertificateNameCheck != nil { + objectMap["enforceCertificateNameCheck"] = aoupp.EnforceCertificateNameCheck + } + return json.Marshal(objectMap) +} + +// AfdPurgeParameters parameters required for content purge. +type AfdPurgeParameters struct { + // ContentPaths - The path to the content to be purged. Can describe a file path or a wild card directory. + ContentPaths *[]string `json:"contentPaths,omitempty"` + // Domains - List of domains. + Domains *[]string `json:"domains,omitempty"` +} + +// AfdRouteCacheConfiguration caching settings for a caching-type route. To disable caching, do not provide +// a cacheConfiguration object. +type AfdRouteCacheConfiguration struct { + // QueryStringCachingBehavior - Defines how Frontdoor caches requests that include query strings. You can ignore any query strings when caching, ignore specific query strings, cache every request with a unique URL, or cache specific query strings. Possible values include: 'AfdQueryStringCachingBehaviorIgnoreQueryString', 'AfdQueryStringCachingBehaviorUseQueryString', 'AfdQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings', 'AfdQueryStringCachingBehaviorIncludeSpecifiedQueryStrings' + QueryStringCachingBehavior AfdQueryStringCachingBehavior `json:"queryStringCachingBehavior,omitempty"` + // QueryParameters - query parameters to include or exclude (comma separated). + QueryParameters *string `json:"queryParameters,omitempty"` + // CompressionSettings - compression settings. + CompressionSettings *CompressionSettings `json:"compressionSettings,omitempty"` +} + +// AFDStateProperties the tracking states for afd resources. +type AFDStateProperties struct { + // ProvisioningState - READ-ONLY; Provisioning status. Possible values include: 'AfdProvisioningStateSucceeded', 'AfdProvisioningStateFailed', 'AfdProvisioningStateUpdating', 'AfdProvisioningStateDeleting', 'AfdProvisioningStateCreating' + ProvisioningState AfdProvisioningState `json:"provisioningState,omitempty"` + // DeploymentStatus - READ-ONLY; Possible values include: 'DeploymentStatusNotStarted', 'DeploymentStatusInProgress', 'DeploymentStatusSucceeded', 'DeploymentStatusFailed' + DeploymentStatus DeploymentStatus `json:"deploymentStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDStateProperties. +func (asp AFDStateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AzureFirstPartyManagedCertificate azure FirstParty Managed Certificate provided by other first party +// resource providers to enable HTTPS. +type AzureFirstPartyManagedCertificate struct { + // Type - Possible values include: 'SecretTypeURLSigningKey', 'SecretTypeCustomerCertificate', 'SecretTypeManagedCertificate', 'SecretTypeAzureFirstPartyManagedCertificate' + Type SecretType `json:"type,omitempty"` + // Subject - READ-ONLY; Subject name in the certificate. + Subject *string `json:"subject,omitempty"` + // ExpirationDate - READ-ONLY; Certificate expiration date. + ExpirationDate *string `json:"expirationDate,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureFirstPartyManagedCertificate. +func (afpmc AzureFirstPartyManagedCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if afpmc.Type != "" { + objectMap["type"] = afpmc.Type + } + return json.Marshal(objectMap) +} + +// AzureFirstPartyManagedCertificateParameters azure FirstParty Managed Certificate provided by other first +// party resource providers to enable HTTPS. +type AzureFirstPartyManagedCertificateParameters struct { + // Type - Possible values include: 'TypeBasicSecretParametersTypeSecretParameters', 'TypeBasicSecretParametersTypeURLSigningKey', 'TypeBasicSecretParametersTypeManagedCertificate', 'TypeBasicSecretParametersTypeCustomerCertificate', 'TypeBasicSecretParametersTypeAzureFirstPartyManagedCertificate' + Type TypeBasicSecretParameters `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureFirstPartyManagedCertificateParameters. +func (afpmcp AzureFirstPartyManagedCertificateParameters) MarshalJSON() ([]byte, error) { + afpmcp.Type = TypeBasicSecretParametersTypeAzureFirstPartyManagedCertificate + objectMap := make(map[string]interface{}) + if afpmcp.Type != "" { + objectMap["type"] = afpmcp.Type + } + return json.Marshal(objectMap) +} + +// AsURLSigningKeyParameters is the BasicSecretParameters implementation for AzureFirstPartyManagedCertificateParameters. +func (afpmcp AzureFirstPartyManagedCertificateParameters) AsURLSigningKeyParameters() (*URLSigningKeyParameters, bool) { + return nil, false +} + +// AsManagedCertificateParameters is the BasicSecretParameters implementation for AzureFirstPartyManagedCertificateParameters. +func (afpmcp AzureFirstPartyManagedCertificateParameters) AsManagedCertificateParameters() (*ManagedCertificateParameters, bool) { + return nil, false +} + +// AsCustomerCertificateParameters is the BasicSecretParameters implementation for AzureFirstPartyManagedCertificateParameters. +func (afpmcp AzureFirstPartyManagedCertificateParameters) AsCustomerCertificateParameters() (*CustomerCertificateParameters, bool) { + return nil, false +} + +// AsAzureFirstPartyManagedCertificateParameters is the BasicSecretParameters implementation for AzureFirstPartyManagedCertificateParameters. +func (afpmcp AzureFirstPartyManagedCertificateParameters) AsAzureFirstPartyManagedCertificateParameters() (*AzureFirstPartyManagedCertificateParameters, bool) { + return &afpmcp, true +} + +// AsSecretParameters is the BasicSecretParameters implementation for AzureFirstPartyManagedCertificateParameters. +func (afpmcp AzureFirstPartyManagedCertificateParameters) AsSecretParameters() (*SecretParameters, bool) { + return nil, false +} + +// AsBasicSecretParameters is the BasicSecretParameters implementation for AzureFirstPartyManagedCertificateParameters. +func (afpmcp AzureFirstPartyManagedCertificateParameters) AsBasicSecretParameters() (BasicSecretParameters, bool) { + return &afpmcp, true +} + +// CacheConfiguration caching settings for a caching-type route. To disable caching, do not provide a +// cacheConfiguration object. +type CacheConfiguration struct { + // QueryStringCachingBehavior - Defines how Frontdoor caches requests that include query strings. You can ignore any query strings when caching, ignore specific query strings, cache every request with a unique URL, or cache specific query strings. Possible values include: 'RuleQueryStringCachingBehaviorIgnoreQueryString', 'RuleQueryStringCachingBehaviorUseQueryString', 'RuleQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings', 'RuleQueryStringCachingBehaviorIncludeSpecifiedQueryStrings' + QueryStringCachingBehavior RuleQueryStringCachingBehavior `json:"queryStringCachingBehavior,omitempty"` + // QueryParameters - query parameters to include or exclude (comma separated). + QueryParameters *string `json:"queryParameters,omitempty"` + // IsCompressionEnabled - Indicates whether content compression is enabled. If compression is enabled, content will be served as compressed if user requests for a compressed version. Content won't be compressed on AzureFrontDoor when requested content is smaller than 1 byte or larger than 1 MB. Possible values include: 'RuleIsCompressionEnabledEnabled', 'RuleIsCompressionEnabledDisabled' + IsCompressionEnabled RuleIsCompressionEnabled `json:"isCompressionEnabled,omitempty"` + // CacheBehavior - Caching behavior for the requests. Possible values include: 'RuleCacheBehaviorHonorOrigin', 'RuleCacheBehaviorOverrideAlways', 'RuleCacheBehaviorOverrideIfOriginMissing' + CacheBehavior RuleCacheBehavior `json:"cacheBehavior,omitempty"` + // CacheDuration - The duration for which the content needs to be cached. Allowed format is [d.]hh:mm:ss + CacheDuration *string `json:"cacheDuration,omitempty"` +} + +// CacheExpirationActionParameters defines the parameters for the cache expiration action. +type CacheExpirationActionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // CacheBehavior - Caching behavior for the requests. Possible values include: 'CacheBehaviorBypassCache', 'CacheBehaviorOverride', 'CacheBehaviorSetIfMissing' + CacheBehavior CacheBehavior `json:"cacheBehavior,omitempty"` + // CacheType - The level at which the content needs to be cached. + CacheType *string `json:"cacheType,omitempty"` + // CacheDuration - The duration for which the content needs to be cached. Allowed format is [d.]hh:mm:ss + CacheDuration *string `json:"cacheDuration,omitempty"` +} + +// CacheKeyQueryStringActionParameters defines the parameters for the cache-key query string action. +type CacheKeyQueryStringActionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // QueryStringBehavior - Caching behavior for the requests. Possible values include: 'QueryStringBehaviorInclude', 'QueryStringBehaviorIncludeAll', 'QueryStringBehaviorExclude', 'QueryStringBehaviorExcludeAll' + QueryStringBehavior QueryStringBehavior `json:"queryStringBehavior,omitempty"` + // QueryParameters - query parameters to include or exclude (comma separated). + QueryParameters *string `json:"queryParameters,omitempty"` +} + +// Certificate certificate used for https +type Certificate struct { + // Type - Possible values include: 'SecretTypeURLSigningKey', 'SecretTypeCustomerCertificate', 'SecretTypeManagedCertificate', 'SecretTypeAzureFirstPartyManagedCertificate' + Type SecretType `json:"type,omitempty"` + // Subject - READ-ONLY; Subject name in the certificate. + Subject *string `json:"subject,omitempty"` + // ExpirationDate - READ-ONLY; Certificate expiration date. + ExpirationDate *string `json:"expirationDate,omitempty"` +} + +// MarshalJSON is the custom marshaler for Certificate. +func (c Certificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if c.Type != "" { + objectMap["type"] = c.Type + } + return json.Marshal(objectMap) +} + +// CertificateSourceParameters defines the parameters for using CDN managed certificate for securing custom +// domain. +type CertificateSourceParameters struct { + TypeName *string `json:"typeName,omitempty"` + // CertificateType - Type of certificate used. Possible values include: 'CertificateTypeShared', 'CertificateTypeDedicated' + CertificateType CertificateType `json:"certificateType,omitempty"` +} + +// CheckEndpointNameAvailabilityInput input of CheckNameAvailability API. +type CheckEndpointNameAvailabilityInput struct { + // Name - The resource name to validate. + Name *string `json:"name,omitempty"` + // Type - The type of the resource whose name is to be validated. Possible values include: 'ResourceTypeMicrosoftCdnProfilesEndpoints', 'ResourceTypeMicrosoftCdnProfilesAfdEndpoints' + Type ResourceType `json:"type,omitempty"` + // AutoGeneratedDomainNameLabelScope - Indicates the endpoint name reuse scope. The default value is TenantReuse. Possible values include: 'AutoGeneratedDomainNameLabelScopeTenantReuse', 'AutoGeneratedDomainNameLabelScopeSubscriptionReuse', 'AutoGeneratedDomainNameLabelScopeResourceGroupReuse', 'AutoGeneratedDomainNameLabelScopeNoReuse' + AutoGeneratedDomainNameLabelScope AutoGeneratedDomainNameLabelScope `json:"autoGeneratedDomainNameLabelScope,omitempty"` +} + +// CheckEndpointNameAvailabilityOutput output of check name availability API. +type CheckEndpointNameAvailabilityOutput struct { + autorest.Response `json:"-"` + // NameAvailable - READ-ONLY; Indicates whether the name is available. + NameAvailable *bool `json:"nameAvailable,omitempty"` + // AvailableHostname - READ-ONLY; Returns the available hostname generated based on the AutoGeneratedDomainNameLabelScope when the name is available, otherwise it returns empty string + AvailableHostname *string `json:"availableHostname,omitempty"` + // Reason - READ-ONLY; The reason why the name is not available. + Reason *string `json:"reason,omitempty"` + // Message - READ-ONLY; The detailed error message describing why the name is not available. + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for CheckEndpointNameAvailabilityOutput. +func (cenao CheckEndpointNameAvailabilityOutput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CheckHostNameAvailabilityInput input of CheckHostNameAvailability API. +type CheckHostNameAvailabilityInput struct { + // HostName - The host name to validate. + HostName *string `json:"hostName,omitempty"` +} + +// CheckNameAvailabilityInput input of CheckNameAvailability API. +type CheckNameAvailabilityInput struct { + // Name - The resource name to validate. + Name *string `json:"name,omitempty"` + // Type - The type of the resource whose name is to be validated. Possible values include: 'ResourceTypeMicrosoftCdnProfilesEndpoints', 'ResourceTypeMicrosoftCdnProfilesAfdEndpoints' + Type ResourceType `json:"type,omitempty"` +} + +// CheckNameAvailabilityOutput output of check name availability API. +type CheckNameAvailabilityOutput struct { + autorest.Response `json:"-"` + // NameAvailable - READ-ONLY; Indicates whether the name is available. + NameAvailable *bool `json:"nameAvailable,omitempty"` + // Reason - READ-ONLY; The reason why the name is not available. + Reason *string `json:"reason,omitempty"` + // Message - READ-ONLY; The detailed error message describing why the name is not available. + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for CheckNameAvailabilityOutput. +func (cnao CheckNameAvailabilityOutput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CidrIPAddress CIDR Ip address +type CidrIPAddress struct { + // BaseIPAddress - Ip address itself. + BaseIPAddress *string `json:"baseIpAddress,omitempty"` + // PrefixLength - The length of the prefix of the ip address. + PrefixLength *int32 `json:"prefixLength,omitempty"` +} + +// ClientPortMatchConditionParameters defines the parameters for ClientPort match conditions +type ClientPortMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched. Possible values include: 'ClientPortOperatorAny', 'ClientPortOperatorEqual', 'ClientPortOperatorContains', 'ClientPortOperatorBeginsWith', 'ClientPortOperatorEndsWith', 'ClientPortOperatorLessThan', 'ClientPortOperatorLessThanOrEqual', 'ClientPortOperatorGreaterThan', 'ClientPortOperatorGreaterThanOrEqual', 'ClientPortOperatorRegEx' + Operator ClientPortOperator `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// CompressionSettings settings for compression. +type CompressionSettings struct { + // ContentTypesToCompress - List of content types on which compression applies. The value should be a valid MIME type. + ContentTypesToCompress *[]string `json:"contentTypesToCompress,omitempty"` + // IsCompressionEnabled - Indicates whether content compression is enabled on AzureFrontDoor. Default value is false. If compression is enabled, content will be served as compressed if user requests for a compressed version. Content won't be compressed on AzureFrontDoor when requested content is smaller than 1 byte or larger than 1 MB. + IsCompressionEnabled *bool `json:"isCompressionEnabled,omitempty"` +} + +// ContinentsResponse continents Response +type ContinentsResponse struct { + autorest.Response `json:"-"` + Continents *[]ContinentsResponseContinentsItem `json:"continents,omitempty"` + CountryOrRegions *[]ContinentsResponseCountryOrRegionsItem `json:"countryOrRegions,omitempty"` +} + +// ContinentsResponseContinentsItem ... +type ContinentsResponseContinentsItem struct { + ID *string `json:"id,omitempty"` +} + +// ContinentsResponseCountryOrRegionsItem ... +type ContinentsResponseCountryOrRegionsItem struct { + ID *string `json:"id,omitempty"` + ContinentID *string `json:"continentId,omitempty"` +} + +// CookiesMatchConditionParameters defines the parameters for Cookies match conditions +type CookiesMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Selector - Name of Cookies to be matched + Selector *string `json:"selector,omitempty"` + // Operator - Describes operator to be matched. Possible values include: 'CookiesOperatorAny', 'CookiesOperatorEqual', 'CookiesOperatorContains', 'CookiesOperatorBeginsWith', 'CookiesOperatorEndsWith', 'CookiesOperatorLessThan', 'CookiesOperatorLessThanOrEqual', 'CookiesOperatorGreaterThan', 'CookiesOperatorGreaterThanOrEqual', 'CookiesOperatorRegEx' + Operator CookiesOperator `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// CustomDomain friendly domain name mapping to the endpoint hostname that the customer provides for +// branding purposes, e.g. www.contoso.com. +type CustomDomain struct { + autorest.Response `json:"-"` + *CustomDomainProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomDomain. +func (cd CustomDomain) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cd.CustomDomainProperties != nil { + objectMap["properties"] = cd.CustomDomainProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for CustomDomain struct. +func (cd *CustomDomain) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var customDomainProperties CustomDomainProperties + err = json.Unmarshal(*v, &customDomainProperties) + if err != nil { + return err + } + cd.CustomDomainProperties = &customDomainProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cd.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cd.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cd.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + cd.SystemData = &systemData + } + } + } + + return nil +} + +// BasicCustomDomainHTTPSParameters the JSON object that contains the properties to secure a custom domain. +type BasicCustomDomainHTTPSParameters interface { + AsUserManagedHTTPSParameters() (*UserManagedHTTPSParameters, bool) + AsManagedHTTPSParameters() (*ManagedHTTPSParameters, bool) + AsCustomDomainHTTPSParameters() (*CustomDomainHTTPSParameters, bool) +} + +// CustomDomainHTTPSParameters the JSON object that contains the properties to secure a custom domain. +type CustomDomainHTTPSParameters struct { + // ProtocolType - Defines the TLS extension protocol that is used for secure delivery. Possible values include: 'ProtocolTypeServerNameIndication', 'ProtocolTypeIPBased' + ProtocolType ProtocolType `json:"protocolType,omitempty"` + // MinimumTLSVersion - TLS protocol version that will be used for Https. Possible values include: 'MinimumTLSVersionNone', 'MinimumTLSVersionTLS10', 'MinimumTLSVersionTLS12' + MinimumTLSVersion MinimumTLSVersion `json:"minimumTlsVersion,omitempty"` + // CertificateSource - Possible values include: 'CertificateSourceCustomDomainHTTPSParameters', 'CertificateSourceAzureKeyVault', 'CertificateSourceCdn' + CertificateSource CertificateSource `json:"certificateSource,omitempty"` +} + +func unmarshalBasicCustomDomainHTTPSParameters(body []byte) (BasicCustomDomainHTTPSParameters, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["certificateSource"] { + case string(CertificateSourceAzureKeyVault): + var umhp UserManagedHTTPSParameters + err := json.Unmarshal(body, &umhp) + return umhp, err + case string(CertificateSourceCdn): + var mhp ManagedHTTPSParameters + err := json.Unmarshal(body, &mhp) + return mhp, err + default: + var cdhp CustomDomainHTTPSParameters + err := json.Unmarshal(body, &cdhp) + return cdhp, err + } +} +func unmarshalBasicCustomDomainHTTPSParametersArray(body []byte) ([]BasicCustomDomainHTTPSParameters, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + cdhpArray := make([]BasicCustomDomainHTTPSParameters, len(rawMessages)) + + for index, rawMessage := range rawMessages { + cdhp, err := unmarshalBasicCustomDomainHTTPSParameters(*rawMessage) + if err != nil { + return nil, err + } + cdhpArray[index] = cdhp + } + return cdhpArray, nil +} + +// MarshalJSON is the custom marshaler for CustomDomainHTTPSParameters. +func (cdhp CustomDomainHTTPSParameters) MarshalJSON() ([]byte, error) { + cdhp.CertificateSource = CertificateSourceCustomDomainHTTPSParameters + objectMap := make(map[string]interface{}) + if cdhp.ProtocolType != "" { + objectMap["protocolType"] = cdhp.ProtocolType + } + if cdhp.MinimumTLSVersion != "" { + objectMap["minimumTlsVersion"] = cdhp.MinimumTLSVersion + } + if cdhp.CertificateSource != "" { + objectMap["certificateSource"] = cdhp.CertificateSource + } + return json.Marshal(objectMap) +} + +// AsUserManagedHTTPSParameters is the BasicCustomDomainHTTPSParameters implementation for CustomDomainHTTPSParameters. +func (cdhp CustomDomainHTTPSParameters) AsUserManagedHTTPSParameters() (*UserManagedHTTPSParameters, bool) { + return nil, false +} + +// AsManagedHTTPSParameters is the BasicCustomDomainHTTPSParameters implementation for CustomDomainHTTPSParameters. +func (cdhp CustomDomainHTTPSParameters) AsManagedHTTPSParameters() (*ManagedHTTPSParameters, bool) { + return nil, false +} + +// AsCustomDomainHTTPSParameters is the BasicCustomDomainHTTPSParameters implementation for CustomDomainHTTPSParameters. +func (cdhp CustomDomainHTTPSParameters) AsCustomDomainHTTPSParameters() (*CustomDomainHTTPSParameters, bool) { + return &cdhp, true +} + +// AsBasicCustomDomainHTTPSParameters is the BasicCustomDomainHTTPSParameters implementation for CustomDomainHTTPSParameters. +func (cdhp CustomDomainHTTPSParameters) AsBasicCustomDomainHTTPSParameters() (BasicCustomDomainHTTPSParameters, bool) { + return &cdhp, true +} + +// CustomDomainListResult result of the request to list custom domains. It contains a list of custom domain +// objects and a URL link to get the next set of results. +type CustomDomainListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of CDN CustomDomains within an endpoint. + Value *[]CustomDomain `json:"value,omitempty"` + // NextLink - URL to get the next set of custom domain objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomDomainListResult. +func (cdlr CustomDomainListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cdlr.NextLink != nil { + objectMap["nextLink"] = cdlr.NextLink + } + return json.Marshal(objectMap) +} + +// CustomDomainListResultIterator provides access to a complete listing of CustomDomain values. +type CustomDomainListResultIterator struct { + i int + page CustomDomainListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *CustomDomainListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *CustomDomainListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CustomDomainListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter CustomDomainListResultIterator) Response() CustomDomainListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter CustomDomainListResultIterator) Value() CustomDomain { + if !iter.page.NotDone() { + return CustomDomain{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CustomDomainListResultIterator type. +func NewCustomDomainListResultIterator(page CustomDomainListResultPage) CustomDomainListResultIterator { + return CustomDomainListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (cdlr CustomDomainListResult) IsEmpty() bool { + return cdlr.Value == nil || len(*cdlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (cdlr CustomDomainListResult) hasNextLink() bool { + return cdlr.NextLink != nil && len(*cdlr.NextLink) != 0 +} + +// customDomainListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cdlr CustomDomainListResult) customDomainListResultPreparer(ctx context.Context) (*http.Request, error) { + if !cdlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cdlr.NextLink))) +} + +// CustomDomainListResultPage contains a page of CustomDomain values. +type CustomDomainListResultPage struct { + fn func(context.Context, CustomDomainListResult) (CustomDomainListResult, error) + cdlr CustomDomainListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *CustomDomainListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.cdlr) + if err != nil { + return err + } + page.cdlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *CustomDomainListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CustomDomainListResultPage) NotDone() bool { + return !page.cdlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CustomDomainListResultPage) Response() CustomDomainListResult { + return page.cdlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CustomDomainListResultPage) Values() []CustomDomain { + if page.cdlr.IsEmpty() { + return nil + } + return *page.cdlr.Value +} + +// Creates a new instance of the CustomDomainListResultPage type. +func NewCustomDomainListResultPage(cur CustomDomainListResult, getNextPage func(context.Context, CustomDomainListResult) (CustomDomainListResult, error)) CustomDomainListResultPage { + return CustomDomainListResultPage{ + fn: getNextPage, + cdlr: cur, + } +} + +// CustomDomainParameters the customDomain JSON object required for custom domain creation or update. +type CustomDomainParameters struct { + *CustomDomainPropertiesParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomDomainParameters. +func (cdp CustomDomainParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cdp.CustomDomainPropertiesParameters != nil { + objectMap["properties"] = cdp.CustomDomainPropertiesParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for CustomDomainParameters struct. +func (cdp *CustomDomainParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var customDomainPropertiesParameters CustomDomainPropertiesParameters + err = json.Unmarshal(*v, &customDomainPropertiesParameters) + if err != nil { + return err + } + cdp.CustomDomainPropertiesParameters = &customDomainPropertiesParameters + } + } + } + + return nil +} + +// CustomDomainProperties the JSON object that contains the properties of the custom domain to create. +type CustomDomainProperties struct { + // HostName - The host name of the custom domain. Must be a domain name. + HostName *string `json:"hostName,omitempty"` + // ResourceState - READ-ONLY; Resource status of the custom domain. Possible values include: 'CustomDomainResourceStateCreating', 'CustomDomainResourceStateActive', 'CustomDomainResourceStateDeleting' + ResourceState CustomDomainResourceState `json:"resourceState,omitempty"` + // CustomHTTPSProvisioningState - READ-ONLY; Provisioning status of Custom Https of the custom domain. Possible values include: 'CustomHTTPSProvisioningStateEnabling', 'CustomHTTPSProvisioningStateEnabled', 'CustomHTTPSProvisioningStateDisabling', 'CustomHTTPSProvisioningStateDisabled', 'CustomHTTPSProvisioningStateFailed' + CustomHTTPSProvisioningState CustomHTTPSProvisioningState `json:"customHttpsProvisioningState,omitempty"` + // CustomHTTPSProvisioningSubstate - READ-ONLY; Provisioning substate shows the progress of custom HTTPS enabling/disabling process step by step. Possible values include: 'CustomHTTPSProvisioningSubstateSubmittingDomainControlValidationRequest', 'CustomHTTPSProvisioningSubstatePendingDomainControlValidationREquestApproval', 'CustomHTTPSProvisioningSubstateDomainControlValidationRequestApproved', 'CustomHTTPSProvisioningSubstateDomainControlValidationRequestRejected', 'CustomHTTPSProvisioningSubstateDomainControlValidationRequestTimedOut', 'CustomHTTPSProvisioningSubstateIssuingCertificate', 'CustomHTTPSProvisioningSubstateDeployingCertificate', 'CustomHTTPSProvisioningSubstateCertificateDeployed', 'CustomHTTPSProvisioningSubstateDeletingCertificate', 'CustomHTTPSProvisioningSubstateCertificateDeleted' + CustomHTTPSProvisioningSubstate CustomHTTPSProvisioningSubstate `json:"customHttpsProvisioningSubstate,omitempty"` + // CustomHTTPSParameters - Certificate parameters for securing custom HTTPS + CustomHTTPSParameters BasicCustomDomainHTTPSParameters `json:"customHttpsParameters,omitempty"` + // ValidationData - Special validation or data may be required when delivering CDN to some regions due to local compliance reasons. E.g. ICP license number of a custom domain is required to deliver content in China. + ValidationData *string `json:"validationData,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning status of the custom domain. + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomDomainProperties. +func (cdp CustomDomainProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cdp.HostName != nil { + objectMap["hostName"] = cdp.HostName + } + objectMap["customHttpsParameters"] = cdp.CustomHTTPSParameters + if cdp.ValidationData != nil { + objectMap["validationData"] = cdp.ValidationData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for CustomDomainProperties struct. +func (cdp *CustomDomainProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "hostName": + if v != nil { + var hostName string + err = json.Unmarshal(*v, &hostName) + if err != nil { + return err + } + cdp.HostName = &hostName + } + case "resourceState": + if v != nil { + var resourceState CustomDomainResourceState + err = json.Unmarshal(*v, &resourceState) + if err != nil { + return err + } + cdp.ResourceState = resourceState + } + case "customHttpsProvisioningState": + if v != nil { + var customHTTPSProvisioningState CustomHTTPSProvisioningState + err = json.Unmarshal(*v, &customHTTPSProvisioningState) + if err != nil { + return err + } + cdp.CustomHTTPSProvisioningState = customHTTPSProvisioningState + } + case "customHttpsProvisioningSubstate": + if v != nil { + var customHTTPSProvisioningSubstate CustomHTTPSProvisioningSubstate + err = json.Unmarshal(*v, &customHTTPSProvisioningSubstate) + if err != nil { + return err + } + cdp.CustomHTTPSProvisioningSubstate = customHTTPSProvisioningSubstate + } + case "customHttpsParameters": + if v != nil { + customHTTPSParameters, err := unmarshalBasicCustomDomainHTTPSParameters(*v) + if err != nil { + return err + } + cdp.CustomHTTPSParameters = customHTTPSParameters + } + case "validationData": + if v != nil { + var validationData string + err = json.Unmarshal(*v, &validationData) + if err != nil { + return err + } + cdp.ValidationData = &validationData + } + case "provisioningState": + if v != nil { + var provisioningState string + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + cdp.ProvisioningState = &provisioningState + } + } + } + + return nil +} + +// CustomDomainPropertiesParameters the JSON object that contains the properties of the custom domain to +// create. +type CustomDomainPropertiesParameters struct { + // HostName - The host name of the custom domain. Must be a domain name. + HostName *string `json:"hostName,omitempty"` +} + +// CustomDomainsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type CustomDomainsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CustomDomainsClient) (CustomDomain, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CustomDomainsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for CustomDomainsCreateFuture.Result. +func (future *CustomDomainsCreateFuture) result(client CustomDomainsClient) (cd CustomDomain, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cd.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.CustomDomainsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cd.Response.Response, err = future.GetResult(sender); err == nil && cd.Response.Response.StatusCode != http.StatusNoContent { + cd, err = client.CreateResponder(cd.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsCreateFuture", "Result", cd.Response.Response, "Failure responding to request") + } + } + return +} + +// CustomDomainsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type CustomDomainsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CustomDomainsClient) (CustomDomain, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CustomDomainsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for CustomDomainsDeleteFuture.Result. +func (future *CustomDomainsDeleteFuture) result(client CustomDomainsClient) (cd CustomDomain, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cd.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.CustomDomainsDeleteFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cd.Response.Response, err = future.GetResult(sender); err == nil && cd.Response.Response.StatusCode != http.StatusNoContent { + cd, err = client.DeleteResponder(cd.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsDeleteFuture", "Result", cd.Response.Response, "Failure responding to request") + } + } + return +} + +// CustomerCertificate customer Certificate used for https +type CustomerCertificate struct { + // SecretSource - Resource reference to the Azure Key Vault certificate. Expected to be in format of /subscriptions/{​​​​​​​​​subscriptionId}​​​​​​​​​/resourceGroups/{​​​​​​​​​resourceGroupName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/providers/Microsoft.KeyVault/vaults/{vaultName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/secrets/{certificateName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​ + SecretSource *ResourceReference `json:"secretSource,omitempty"` + // SecretVersion - Certificate version. + SecretVersion *string `json:"secretVersion,omitempty"` + // CertificateAuthority - READ-ONLY; Certificate issuing authority. + CertificateAuthority *string `json:"certificateAuthority,omitempty"` + // UseLatestVersion - Whether to use the latest version for the certificate + UseLatestVersion *bool `json:"useLatestVersion,omitempty"` + // SubjectAlternativeNames - The list of SANs. + SubjectAlternativeNames *[]string `json:"subjectAlternativeNames,omitempty"` + // Thumbprint - READ-ONLY; Certificate thumbprint. + Thumbprint *string `json:"thumbprint,omitempty"` + // Type - Possible values include: 'SecretTypeURLSigningKey', 'SecretTypeCustomerCertificate', 'SecretTypeManagedCertificate', 'SecretTypeAzureFirstPartyManagedCertificate' + Type SecretType `json:"type,omitempty"` + // Subject - READ-ONLY; Subject name in the certificate. + Subject *string `json:"subject,omitempty"` + // ExpirationDate - READ-ONLY; Certificate expiration date. + ExpirationDate *string `json:"expirationDate,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomerCertificate. +func (cc CustomerCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cc.SecretSource != nil { + objectMap["secretSource"] = cc.SecretSource + } + if cc.SecretVersion != nil { + objectMap["secretVersion"] = cc.SecretVersion + } + if cc.UseLatestVersion != nil { + objectMap["useLatestVersion"] = cc.UseLatestVersion + } + if cc.SubjectAlternativeNames != nil { + objectMap["subjectAlternativeNames"] = cc.SubjectAlternativeNames + } + if cc.Type != "" { + objectMap["type"] = cc.Type + } + return json.Marshal(objectMap) +} + +// CustomerCertificateParameters customer Certificate used for https +type CustomerCertificateParameters struct { + // SecretSource - Resource reference to the Azure Key Vault certificate. Expected to be in format of /subscriptions/{​​​​​​​​​subscriptionId}​​​​​​​​​/resourceGroups/{​​​​​​​​​resourceGroupName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/providers/Microsoft.KeyVault/vaults/{vaultName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/secrets/{certificateName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​ + SecretSource *ResourceReference `json:"secretSource,omitempty"` + // SecretVersion - Version of the secret to be used + SecretVersion *string `json:"secretVersion,omitempty"` + // UseLatestVersion - Whether to use the latest version for the certificate + UseLatestVersion *bool `json:"useLatestVersion,omitempty"` + // Subject - READ-ONLY; Subject name in the certificate. + Subject *string `json:"subject,omitempty"` + // ExpirationDate - READ-ONLY; Certificate expiration date. + ExpirationDate *string `json:"expirationDate,omitempty"` + // CertificateAuthority - READ-ONLY; Certificate issuing authority. + CertificateAuthority *string `json:"certificateAuthority,omitempty"` + // SubjectAlternativeNames - The list of SANs. + SubjectAlternativeNames *[]string `json:"subjectAlternativeNames,omitempty"` + // Thumbprint - READ-ONLY; Certificate thumbprint. + Thumbprint *string `json:"thumbprint,omitempty"` + // Type - Possible values include: 'TypeBasicSecretParametersTypeSecretParameters', 'TypeBasicSecretParametersTypeURLSigningKey', 'TypeBasicSecretParametersTypeManagedCertificate', 'TypeBasicSecretParametersTypeCustomerCertificate', 'TypeBasicSecretParametersTypeAzureFirstPartyManagedCertificate' + Type TypeBasicSecretParameters `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomerCertificateParameters. +func (ccp CustomerCertificateParameters) MarshalJSON() ([]byte, error) { + ccp.Type = TypeBasicSecretParametersTypeCustomerCertificate + objectMap := make(map[string]interface{}) + if ccp.SecretSource != nil { + objectMap["secretSource"] = ccp.SecretSource + } + if ccp.SecretVersion != nil { + objectMap["secretVersion"] = ccp.SecretVersion + } + if ccp.UseLatestVersion != nil { + objectMap["useLatestVersion"] = ccp.UseLatestVersion + } + if ccp.SubjectAlternativeNames != nil { + objectMap["subjectAlternativeNames"] = ccp.SubjectAlternativeNames + } + if ccp.Type != "" { + objectMap["type"] = ccp.Type + } + return json.Marshal(objectMap) +} + +// AsURLSigningKeyParameters is the BasicSecretParameters implementation for CustomerCertificateParameters. +func (ccp CustomerCertificateParameters) AsURLSigningKeyParameters() (*URLSigningKeyParameters, bool) { + return nil, false +} + +// AsManagedCertificateParameters is the BasicSecretParameters implementation for CustomerCertificateParameters. +func (ccp CustomerCertificateParameters) AsManagedCertificateParameters() (*ManagedCertificateParameters, bool) { + return nil, false +} + +// AsCustomerCertificateParameters is the BasicSecretParameters implementation for CustomerCertificateParameters. +func (ccp CustomerCertificateParameters) AsCustomerCertificateParameters() (*CustomerCertificateParameters, bool) { + return &ccp, true +} + +// AsAzureFirstPartyManagedCertificateParameters is the BasicSecretParameters implementation for CustomerCertificateParameters. +func (ccp CustomerCertificateParameters) AsAzureFirstPartyManagedCertificateParameters() (*AzureFirstPartyManagedCertificateParameters, bool) { + return nil, false +} + +// AsSecretParameters is the BasicSecretParameters implementation for CustomerCertificateParameters. +func (ccp CustomerCertificateParameters) AsSecretParameters() (*SecretParameters, bool) { + return nil, false +} + +// AsBasicSecretParameters is the BasicSecretParameters implementation for CustomerCertificateParameters. +func (ccp CustomerCertificateParameters) AsBasicSecretParameters() (BasicSecretParameters, bool) { + return &ccp, true +} + +// CustomRule defines the common attributes for a custom rule that can be included in a waf policy +type CustomRule struct { + // Name - Defines the name of the custom rule + Name *string `json:"name,omitempty"` + // EnabledState - Describes if the custom rule is in enabled or disabled state. Defaults to Enabled if not specified. Possible values include: 'CustomRuleEnabledStateDisabled', 'CustomRuleEnabledStateEnabled' + EnabledState CustomRuleEnabledState `json:"enabledState,omitempty"` + // Priority - Defines in what order this rule be evaluated in the overall list of custom rules + Priority *int32 `json:"priority,omitempty"` + // MatchConditions - List of match conditions. + MatchConditions *[]MatchCondition `json:"matchConditions,omitempty"` + // Action - Describes what action to be applied when rule matches. Possible values include: 'ActionTypeAllow', 'ActionTypeBlock', 'ActionTypeLog', 'ActionTypeRedirect' + Action ActionType `json:"action,omitempty"` +} + +// CustomRuleList defines contents of custom rules +type CustomRuleList struct { + // Rules - List of rules + Rules *[]CustomRule `json:"rules,omitempty"` +} + +// DeepCreatedOrigin the main origin of CDN content which is added when creating a CDN endpoint. +type DeepCreatedOrigin struct { + // Name - Origin name which must be unique within the endpoint. + Name *string `json:"name,omitempty"` + *DeepCreatedOriginProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeepCreatedOrigin. +func (dco DeepCreatedOrigin) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dco.Name != nil { + objectMap["name"] = dco.Name + } + if dco.DeepCreatedOriginProperties != nil { + objectMap["properties"] = dco.DeepCreatedOriginProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DeepCreatedOrigin struct. +func (dco *DeepCreatedOrigin) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dco.Name = &name + } + case "properties": + if v != nil { + var deepCreatedOriginProperties DeepCreatedOriginProperties + err = json.Unmarshal(*v, &deepCreatedOriginProperties) + if err != nil { + return err + } + dco.DeepCreatedOriginProperties = &deepCreatedOriginProperties + } + } + } + + return nil +} + +// DeepCreatedOriginGroup the origin group for CDN content which is added when creating a CDN endpoint. +// Traffic is sent to the origins within the origin group based on origin health. +type DeepCreatedOriginGroup struct { + // Name - Origin group name which must be unique within the endpoint. + Name *string `json:"name,omitempty"` + *DeepCreatedOriginGroupProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeepCreatedOriginGroup. +func (dcog DeepCreatedOriginGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dcog.Name != nil { + objectMap["name"] = dcog.Name + } + if dcog.DeepCreatedOriginGroupProperties != nil { + objectMap["properties"] = dcog.DeepCreatedOriginGroupProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DeepCreatedOriginGroup struct. +func (dcog *DeepCreatedOriginGroup) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dcog.Name = &name + } + case "properties": + if v != nil { + var deepCreatedOriginGroupProperties DeepCreatedOriginGroupProperties + err = json.Unmarshal(*v, &deepCreatedOriginGroupProperties) + if err != nil { + return err + } + dcog.DeepCreatedOriginGroupProperties = &deepCreatedOriginGroupProperties + } + } + } + + return nil +} + +// DeepCreatedOriginGroupProperties properties of the origin group created on the CDN endpoint. +type DeepCreatedOriginGroupProperties struct { + // HealthProbeSettings - Health probe settings to the origin that is used to determine the health of the origin. + HealthProbeSettings *HealthProbeParameters `json:"healthProbeSettings,omitempty"` + // Origins - The source of the content being delivered via CDN within given origin group. + Origins *[]ResourceReference `json:"origins,omitempty"` + // TrafficRestorationTimeToHealedOrNewEndpointsInMinutes - Time in minutes to shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new endpoint is added. Default is 10 mins. This property is currently not supported. + TrafficRestorationTimeToHealedOrNewEndpointsInMinutes *int32 `json:"trafficRestorationTimeToHealedOrNewEndpointsInMinutes,omitempty"` + // ResponseBasedOriginErrorDetectionSettings - The JSON object that contains the properties to determine origin health using real requests/responses.This property is currently not supported. + ResponseBasedOriginErrorDetectionSettings *ResponseBasedOriginErrorDetectionParameters `json:"responseBasedOriginErrorDetectionSettings,omitempty"` +} + +// DeepCreatedOriginProperties properties of the origin created on the CDN endpoint. +type DeepCreatedOriginProperties struct { + // HostName - The address of the origin. It can be a domain name, IPv4 address, or IPv6 address. This should be unique across all origins in an endpoint. + HostName *string `json:"hostName,omitempty"` + // HTTPPort - The value of the HTTP port. Must be between 1 and 65535. + HTTPPort *int32 `json:"httpPort,omitempty"` + // HTTPSPort - The value of the HTTPS port. Must be between 1 and 65535. + HTTPSPort *int32 `json:"httpsPort,omitempty"` + // OriginHostHeader - The host header value sent to the origin with each request. If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. + OriginHostHeader *string `json:"originHostHeader,omitempty"` + // Priority - Priority of origin in given origin group for load balancing. Higher priorities will not be used for load balancing if any lower priority origin is healthy.Must be between 1 and 5. + Priority *int32 `json:"priority,omitempty"` + // Weight - Weight of the origin in given origin group for load balancing. Must be between 1 and 1000 + Weight *int32 `json:"weight,omitempty"` + // Enabled - Origin is enabled for load balancing or not. By default, origin is always enabled. + Enabled *bool `json:"enabled,omitempty"` + // PrivateLinkAlias - The Alias of the Private Link resource. Populating this optional field indicates that this origin is 'Private' + PrivateLinkAlias *string `json:"privateLinkAlias,omitempty"` + // PrivateLinkResourceID - The Resource Id of the Private Link resource. Populating this optional field indicates that this backend is 'Private' + PrivateLinkResourceID *string `json:"privateLinkResourceId,omitempty"` + // PrivateLinkLocation - The location of the Private Link resource. Required only if 'privateLinkResourceId' is populated + PrivateLinkLocation *string `json:"privateLinkLocation,omitempty"` + // PrivateLinkApprovalMessage - A custom message to be included in the approval request to connect to the Private Link. + PrivateLinkApprovalMessage *string `json:"privateLinkApprovalMessage,omitempty"` + // PrivateEndpointStatus - READ-ONLY; The approval status for the connection to the Private Link. Possible values include: 'PrivateEndpointStatusPending', 'PrivateEndpointStatusApproved', 'PrivateEndpointStatusRejected', 'PrivateEndpointStatusDisconnected', 'PrivateEndpointStatusTimeout' + PrivateEndpointStatus PrivateEndpointStatus `json:"privateEndpointStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeepCreatedOriginProperties. +func (dcop DeepCreatedOriginProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dcop.HostName != nil { + objectMap["hostName"] = dcop.HostName + } + if dcop.HTTPPort != nil { + objectMap["httpPort"] = dcop.HTTPPort + } + if dcop.HTTPSPort != nil { + objectMap["httpsPort"] = dcop.HTTPSPort + } + if dcop.OriginHostHeader != nil { + objectMap["originHostHeader"] = dcop.OriginHostHeader + } + if dcop.Priority != nil { + objectMap["priority"] = dcop.Priority + } + if dcop.Weight != nil { + objectMap["weight"] = dcop.Weight + } + if dcop.Enabled != nil { + objectMap["enabled"] = dcop.Enabled + } + if dcop.PrivateLinkAlias != nil { + objectMap["privateLinkAlias"] = dcop.PrivateLinkAlias + } + if dcop.PrivateLinkResourceID != nil { + objectMap["privateLinkResourceId"] = dcop.PrivateLinkResourceID + } + if dcop.PrivateLinkLocation != nil { + objectMap["privateLinkLocation"] = dcop.PrivateLinkLocation + } + if dcop.PrivateLinkApprovalMessage != nil { + objectMap["privateLinkApprovalMessage"] = dcop.PrivateLinkApprovalMessage + } + return json.Marshal(objectMap) +} + +// DeliveryRule a rule that specifies a set of actions and conditions +type DeliveryRule struct { + // Name - Name of the rule + Name *string `json:"name,omitempty"` + // Order - The order in which the rules are applied for the endpoint. Possible values {0,1,2,3,………}. A rule with a lesser order will be applied before a rule with a greater order. Rule with order 0 is a special rule. It does not require any condition and actions listed in it will always be applied. + Order *int32 `json:"order,omitempty"` + // Conditions - A list of conditions that must be matched for the actions to be executed + Conditions *[]BasicDeliveryRuleCondition `json:"conditions,omitempty"` + // Actions - A list of actions that are executed when all the conditions of a rule are satisfied. + Actions *[]BasicDeliveryRuleAction `json:"actions,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for DeliveryRule struct. +func (dr *DeliveryRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dr.Name = &name + } + case "order": + if v != nil { + var order int32 + err = json.Unmarshal(*v, &order) + if err != nil { + return err + } + dr.Order = &order + } + case "conditions": + if v != nil { + conditions, err := unmarshalBasicDeliveryRuleConditionArray(*v) + if err != nil { + return err + } + dr.Conditions = &conditions + } + case "actions": + if v != nil { + actions, err := unmarshalBasicDeliveryRuleActionArray(*v) + if err != nil { + return err + } + dr.Actions = &actions + } + } + } + + return nil +} + +// BasicDeliveryRuleAction an action for the delivery rule. +type BasicDeliveryRuleAction interface { + AsDeliveryRuleRouteConfigurationOverrideAction() (*DeliveryRuleRouteConfigurationOverrideAction, bool) + AsDeliveryRuleCacheKeyQueryStringAction() (*DeliveryRuleCacheKeyQueryStringAction, bool) + AsDeliveryRuleCacheExpirationAction() (*DeliveryRuleCacheExpirationAction, bool) + AsDeliveryRuleResponseHeaderAction() (*DeliveryRuleResponseHeaderAction, bool) + AsDeliveryRuleRequestHeaderAction() (*DeliveryRuleRequestHeaderAction, bool) + AsURLRewriteAction() (*URLRewriteAction, bool) + AsOriginGroupOverrideAction() (*OriginGroupOverrideAction, bool) + AsURLSigningAction() (*URLSigningAction, bool) + AsURLRedirectAction() (*URLRedirectAction, bool) + AsDeliveryRuleAction() (*DeliveryRuleAction, bool) +} + +// DeliveryRuleAction an action for the delivery rule. +type DeliveryRuleAction struct { + // Name - Possible values include: 'NameBasicDeliveryRuleActionNameDeliveryRuleAction', 'NameBasicDeliveryRuleActionNameRouteConfigurationOverride', 'NameBasicDeliveryRuleActionNameCacheKeyQueryString', 'NameBasicDeliveryRuleActionNameCacheExpiration', 'NameBasicDeliveryRuleActionNameModifyResponseHeader', 'NameBasicDeliveryRuleActionNameModifyRequestHeader', 'NameBasicDeliveryRuleActionNameURLRewrite', 'NameBasicDeliveryRuleActionNameOriginGroupOverride', 'NameBasicDeliveryRuleActionNameURLSigning', 'NameBasicDeliveryRuleActionNameURLRedirect' + Name NameBasicDeliveryRuleAction `json:"name,omitempty"` +} + +func unmarshalBasicDeliveryRuleAction(body []byte) (BasicDeliveryRuleAction, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["name"] { + case string(NameBasicDeliveryRuleActionNameRouteConfigurationOverride): + var drrcoa DeliveryRuleRouteConfigurationOverrideAction + err := json.Unmarshal(body, &drrcoa) + return drrcoa, err + case string(NameBasicDeliveryRuleActionNameCacheKeyQueryString): + var drckqsa DeliveryRuleCacheKeyQueryStringAction + err := json.Unmarshal(body, &drckqsa) + return drckqsa, err + case string(NameBasicDeliveryRuleActionNameCacheExpiration): + var drcea DeliveryRuleCacheExpirationAction + err := json.Unmarshal(body, &drcea) + return drcea, err + case string(NameBasicDeliveryRuleActionNameModifyResponseHeader): + var drrha DeliveryRuleResponseHeaderAction + err := json.Unmarshal(body, &drrha) + return drrha, err + case string(NameBasicDeliveryRuleActionNameModifyRequestHeader): + var drrha DeliveryRuleRequestHeaderAction + err := json.Unmarshal(body, &drrha) + return drrha, err + case string(NameBasicDeliveryRuleActionNameURLRewrite): + var ura URLRewriteAction + err := json.Unmarshal(body, &ura) + return ura, err + case string(NameBasicDeliveryRuleActionNameOriginGroupOverride): + var ogoa OriginGroupOverrideAction + err := json.Unmarshal(body, &ogoa) + return ogoa, err + case string(NameBasicDeliveryRuleActionNameURLSigning): + var usa URLSigningAction + err := json.Unmarshal(body, &usa) + return usa, err + case string(NameBasicDeliveryRuleActionNameURLRedirect): + var ura URLRedirectAction + err := json.Unmarshal(body, &ura) + return ura, err + default: + var dra DeliveryRuleAction + err := json.Unmarshal(body, &dra) + return dra, err + } +} +func unmarshalBasicDeliveryRuleActionArray(body []byte) ([]BasicDeliveryRuleAction, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + draArray := make([]BasicDeliveryRuleAction, len(rawMessages)) + + for index, rawMessage := range rawMessages { + dra, err := unmarshalBasicDeliveryRuleAction(*rawMessage) + if err != nil { + return nil, err + } + draArray[index] = dra + } + return draArray, nil +} + +// MarshalJSON is the custom marshaler for DeliveryRuleAction. +func (dra DeliveryRuleAction) MarshalJSON() ([]byte, error) { + dra.Name = NameBasicDeliveryRuleActionNameDeliveryRuleAction + objectMap := make(map[string]interface{}) + if dra.Name != "" { + objectMap["name"] = dra.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleRouteConfigurationOverrideAction is the BasicDeliveryRuleAction implementation for DeliveryRuleAction. +func (dra DeliveryRuleAction) AsDeliveryRuleRouteConfigurationOverrideAction() (*DeliveryRuleRouteConfigurationOverrideAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheKeyQueryStringAction is the BasicDeliveryRuleAction implementation for DeliveryRuleAction. +func (dra DeliveryRuleAction) AsDeliveryRuleCacheKeyQueryStringAction() (*DeliveryRuleCacheKeyQueryStringAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheExpirationAction is the BasicDeliveryRuleAction implementation for DeliveryRuleAction. +func (dra DeliveryRuleAction) AsDeliveryRuleCacheExpirationAction() (*DeliveryRuleCacheExpirationAction, bool) { + return nil, false +} + +// AsDeliveryRuleResponseHeaderAction is the BasicDeliveryRuleAction implementation for DeliveryRuleAction. +func (dra DeliveryRuleAction) AsDeliveryRuleResponseHeaderAction() (*DeliveryRuleResponseHeaderAction, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderAction is the BasicDeliveryRuleAction implementation for DeliveryRuleAction. +func (dra DeliveryRuleAction) AsDeliveryRuleRequestHeaderAction() (*DeliveryRuleRequestHeaderAction, bool) { + return nil, false +} + +// AsURLRewriteAction is the BasicDeliveryRuleAction implementation for DeliveryRuleAction. +func (dra DeliveryRuleAction) AsURLRewriteAction() (*URLRewriteAction, bool) { + return nil, false +} + +// AsOriginGroupOverrideAction is the BasicDeliveryRuleAction implementation for DeliveryRuleAction. +func (dra DeliveryRuleAction) AsOriginGroupOverrideAction() (*OriginGroupOverrideAction, bool) { + return nil, false +} + +// AsURLSigningAction is the BasicDeliveryRuleAction implementation for DeliveryRuleAction. +func (dra DeliveryRuleAction) AsURLSigningAction() (*URLSigningAction, bool) { + return nil, false +} + +// AsURLRedirectAction is the BasicDeliveryRuleAction implementation for DeliveryRuleAction. +func (dra DeliveryRuleAction) AsURLRedirectAction() (*URLRedirectAction, bool) { + return nil, false +} + +// AsDeliveryRuleAction is the BasicDeliveryRuleAction implementation for DeliveryRuleAction. +func (dra DeliveryRuleAction) AsDeliveryRuleAction() (*DeliveryRuleAction, bool) { + return &dra, true +} + +// AsBasicDeliveryRuleAction is the BasicDeliveryRuleAction implementation for DeliveryRuleAction. +func (dra DeliveryRuleAction) AsBasicDeliveryRuleAction() (BasicDeliveryRuleAction, bool) { + return &dra, true +} + +// DeliveryRuleCacheExpirationAction defines the cache expiration action for the delivery rule. +type DeliveryRuleCacheExpirationAction struct { + // Parameters - Defines the parameters for the action. + Parameters *CacheExpirationActionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameBasicDeliveryRuleActionNameDeliveryRuleAction', 'NameBasicDeliveryRuleActionNameRouteConfigurationOverride', 'NameBasicDeliveryRuleActionNameCacheKeyQueryString', 'NameBasicDeliveryRuleActionNameCacheExpiration', 'NameBasicDeliveryRuleActionNameModifyResponseHeader', 'NameBasicDeliveryRuleActionNameModifyRequestHeader', 'NameBasicDeliveryRuleActionNameURLRewrite', 'NameBasicDeliveryRuleActionNameOriginGroupOverride', 'NameBasicDeliveryRuleActionNameURLSigning', 'NameBasicDeliveryRuleActionNameURLRedirect' + Name NameBasicDeliveryRuleAction `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleCacheExpirationAction. +func (drcea DeliveryRuleCacheExpirationAction) MarshalJSON() ([]byte, error) { + drcea.Name = NameBasicDeliveryRuleActionNameCacheExpiration + objectMap := make(map[string]interface{}) + if drcea.Parameters != nil { + objectMap["parameters"] = drcea.Parameters + } + if drcea.Name != "" { + objectMap["name"] = drcea.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleRouteConfigurationOverrideAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheExpirationAction. +func (drcea DeliveryRuleCacheExpirationAction) AsDeliveryRuleRouteConfigurationOverrideAction() (*DeliveryRuleRouteConfigurationOverrideAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheKeyQueryStringAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheExpirationAction. +func (drcea DeliveryRuleCacheExpirationAction) AsDeliveryRuleCacheKeyQueryStringAction() (*DeliveryRuleCacheKeyQueryStringAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheExpirationAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheExpirationAction. +func (drcea DeliveryRuleCacheExpirationAction) AsDeliveryRuleCacheExpirationAction() (*DeliveryRuleCacheExpirationAction, bool) { + return &drcea, true +} + +// AsDeliveryRuleResponseHeaderAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheExpirationAction. +func (drcea DeliveryRuleCacheExpirationAction) AsDeliveryRuleResponseHeaderAction() (*DeliveryRuleResponseHeaderAction, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheExpirationAction. +func (drcea DeliveryRuleCacheExpirationAction) AsDeliveryRuleRequestHeaderAction() (*DeliveryRuleRequestHeaderAction, bool) { + return nil, false +} + +// AsURLRewriteAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheExpirationAction. +func (drcea DeliveryRuleCacheExpirationAction) AsURLRewriteAction() (*URLRewriteAction, bool) { + return nil, false +} + +// AsOriginGroupOverrideAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheExpirationAction. +func (drcea DeliveryRuleCacheExpirationAction) AsOriginGroupOverrideAction() (*OriginGroupOverrideAction, bool) { + return nil, false +} + +// AsURLSigningAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheExpirationAction. +func (drcea DeliveryRuleCacheExpirationAction) AsURLSigningAction() (*URLSigningAction, bool) { + return nil, false +} + +// AsURLRedirectAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheExpirationAction. +func (drcea DeliveryRuleCacheExpirationAction) AsURLRedirectAction() (*URLRedirectAction, bool) { + return nil, false +} + +// AsDeliveryRuleAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheExpirationAction. +func (drcea DeliveryRuleCacheExpirationAction) AsDeliveryRuleAction() (*DeliveryRuleAction, bool) { + return nil, false +} + +// AsBasicDeliveryRuleAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheExpirationAction. +func (drcea DeliveryRuleCacheExpirationAction) AsBasicDeliveryRuleAction() (BasicDeliveryRuleAction, bool) { + return &drcea, true +} + +// DeliveryRuleCacheKeyQueryStringAction defines the cache-key query string action for the delivery rule. +type DeliveryRuleCacheKeyQueryStringAction struct { + // Parameters - Defines the parameters for the action. + Parameters *CacheKeyQueryStringActionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameBasicDeliveryRuleActionNameDeliveryRuleAction', 'NameBasicDeliveryRuleActionNameRouteConfigurationOverride', 'NameBasicDeliveryRuleActionNameCacheKeyQueryString', 'NameBasicDeliveryRuleActionNameCacheExpiration', 'NameBasicDeliveryRuleActionNameModifyResponseHeader', 'NameBasicDeliveryRuleActionNameModifyRequestHeader', 'NameBasicDeliveryRuleActionNameURLRewrite', 'NameBasicDeliveryRuleActionNameOriginGroupOverride', 'NameBasicDeliveryRuleActionNameURLSigning', 'NameBasicDeliveryRuleActionNameURLRedirect' + Name NameBasicDeliveryRuleAction `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleCacheKeyQueryStringAction. +func (drckqsa DeliveryRuleCacheKeyQueryStringAction) MarshalJSON() ([]byte, error) { + drckqsa.Name = NameBasicDeliveryRuleActionNameCacheKeyQueryString + objectMap := make(map[string]interface{}) + if drckqsa.Parameters != nil { + objectMap["parameters"] = drckqsa.Parameters + } + if drckqsa.Name != "" { + objectMap["name"] = drckqsa.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleRouteConfigurationOverrideAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheKeyQueryStringAction. +func (drckqsa DeliveryRuleCacheKeyQueryStringAction) AsDeliveryRuleRouteConfigurationOverrideAction() (*DeliveryRuleRouteConfigurationOverrideAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheKeyQueryStringAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheKeyQueryStringAction. +func (drckqsa DeliveryRuleCacheKeyQueryStringAction) AsDeliveryRuleCacheKeyQueryStringAction() (*DeliveryRuleCacheKeyQueryStringAction, bool) { + return &drckqsa, true +} + +// AsDeliveryRuleCacheExpirationAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheKeyQueryStringAction. +func (drckqsa DeliveryRuleCacheKeyQueryStringAction) AsDeliveryRuleCacheExpirationAction() (*DeliveryRuleCacheExpirationAction, bool) { + return nil, false +} + +// AsDeliveryRuleResponseHeaderAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheKeyQueryStringAction. +func (drckqsa DeliveryRuleCacheKeyQueryStringAction) AsDeliveryRuleResponseHeaderAction() (*DeliveryRuleResponseHeaderAction, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheKeyQueryStringAction. +func (drckqsa DeliveryRuleCacheKeyQueryStringAction) AsDeliveryRuleRequestHeaderAction() (*DeliveryRuleRequestHeaderAction, bool) { + return nil, false +} + +// AsURLRewriteAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheKeyQueryStringAction. +func (drckqsa DeliveryRuleCacheKeyQueryStringAction) AsURLRewriteAction() (*URLRewriteAction, bool) { + return nil, false +} + +// AsOriginGroupOverrideAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheKeyQueryStringAction. +func (drckqsa DeliveryRuleCacheKeyQueryStringAction) AsOriginGroupOverrideAction() (*OriginGroupOverrideAction, bool) { + return nil, false +} + +// AsURLSigningAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheKeyQueryStringAction. +func (drckqsa DeliveryRuleCacheKeyQueryStringAction) AsURLSigningAction() (*URLSigningAction, bool) { + return nil, false +} + +// AsURLRedirectAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheKeyQueryStringAction. +func (drckqsa DeliveryRuleCacheKeyQueryStringAction) AsURLRedirectAction() (*URLRedirectAction, bool) { + return nil, false +} + +// AsDeliveryRuleAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheKeyQueryStringAction. +func (drckqsa DeliveryRuleCacheKeyQueryStringAction) AsDeliveryRuleAction() (*DeliveryRuleAction, bool) { + return nil, false +} + +// AsBasicDeliveryRuleAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheKeyQueryStringAction. +func (drckqsa DeliveryRuleCacheKeyQueryStringAction) AsBasicDeliveryRuleAction() (BasicDeliveryRuleAction, bool) { + return &drckqsa, true +} + +// DeliveryRuleClientPortCondition defines the ClientPort condition for the delivery rule. +type DeliveryRuleClientPortCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *ClientPortMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) MarshalJSON() ([]byte, error) { + drcpc.Name = NameClientPort + objectMap := make(map[string]interface{}) + if drcpc.Parameters != nil { + objectMap["parameters"] = drcpc.Parameters + } + if drcpc.Name != "" { + objectMap["name"] = drcpc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return &drcpc, true +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drcpc, true +} + +// BasicDeliveryRuleCondition a condition for the delivery rule. +type BasicDeliveryRuleCondition interface { + AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) + AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) + AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) + AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) + AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) + AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) + AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) + AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) + AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) + AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) + AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) + AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) + AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) + AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) + AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) + AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) + AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) + AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) + AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) + AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) +} + +// DeliveryRuleCondition a condition for the delivery rule. +type DeliveryRuleCondition struct { + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +func unmarshalBasicDeliveryRuleCondition(body []byte) (BasicDeliveryRuleCondition, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["name"] { + case string(NameSslProtocol): + var drspc DeliveryRuleSslProtocolCondition + err := json.Unmarshal(body, &drspc) + return drspc, err + case string(NameHostName): + var drhnc DeliveryRuleHostNameCondition + err := json.Unmarshal(body, &drhnc) + return drhnc, err + case string(NameServerPort): + var drspc DeliveryRuleServerPortCondition + err := json.Unmarshal(body, &drspc) + return drspc, err + case string(NameClientPort): + var drcpc DeliveryRuleClientPortCondition + err := json.Unmarshal(body, &drcpc) + return drcpc, err + case string(NameSocketAddr): + var drsac DeliveryRuleSocketAddrCondition + err := json.Unmarshal(body, &drsac) + return drsac, err + case string(NameIsDevice): + var dridc DeliveryRuleIsDeviceCondition + err := json.Unmarshal(body, &dridc) + return dridc, err + case string(NameCookies): + var drcc DeliveryRuleCookiesCondition + err := json.Unmarshal(body, &drcc) + return drcc, err + case string(NameHTTPVersion): + var drhvc DeliveryRuleHTTPVersionCondition + err := json.Unmarshal(body, &drhvc) + return drhvc, err + case string(NameURLFileName): + var drufnc DeliveryRuleURLFileNameCondition + err := json.Unmarshal(body, &drufnc) + return drufnc, err + case string(NameURLFileExtension): + var drufec DeliveryRuleURLFileExtensionCondition + err := json.Unmarshal(body, &drufec) + return drufec, err + case string(NameURLPath): + var drupc DeliveryRuleURLPathCondition + err := json.Unmarshal(body, &drupc) + return drupc, err + case string(NameRequestScheme): + var drrsc DeliveryRuleRequestSchemeCondition + err := json.Unmarshal(body, &drrsc) + return drrsc, err + case string(NameRequestBody): + var drrbc DeliveryRuleRequestBodyCondition + err := json.Unmarshal(body, &drrbc) + return drrbc, err + case string(NameRequestHeader): + var drrhc DeliveryRuleRequestHeaderCondition + err := json.Unmarshal(body, &drrhc) + return drrhc, err + case string(NameRequestURI): + var drruc DeliveryRuleRequestURICondition + err := json.Unmarshal(body, &drruc) + return drruc, err + case string(NamePostArgs): + var drpac DeliveryRulePostArgsCondition + err := json.Unmarshal(body, &drpac) + return drpac, err + case string(NameQueryString): + var drqsc DeliveryRuleQueryStringCondition + err := json.Unmarshal(body, &drqsc) + return drqsc, err + case string(NameRequestMethod): + var drrmc DeliveryRuleRequestMethodCondition + err := json.Unmarshal(body, &drrmc) + return drrmc, err + case string(NameRemoteAddress): + var drrac DeliveryRuleRemoteAddressCondition + err := json.Unmarshal(body, &drrac) + return drrac, err + default: + var drc DeliveryRuleCondition + err := json.Unmarshal(body, &drc) + return drc, err + } +} +func unmarshalBasicDeliveryRuleConditionArray(body []byte) ([]BasicDeliveryRuleCondition, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + drcArray := make([]BasicDeliveryRuleCondition, len(rawMessages)) + + for index, rawMessage := range rawMessages { + drc, err := unmarshalBasicDeliveryRuleCondition(*rawMessage) + if err != nil { + return nil, err + } + drcArray[index] = drc + } + return drcArray, nil +} + +// MarshalJSON is the custom marshaler for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) MarshalJSON() ([]byte, error) { + drc.Name = NameDeliveryRuleCondition + objectMap := make(map[string]interface{}) + if drc.Name != "" { + objectMap["name"] = drc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return &drc, true +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drc, true +} + +// DeliveryRuleCookiesCondition defines the Cookies condition for the delivery rule. +type DeliveryRuleCookiesCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *CookiesMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) MarshalJSON() ([]byte, error) { + drcc.Name = NameCookies + objectMap := make(map[string]interface{}) + if drcc.Parameters != nil { + objectMap["parameters"] = drcc.Parameters + } + if drcc.Name != "" { + objectMap["name"] = drcc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return &drcc, true +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drcc, true +} + +// DeliveryRuleHostNameCondition defines the HostName condition for the delivery rule. +type DeliveryRuleHostNameCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *HostNameMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) MarshalJSON() ([]byte, error) { + drhnc.Name = NameHostName + objectMap := make(map[string]interface{}) + if drhnc.Parameters != nil { + objectMap["parameters"] = drhnc.Parameters + } + if drhnc.Name != "" { + objectMap["name"] = drhnc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return &drhnc, true +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drhnc, true +} + +// DeliveryRuleHTTPVersionCondition defines the HttpVersion condition for the delivery rule. +type DeliveryRuleHTTPVersionCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *HTTPVersionMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) MarshalJSON() ([]byte, error) { + drhvc.Name = NameHTTPVersion + objectMap := make(map[string]interface{}) + if drhvc.Parameters != nil { + objectMap["parameters"] = drhvc.Parameters + } + if drhvc.Name != "" { + objectMap["name"] = drhvc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return &drhvc, true +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drhvc, true +} + +// DeliveryRuleIsDeviceCondition defines the IsDevice condition for the delivery rule. +type DeliveryRuleIsDeviceCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *IsDeviceMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) MarshalJSON() ([]byte, error) { + dridc.Name = NameIsDevice + objectMap := make(map[string]interface{}) + if dridc.Parameters != nil { + objectMap["parameters"] = dridc.Parameters + } + if dridc.Name != "" { + objectMap["name"] = dridc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return &dridc, true +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &dridc, true +} + +// DeliveryRulePostArgsCondition defines the PostArgs condition for the delivery rule. +type DeliveryRulePostArgsCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *PostArgsMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) MarshalJSON() ([]byte, error) { + drpac.Name = NamePostArgs + objectMap := make(map[string]interface{}) + if drpac.Parameters != nil { + objectMap["parameters"] = drpac.Parameters + } + if drpac.Name != "" { + objectMap["name"] = drpac.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return &drpac, true +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drpac, true +} + +// DeliveryRuleQueryStringCondition defines the QueryString condition for the delivery rule. +type DeliveryRuleQueryStringCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *QueryStringMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) MarshalJSON() ([]byte, error) { + drqsc.Name = NameQueryString + objectMap := make(map[string]interface{}) + if drqsc.Parameters != nil { + objectMap["parameters"] = drqsc.Parameters + } + if drqsc.Name != "" { + objectMap["name"] = drqsc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return &drqsc, true +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drqsc, true +} + +// DeliveryRuleRemoteAddressCondition defines the RemoteAddress condition for the delivery rule. +type DeliveryRuleRemoteAddressCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *RemoteAddressMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) MarshalJSON() ([]byte, error) { + drrac.Name = NameRemoteAddress + objectMap := make(map[string]interface{}) + if drrac.Parameters != nil { + objectMap["parameters"] = drrac.Parameters + } + if drrac.Name != "" { + objectMap["name"] = drrac.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return &drrac, true +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drrac, true +} + +// DeliveryRuleRequestBodyCondition defines the RequestBody condition for the delivery rule. +type DeliveryRuleRequestBodyCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *RequestBodyMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) MarshalJSON() ([]byte, error) { + drrbc.Name = NameRequestBody + objectMap := make(map[string]interface{}) + if drrbc.Parameters != nil { + objectMap["parameters"] = drrbc.Parameters + } + if drrbc.Name != "" { + objectMap["name"] = drrbc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return &drrbc, true +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drrbc, true +} + +// DeliveryRuleRequestHeaderAction defines the request header action for the delivery rule. +type DeliveryRuleRequestHeaderAction struct { + // Parameters - Defines the parameters for the action. + Parameters *HeaderActionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameBasicDeliveryRuleActionNameDeliveryRuleAction', 'NameBasicDeliveryRuleActionNameRouteConfigurationOverride', 'NameBasicDeliveryRuleActionNameCacheKeyQueryString', 'NameBasicDeliveryRuleActionNameCacheExpiration', 'NameBasicDeliveryRuleActionNameModifyResponseHeader', 'NameBasicDeliveryRuleActionNameModifyRequestHeader', 'NameBasicDeliveryRuleActionNameURLRewrite', 'NameBasicDeliveryRuleActionNameOriginGroupOverride', 'NameBasicDeliveryRuleActionNameURLSigning', 'NameBasicDeliveryRuleActionNameURLRedirect' + Name NameBasicDeliveryRuleAction `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleRequestHeaderAction. +func (drrha DeliveryRuleRequestHeaderAction) MarshalJSON() ([]byte, error) { + drrha.Name = NameBasicDeliveryRuleActionNameModifyRequestHeader + objectMap := make(map[string]interface{}) + if drrha.Parameters != nil { + objectMap["parameters"] = drrha.Parameters + } + if drrha.Name != "" { + objectMap["name"] = drrha.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleRouteConfigurationOverrideAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRequestHeaderAction. +func (drrha DeliveryRuleRequestHeaderAction) AsDeliveryRuleRouteConfigurationOverrideAction() (*DeliveryRuleRouteConfigurationOverrideAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheKeyQueryStringAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRequestHeaderAction. +func (drrha DeliveryRuleRequestHeaderAction) AsDeliveryRuleCacheKeyQueryStringAction() (*DeliveryRuleCacheKeyQueryStringAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheExpirationAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRequestHeaderAction. +func (drrha DeliveryRuleRequestHeaderAction) AsDeliveryRuleCacheExpirationAction() (*DeliveryRuleCacheExpirationAction, bool) { + return nil, false +} + +// AsDeliveryRuleResponseHeaderAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRequestHeaderAction. +func (drrha DeliveryRuleRequestHeaderAction) AsDeliveryRuleResponseHeaderAction() (*DeliveryRuleResponseHeaderAction, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRequestHeaderAction. +func (drrha DeliveryRuleRequestHeaderAction) AsDeliveryRuleRequestHeaderAction() (*DeliveryRuleRequestHeaderAction, bool) { + return &drrha, true +} + +// AsURLRewriteAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRequestHeaderAction. +func (drrha DeliveryRuleRequestHeaderAction) AsURLRewriteAction() (*URLRewriteAction, bool) { + return nil, false +} + +// AsOriginGroupOverrideAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRequestHeaderAction. +func (drrha DeliveryRuleRequestHeaderAction) AsOriginGroupOverrideAction() (*OriginGroupOverrideAction, bool) { + return nil, false +} + +// AsURLSigningAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRequestHeaderAction. +func (drrha DeliveryRuleRequestHeaderAction) AsURLSigningAction() (*URLSigningAction, bool) { + return nil, false +} + +// AsURLRedirectAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRequestHeaderAction. +func (drrha DeliveryRuleRequestHeaderAction) AsURLRedirectAction() (*URLRedirectAction, bool) { + return nil, false +} + +// AsDeliveryRuleAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRequestHeaderAction. +func (drrha DeliveryRuleRequestHeaderAction) AsDeliveryRuleAction() (*DeliveryRuleAction, bool) { + return nil, false +} + +// AsBasicDeliveryRuleAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRequestHeaderAction. +func (drrha DeliveryRuleRequestHeaderAction) AsBasicDeliveryRuleAction() (BasicDeliveryRuleAction, bool) { + return &drrha, true +} + +// DeliveryRuleRequestHeaderCondition defines the RequestHeader condition for the delivery rule. +type DeliveryRuleRequestHeaderCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *RequestHeaderMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) MarshalJSON() ([]byte, error) { + drrhc.Name = NameRequestHeader + objectMap := make(map[string]interface{}) + if drrhc.Parameters != nil { + objectMap["parameters"] = drrhc.Parameters + } + if drrhc.Name != "" { + objectMap["name"] = drrhc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return &drrhc, true +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drrhc, true +} + +// DeliveryRuleRequestMethodCondition defines the RequestMethod condition for the delivery rule. +type DeliveryRuleRequestMethodCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *RequestMethodMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) MarshalJSON() ([]byte, error) { + drrmc.Name = NameRequestMethod + objectMap := make(map[string]interface{}) + if drrmc.Parameters != nil { + objectMap["parameters"] = drrmc.Parameters + } + if drrmc.Name != "" { + objectMap["name"] = drrmc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return &drrmc, true +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drrmc, true +} + +// DeliveryRuleRequestSchemeCondition defines the RequestScheme condition for the delivery rule. +type DeliveryRuleRequestSchemeCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *RequestSchemeMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) MarshalJSON() ([]byte, error) { + drrsc.Name = NameRequestScheme + objectMap := make(map[string]interface{}) + if drrsc.Parameters != nil { + objectMap["parameters"] = drrsc.Parameters + } + if drrsc.Name != "" { + objectMap["name"] = drrsc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return &drrsc, true +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drrsc, true +} + +// DeliveryRuleRequestURICondition defines the RequestUri condition for the delivery rule. +type DeliveryRuleRequestURICondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *RequestURIMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) MarshalJSON() ([]byte, error) { + drruc.Name = NameRequestURI + objectMap := make(map[string]interface{}) + if drruc.Parameters != nil { + objectMap["parameters"] = drruc.Parameters + } + if drruc.Name != "" { + objectMap["name"] = drruc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return &drruc, true +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drruc, true +} + +// DeliveryRuleResponseHeaderAction defines the response header action for the delivery rule. +type DeliveryRuleResponseHeaderAction struct { + // Parameters - Defines the parameters for the action. + Parameters *HeaderActionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameBasicDeliveryRuleActionNameDeliveryRuleAction', 'NameBasicDeliveryRuleActionNameRouteConfigurationOverride', 'NameBasicDeliveryRuleActionNameCacheKeyQueryString', 'NameBasicDeliveryRuleActionNameCacheExpiration', 'NameBasicDeliveryRuleActionNameModifyResponseHeader', 'NameBasicDeliveryRuleActionNameModifyRequestHeader', 'NameBasicDeliveryRuleActionNameURLRewrite', 'NameBasicDeliveryRuleActionNameOriginGroupOverride', 'NameBasicDeliveryRuleActionNameURLSigning', 'NameBasicDeliveryRuleActionNameURLRedirect' + Name NameBasicDeliveryRuleAction `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleResponseHeaderAction. +func (drrha DeliveryRuleResponseHeaderAction) MarshalJSON() ([]byte, error) { + drrha.Name = NameBasicDeliveryRuleActionNameModifyResponseHeader + objectMap := make(map[string]interface{}) + if drrha.Parameters != nil { + objectMap["parameters"] = drrha.Parameters + } + if drrha.Name != "" { + objectMap["name"] = drrha.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleRouteConfigurationOverrideAction is the BasicDeliveryRuleAction implementation for DeliveryRuleResponseHeaderAction. +func (drrha DeliveryRuleResponseHeaderAction) AsDeliveryRuleRouteConfigurationOverrideAction() (*DeliveryRuleRouteConfigurationOverrideAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheKeyQueryStringAction is the BasicDeliveryRuleAction implementation for DeliveryRuleResponseHeaderAction. +func (drrha DeliveryRuleResponseHeaderAction) AsDeliveryRuleCacheKeyQueryStringAction() (*DeliveryRuleCacheKeyQueryStringAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheExpirationAction is the BasicDeliveryRuleAction implementation for DeliveryRuleResponseHeaderAction. +func (drrha DeliveryRuleResponseHeaderAction) AsDeliveryRuleCacheExpirationAction() (*DeliveryRuleCacheExpirationAction, bool) { + return nil, false +} + +// AsDeliveryRuleResponseHeaderAction is the BasicDeliveryRuleAction implementation for DeliveryRuleResponseHeaderAction. +func (drrha DeliveryRuleResponseHeaderAction) AsDeliveryRuleResponseHeaderAction() (*DeliveryRuleResponseHeaderAction, bool) { + return &drrha, true +} + +// AsDeliveryRuleRequestHeaderAction is the BasicDeliveryRuleAction implementation for DeliveryRuleResponseHeaderAction. +func (drrha DeliveryRuleResponseHeaderAction) AsDeliveryRuleRequestHeaderAction() (*DeliveryRuleRequestHeaderAction, bool) { + return nil, false +} + +// AsURLRewriteAction is the BasicDeliveryRuleAction implementation for DeliveryRuleResponseHeaderAction. +func (drrha DeliveryRuleResponseHeaderAction) AsURLRewriteAction() (*URLRewriteAction, bool) { + return nil, false +} + +// AsOriginGroupOverrideAction is the BasicDeliveryRuleAction implementation for DeliveryRuleResponseHeaderAction. +func (drrha DeliveryRuleResponseHeaderAction) AsOriginGroupOverrideAction() (*OriginGroupOverrideAction, bool) { + return nil, false +} + +// AsURLSigningAction is the BasicDeliveryRuleAction implementation for DeliveryRuleResponseHeaderAction. +func (drrha DeliveryRuleResponseHeaderAction) AsURLSigningAction() (*URLSigningAction, bool) { + return nil, false +} + +// AsURLRedirectAction is the BasicDeliveryRuleAction implementation for DeliveryRuleResponseHeaderAction. +func (drrha DeliveryRuleResponseHeaderAction) AsURLRedirectAction() (*URLRedirectAction, bool) { + return nil, false +} + +// AsDeliveryRuleAction is the BasicDeliveryRuleAction implementation for DeliveryRuleResponseHeaderAction. +func (drrha DeliveryRuleResponseHeaderAction) AsDeliveryRuleAction() (*DeliveryRuleAction, bool) { + return nil, false +} + +// AsBasicDeliveryRuleAction is the BasicDeliveryRuleAction implementation for DeliveryRuleResponseHeaderAction. +func (drrha DeliveryRuleResponseHeaderAction) AsBasicDeliveryRuleAction() (BasicDeliveryRuleAction, bool) { + return &drrha, true +} + +// DeliveryRuleRouteConfigurationOverrideAction defines the route configuration override action for the +// delivery rule. Only applicable to Frontdoor Standard/Premium Profiles. +type DeliveryRuleRouteConfigurationOverrideAction struct { + // Parameters - Defines the parameters for the action. + Parameters *RouteConfigurationOverrideActionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameBasicDeliveryRuleActionNameDeliveryRuleAction', 'NameBasicDeliveryRuleActionNameRouteConfigurationOverride', 'NameBasicDeliveryRuleActionNameCacheKeyQueryString', 'NameBasicDeliveryRuleActionNameCacheExpiration', 'NameBasicDeliveryRuleActionNameModifyResponseHeader', 'NameBasicDeliveryRuleActionNameModifyRequestHeader', 'NameBasicDeliveryRuleActionNameURLRewrite', 'NameBasicDeliveryRuleActionNameOriginGroupOverride', 'NameBasicDeliveryRuleActionNameURLSigning', 'NameBasicDeliveryRuleActionNameURLRedirect' + Name NameBasicDeliveryRuleAction `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleRouteConfigurationOverrideAction. +func (drrcoa DeliveryRuleRouteConfigurationOverrideAction) MarshalJSON() ([]byte, error) { + drrcoa.Name = NameBasicDeliveryRuleActionNameRouteConfigurationOverride + objectMap := make(map[string]interface{}) + if drrcoa.Parameters != nil { + objectMap["parameters"] = drrcoa.Parameters + } + if drrcoa.Name != "" { + objectMap["name"] = drrcoa.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleRouteConfigurationOverrideAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRouteConfigurationOverrideAction. +func (drrcoa DeliveryRuleRouteConfigurationOverrideAction) AsDeliveryRuleRouteConfigurationOverrideAction() (*DeliveryRuleRouteConfigurationOverrideAction, bool) { + return &drrcoa, true +} + +// AsDeliveryRuleCacheKeyQueryStringAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRouteConfigurationOverrideAction. +func (drrcoa DeliveryRuleRouteConfigurationOverrideAction) AsDeliveryRuleCacheKeyQueryStringAction() (*DeliveryRuleCacheKeyQueryStringAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheExpirationAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRouteConfigurationOverrideAction. +func (drrcoa DeliveryRuleRouteConfigurationOverrideAction) AsDeliveryRuleCacheExpirationAction() (*DeliveryRuleCacheExpirationAction, bool) { + return nil, false +} + +// AsDeliveryRuleResponseHeaderAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRouteConfigurationOverrideAction. +func (drrcoa DeliveryRuleRouteConfigurationOverrideAction) AsDeliveryRuleResponseHeaderAction() (*DeliveryRuleResponseHeaderAction, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRouteConfigurationOverrideAction. +func (drrcoa DeliveryRuleRouteConfigurationOverrideAction) AsDeliveryRuleRequestHeaderAction() (*DeliveryRuleRequestHeaderAction, bool) { + return nil, false +} + +// AsURLRewriteAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRouteConfigurationOverrideAction. +func (drrcoa DeliveryRuleRouteConfigurationOverrideAction) AsURLRewriteAction() (*URLRewriteAction, bool) { + return nil, false +} + +// AsOriginGroupOverrideAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRouteConfigurationOverrideAction. +func (drrcoa DeliveryRuleRouteConfigurationOverrideAction) AsOriginGroupOverrideAction() (*OriginGroupOverrideAction, bool) { + return nil, false +} + +// AsURLSigningAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRouteConfigurationOverrideAction. +func (drrcoa DeliveryRuleRouteConfigurationOverrideAction) AsURLSigningAction() (*URLSigningAction, bool) { + return nil, false +} + +// AsURLRedirectAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRouteConfigurationOverrideAction. +func (drrcoa DeliveryRuleRouteConfigurationOverrideAction) AsURLRedirectAction() (*URLRedirectAction, bool) { + return nil, false +} + +// AsDeliveryRuleAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRouteConfigurationOverrideAction. +func (drrcoa DeliveryRuleRouteConfigurationOverrideAction) AsDeliveryRuleAction() (*DeliveryRuleAction, bool) { + return nil, false +} + +// AsBasicDeliveryRuleAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRouteConfigurationOverrideAction. +func (drrcoa DeliveryRuleRouteConfigurationOverrideAction) AsBasicDeliveryRuleAction() (BasicDeliveryRuleAction, bool) { + return &drrcoa, true +} + +// DeliveryRuleServerPortCondition defines the ServerPort condition for the delivery rule. +type DeliveryRuleServerPortCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *ServerPortMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) MarshalJSON() ([]byte, error) { + drspc.Name = NameServerPort + objectMap := make(map[string]interface{}) + if drspc.Parameters != nil { + objectMap["parameters"] = drspc.Parameters + } + if drspc.Name != "" { + objectMap["name"] = drspc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return &drspc, true +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drspc, true +} + +// DeliveryRuleSocketAddrCondition defines the SocketAddress condition for the delivery rule. +type DeliveryRuleSocketAddrCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *SocketAddrMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) MarshalJSON() ([]byte, error) { + drsac.Name = NameSocketAddr + objectMap := make(map[string]interface{}) + if drsac.Parameters != nil { + objectMap["parameters"] = drsac.Parameters + } + if drsac.Name != "" { + objectMap["name"] = drsac.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return &drsac, true +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drsac, true +} + +// DeliveryRuleSslProtocolCondition defines the SslProtocol condition for the delivery rule. +type DeliveryRuleSslProtocolCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *SslProtocolMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) MarshalJSON() ([]byte, error) { + drspc.Name = NameSslProtocol + objectMap := make(map[string]interface{}) + if drspc.Parameters != nil { + objectMap["parameters"] = drspc.Parameters + } + if drspc.Name != "" { + objectMap["name"] = drspc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return &drspc, true +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drspc, true +} + +// DeliveryRuleURLFileExtensionCondition defines the UrlFileExtension condition for the delivery rule. +type DeliveryRuleURLFileExtensionCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *URLFileExtensionMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) MarshalJSON() ([]byte, error) { + drufec.Name = NameURLFileExtension + objectMap := make(map[string]interface{}) + if drufec.Parameters != nil { + objectMap["parameters"] = drufec.Parameters + } + if drufec.Name != "" { + objectMap["name"] = drufec.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return &drufec, true +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drufec, true +} + +// DeliveryRuleURLFileNameCondition defines the UrlFileName condition for the delivery rule. +type DeliveryRuleURLFileNameCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *URLFileNameMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) MarshalJSON() ([]byte, error) { + drufnc.Name = NameURLFileName + objectMap := make(map[string]interface{}) + if drufnc.Parameters != nil { + objectMap["parameters"] = drufnc.Parameters + } + if drufnc.Name != "" { + objectMap["name"] = drufnc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return &drufnc, true +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drufnc, true +} + +// DeliveryRuleURLPathCondition defines the UrlPath condition for the delivery rule. +type DeliveryRuleURLPathCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *URLPathMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) MarshalJSON() ([]byte, error) { + drupc.Name = NameURLPath + objectMap := make(map[string]interface{}) + if drupc.Parameters != nil { + objectMap["parameters"] = drupc.Parameters + } + if drupc.Name != "" { + objectMap["name"] = drupc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return &drupc, true +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drupc, true +} + +// DimensionProperties type of operation: get, read, delete, etc. +type DimensionProperties struct { + // Name - Name of dimension. + Name *string `json:"name,omitempty"` + // DisplayName - Display name of dimension. + DisplayName *string `json:"displayName,omitempty"` + // InternalName - Internal name of dimension. + InternalName *string `json:"internalName,omitempty"` +} + +// DomainValidationProperties the JSON object that contains the properties to validate a domain. +type DomainValidationProperties struct { + // ValidationToken - READ-ONLY; Challenge used for DNS TXT record or file based validation + ValidationToken *string `json:"validationToken,omitempty"` + // ExpirationDate - READ-ONLY; The date time that the token expires + ExpirationDate *string `json:"expirationDate,omitempty"` +} + +// MarshalJSON is the custom marshaler for DomainValidationProperties. +func (dvp DomainValidationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// EdgeNode edgenode is a global Point of Presence (POP) location used to deliver CDN content to end users. +type EdgeNode struct { + *EdgeNodeProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for EdgeNode. +func (en EdgeNode) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if en.EdgeNodeProperties != nil { + objectMap["properties"] = en.EdgeNodeProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for EdgeNode struct. +func (en *EdgeNode) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var edgeNodeProperties EdgeNodeProperties + err = json.Unmarshal(*v, &edgeNodeProperties) + if err != nil { + return err + } + en.EdgeNodeProperties = &edgeNodeProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + en.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + en.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + en.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + en.SystemData = &systemData + } + } + } + + return nil +} + +// EdgeNodeProperties the JSON object that contains the properties required to create an edgenode. +type EdgeNodeProperties struct { + // IPAddressGroups - List of ip address groups. + IPAddressGroups *[]IPAddressGroup `json:"ipAddressGroups,omitempty"` +} + +// EdgenodeResult result of the request to list CDN edgenodes. It contains a list of ip address group and a +// URL link to get the next set of results. +type EdgenodeResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Edge node of CDN service. + Value *[]EdgeNode `json:"value,omitempty"` + // NextLink - URL to get the next set of edgenode list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for EdgenodeResult. +func (er EdgenodeResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if er.NextLink != nil { + objectMap["nextLink"] = er.NextLink + } + return json.Marshal(objectMap) +} + +// EdgenodeResultIterator provides access to a complete listing of EdgeNode values. +type EdgenodeResultIterator struct { + i int + page EdgenodeResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *EdgenodeResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EdgenodeResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *EdgenodeResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter EdgenodeResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter EdgenodeResultIterator) Response() EdgenodeResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter EdgenodeResultIterator) Value() EdgeNode { + if !iter.page.NotDone() { + return EdgeNode{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the EdgenodeResultIterator type. +func NewEdgenodeResultIterator(page EdgenodeResultPage) EdgenodeResultIterator { + return EdgenodeResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (er EdgenodeResult) IsEmpty() bool { + return er.Value == nil || len(*er.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (er EdgenodeResult) hasNextLink() bool { + return er.NextLink != nil && len(*er.NextLink) != 0 +} + +// edgenodeResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (er EdgenodeResult) edgenodeResultPreparer(ctx context.Context) (*http.Request, error) { + if !er.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(er.NextLink))) +} + +// EdgenodeResultPage contains a page of EdgeNode values. +type EdgenodeResultPage struct { + fn func(context.Context, EdgenodeResult) (EdgenodeResult, error) + er EdgenodeResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *EdgenodeResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EdgenodeResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.er) + if err != nil { + return err + } + page.er = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *EdgenodeResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page EdgenodeResultPage) NotDone() bool { + return !page.er.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page EdgenodeResultPage) Response() EdgenodeResult { + return page.er +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page EdgenodeResultPage) Values() []EdgeNode { + if page.er.IsEmpty() { + return nil + } + return *page.er.Value +} + +// Creates a new instance of the EdgenodeResultPage type. +func NewEdgenodeResultPage(cur EdgenodeResult, getNextPage func(context.Context, EdgenodeResult) (EdgenodeResult, error)) EdgenodeResultPage { + return EdgenodeResultPage{ + fn: getNextPage, + er: cur, + } +} + +// Endpoint CDN endpoint is the entity within a CDN profile containing configuration information such as +// origin, protocol, content caching and delivery behavior. The CDN endpoint uses the URL format +// .azureedge.net. +type Endpoint struct { + autorest.Response `json:"-"` + *EndpointProperties `json:"properties,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Endpoint. +func (e Endpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if e.EndpointProperties != nil { + objectMap["properties"] = e.EndpointProperties + } + if e.Location != nil { + objectMap["location"] = e.Location + } + if e.Tags != nil { + objectMap["tags"] = e.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Endpoint struct. +func (e *Endpoint) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var endpointProperties EndpointProperties + err = json.Unmarshal(*v, &endpointProperties) + if err != nil { + return err + } + e.EndpointProperties = &endpointProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + e.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + e.Tags = tags + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + e.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + e.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + e.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + e.SystemData = &systemData + } + } + } + + return nil +} + +// EndpointListResult result of the request to list endpoints. It contains a list of endpoint objects and a +// URL link to get the next set of results. +type EndpointListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of CDN endpoints within a profile + Value *[]Endpoint `json:"value,omitempty"` + // NextLink - URL to get the next set of endpoint objects if there is any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for EndpointListResult. +func (elr EndpointListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if elr.NextLink != nil { + objectMap["nextLink"] = elr.NextLink + } + return json.Marshal(objectMap) +} + +// EndpointListResultIterator provides access to a complete listing of Endpoint values. +type EndpointListResultIterator struct { + i int + page EndpointListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *EndpointListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *EndpointListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter EndpointListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter EndpointListResultIterator) Response() EndpointListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter EndpointListResultIterator) Value() Endpoint { + if !iter.page.NotDone() { + return Endpoint{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the EndpointListResultIterator type. +func NewEndpointListResultIterator(page EndpointListResultPage) EndpointListResultIterator { + return EndpointListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (elr EndpointListResult) IsEmpty() bool { + return elr.Value == nil || len(*elr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (elr EndpointListResult) hasNextLink() bool { + return elr.NextLink != nil && len(*elr.NextLink) != 0 +} + +// endpointListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (elr EndpointListResult) endpointListResultPreparer(ctx context.Context) (*http.Request, error) { + if !elr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(elr.NextLink))) +} + +// EndpointListResultPage contains a page of Endpoint values. +type EndpointListResultPage struct { + fn func(context.Context, EndpointListResult) (EndpointListResult, error) + elr EndpointListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *EndpointListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.elr) + if err != nil { + return err + } + page.elr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *EndpointListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page EndpointListResultPage) NotDone() bool { + return !page.elr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page EndpointListResultPage) Response() EndpointListResult { + return page.elr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page EndpointListResultPage) Values() []Endpoint { + if page.elr.IsEmpty() { + return nil + } + return *page.elr.Value +} + +// Creates a new instance of the EndpointListResultPage type. +func NewEndpointListResultPage(cur EndpointListResult, getNextPage func(context.Context, EndpointListResult) (EndpointListResult, error)) EndpointListResultPage { + return EndpointListResultPage{ + fn: getNextPage, + elr: cur, + } +} + +// EndpointProperties the JSON object that contains the properties required to create an endpoint. +type EndpointProperties struct { + // HostName - READ-ONLY; The host name of the endpoint structured as {endpointName}.{DNSZone}, e.g. contoso.azureedge.net + HostName *string `json:"hostName,omitempty"` + // Origins - The source of the content being delivered via CDN. + Origins *[]DeepCreatedOrigin `json:"origins,omitempty"` + // OriginGroups - The origin groups comprising of origins that are used for load balancing the traffic based on availability. + OriginGroups *[]DeepCreatedOriginGroup `json:"originGroups,omitempty"` + // CustomDomains - READ-ONLY; The custom domains under the endpoint. + CustomDomains *[]CustomDomain `json:"customDomains,omitempty"` + // ResourceState - READ-ONLY; Resource status of the endpoint. Possible values include: 'EndpointResourceStateCreating', 'EndpointResourceStateDeleting', 'EndpointResourceStateRunning', 'EndpointResourceStateStarting', 'EndpointResourceStateStopped', 'EndpointResourceStateStopping' + ResourceState EndpointResourceState `json:"resourceState,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning status of the endpoint. + ProvisioningState *string `json:"provisioningState,omitempty"` + // OriginPath - A directory path on the origin that CDN can use to retrieve content from, e.g. contoso.cloudapp.net/originpath. + OriginPath *string `json:"originPath,omitempty"` + // ContentTypesToCompress - List of content types on which compression applies. The value should be a valid MIME type. + ContentTypesToCompress *[]string `json:"contentTypesToCompress,omitempty"` + // OriginHostHeader - The host header value sent to the origin with each request. This property at Endpoint is only allowed when endpoint uses single origin and can be overridden by the same property specified at origin.If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. + OriginHostHeader *string `json:"originHostHeader,omitempty"` + // IsCompressionEnabled - Indicates whether content compression is enabled on CDN. Default value is false. If compression is enabled, content will be served as compressed if user requests for a compressed version. Content won't be compressed on CDN when requested content is smaller than 1 byte or larger than 1 MB. + IsCompressionEnabled *bool `json:"isCompressionEnabled,omitempty"` + // IsHTTPAllowed - Indicates whether HTTP traffic is allowed on the endpoint. Default value is true. At least one protocol (HTTP or HTTPS) must be allowed. + IsHTTPAllowed *bool `json:"isHttpAllowed,omitempty"` + // IsHTTPSAllowed - Indicates whether HTTPS traffic is allowed on the endpoint. Default value is true. At least one protocol (HTTP or HTTPS) must be allowed. + IsHTTPSAllowed *bool `json:"isHttpsAllowed,omitempty"` + // QueryStringCachingBehavior - Defines how CDN caches requests that include query strings. You can ignore any query strings when caching, bypass caching to prevent requests that contain query strings from being cached, or cache every request with a unique URL. Possible values include: 'QueryStringCachingBehaviorIgnoreQueryString', 'QueryStringCachingBehaviorBypassCaching', 'QueryStringCachingBehaviorUseQueryString', 'QueryStringCachingBehaviorNotSet' + QueryStringCachingBehavior QueryStringCachingBehavior `json:"queryStringCachingBehavior,omitempty"` + // OptimizationType - Specifies what scenario the customer wants this CDN endpoint to optimize for, e.g. Download, Media services. With this information, CDN can apply scenario driven optimization. Possible values include: 'OptimizationTypeGeneralWebDelivery', 'OptimizationTypeGeneralMediaStreaming', 'OptimizationTypeVideoOnDemandMediaStreaming', 'OptimizationTypeLargeFileDownload', 'OptimizationTypeDynamicSiteAcceleration' + OptimizationType OptimizationType `json:"optimizationType,omitempty"` + // ProbePath - Path to a file hosted on the origin which helps accelerate delivery of the dynamic content and calculate the most optimal routes for the CDN. This is relative to the origin path. This property is only relevant when using a single origin. + ProbePath *string `json:"probePath,omitempty"` + // GeoFilters - List of rules defining the user's geo access within a CDN endpoint. Each geo filter defines an access rule to a specified path or content, e.g. block APAC for path /pictures/ + GeoFilters *[]GeoFilter `json:"geoFilters,omitempty"` + // DefaultOriginGroup - A reference to the origin group. + DefaultOriginGroup *ResourceReference `json:"defaultOriginGroup,omitempty"` + // URLSigningKeys - List of keys used to validate the signed URL hashes. + URLSigningKeys *[]URLSigningKey `json:"urlSigningKeys,omitempty"` + // DeliveryPolicy - A policy that specifies the delivery rules to be used for an endpoint. + DeliveryPolicy *EndpointPropertiesUpdateParametersDeliveryPolicy `json:"deliveryPolicy,omitempty"` + // WebApplicationFirewallPolicyLink - Defines the Web Application Firewall policy for the endpoint (if applicable) + WebApplicationFirewallPolicyLink *EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink `json:"webApplicationFirewallPolicyLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for EndpointProperties. +func (ep EndpointProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ep.Origins != nil { + objectMap["origins"] = ep.Origins + } + if ep.OriginGroups != nil { + objectMap["originGroups"] = ep.OriginGroups + } + if ep.OriginPath != nil { + objectMap["originPath"] = ep.OriginPath + } + if ep.ContentTypesToCompress != nil { + objectMap["contentTypesToCompress"] = ep.ContentTypesToCompress + } + if ep.OriginHostHeader != nil { + objectMap["originHostHeader"] = ep.OriginHostHeader + } + if ep.IsCompressionEnabled != nil { + objectMap["isCompressionEnabled"] = ep.IsCompressionEnabled + } + if ep.IsHTTPAllowed != nil { + objectMap["isHttpAllowed"] = ep.IsHTTPAllowed + } + if ep.IsHTTPSAllowed != nil { + objectMap["isHttpsAllowed"] = ep.IsHTTPSAllowed + } + if ep.QueryStringCachingBehavior != "" { + objectMap["queryStringCachingBehavior"] = ep.QueryStringCachingBehavior + } + if ep.OptimizationType != "" { + objectMap["optimizationType"] = ep.OptimizationType + } + if ep.ProbePath != nil { + objectMap["probePath"] = ep.ProbePath + } + if ep.GeoFilters != nil { + objectMap["geoFilters"] = ep.GeoFilters + } + if ep.DefaultOriginGroup != nil { + objectMap["defaultOriginGroup"] = ep.DefaultOriginGroup + } + if ep.URLSigningKeys != nil { + objectMap["urlSigningKeys"] = ep.URLSigningKeys + } + if ep.DeliveryPolicy != nil { + objectMap["deliveryPolicy"] = ep.DeliveryPolicy + } + if ep.WebApplicationFirewallPolicyLink != nil { + objectMap["webApplicationFirewallPolicyLink"] = ep.WebApplicationFirewallPolicyLink + } + return json.Marshal(objectMap) +} + +// EndpointPropertiesUpdateParameters the JSON object containing endpoint update parameters. +type EndpointPropertiesUpdateParameters struct { + // OriginPath - A directory path on the origin that CDN can use to retrieve content from, e.g. contoso.cloudapp.net/originpath. + OriginPath *string `json:"originPath,omitempty"` + // ContentTypesToCompress - List of content types on which compression applies. The value should be a valid MIME type. + ContentTypesToCompress *[]string `json:"contentTypesToCompress,omitempty"` + // OriginHostHeader - The host header value sent to the origin with each request. This property at Endpoint is only allowed when endpoint uses single origin and can be overridden by the same property specified at origin.If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. + OriginHostHeader *string `json:"originHostHeader,omitempty"` + // IsCompressionEnabled - Indicates whether content compression is enabled on CDN. Default value is false. If compression is enabled, content will be served as compressed if user requests for a compressed version. Content won't be compressed on CDN when requested content is smaller than 1 byte or larger than 1 MB. + IsCompressionEnabled *bool `json:"isCompressionEnabled,omitempty"` + // IsHTTPAllowed - Indicates whether HTTP traffic is allowed on the endpoint. Default value is true. At least one protocol (HTTP or HTTPS) must be allowed. + IsHTTPAllowed *bool `json:"isHttpAllowed,omitempty"` + // IsHTTPSAllowed - Indicates whether HTTPS traffic is allowed on the endpoint. Default value is true. At least one protocol (HTTP or HTTPS) must be allowed. + IsHTTPSAllowed *bool `json:"isHttpsAllowed,omitempty"` + // QueryStringCachingBehavior - Defines how CDN caches requests that include query strings. You can ignore any query strings when caching, bypass caching to prevent requests that contain query strings from being cached, or cache every request with a unique URL. Possible values include: 'QueryStringCachingBehaviorIgnoreQueryString', 'QueryStringCachingBehaviorBypassCaching', 'QueryStringCachingBehaviorUseQueryString', 'QueryStringCachingBehaviorNotSet' + QueryStringCachingBehavior QueryStringCachingBehavior `json:"queryStringCachingBehavior,omitempty"` + // OptimizationType - Specifies what scenario the customer wants this CDN endpoint to optimize for, e.g. Download, Media services. With this information, CDN can apply scenario driven optimization. Possible values include: 'OptimizationTypeGeneralWebDelivery', 'OptimizationTypeGeneralMediaStreaming', 'OptimizationTypeVideoOnDemandMediaStreaming', 'OptimizationTypeLargeFileDownload', 'OptimizationTypeDynamicSiteAcceleration' + OptimizationType OptimizationType `json:"optimizationType,omitempty"` + // ProbePath - Path to a file hosted on the origin which helps accelerate delivery of the dynamic content and calculate the most optimal routes for the CDN. This is relative to the origin path. This property is only relevant when using a single origin. + ProbePath *string `json:"probePath,omitempty"` + // GeoFilters - List of rules defining the user's geo access within a CDN endpoint. Each geo filter defines an access rule to a specified path or content, e.g. block APAC for path /pictures/ + GeoFilters *[]GeoFilter `json:"geoFilters,omitempty"` + // DefaultOriginGroup - A reference to the origin group. + DefaultOriginGroup *ResourceReference `json:"defaultOriginGroup,omitempty"` + // URLSigningKeys - List of keys used to validate the signed URL hashes. + URLSigningKeys *[]URLSigningKey `json:"urlSigningKeys,omitempty"` + // DeliveryPolicy - A policy that specifies the delivery rules to be used for an endpoint. + DeliveryPolicy *EndpointPropertiesUpdateParametersDeliveryPolicy `json:"deliveryPolicy,omitempty"` + // WebApplicationFirewallPolicyLink - Defines the Web Application Firewall policy for the endpoint (if applicable) + WebApplicationFirewallPolicyLink *EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink `json:"webApplicationFirewallPolicyLink,omitempty"` +} + +// EndpointPropertiesUpdateParametersDeliveryPolicy a policy that specifies the delivery rules to be used +// for an endpoint. +type EndpointPropertiesUpdateParametersDeliveryPolicy struct { + // Description - User-friendly description of the policy. + Description *string `json:"description,omitempty"` + // Rules - A list of the delivery rules. + Rules *[]DeliveryRule `json:"rules,omitempty"` +} + +// EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink defines the Web Application Firewall +// policy for the endpoint (if applicable) +type EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink struct { + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// EndpointsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type EndpointsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(EndpointsClient) (Endpoint, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *EndpointsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for EndpointsCreateFuture.Result. +func (future *EndpointsCreateFuture) result(client EndpointsClient) (e Endpoint, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + e.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.EndpointsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { + e, err = client.CreateResponder(e.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsCreateFuture", "Result", e.Response.Response, "Failure responding to request") + } + } + return +} + +// EndpointsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type EndpointsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(EndpointsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *EndpointsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for EndpointsDeleteFuture.Result. +func (future *EndpointsDeleteFuture) result(client EndpointsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.EndpointsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// EndpointsLoadContentFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type EndpointsLoadContentFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(EndpointsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *EndpointsLoadContentFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for EndpointsLoadContentFuture.Result. +func (future *EndpointsLoadContentFuture) result(client EndpointsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsLoadContentFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.EndpointsLoadContentFuture") + return + } + ar.Response = future.Response() + return +} + +// EndpointsPurgeContentFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type EndpointsPurgeContentFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(EndpointsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *EndpointsPurgeContentFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for EndpointsPurgeContentFuture.Result. +func (future *EndpointsPurgeContentFuture) result(client EndpointsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsPurgeContentFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.EndpointsPurgeContentFuture") + return + } + ar.Response = future.Response() + return +} + +// EndpointsStartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type EndpointsStartFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(EndpointsClient) (Endpoint, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *EndpointsStartFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for EndpointsStartFuture.Result. +func (future *EndpointsStartFuture) result(client EndpointsClient) (e Endpoint, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + e.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.EndpointsStartFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { + e, err = client.StartResponder(e.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsStartFuture", "Result", e.Response.Response, "Failure responding to request") + } + } + return +} + +// EndpointsStopFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type EndpointsStopFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(EndpointsClient) (Endpoint, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *EndpointsStopFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for EndpointsStopFuture.Result. +func (future *EndpointsStopFuture) result(client EndpointsClient) (e Endpoint, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsStopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + e.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.EndpointsStopFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { + e, err = client.StopResponder(e.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsStopFuture", "Result", e.Response.Response, "Failure responding to request") + } + } + return +} + +// EndpointsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type EndpointsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(EndpointsClient) (Endpoint, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *EndpointsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for EndpointsUpdateFuture.Result. +func (future *EndpointsUpdateFuture) result(client EndpointsClient) (e Endpoint, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + e.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.EndpointsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { + e, err = client.UpdateResponder(e.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsUpdateFuture", "Result", e.Response.Response, "Failure responding to request") + } + } + return +} + +// EndpointType defines the ARM Resource ID for the linked endpoints +type EndpointType struct { + // ID - ARM Resource ID string. + ID *string `json:"id,omitempty"` +} + +// EndpointUpdateParameters properties required to create or update an endpoint. +type EndpointUpdateParameters struct { + // Tags - Endpoint tags. + Tags map[string]*string `json:"tags"` + *EndpointPropertiesUpdateParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for EndpointUpdateParameters. +func (eup EndpointUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if eup.Tags != nil { + objectMap["tags"] = eup.Tags + } + if eup.EndpointPropertiesUpdateParameters != nil { + objectMap["properties"] = eup.EndpointPropertiesUpdateParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for EndpointUpdateParameters struct. +func (eup *EndpointUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + eup.Tags = tags + } + case "properties": + if v != nil { + var endpointPropertiesUpdateParameters EndpointPropertiesUpdateParameters + err = json.Unmarshal(*v, &endpointPropertiesUpdateParameters) + if err != nil { + return err + } + eup.EndpointPropertiesUpdateParameters = &endpointPropertiesUpdateParameters + } + } + } + + return nil +} + +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorDetail the error detail. +type ErrorDetail struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorDetail `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDetail. +func (ed ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponse error response indicates Azure Front Door Standard or Azure Front Door Premium or CDN +// service is not able to process the incoming request. The reason is provided in the error message. +type ErrorResponse struct { + // Error - The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + +// GeoFilter rules defining user's geo access within a CDN endpoint. +type GeoFilter struct { + // RelativePath - Relative path applicable to geo filter. (e.g. '/mypictures', '/mypicture/kitty.jpg', and etc.) + RelativePath *string `json:"relativePath,omitempty"` + // Action - Action of the geo filter, i.e. allow or block access. Possible values include: 'GeoFilterActionsBlock', 'GeoFilterActionsAllow' + Action GeoFilterActions `json:"action,omitempty"` + // CountryCodes - Two letter country or region codes defining user country or region access in a geo filter, e.g. AU, MX, US. + CountryCodes *[]string `json:"countryCodes,omitempty"` +} + +// HeaderActionParameters defines the parameters for the request header action. +type HeaderActionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // HeaderAction - Action to perform. Possible values include: 'HeaderActionAppend', 'HeaderActionOverwrite', 'HeaderActionDelete' + HeaderAction HeaderAction `json:"headerAction,omitempty"` + // HeaderName - Name of the header to modify + HeaderName *string `json:"headerName,omitempty"` + // Value - Value for the specified action + Value *string `json:"value,omitempty"` +} + +// HealthProbeParameters the JSON object that contains the properties to send health probes to origin. +type HealthProbeParameters struct { + // ProbePath - The path relative to the origin that is used to determine the health of the origin. + ProbePath *string `json:"probePath,omitempty"` + // ProbeRequestType - The type of health probe request that is made. Possible values include: 'HealthProbeRequestTypeNotSet', 'HealthProbeRequestTypeGET', 'HealthProbeRequestTypeHEAD' + ProbeRequestType HealthProbeRequestType `json:"probeRequestType,omitempty"` + // ProbeProtocol - Protocol to use for health probe. Possible values include: 'ProbeProtocolNotSet', 'ProbeProtocolHTTP', 'ProbeProtocolHTTPS' + ProbeProtocol ProbeProtocol `json:"probeProtocol,omitempty"` + // ProbeIntervalInSeconds - The number of seconds between health probes.Default is 240sec. + ProbeIntervalInSeconds *int32 `json:"probeIntervalInSeconds,omitempty"` +} + +// HostNameMatchConditionParameters defines the parameters for HostName match conditions +type HostNameMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched. Possible values include: 'HostNameOperatorAny', 'HostNameOperatorEqual', 'HostNameOperatorContains', 'HostNameOperatorBeginsWith', 'HostNameOperatorEndsWith', 'HostNameOperatorLessThan', 'HostNameOperatorLessThanOrEqual', 'HostNameOperatorGreaterThan', 'HostNameOperatorGreaterThanOrEqual', 'HostNameOperatorRegEx' + Operator HostNameOperator `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// HTTPErrorRangeParameters the JSON object that represents the range for http status codes +type HTTPErrorRangeParameters struct { + // Begin - The inclusive start of the http status code range. + Begin *int32 `json:"begin,omitempty"` + // End - The inclusive end of the http status code range. + End *int32 `json:"end,omitempty"` +} + +// HTTPVersionMatchConditionParameters defines the parameters for HttpVersion match conditions +type HTTPVersionMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched + Operator *string `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// IPAddressGroup CDN Ip address group +type IPAddressGroup struct { + // DeliveryRegion - The delivery region of the ip address group + DeliveryRegion *string `json:"deliveryRegion,omitempty"` + // Ipv4Addresses - The list of ip v4 addresses. + Ipv4Addresses *[]CidrIPAddress `json:"ipv4Addresses,omitempty"` + // Ipv6Addresses - The list of ip v6 addresses. + Ipv6Addresses *[]CidrIPAddress `json:"ipv6Addresses,omitempty"` +} + +// IsDeviceMatchConditionParameters defines the parameters for IsDevice match conditions +type IsDeviceMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched + Operator *string `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// KeyVaultCertificateSourceParameters describes the parameters for using a user's KeyVault certificate for +// securing custom domain. +type KeyVaultCertificateSourceParameters struct { + TypeName *string `json:"typeName,omitempty"` + // SubscriptionID - Subscription Id of the user's Key Vault containing the SSL certificate + SubscriptionID *string `json:"subscriptionId,omitempty"` + // ResourceGroupName - Resource group of the user's Key Vault containing the SSL certificate + ResourceGroupName *string `json:"resourceGroupName,omitempty"` + // VaultName - The name of the user's Key Vault containing the SSL certificate + VaultName *string `json:"vaultName,omitempty"` + // SecretName - The name of Key Vault Secret (representing the full certificate PFX) in Key Vault. + SecretName *string `json:"secretName,omitempty"` + // SecretVersion - The version(GUID) of Key Vault Secret in Key Vault. + SecretVersion *string `json:"secretVersion,omitempty"` + // UpdateRule - Describes the action that shall be taken when the certificate is updated in Key Vault. + UpdateRule *string `json:"updateRule,omitempty"` + // DeleteRule - Describes the action that shall be taken when the certificate is removed from Key Vault. + DeleteRule *string `json:"deleteRule,omitempty"` +} + +// KeyVaultSigningKeyParameters describes the parameters for using a user's KeyVault for URL Signing Key. +type KeyVaultSigningKeyParameters struct { + TypeName *string `json:"typeName,omitempty"` + // SubscriptionID - Subscription Id of the user's Key Vault containing the secret + SubscriptionID *string `json:"subscriptionId,omitempty"` + // ResourceGroupName - Resource group of the user's Key Vault containing the secret + ResourceGroupName *string `json:"resourceGroupName,omitempty"` + // VaultName - The name of the user's Key Vault containing the secret + VaultName *string `json:"vaultName,omitempty"` + // SecretName - The name of secret in Key Vault. + SecretName *string `json:"secretName,omitempty"` + // SecretVersion - The version(GUID) of secret in Key Vault. + SecretVersion *string `json:"secretVersion,omitempty"` +} + +// LoadBalancingSettingsParameters round-Robin load balancing settings for a backend pool +type LoadBalancingSettingsParameters struct { + // SampleSize - The number of samples to consider for load balancing decisions + SampleSize *int32 `json:"sampleSize,omitempty"` + // SuccessfulSamplesRequired - The number of samples within the sample period that must succeed + SuccessfulSamplesRequired *int32 `json:"successfulSamplesRequired,omitempty"` + // AdditionalLatencyInMilliseconds - The additional latency in milliseconds for probes to fall into the lowest latency bucket + AdditionalLatencyInMilliseconds *int32 `json:"additionalLatencyInMilliseconds,omitempty"` +} + +// LoadParameters parameters required for content load. +type LoadParameters struct { + // ContentPaths - The path to the content to be loaded. Path should be a relative file URL of the origin. + ContentPaths *[]string `json:"contentPaths,omitempty"` +} + +// LogSpecification log specification of operation. +type LogSpecification struct { + // Name - Name of log specification. + Name *string `json:"name,omitempty"` + // DisplayName - Display name of log specification. + DisplayName *string `json:"displayName,omitempty"` + // BlobDuration - Blob duration of specification. + BlobDuration *string `json:"blobDuration,omitempty"` + // LogFilterPattern - Pattern to filter based on name + LogFilterPattern *string `json:"logFilterPattern,omitempty"` +} + +// ManagedCertificate managed Certificate used for https +type ManagedCertificate struct { + // Type - Possible values include: 'SecretTypeURLSigningKey', 'SecretTypeCustomerCertificate', 'SecretTypeManagedCertificate', 'SecretTypeAzureFirstPartyManagedCertificate' + Type SecretType `json:"type,omitempty"` + // Subject - READ-ONLY; Subject name in the certificate. + Subject *string `json:"subject,omitempty"` + // ExpirationDate - READ-ONLY; Certificate expiration date. + ExpirationDate *string `json:"expirationDate,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedCertificate. +func (mc ManagedCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mc.Type != "" { + objectMap["type"] = mc.Type + } + return json.Marshal(objectMap) +} + +// ManagedCertificateParameters managed Certificate used for https +type ManagedCertificateParameters struct { + // Subject - READ-ONLY; Subject name in the certificate. + Subject *string `json:"subject,omitempty"` + // ExpirationDate - READ-ONLY; Certificate expiration date. + ExpirationDate *string `json:"expirationDate,omitempty"` + // Type - Possible values include: 'TypeBasicSecretParametersTypeSecretParameters', 'TypeBasicSecretParametersTypeURLSigningKey', 'TypeBasicSecretParametersTypeManagedCertificate', 'TypeBasicSecretParametersTypeCustomerCertificate', 'TypeBasicSecretParametersTypeAzureFirstPartyManagedCertificate' + Type TypeBasicSecretParameters `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedCertificateParameters. +func (mcp ManagedCertificateParameters) MarshalJSON() ([]byte, error) { + mcp.Type = TypeBasicSecretParametersTypeManagedCertificate + objectMap := make(map[string]interface{}) + if mcp.Type != "" { + objectMap["type"] = mcp.Type + } + return json.Marshal(objectMap) +} + +// AsURLSigningKeyParameters is the BasicSecretParameters implementation for ManagedCertificateParameters. +func (mcp ManagedCertificateParameters) AsURLSigningKeyParameters() (*URLSigningKeyParameters, bool) { + return nil, false +} + +// AsManagedCertificateParameters is the BasicSecretParameters implementation for ManagedCertificateParameters. +func (mcp ManagedCertificateParameters) AsManagedCertificateParameters() (*ManagedCertificateParameters, bool) { + return &mcp, true +} + +// AsCustomerCertificateParameters is the BasicSecretParameters implementation for ManagedCertificateParameters. +func (mcp ManagedCertificateParameters) AsCustomerCertificateParameters() (*CustomerCertificateParameters, bool) { + return nil, false +} + +// AsAzureFirstPartyManagedCertificateParameters is the BasicSecretParameters implementation for ManagedCertificateParameters. +func (mcp ManagedCertificateParameters) AsAzureFirstPartyManagedCertificateParameters() (*AzureFirstPartyManagedCertificateParameters, bool) { + return nil, false +} + +// AsSecretParameters is the BasicSecretParameters implementation for ManagedCertificateParameters. +func (mcp ManagedCertificateParameters) AsSecretParameters() (*SecretParameters, bool) { + return nil, false +} + +// AsBasicSecretParameters is the BasicSecretParameters implementation for ManagedCertificateParameters. +func (mcp ManagedCertificateParameters) AsBasicSecretParameters() (BasicSecretParameters, bool) { + return &mcp, true +} + +// ManagedHTTPSParameters defines the certificate source parameters using CDN managed certificate for +// enabling SSL. +type ManagedHTTPSParameters struct { + // CertificateSourceParameters - Defines the certificate source parameters using CDN managed certificate for enabling SSL. + CertificateSourceParameters *CertificateSourceParameters `json:"certificateSourceParameters,omitempty"` + // ProtocolType - Defines the TLS extension protocol that is used for secure delivery. Possible values include: 'ProtocolTypeServerNameIndication', 'ProtocolTypeIPBased' + ProtocolType ProtocolType `json:"protocolType,omitempty"` + // MinimumTLSVersion - TLS protocol version that will be used for Https. Possible values include: 'MinimumTLSVersionNone', 'MinimumTLSVersionTLS10', 'MinimumTLSVersionTLS12' + MinimumTLSVersion MinimumTLSVersion `json:"minimumTlsVersion,omitempty"` + // CertificateSource - Possible values include: 'CertificateSourceCustomDomainHTTPSParameters', 'CertificateSourceAzureKeyVault', 'CertificateSourceCdn' + CertificateSource CertificateSource `json:"certificateSource,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedHTTPSParameters. +func (mhp ManagedHTTPSParameters) MarshalJSON() ([]byte, error) { + mhp.CertificateSource = CertificateSourceCdn + objectMap := make(map[string]interface{}) + if mhp.CertificateSourceParameters != nil { + objectMap["certificateSourceParameters"] = mhp.CertificateSourceParameters + } + if mhp.ProtocolType != "" { + objectMap["protocolType"] = mhp.ProtocolType + } + if mhp.MinimumTLSVersion != "" { + objectMap["minimumTlsVersion"] = mhp.MinimumTLSVersion + } + if mhp.CertificateSource != "" { + objectMap["certificateSource"] = mhp.CertificateSource + } + return json.Marshal(objectMap) +} + +// AsUserManagedHTTPSParameters is the BasicCustomDomainHTTPSParameters implementation for ManagedHTTPSParameters. +func (mhp ManagedHTTPSParameters) AsUserManagedHTTPSParameters() (*UserManagedHTTPSParameters, bool) { + return nil, false +} + +// AsManagedHTTPSParameters is the BasicCustomDomainHTTPSParameters implementation for ManagedHTTPSParameters. +func (mhp ManagedHTTPSParameters) AsManagedHTTPSParameters() (*ManagedHTTPSParameters, bool) { + return &mhp, true +} + +// AsCustomDomainHTTPSParameters is the BasicCustomDomainHTTPSParameters implementation for ManagedHTTPSParameters. +func (mhp ManagedHTTPSParameters) AsCustomDomainHTTPSParameters() (*CustomDomainHTTPSParameters, bool) { + return nil, false +} + +// AsBasicCustomDomainHTTPSParameters is the BasicCustomDomainHTTPSParameters implementation for ManagedHTTPSParameters. +func (mhp ManagedHTTPSParameters) AsBasicCustomDomainHTTPSParameters() (BasicCustomDomainHTTPSParameters, bool) { + return &mhp, true +} + +// ManagedRuleDefinition describes a managed rule definition. +type ManagedRuleDefinition struct { + // RuleID - READ-ONLY; Identifier for the managed rule. + RuleID *string `json:"ruleId,omitempty"` + // Description - READ-ONLY; Describes the functionality of the managed rule. + Description *string `json:"description,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedRuleDefinition. +func (mrd ManagedRuleDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ManagedRuleGroupDefinition describes a managed rule group. +type ManagedRuleGroupDefinition struct { + // RuleGroupName - READ-ONLY; Name of the managed rule group. + RuleGroupName *string `json:"ruleGroupName,omitempty"` + // Description - READ-ONLY; Description of the managed rule group. + Description *string `json:"description,omitempty"` + // Rules - READ-ONLY; List of rules within the managed rule group. + Rules *[]ManagedRuleDefinition `json:"rules,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedRuleGroupDefinition. +func (mrgd ManagedRuleGroupDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ManagedRuleGroupOverride defines a managed rule group override setting. +type ManagedRuleGroupOverride struct { + // RuleGroupName - Describes the managed rule group within the rule set to override + RuleGroupName *string `json:"ruleGroupName,omitempty"` + // Rules - List of rules that will be disabled. If none specified, all rules in the group will be disabled. + Rules *[]ManagedRuleOverride `json:"rules,omitempty"` +} + +// ManagedRuleOverride defines a managed rule group override setting. +type ManagedRuleOverride struct { + // RuleID - Identifier for the managed rule. + RuleID *string `json:"ruleId,omitempty"` + // EnabledState - Describes if the managed rule is in enabled or disabled state. Defaults to Disabled if not specified. Possible values include: 'ManagedRuleEnabledStateDisabled', 'ManagedRuleEnabledStateEnabled' + EnabledState ManagedRuleEnabledState `json:"enabledState,omitempty"` + // Action - Describes the override action to be applied when rule matches. Possible values include: 'ActionTypeAllow', 'ActionTypeBlock', 'ActionTypeLog', 'ActionTypeRedirect' + Action ActionType `json:"action,omitempty"` +} + +// ManagedRuleSet defines a managed rule set. +type ManagedRuleSet struct { + // RuleSetType - Defines the rule set type to use. + RuleSetType *string `json:"ruleSetType,omitempty"` + // RuleSetVersion - Defines the version of the rule set to use. + RuleSetVersion *string `json:"ruleSetVersion,omitempty"` + // AnomalyScore - Verizon only : If the rule set supports anomaly detection mode, this describes the threshold for blocking requests. + AnomalyScore *int32 `json:"anomalyScore,omitempty"` + // RuleGroupOverrides - Defines the rule overrides to apply to the rule set. + RuleGroupOverrides *[]ManagedRuleGroupOverride `json:"ruleGroupOverrides,omitempty"` +} + +// ManagedRuleSetDefinition describes a managed rule set definition. +type ManagedRuleSetDefinition struct { + // ManagedRuleSetDefinitionProperties - Describes managed rule set definition properties. + *ManagedRuleSetDefinitionProperties `json:"properties,omitempty"` + // Sku - The pricing tier (defines a CDN provider, feature list and rate) of the CdnWebApplicationFirewallPolicy. + Sku *Sku `json:"sku,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedRuleSetDefinition. +func (mrsd ManagedRuleSetDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mrsd.ManagedRuleSetDefinitionProperties != nil { + objectMap["properties"] = mrsd.ManagedRuleSetDefinitionProperties + } + if mrsd.Sku != nil { + objectMap["sku"] = mrsd.Sku + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagedRuleSetDefinition struct. +func (mrsd *ManagedRuleSetDefinition) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var managedRuleSetDefinitionProperties ManagedRuleSetDefinitionProperties + err = json.Unmarshal(*v, &managedRuleSetDefinitionProperties) + if err != nil { + return err + } + mrsd.ManagedRuleSetDefinitionProperties = &managedRuleSetDefinitionProperties + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + mrsd.Sku = &sku + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mrsd.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mrsd.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mrsd.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mrsd.SystemData = &systemData + } + } + } + + return nil +} + +// ManagedRuleSetDefinitionList list of managed rule set definitions available for use in a policy. +type ManagedRuleSetDefinitionList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of managed rule set definitions. + Value *[]ManagedRuleSetDefinition `json:"value,omitempty"` + // NextLink - URL to retrieve next set of managed rule set definitions. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedRuleSetDefinitionList. +func (mrsdl ManagedRuleSetDefinitionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mrsdl.NextLink != nil { + objectMap["nextLink"] = mrsdl.NextLink + } + return json.Marshal(objectMap) +} + +// ManagedRuleSetDefinitionListIterator provides access to a complete listing of ManagedRuleSetDefinition +// values. +type ManagedRuleSetDefinitionListIterator struct { + i int + page ManagedRuleSetDefinitionListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ManagedRuleSetDefinitionListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedRuleSetDefinitionListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ManagedRuleSetDefinitionListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ManagedRuleSetDefinitionListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ManagedRuleSetDefinitionListIterator) Response() ManagedRuleSetDefinitionList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ManagedRuleSetDefinitionListIterator) Value() ManagedRuleSetDefinition { + if !iter.page.NotDone() { + return ManagedRuleSetDefinition{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ManagedRuleSetDefinitionListIterator type. +func NewManagedRuleSetDefinitionListIterator(page ManagedRuleSetDefinitionListPage) ManagedRuleSetDefinitionListIterator { + return ManagedRuleSetDefinitionListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mrsdl ManagedRuleSetDefinitionList) IsEmpty() bool { + return mrsdl.Value == nil || len(*mrsdl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mrsdl ManagedRuleSetDefinitionList) hasNextLink() bool { + return mrsdl.NextLink != nil && len(*mrsdl.NextLink) != 0 +} + +// managedRuleSetDefinitionListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mrsdl ManagedRuleSetDefinitionList) managedRuleSetDefinitionListPreparer(ctx context.Context) (*http.Request, error) { + if !mrsdl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mrsdl.NextLink))) +} + +// ManagedRuleSetDefinitionListPage contains a page of ManagedRuleSetDefinition values. +type ManagedRuleSetDefinitionListPage struct { + fn func(context.Context, ManagedRuleSetDefinitionList) (ManagedRuleSetDefinitionList, error) + mrsdl ManagedRuleSetDefinitionList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ManagedRuleSetDefinitionListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedRuleSetDefinitionListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.mrsdl) + if err != nil { + return err + } + page.mrsdl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ManagedRuleSetDefinitionListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ManagedRuleSetDefinitionListPage) NotDone() bool { + return !page.mrsdl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ManagedRuleSetDefinitionListPage) Response() ManagedRuleSetDefinitionList { + return page.mrsdl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ManagedRuleSetDefinitionListPage) Values() []ManagedRuleSetDefinition { + if page.mrsdl.IsEmpty() { + return nil + } + return *page.mrsdl.Value +} + +// Creates a new instance of the ManagedRuleSetDefinitionListPage type. +func NewManagedRuleSetDefinitionListPage(cur ManagedRuleSetDefinitionList, getNextPage func(context.Context, ManagedRuleSetDefinitionList) (ManagedRuleSetDefinitionList, error)) ManagedRuleSetDefinitionListPage { + return ManagedRuleSetDefinitionListPage{ + fn: getNextPage, + mrsdl: cur, + } +} + +// ManagedRuleSetDefinitionProperties properties for a managed rule set definition. +type ManagedRuleSetDefinitionProperties struct { + // ProvisioningState - READ-ONLY; Provisioning state of the managed rule set. + ProvisioningState *string `json:"provisioningState,omitempty"` + // RuleSetType - READ-ONLY; Type of the managed rule set. + RuleSetType *string `json:"ruleSetType,omitempty"` + // RuleSetVersion - READ-ONLY; Version of the managed rule set type. + RuleSetVersion *string `json:"ruleSetVersion,omitempty"` + // RuleGroups - READ-ONLY; Rule groups of the managed rule set. + RuleGroups *[]ManagedRuleGroupDefinition `json:"ruleGroups,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedRuleSetDefinitionProperties. +func (mrsdp ManagedRuleSetDefinitionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ManagedRuleSetList defines the list of managed rule sets for the policy. +type ManagedRuleSetList struct { + // ManagedRuleSets - List of rule sets. + ManagedRuleSets *[]ManagedRuleSet `json:"managedRuleSets,omitempty"` +} + +// MatchCondition define match conditions +type MatchCondition struct { + // MatchVariable - Match variable to compare against. Possible values include: 'WafMatchVariableRemoteAddr', 'WafMatchVariableSocketAddr', 'WafMatchVariableRequestMethod', 'WafMatchVariableRequestHeader', 'WafMatchVariableRequestURI', 'WafMatchVariableQueryString', 'WafMatchVariableRequestBody', 'WafMatchVariableCookies', 'WafMatchVariablePostArgs' + MatchVariable WafMatchVariable `json:"matchVariable,omitempty"` + // Selector - Selector can used to match a specific key for QueryString, Cookies, RequestHeader or PostArgs. + Selector *string `json:"selector,omitempty"` + // Operator - Describes operator to be matched. Possible values include: 'OperatorAny', 'OperatorIPMatch', 'OperatorGeoMatch', 'OperatorEqual', 'OperatorContains', 'OperatorLessThan', 'OperatorGreaterThan', 'OperatorLessThanOrEqual', 'OperatorGreaterThanOrEqual', 'OperatorBeginsWith', 'OperatorEndsWith', 'OperatorRegEx' + Operator Operator `json:"operator,omitempty"` + // NegateCondition - Describes if the result of this condition should be negated. + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValue - List of possible match values. + MatchValue *[]string `json:"matchValue,omitempty"` + // Transforms - List of transforms. + Transforms *[]TransformType `json:"transforms,omitempty"` +} + +// MetricAvailability retention policy of a resource metric. +type MetricAvailability struct { + TimeGrain *string `json:"timeGrain,omitempty"` + BlobDuration *string `json:"blobDuration,omitempty"` +} + +// MetricSpecification metric specification of operation. +type MetricSpecification struct { + // Name - Name of metric specification. + Name *string `json:"name,omitempty"` + // DisplayName - Display name of metric specification. + DisplayName *string `json:"displayName,omitempty"` + // DisplayDescription - Display description of metric specification. + DisplayDescription *string `json:"displayDescription,omitempty"` + // Unit - The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. + Unit *string `json:"unit,omitempty"` + // AggregationType - The metric aggregation type. Possible values include: 'Average', 'Count', 'Total'. + AggregationType *string `json:"aggregationType,omitempty"` + // Availabilities - Retention policies of a resource metric. + Availabilities *[]MetricAvailability `json:"availabilities,omitempty"` + // SupportedTimeGrainTypes - The supported time grain types for the metrics. + SupportedTimeGrainTypes *[]string `json:"supportedTimeGrainTypes,omitempty"` + // Dimensions - The dimensions of metric + Dimensions *[]DimensionProperties `json:"dimensions,omitempty"` + // FillGapWithZero - Property to specify whether to fill gap with zero. + FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` + // MetricFilterPattern - Pattern to filter based on name + MetricFilterPattern *string `json:"metricFilterPattern,omitempty"` + // IsInternal - Property to specify metric is internal or not. + IsInternal *bool `json:"isInternal,omitempty"` +} + +// MetricsResponse metrics Response +type MetricsResponse struct { + autorest.Response `json:"-"` + DateTimeBegin *date.Time `json:"dateTimeBegin,omitempty"` + DateTimeEnd *date.Time `json:"dateTimeEnd,omitempty"` + // Granularity - Possible values include: 'GranularityPT5M', 'GranularityPT1H', 'GranularityP1D' + Granularity Granularity `json:"granularity,omitempty"` + Series *[]MetricsResponseSeriesItem `json:"series,omitempty"` +} + +// MetricsResponseSeriesItem ... +type MetricsResponseSeriesItem struct { + Metric *string `json:"metric,omitempty"` + // Unit - Possible values include: 'UnitCount', 'UnitBytes', 'UnitBitsPerSecond', 'UnitMilliSeconds' + Unit Unit `json:"unit,omitempty"` + Groups *[]MetricsResponseSeriesItemGroupsItem `json:"groups,omitempty"` + Data *[]MetricsResponseSeriesItemDataItem `json:"data,omitempty"` +} + +// MetricsResponseSeriesItemDataItem ... +type MetricsResponseSeriesItemDataItem struct { + DateTime *date.Time `json:"dateTime,omitempty"` + Value *float64 `json:"value,omitempty"` +} + +// MetricsResponseSeriesItemGroupsItem ... +type MetricsResponseSeriesItemGroupsItem struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +// Operation CDN REST API operation +type Operation struct { + // Name - READ-ONLY; Operation name: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // IsDataAction - Indicates whether the operation is a data action + IsDataAction *bool `json:"isDataAction,omitempty"` + // Display - The object that represents the operation. + Display *OperationDisplay `json:"display,omitempty"` + // Origin - READ-ONLY; The origin of operations. + Origin *string `json:"origin,omitempty"` + // OperationProperties - Properties of operation, include metric specifications. + *OperationProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if o.IsDataAction != nil { + objectMap["isDataAction"] = o.IsDataAction + } + if o.Display != nil { + objectMap["display"] = o.Display + } + if o.OperationProperties != nil { + objectMap["properties"] = o.OperationProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Operation struct. +func (o *Operation) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + o.Name = &name + } + case "isDataAction": + if v != nil { + var isDataAction bool + err = json.Unmarshal(*v, &isDataAction) + if err != nil { + return err + } + o.IsDataAction = &isDataAction + } + case "display": + if v != nil { + var display OperationDisplay + err = json.Unmarshal(*v, &display) + if err != nil { + return err + } + o.Display = &display + } + case "origin": + if v != nil { + var origin string + err = json.Unmarshal(*v, &origin) + if err != nil { + return err + } + o.Origin = &origin + } + case "properties": + if v != nil { + var operationProperties OperationProperties + err = json.Unmarshal(*v, &operationProperties) + if err != nil { + return err + } + o.OperationProperties = &operationProperties + } + } + } + + return nil +} + +// OperationDisplay the object that represents the operation. +type OperationDisplay struct { + // Provider - READ-ONLY; Service provider: Microsoft.Cdn + Provider *string `json:"provider,omitempty"` + // Resource - READ-ONLY; Resource on which the operation is performed: Profile, endpoint, etc. + Resource *string `json:"resource,omitempty"` + // Operation - READ-ONLY; Operation type: Read, write, delete, etc. + Operation *string `json:"operation,omitempty"` + // Description - READ-ONLY; Description of operation. + Description *string `json:"description,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationProperties properties of operation, include metric specifications. +type OperationProperties struct { + // ServiceSpecification - One property of operation, include metric specifications. + ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` +} + +// OperationsListResult result of the request to list CDN operations. It contains a list of operations and +// a URL link to get the next set of results. +type OperationsListResult struct { + autorest.Response `json:"-"` + // Value - List of CDN operations supported by the CDN resource provider. + Value *[]Operation `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationsListResultIterator provides access to a complete listing of Operation values. +type OperationsListResultIterator struct { + i int + page OperationsListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationsListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationsListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationsListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationsListResultIterator) Response() OperationsListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationsListResultIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationsListResultIterator type. +func NewOperationsListResultIterator(page OperationsListResultPage) OperationsListResultIterator { + return OperationsListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OperationsListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (olr OperationsListResult) hasNextLink() bool { + return olr.NextLink != nil && len(*olr.NextLink) != 0 +} + +// operationsListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OperationsListResult) operationsListResultPreparer(ctx context.Context) (*http.Request, error) { + if !olr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationsListResultPage contains a page of Operation values. +type OperationsListResultPage struct { + fn func(context.Context, OperationsListResult) (OperationsListResult, error) + olr OperationsListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationsListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.olr) + if err != nil { + return err + } + page.olr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationsListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationsListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationsListResultPage) Response() OperationsListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationsListResultPage) Values() []Operation { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OperationsListResultPage type. +func NewOperationsListResultPage(cur OperationsListResult, getNextPage func(context.Context, OperationsListResult) (OperationsListResult, error)) OperationsListResultPage { + return OperationsListResultPage{ + fn: getNextPage, + olr: cur, + } +} + +// Origin CDN origin is the source of the content being delivered via CDN. When the edge nodes represented +// by an endpoint do not have the requested content cached, they attempt to fetch it from one or more of +// the configured origins. +type Origin struct { + autorest.Response `json:"-"` + *OriginProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Origin. +func (o Origin) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if o.OriginProperties != nil { + objectMap["properties"] = o.OriginProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Origin struct. +func (o *Origin) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var originProperties OriginProperties + err = json.Unmarshal(*v, &originProperties) + if err != nil { + return err + } + o.OriginProperties = &originProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + o.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + o.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + o.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + o.SystemData = &systemData + } + } + } + + return nil +} + +// OriginGroup origin group comprising of origins is used for load balancing to origins when the content +// cannot be served from CDN. +type OriginGroup struct { + autorest.Response `json:"-"` + *OriginGroupProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for OriginGroup. +func (og OriginGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if og.OriginGroupProperties != nil { + objectMap["properties"] = og.OriginGroupProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for OriginGroup struct. +func (og *OriginGroup) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var originGroupProperties OriginGroupProperties + err = json.Unmarshal(*v, &originGroupProperties) + if err != nil { + return err + } + og.OriginGroupProperties = &originGroupProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + og.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + og.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + og.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + og.SystemData = &systemData + } + } + } + + return nil +} + +// OriginGroupListResult result of the request to list origin groups. It contains a list of origin groups +// objects and a URL link to get the next set of results. +type OriginGroupListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of CDN origin groups within an endpoint + Value *[]OriginGroup `json:"value,omitempty"` + // NextLink - URL to get the next set of origin objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for OriginGroupListResult. +func (oglr OriginGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if oglr.NextLink != nil { + objectMap["nextLink"] = oglr.NextLink + } + return json.Marshal(objectMap) +} + +// OriginGroupListResultIterator provides access to a complete listing of OriginGroup values. +type OriginGroupListResultIterator struct { + i int + page OriginGroupListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OriginGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginGroupListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OriginGroupListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OriginGroupListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OriginGroupListResultIterator) Response() OriginGroupListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OriginGroupListResultIterator) Value() OriginGroup { + if !iter.page.NotDone() { + return OriginGroup{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OriginGroupListResultIterator type. +func NewOriginGroupListResultIterator(page OriginGroupListResultPage) OriginGroupListResultIterator { + return OriginGroupListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (oglr OriginGroupListResult) IsEmpty() bool { + return oglr.Value == nil || len(*oglr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (oglr OriginGroupListResult) hasNextLink() bool { + return oglr.NextLink != nil && len(*oglr.NextLink) != 0 +} + +// originGroupListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (oglr OriginGroupListResult) originGroupListResultPreparer(ctx context.Context) (*http.Request, error) { + if !oglr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(oglr.NextLink))) +} + +// OriginGroupListResultPage contains a page of OriginGroup values. +type OriginGroupListResultPage struct { + fn func(context.Context, OriginGroupListResult) (OriginGroupListResult, error) + oglr OriginGroupListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OriginGroupListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginGroupListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.oglr) + if err != nil { + return err + } + page.oglr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OriginGroupListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OriginGroupListResultPage) NotDone() bool { + return !page.oglr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OriginGroupListResultPage) Response() OriginGroupListResult { + return page.oglr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OriginGroupListResultPage) Values() []OriginGroup { + if page.oglr.IsEmpty() { + return nil + } + return *page.oglr.Value +} + +// Creates a new instance of the OriginGroupListResultPage type. +func NewOriginGroupListResultPage(cur OriginGroupListResult, getNextPage func(context.Context, OriginGroupListResult) (OriginGroupListResult, error)) OriginGroupListResultPage { + return OriginGroupListResultPage{ + fn: getNextPage, + oglr: cur, + } +} + +// OriginGroupOverride defines the parameters for the origin group override configuration. +type OriginGroupOverride struct { + // OriginGroup - defines the OriginGroup that would override the DefaultOriginGroup on route. + OriginGroup *ResourceReference `json:"originGroup,omitempty"` + // ForwardingProtocol - Protocol this rule will use when forwarding traffic to backends. Possible values include: 'ForwardingProtocolHTTPOnly', 'ForwardingProtocolHTTPSOnly', 'ForwardingProtocolMatchRequest' + ForwardingProtocol ForwardingProtocol `json:"forwardingProtocol,omitempty"` +} + +// OriginGroupOverrideAction defines the origin group override action for the delivery rule. +type OriginGroupOverrideAction struct { + // Parameters - Defines the parameters for the action. + Parameters *OriginGroupOverrideActionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameBasicDeliveryRuleActionNameDeliveryRuleAction', 'NameBasicDeliveryRuleActionNameRouteConfigurationOverride', 'NameBasicDeliveryRuleActionNameCacheKeyQueryString', 'NameBasicDeliveryRuleActionNameCacheExpiration', 'NameBasicDeliveryRuleActionNameModifyResponseHeader', 'NameBasicDeliveryRuleActionNameModifyRequestHeader', 'NameBasicDeliveryRuleActionNameURLRewrite', 'NameBasicDeliveryRuleActionNameOriginGroupOverride', 'NameBasicDeliveryRuleActionNameURLSigning', 'NameBasicDeliveryRuleActionNameURLRedirect' + Name NameBasicDeliveryRuleAction `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for OriginGroupOverrideAction. +func (ogoa OriginGroupOverrideAction) MarshalJSON() ([]byte, error) { + ogoa.Name = NameBasicDeliveryRuleActionNameOriginGroupOverride + objectMap := make(map[string]interface{}) + if ogoa.Parameters != nil { + objectMap["parameters"] = ogoa.Parameters + } + if ogoa.Name != "" { + objectMap["name"] = ogoa.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleRouteConfigurationOverrideAction is the BasicDeliveryRuleAction implementation for OriginGroupOverrideAction. +func (ogoa OriginGroupOverrideAction) AsDeliveryRuleRouteConfigurationOverrideAction() (*DeliveryRuleRouteConfigurationOverrideAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheKeyQueryStringAction is the BasicDeliveryRuleAction implementation for OriginGroupOverrideAction. +func (ogoa OriginGroupOverrideAction) AsDeliveryRuleCacheKeyQueryStringAction() (*DeliveryRuleCacheKeyQueryStringAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheExpirationAction is the BasicDeliveryRuleAction implementation for OriginGroupOverrideAction. +func (ogoa OriginGroupOverrideAction) AsDeliveryRuleCacheExpirationAction() (*DeliveryRuleCacheExpirationAction, bool) { + return nil, false +} + +// AsDeliveryRuleResponseHeaderAction is the BasicDeliveryRuleAction implementation for OriginGroupOverrideAction. +func (ogoa OriginGroupOverrideAction) AsDeliveryRuleResponseHeaderAction() (*DeliveryRuleResponseHeaderAction, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderAction is the BasicDeliveryRuleAction implementation for OriginGroupOverrideAction. +func (ogoa OriginGroupOverrideAction) AsDeliveryRuleRequestHeaderAction() (*DeliveryRuleRequestHeaderAction, bool) { + return nil, false +} + +// AsURLRewriteAction is the BasicDeliveryRuleAction implementation for OriginGroupOverrideAction. +func (ogoa OriginGroupOverrideAction) AsURLRewriteAction() (*URLRewriteAction, bool) { + return nil, false +} + +// AsOriginGroupOverrideAction is the BasicDeliveryRuleAction implementation for OriginGroupOverrideAction. +func (ogoa OriginGroupOverrideAction) AsOriginGroupOverrideAction() (*OriginGroupOverrideAction, bool) { + return &ogoa, true +} + +// AsURLSigningAction is the BasicDeliveryRuleAction implementation for OriginGroupOverrideAction. +func (ogoa OriginGroupOverrideAction) AsURLSigningAction() (*URLSigningAction, bool) { + return nil, false +} + +// AsURLRedirectAction is the BasicDeliveryRuleAction implementation for OriginGroupOverrideAction. +func (ogoa OriginGroupOverrideAction) AsURLRedirectAction() (*URLRedirectAction, bool) { + return nil, false +} + +// AsDeliveryRuleAction is the BasicDeliveryRuleAction implementation for OriginGroupOverrideAction. +func (ogoa OriginGroupOverrideAction) AsDeliveryRuleAction() (*DeliveryRuleAction, bool) { + return nil, false +} + +// AsBasicDeliveryRuleAction is the BasicDeliveryRuleAction implementation for OriginGroupOverrideAction. +func (ogoa OriginGroupOverrideAction) AsBasicDeliveryRuleAction() (BasicDeliveryRuleAction, bool) { + return &ogoa, true +} + +// OriginGroupOverrideActionParameters defines the parameters for the origin group override action. +type OriginGroupOverrideActionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // OriginGroup - defines the OriginGroup that would override the DefaultOriginGroup. + OriginGroup *ResourceReference `json:"originGroup,omitempty"` +} + +// OriginGroupProperties the JSON object that contains the properties of the origin group. +type OriginGroupProperties struct { + // ResourceState - READ-ONLY; Resource status of the origin group. Possible values include: 'OriginGroupResourceStateCreating', 'OriginGroupResourceStateActive', 'OriginGroupResourceStateDeleting' + ResourceState OriginGroupResourceState `json:"resourceState,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning status of the origin group. + ProvisioningState *string `json:"provisioningState,omitempty"` + // HealthProbeSettings - Health probe settings to the origin that is used to determine the health of the origin. + HealthProbeSettings *HealthProbeParameters `json:"healthProbeSettings,omitempty"` + // Origins - The source of the content being delivered via CDN within given origin group. + Origins *[]ResourceReference `json:"origins,omitempty"` + // TrafficRestorationTimeToHealedOrNewEndpointsInMinutes - Time in minutes to shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new endpoint is added. Default is 10 mins. This property is currently not supported. + TrafficRestorationTimeToHealedOrNewEndpointsInMinutes *int32 `json:"trafficRestorationTimeToHealedOrNewEndpointsInMinutes,omitempty"` + // ResponseBasedOriginErrorDetectionSettings - The JSON object that contains the properties to determine origin health using real requests/responses. This property is currently not supported. + ResponseBasedOriginErrorDetectionSettings *ResponseBasedOriginErrorDetectionParameters `json:"responseBasedOriginErrorDetectionSettings,omitempty"` +} + +// MarshalJSON is the custom marshaler for OriginGroupProperties. +func (ogp OriginGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ogp.HealthProbeSettings != nil { + objectMap["healthProbeSettings"] = ogp.HealthProbeSettings + } + if ogp.Origins != nil { + objectMap["origins"] = ogp.Origins + } + if ogp.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes != nil { + objectMap["trafficRestorationTimeToHealedOrNewEndpointsInMinutes"] = ogp.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes + } + if ogp.ResponseBasedOriginErrorDetectionSettings != nil { + objectMap["responseBasedOriginErrorDetectionSettings"] = ogp.ResponseBasedOriginErrorDetectionSettings + } + return json.Marshal(objectMap) +} + +// OriginGroupsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type OriginGroupsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(OriginGroupsClient) (OriginGroup, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *OriginGroupsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for OriginGroupsCreateFuture.Result. +func (future *OriginGroupsCreateFuture) result(client OriginGroupsClient) (og OriginGroup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + og.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.OriginGroupsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if og.Response.Response, err = future.GetResult(sender); err == nil && og.Response.Response.StatusCode != http.StatusNoContent { + og, err = client.CreateResponder(og.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsCreateFuture", "Result", og.Response.Response, "Failure responding to request") + } + } + return +} + +// OriginGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type OriginGroupsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(OriginGroupsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *OriginGroupsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for OriginGroupsDeleteFuture.Result. +func (future *OriginGroupsDeleteFuture) result(client OriginGroupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.OriginGroupsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// OriginGroupsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type OriginGroupsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(OriginGroupsClient) (OriginGroup, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *OriginGroupsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for OriginGroupsUpdateFuture.Result. +func (future *OriginGroupsUpdateFuture) result(client OriginGroupsClient) (og OriginGroup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + og.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.OriginGroupsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if og.Response.Response, err = future.GetResult(sender); err == nil && og.Response.Response.StatusCode != http.StatusNoContent { + og, err = client.UpdateResponder(og.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsUpdateFuture", "Result", og.Response.Response, "Failure responding to request") + } + } + return +} + +// OriginGroupUpdateParameters origin group properties needed for origin group creation or update. +type OriginGroupUpdateParameters struct { + *OriginGroupUpdatePropertiesParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for OriginGroupUpdateParameters. +func (ogup OriginGroupUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ogup.OriginGroupUpdatePropertiesParameters != nil { + objectMap["properties"] = ogup.OriginGroupUpdatePropertiesParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for OriginGroupUpdateParameters struct. +func (ogup *OriginGroupUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var originGroupUpdatePropertiesParameters OriginGroupUpdatePropertiesParameters + err = json.Unmarshal(*v, &originGroupUpdatePropertiesParameters) + if err != nil { + return err + } + ogup.OriginGroupUpdatePropertiesParameters = &originGroupUpdatePropertiesParameters + } + } + } + + return nil +} + +// OriginGroupUpdatePropertiesParameters the JSON object that contains the properties of the origin group. +type OriginGroupUpdatePropertiesParameters struct { + // HealthProbeSettings - Health probe settings to the origin that is used to determine the health of the origin. + HealthProbeSettings *HealthProbeParameters `json:"healthProbeSettings,omitempty"` + // Origins - The source of the content being delivered via CDN within given origin group. + Origins *[]ResourceReference `json:"origins,omitempty"` + // TrafficRestorationTimeToHealedOrNewEndpointsInMinutes - Time in minutes to shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new endpoint is added. Default is 10 mins. This property is currently not supported. + TrafficRestorationTimeToHealedOrNewEndpointsInMinutes *int32 `json:"trafficRestorationTimeToHealedOrNewEndpointsInMinutes,omitempty"` + // ResponseBasedOriginErrorDetectionSettings - The JSON object that contains the properties to determine origin health using real requests/responses. This property is currently not supported. + ResponseBasedOriginErrorDetectionSettings *ResponseBasedOriginErrorDetectionParameters `json:"responseBasedOriginErrorDetectionSettings,omitempty"` +} + +// OriginListResult result of the request to list origins. It contains a list of origin objects and a URL +// link to get the next set of results. +type OriginListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of CDN origins within an endpoint + Value *[]Origin `json:"value,omitempty"` + // NextLink - URL to get the next set of origin objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for OriginListResult. +func (olr OriginListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if olr.NextLink != nil { + objectMap["nextLink"] = olr.NextLink + } + return json.Marshal(objectMap) +} + +// OriginListResultIterator provides access to a complete listing of Origin values. +type OriginListResultIterator struct { + i int + page OriginListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OriginListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OriginListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OriginListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OriginListResultIterator) Response() OriginListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OriginListResultIterator) Value() Origin { + if !iter.page.NotDone() { + return Origin{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OriginListResultIterator type. +func NewOriginListResultIterator(page OriginListResultPage) OriginListResultIterator { + return OriginListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OriginListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (olr OriginListResult) hasNextLink() bool { + return olr.NextLink != nil && len(*olr.NextLink) != 0 +} + +// originListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OriginListResult) originListResultPreparer(ctx context.Context) (*http.Request, error) { + if !olr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OriginListResultPage contains a page of Origin values. +type OriginListResultPage struct { + fn func(context.Context, OriginListResult) (OriginListResult, error) + olr OriginListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OriginListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.olr) + if err != nil { + return err + } + page.olr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OriginListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OriginListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OriginListResultPage) Response() OriginListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OriginListResultPage) Values() []Origin { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OriginListResultPage type. +func NewOriginListResultPage(cur OriginListResult, getNextPage func(context.Context, OriginListResult) (OriginListResult, error)) OriginListResultPage { + return OriginListResultPage{ + fn: getNextPage, + olr: cur, + } +} + +// OriginProperties the JSON object that contains the properties of the origin. +type OriginProperties struct { + // ResourceState - READ-ONLY; Resource status of the origin. Possible values include: 'OriginResourceStateCreating', 'OriginResourceStateActive', 'OriginResourceStateDeleting' + ResourceState OriginResourceState `json:"resourceState,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning status of the origin. + ProvisioningState *string `json:"provisioningState,omitempty"` + // PrivateEndpointStatus - READ-ONLY; The approval status for the connection to the Private Link. Possible values include: 'PrivateEndpointStatusPending', 'PrivateEndpointStatusApproved', 'PrivateEndpointStatusRejected', 'PrivateEndpointStatusDisconnected', 'PrivateEndpointStatusTimeout' + PrivateEndpointStatus PrivateEndpointStatus `json:"privateEndpointStatus,omitempty"` + // HostName - The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.This should be unique across all origins in an endpoint. + HostName *string `json:"hostName,omitempty"` + // HTTPPort - The value of the HTTP port. Must be between 1 and 65535. + HTTPPort *int32 `json:"httpPort,omitempty"` + // HTTPSPort - The value of the HTTPS port. Must be between 1 and 65535. + HTTPSPort *int32 `json:"httpsPort,omitempty"` + // OriginHostHeader - The host header value sent to the origin with each request. If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. This overrides the host header defined at Endpoint + OriginHostHeader *string `json:"originHostHeader,omitempty"` + // Priority - Priority of origin in given origin group for load balancing. Higher priorities will not be used for load balancing if any lower priority origin is healthy.Must be between 1 and 5 + Priority *int32 `json:"priority,omitempty"` + // Weight - Weight of the origin in given origin group for load balancing. Must be between 1 and 1000 + Weight *int32 `json:"weight,omitempty"` + // Enabled - Origin is enabled for load balancing or not + Enabled *bool `json:"enabled,omitempty"` + // PrivateLinkAlias - The Alias of the Private Link resource. Populating this optional field indicates that this origin is 'Private' + PrivateLinkAlias *string `json:"privateLinkAlias,omitempty"` + // PrivateLinkResourceID - The Resource Id of the Private Link resource. Populating this optional field indicates that this backend is 'Private' + PrivateLinkResourceID *string `json:"privateLinkResourceId,omitempty"` + // PrivateLinkLocation - The location of the Private Link resource. Required only if 'privateLinkResourceId' is populated + PrivateLinkLocation *string `json:"privateLinkLocation,omitempty"` + // PrivateLinkApprovalMessage - A custom message to be included in the approval request to connect to the Private Link. + PrivateLinkApprovalMessage *string `json:"privateLinkApprovalMessage,omitempty"` +} + +// MarshalJSON is the custom marshaler for OriginProperties. +func (op OriginProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if op.HostName != nil { + objectMap["hostName"] = op.HostName + } + if op.HTTPPort != nil { + objectMap["httpPort"] = op.HTTPPort + } + if op.HTTPSPort != nil { + objectMap["httpsPort"] = op.HTTPSPort + } + if op.OriginHostHeader != nil { + objectMap["originHostHeader"] = op.OriginHostHeader + } + if op.Priority != nil { + objectMap["priority"] = op.Priority + } + if op.Weight != nil { + objectMap["weight"] = op.Weight + } + if op.Enabled != nil { + objectMap["enabled"] = op.Enabled + } + if op.PrivateLinkAlias != nil { + objectMap["privateLinkAlias"] = op.PrivateLinkAlias + } + if op.PrivateLinkResourceID != nil { + objectMap["privateLinkResourceId"] = op.PrivateLinkResourceID + } + if op.PrivateLinkLocation != nil { + objectMap["privateLinkLocation"] = op.PrivateLinkLocation + } + if op.PrivateLinkApprovalMessage != nil { + objectMap["privateLinkApprovalMessage"] = op.PrivateLinkApprovalMessage + } + return json.Marshal(objectMap) +} + +// OriginsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type OriginsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(OriginsClient) (Origin, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *OriginsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for OriginsCreateFuture.Result. +func (future *OriginsCreateFuture) result(client OriginsClient) (o Origin, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + o.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.OriginsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if o.Response.Response, err = future.GetResult(sender); err == nil && o.Response.Response.StatusCode != http.StatusNoContent { + o, err = client.CreateResponder(o.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsCreateFuture", "Result", o.Response.Response, "Failure responding to request") + } + } + return +} + +// OriginsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type OriginsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(OriginsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *OriginsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for OriginsDeleteFuture.Result. +func (future *OriginsDeleteFuture) result(client OriginsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.OriginsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// OriginsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type OriginsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(OriginsClient) (Origin, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *OriginsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for OriginsUpdateFuture.Result. +func (future *OriginsUpdateFuture) result(client OriginsClient) (o Origin, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + o.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.OriginsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if o.Response.Response, err = future.GetResult(sender); err == nil && o.Response.Response.StatusCode != http.StatusNoContent { + o, err = client.UpdateResponder(o.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsUpdateFuture", "Result", o.Response.Response, "Failure responding to request") + } + } + return +} + +// OriginUpdateParameters origin properties needed for origin update. +type OriginUpdateParameters struct { + *OriginUpdatePropertiesParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for OriginUpdateParameters. +func (oup OriginUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if oup.OriginUpdatePropertiesParameters != nil { + objectMap["properties"] = oup.OriginUpdatePropertiesParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for OriginUpdateParameters struct. +func (oup *OriginUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var originUpdatePropertiesParameters OriginUpdatePropertiesParameters + err = json.Unmarshal(*v, &originUpdatePropertiesParameters) + if err != nil { + return err + } + oup.OriginUpdatePropertiesParameters = &originUpdatePropertiesParameters + } + } + } + + return nil +} + +// OriginUpdatePropertiesParameters the JSON object that contains the properties of the origin. +type OriginUpdatePropertiesParameters struct { + // HostName - The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.This should be unique across all origins in an endpoint. + HostName *string `json:"hostName,omitempty"` + // HTTPPort - The value of the HTTP port. Must be between 1 and 65535. + HTTPPort *int32 `json:"httpPort,omitempty"` + // HTTPSPort - The value of the HTTPS port. Must be between 1 and 65535. + HTTPSPort *int32 `json:"httpsPort,omitempty"` + // OriginHostHeader - The host header value sent to the origin with each request. If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. This overrides the host header defined at Endpoint + OriginHostHeader *string `json:"originHostHeader,omitempty"` + // Priority - Priority of origin in given origin group for load balancing. Higher priorities will not be used for load balancing if any lower priority origin is healthy.Must be between 1 and 5 + Priority *int32 `json:"priority,omitempty"` + // Weight - Weight of the origin in given origin group for load balancing. Must be between 1 and 1000 + Weight *int32 `json:"weight,omitempty"` + // Enabled - Origin is enabled for load balancing or not + Enabled *bool `json:"enabled,omitempty"` + // PrivateLinkAlias - The Alias of the Private Link resource. Populating this optional field indicates that this origin is 'Private' + PrivateLinkAlias *string `json:"privateLinkAlias,omitempty"` + // PrivateLinkResourceID - The Resource Id of the Private Link resource. Populating this optional field indicates that this backend is 'Private' + PrivateLinkResourceID *string `json:"privateLinkResourceId,omitempty"` + // PrivateLinkLocation - The location of the Private Link resource. Required only if 'privateLinkResourceId' is populated + PrivateLinkLocation *string `json:"privateLinkLocation,omitempty"` + // PrivateLinkApprovalMessage - A custom message to be included in the approval request to connect to the Private Link. + PrivateLinkApprovalMessage *string `json:"privateLinkApprovalMessage,omitempty"` +} + +// PoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PoliciesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PoliciesClient) (WebApplicationFirewallPolicy, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PoliciesCreateOrUpdateFuture.Result. +func (future *PoliciesCreateOrUpdateFuture) result(client PoliciesClient) (wafp WebApplicationFirewallPolicy, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.PoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + wafp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.PoliciesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if wafp.Response.Response, err = future.GetResult(sender); err == nil && wafp.Response.Response.StatusCode != http.StatusNoContent { + wafp, err = client.CreateOrUpdateResponder(wafp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.PoliciesCreateOrUpdateFuture", "Result", wafp.Response.Response, "Failure responding to request") + } + } + return +} + +// PoliciesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PoliciesUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PoliciesClient) (WebApplicationFirewallPolicy, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PoliciesUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PoliciesUpdateFuture.Result. +func (future *PoliciesUpdateFuture) result(client PoliciesClient) (wafp WebApplicationFirewallPolicy, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.PoliciesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + wafp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.PoliciesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if wafp.Response.Response, err = future.GetResult(sender); err == nil && wafp.Response.Response.StatusCode != http.StatusNoContent { + wafp, err = client.UpdateResponder(wafp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.PoliciesUpdateFuture", "Result", wafp.Response.Response, "Failure responding to request") + } + } + return +} + +// PolicySettings defines contents of a web application firewall global configuration +type PolicySettings struct { + // EnabledState - describes if the policy is in enabled state or disabled state. Possible values include: 'PolicyEnabledStateDisabled', 'PolicyEnabledStateEnabled' + EnabledState PolicyEnabledState `json:"enabledState,omitempty"` + // Mode - Describes if it is in detection mode or prevention mode at policy level. Possible values include: 'PolicyModePrevention', 'PolicyModeDetection' + Mode PolicyMode `json:"mode,omitempty"` + // DefaultRedirectURL - If action type is redirect, this field represents the default redirect URL for the client. + DefaultRedirectURL *string `json:"defaultRedirectUrl,omitempty"` + // DefaultCustomBlockResponseStatusCode - If the action type is block, this field defines the default customer overridable http response status code. + DefaultCustomBlockResponseStatusCode *int32 `json:"defaultCustomBlockResponseStatusCode,omitempty"` + // DefaultCustomBlockResponseBody - If the action type is block, customer can override the response body. The body must be specified in base64 encoding. + DefaultCustomBlockResponseBody *string `json:"defaultCustomBlockResponseBody,omitempty"` +} + +// PostArgsMatchConditionParameters defines the parameters for PostArgs match conditions +type PostArgsMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Selector - Name of PostArg to be matched + Selector *string `json:"selector,omitempty"` + // Operator - Describes operator to be matched. Possible values include: 'PostArgsOperatorAny', 'PostArgsOperatorEqual', 'PostArgsOperatorContains', 'PostArgsOperatorBeginsWith', 'PostArgsOperatorEndsWith', 'PostArgsOperatorLessThan', 'PostArgsOperatorLessThanOrEqual', 'PostArgsOperatorGreaterThan', 'PostArgsOperatorGreaterThanOrEqual', 'PostArgsOperatorRegEx' + Operator PostArgsOperator `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// Profile a profile is a logical grouping of endpoints that share the same settings. +type Profile struct { + autorest.Response `json:"-"` + // Sku - The pricing tier (defines Azure Front Door Standard or Premium or a CDN provider, feature list and rate) of the profile. + Sku *Sku `json:"sku,omitempty"` + // Kind - READ-ONLY; Kind of the profile. Used by portal to differentiate traditional CDN profile and new AFD profile. + Kind *string `json:"kind,omitempty"` + *ProfileProperties `json:"properties,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Profile. +func (p Profile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if p.Sku != nil { + objectMap["sku"] = p.Sku + } + if p.ProfileProperties != nil { + objectMap["properties"] = p.ProfileProperties + } + if p.Location != nil { + objectMap["location"] = p.Location + } + if p.Tags != nil { + objectMap["tags"] = p.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Profile struct. +func (p *Profile) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + p.Sku = &sku + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + p.Kind = &kind + } + case "properties": + if v != nil { + var profileProperties ProfileProperties + err = json.Unmarshal(*v, &profileProperties) + if err != nil { + return err + } + p.ProfileProperties = &profileProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + p.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + p.Tags = tags + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + p.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + p.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + p.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + p.SystemData = &systemData + } + } + } + + return nil +} + +// ProfileListResult result of the request to list profiles. It contains a list of profile objects and a +// URL link to get the next set of results. +type ProfileListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of CDN profiles within a resource group. + Value *[]Profile `json:"value,omitempty"` + // NextLink - URL to get the next set of profile objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProfileListResult. +func (plr ProfileListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plr.NextLink != nil { + objectMap["nextLink"] = plr.NextLink + } + return json.Marshal(objectMap) +} + +// ProfileListResultIterator provides access to a complete listing of Profile values. +type ProfileListResultIterator struct { + i int + page ProfileListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ProfileListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfileListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ProfileListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ProfileListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ProfileListResultIterator) Response() ProfileListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ProfileListResultIterator) Value() Profile { + if !iter.page.NotDone() { + return Profile{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ProfileListResultIterator type. +func NewProfileListResultIterator(page ProfileListResultPage) ProfileListResultIterator { + return ProfileListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (plr ProfileListResult) IsEmpty() bool { + return plr.Value == nil || len(*plr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (plr ProfileListResult) hasNextLink() bool { + return plr.NextLink != nil && len(*plr.NextLink) != 0 +} + +// profileListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (plr ProfileListResult) profileListResultPreparer(ctx context.Context) (*http.Request, error) { + if !plr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(plr.NextLink))) +} + +// ProfileListResultPage contains a page of Profile values. +type ProfileListResultPage struct { + fn func(context.Context, ProfileListResult) (ProfileListResult, error) + plr ProfileListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ProfileListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfileListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.plr) + if err != nil { + return err + } + page.plr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ProfileListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ProfileListResultPage) NotDone() bool { + return !page.plr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ProfileListResultPage) Response() ProfileListResult { + return page.plr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ProfileListResultPage) Values() []Profile { + if page.plr.IsEmpty() { + return nil + } + return *page.plr.Value +} + +// Creates a new instance of the ProfileListResultPage type. +func NewProfileListResultPage(cur ProfileListResult, getNextPage func(context.Context, ProfileListResult) (ProfileListResult, error)) ProfileListResultPage { + return ProfileListResultPage{ + fn: getNextPage, + plr: cur, + } +} + +// ProfileProperties the JSON object that contains the properties required to create a profile. +type ProfileProperties struct { + // ResourceState - READ-ONLY; Resource status of the profile. Possible values include: 'ProfileResourceStateCreating', 'ProfileResourceStateActive', 'ProfileResourceStateDeleting', 'ProfileResourceStateDisabled' + ResourceState ProfileResourceState `json:"resourceState,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning status of the profile. + ProvisioningState *string `json:"provisioningState,omitempty"` + // FrontDoorID - READ-ONLY; The Id of the frontdoor. + FrontDoorID *string `json:"frontDoorId,omitempty"` + // OriginResponseTimeoutSeconds - Send and receive timeout on forwarding request to the origin. When timeout is reached, the request fails and returns. + OriginResponseTimeoutSeconds *int32 `json:"originResponseTimeoutSeconds,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProfileProperties. +func (pp ProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pp.OriginResponseTimeoutSeconds != nil { + objectMap["originResponseTimeoutSeconds"] = pp.OriginResponseTimeoutSeconds + } + return json.Marshal(objectMap) +} + +// ProfilePropertiesUpdateParameters the JSON object containing profile update parameters. +type ProfilePropertiesUpdateParameters struct { + // OriginResponseTimeoutSeconds - Send and receive timeout on forwarding request to the origin. When timeout is reached, the request fails and returns. + OriginResponseTimeoutSeconds *int32 `json:"originResponseTimeoutSeconds,omitempty"` +} + +// ProfilesCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ProfilesCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ProfilesClient) (Profile, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ProfilesCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ProfilesCreateFuture.Result. +func (future *ProfilesCreateFuture) result(client ProfilesClient) (p Profile, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + p.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.ProfilesCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if p.Response.Response, err = future.GetResult(sender); err == nil && p.Response.Response.StatusCode != http.StatusNoContent { + p, err = client.CreateResponder(p.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesCreateFuture", "Result", p.Response.Response, "Failure responding to request") + } + } + return +} + +// ProfilesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ProfilesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ProfilesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ProfilesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ProfilesDeleteFuture.Result. +func (future *ProfilesDeleteFuture) result(client ProfilesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.ProfilesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ProfilesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ProfilesUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ProfilesClient) (Profile, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ProfilesUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ProfilesUpdateFuture.Result. +func (future *ProfilesUpdateFuture) result(client ProfilesClient) (p Profile, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + p.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.ProfilesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if p.Response.Response, err = future.GetResult(sender); err == nil && p.Response.Response.StatusCode != http.StatusNoContent { + p, err = client.UpdateResponder(p.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesUpdateFuture", "Result", p.Response.Response, "Failure responding to request") + } + } + return +} + +// ProfileUpdateParameters properties required to update a profile. +type ProfileUpdateParameters struct { + // Tags - Profile tags + Tags map[string]*string `json:"tags"` + *ProfilePropertiesUpdateParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProfileUpdateParameters. +func (pup ProfileUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pup.Tags != nil { + objectMap["tags"] = pup.Tags + } + if pup.ProfilePropertiesUpdateParameters != nil { + objectMap["properties"] = pup.ProfilePropertiesUpdateParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ProfileUpdateParameters struct. +func (pup *ProfileUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + pup.Tags = tags + } + case "properties": + if v != nil { + var profilePropertiesUpdateParameters ProfilePropertiesUpdateParameters + err = json.Unmarshal(*v, &profilePropertiesUpdateParameters) + if err != nil { + return err + } + pup.ProfilePropertiesUpdateParameters = &profilePropertiesUpdateParameters + } + } + } + + return nil +} + +// ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than +// required location and tags +type ProxyResource struct { + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PurgeParameters parameters required for content purge. +type PurgeParameters struct { + // ContentPaths - The path to the content to be purged. Can describe a file path or a wild card directory. + ContentPaths *[]string `json:"contentPaths,omitempty"` +} + +// QueryStringMatchConditionParameters defines the parameters for QueryString match conditions +type QueryStringMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched. Possible values include: 'QueryStringOperatorAny', 'QueryStringOperatorEqual', 'QueryStringOperatorContains', 'QueryStringOperatorBeginsWith', 'QueryStringOperatorEndsWith', 'QueryStringOperatorLessThan', 'QueryStringOperatorLessThanOrEqual', 'QueryStringOperatorGreaterThan', 'QueryStringOperatorGreaterThanOrEqual', 'QueryStringOperatorRegEx' + Operator QueryStringOperator `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// RankingsResponse rankings Response +type RankingsResponse struct { + autorest.Response `json:"-"` + DateTimeBegin *date.Time `json:"dateTimeBegin,omitempty"` + DateTimeEnd *date.Time `json:"dateTimeEnd,omitempty"` + Tables *[]RankingsResponseTablesItem `json:"tables,omitempty"` +} + +// RankingsResponseTablesItem ... +type RankingsResponseTablesItem struct { + Ranking *string `json:"ranking,omitempty"` + Data *[]RankingsResponseTablesItemDataItem `json:"data,omitempty"` +} + +// RankingsResponseTablesItemDataItem ... +type RankingsResponseTablesItemDataItem struct { + Name *string `json:"name,omitempty"` + Metrics *[]RankingsResponseTablesItemDataItemMetricsItem `json:"metrics,omitempty"` +} + +// RankingsResponseTablesItemDataItemMetricsItem ... +type RankingsResponseTablesItemDataItemMetricsItem struct { + Metric *string `json:"metric,omitempty"` + Value *int64 `json:"value,omitempty"` + Percentage *float64 `json:"percentage,omitempty"` +} + +// RateLimitRule defines a rate limiting rule that can be included in a waf policy +type RateLimitRule struct { + // RateLimitThreshold - Defines rate limit threshold. + RateLimitThreshold *int32 `json:"rateLimitThreshold,omitempty"` + // RateLimitDurationInMinutes - Defines rate limit duration. Default is 1 minute. + RateLimitDurationInMinutes *int32 `json:"rateLimitDurationInMinutes,omitempty"` + // Name - Defines the name of the custom rule + Name *string `json:"name,omitempty"` + // EnabledState - Describes if the custom rule is in enabled or disabled state. Defaults to Enabled if not specified. Possible values include: 'CustomRuleEnabledStateDisabled', 'CustomRuleEnabledStateEnabled' + EnabledState CustomRuleEnabledState `json:"enabledState,omitempty"` + // Priority - Defines in what order this rule be evaluated in the overall list of custom rules + Priority *int32 `json:"priority,omitempty"` + // MatchConditions - List of match conditions. + MatchConditions *[]MatchCondition `json:"matchConditions,omitempty"` + // Action - Describes what action to be applied when rule matches. Possible values include: 'ActionTypeAllow', 'ActionTypeBlock', 'ActionTypeLog', 'ActionTypeRedirect' + Action ActionType `json:"action,omitempty"` +} + +// RateLimitRuleList defines contents of rate limit rules +type RateLimitRuleList struct { + // Rules - List of rules + Rules *[]RateLimitRule `json:"rules,omitempty"` +} + +// RemoteAddressMatchConditionParameters defines the parameters for RemoteAddress match conditions +type RemoteAddressMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched. Possible values include: 'RemoteAddressOperatorAny', 'RemoteAddressOperatorIPMatch', 'RemoteAddressOperatorGeoMatch' + Operator RemoteAddressOperator `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - Match values to match against. The operator will apply to each value in here with OR semantics. If any of them match the variable with the given operator this match condition is considered a match. + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// RequestBodyMatchConditionParameters defines the parameters for RequestBody match conditions +type RequestBodyMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched. Possible values include: 'RequestBodyOperatorAny', 'RequestBodyOperatorEqual', 'RequestBodyOperatorContains', 'RequestBodyOperatorBeginsWith', 'RequestBodyOperatorEndsWith', 'RequestBodyOperatorLessThan', 'RequestBodyOperatorLessThanOrEqual', 'RequestBodyOperatorGreaterThan', 'RequestBodyOperatorGreaterThanOrEqual', 'RequestBodyOperatorRegEx' + Operator RequestBodyOperator `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// RequestHeaderMatchConditionParameters defines the parameters for RequestHeader match conditions +type RequestHeaderMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Selector - Name of Header to be matched + Selector *string `json:"selector,omitempty"` + // Operator - Describes operator to be matched. Possible values include: 'RequestHeaderOperatorAny', 'RequestHeaderOperatorEqual', 'RequestHeaderOperatorContains', 'RequestHeaderOperatorBeginsWith', 'RequestHeaderOperatorEndsWith', 'RequestHeaderOperatorLessThan', 'RequestHeaderOperatorLessThanOrEqual', 'RequestHeaderOperatorGreaterThan', 'RequestHeaderOperatorGreaterThanOrEqual', 'RequestHeaderOperatorRegEx' + Operator RequestHeaderOperator `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// RequestMethodMatchConditionParameters defines the parameters for RequestMethod match conditions +type RequestMethodMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched + Operator *string `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` +} + +// RequestSchemeMatchConditionParameters defines the parameters for RequestScheme match conditions +type RequestSchemeMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched + Operator *string `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` +} + +// RequestURIMatchConditionParameters defines the parameters for RequestUri match conditions +type RequestURIMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched. Possible values include: 'RequestURIOperatorAny', 'RequestURIOperatorEqual', 'RequestURIOperatorContains', 'RequestURIOperatorBeginsWith', 'RequestURIOperatorEndsWith', 'RequestURIOperatorLessThan', 'RequestURIOperatorLessThanOrEqual', 'RequestURIOperatorGreaterThan', 'RequestURIOperatorGreaterThanOrEqual', 'RequestURIOperatorRegEx' + Operator RequestURIOperator `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// Resource the core properties of ARM resources +type Resource struct { + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceReference reference to another resource. +type ResourceReference struct { + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// ResourcesResponse resources Response +type ResourcesResponse struct { + autorest.Response `json:"-"` + Endpoints *[]ResourcesResponseEndpointsItem `json:"endpoints,omitempty"` + CustomDomains *[]ResourcesResponseCustomDomainsItem `json:"customDomains,omitempty"` +} + +// ResourcesResponseCustomDomainsItem ... +type ResourcesResponseCustomDomainsItem struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + EndpointID *string `json:"endpointId,omitempty"` + History *bool `json:"history,omitempty"` +} + +// ResourcesResponseEndpointsItem ... +type ResourcesResponseEndpointsItem struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + History *bool `json:"history,omitempty"` + CustomDomains *[]ResourcesResponseEndpointsItemCustomDomainsItem `json:"customDomains,omitempty"` +} + +// ResourcesResponseEndpointsItemCustomDomainsItem ... +type ResourcesResponseEndpointsItemCustomDomainsItem struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + EndpointID *string `json:"endpointId,omitempty"` + History *bool `json:"history,omitempty"` +} + +// ResourceUsage output of check resource usage API. +type ResourceUsage struct { + // ResourceType - READ-ONLY; Resource type for which the usage is provided. + ResourceType *string `json:"resourceType,omitempty"` + // Unit - READ-ONLY; Unit of the usage. e.g. Count. + Unit *string `json:"unit,omitempty"` + // CurrentValue - READ-ONLY; Actual value of usage on the specified resource type. + CurrentValue *int32 `json:"currentValue,omitempty"` + // Limit - READ-ONLY; Quota of the specified resource type. + Limit *int32 `json:"limit,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceUsage. +func (ru ResourceUsage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceUsageListResult output of check resource usage API. +type ResourceUsageListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of resource usages. + Value *[]ResourceUsage `json:"value,omitempty"` + // NextLink - URL to get the next set of custom domain objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceUsageListResult. +func (rulr ResourceUsageListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rulr.NextLink != nil { + objectMap["nextLink"] = rulr.NextLink + } + return json.Marshal(objectMap) +} + +// ResourceUsageListResultIterator provides access to a complete listing of ResourceUsage values. +type ResourceUsageListResultIterator struct { + i int + page ResourceUsageListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ResourceUsageListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceUsageListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ResourceUsageListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourceUsageListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResourceUsageListResultIterator) Response() ResourceUsageListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResourceUsageListResultIterator) Value() ResourceUsage { + if !iter.page.NotDone() { + return ResourceUsage{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResourceUsageListResultIterator type. +func NewResourceUsageListResultIterator(page ResourceUsageListResultPage) ResourceUsageListResultIterator { + return ResourceUsageListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rulr ResourceUsageListResult) IsEmpty() bool { + return rulr.Value == nil || len(*rulr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rulr ResourceUsageListResult) hasNextLink() bool { + return rulr.NextLink != nil && len(*rulr.NextLink) != 0 +} + +// resourceUsageListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rulr ResourceUsageListResult) resourceUsageListResultPreparer(ctx context.Context) (*http.Request, error) { + if !rulr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rulr.NextLink))) +} + +// ResourceUsageListResultPage contains a page of ResourceUsage values. +type ResourceUsageListResultPage struct { + fn func(context.Context, ResourceUsageListResult) (ResourceUsageListResult, error) + rulr ResourceUsageListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResourceUsageListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceUsageListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rulr) + if err != nil { + return err + } + page.rulr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ResourceUsageListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourceUsageListResultPage) NotDone() bool { + return !page.rulr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourceUsageListResultPage) Response() ResourceUsageListResult { + return page.rulr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourceUsageListResultPage) Values() []ResourceUsage { + if page.rulr.IsEmpty() { + return nil + } + return *page.rulr.Value +} + +// Creates a new instance of the ResourceUsageListResultPage type. +func NewResourceUsageListResultPage(cur ResourceUsageListResult, getNextPage func(context.Context, ResourceUsageListResult) (ResourceUsageListResult, error)) ResourceUsageListResultPage { + return ResourceUsageListResultPage{ + fn: getNextPage, + rulr: cur, + } +} + +// ResponseBasedOriginErrorDetectionParameters the JSON object that contains the properties to determine +// origin health using real requests/responses. +type ResponseBasedOriginErrorDetectionParameters struct { + // ResponseBasedDetectedErrorTypes - Type of response errors for real user requests for which origin will be deemed unhealthy. Possible values include: 'ResponseBasedDetectedErrorTypesNone', 'ResponseBasedDetectedErrorTypesTCPErrorsOnly', 'ResponseBasedDetectedErrorTypesTCPAndHTTPErrors' + ResponseBasedDetectedErrorTypes ResponseBasedDetectedErrorTypes `json:"responseBasedDetectedErrorTypes,omitempty"` + // ResponseBasedFailoverThresholdPercentage - The percentage of failed requests in the sample where failover should trigger. + ResponseBasedFailoverThresholdPercentage *int32 `json:"responseBasedFailoverThresholdPercentage,omitempty"` + // HTTPErrorRanges - The list of Http status code ranges that are considered as server errors for origin and it is marked as unhealthy. + HTTPErrorRanges *[]HTTPErrorRangeParameters `json:"httpErrorRanges,omitempty"` +} + +// Route friendly Routes name mapping to the any Routes or secret related information. +type Route struct { + autorest.Response `json:"-"` + *RouteProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Route. +func (r Route) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.RouteProperties != nil { + objectMap["properties"] = r.RouteProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Route struct. +func (r *Route) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var routeProperties RouteProperties + err = json.Unmarshal(*v, &routeProperties) + if err != nil { + return err + } + r.RouteProperties = &routeProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + r.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + r.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + r.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + r.SystemData = &systemData + } + } + } + + return nil +} + +// RouteConfigurationOverrideActionParameters defines the parameters for the route configuration override +// action. +type RouteConfigurationOverrideActionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // OriginGroupOverride - A reference to the origin group override configuration. Leave empty to use the default origin group on route. + OriginGroupOverride *OriginGroupOverride `json:"originGroupOverride,omitempty"` + // CacheConfiguration - The caching configuration associated with this rule. To disable caching, do not provide a cacheConfiguration object. + CacheConfiguration *CacheConfiguration `json:"cacheConfiguration,omitempty"` +} + +// RouteListResult result of the request to list routes. It contains a list of route objects and a URL link +// to get the next set of results. +type RouteListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of AzureFrontDoor routes within a profile. + Value *[]Route `json:"value,omitempty"` + // NextLink - URL to get the next set of route objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for RouteListResult. +func (rlr RouteListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rlr.NextLink != nil { + objectMap["nextLink"] = rlr.NextLink + } + return json.Marshal(objectMap) +} + +// RouteListResultIterator provides access to a complete listing of Route values. +type RouteListResultIterator struct { + i int + page RouteListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RouteListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RouteListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RouteListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RouteListResultIterator) Response() RouteListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RouteListResultIterator) Value() Route { + if !iter.page.NotDone() { + return Route{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RouteListResultIterator type. +func NewRouteListResultIterator(page RouteListResultPage) RouteListResultIterator { + return RouteListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rlr RouteListResult) IsEmpty() bool { + return rlr.Value == nil || len(*rlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rlr RouteListResult) hasNextLink() bool { + return rlr.NextLink != nil && len(*rlr.NextLink) != 0 +} + +// routeListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rlr RouteListResult) routeListResultPreparer(ctx context.Context) (*http.Request, error) { + if !rlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rlr.NextLink))) +} + +// RouteListResultPage contains a page of Route values. +type RouteListResultPage struct { + fn func(context.Context, RouteListResult) (RouteListResult, error) + rlr RouteListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RouteListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rlr) + if err != nil { + return err + } + page.rlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RouteListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RouteListResultPage) NotDone() bool { + return !page.rlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RouteListResultPage) Response() RouteListResult { + return page.rlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RouteListResultPage) Values() []Route { + if page.rlr.IsEmpty() { + return nil + } + return *page.rlr.Value +} + +// Creates a new instance of the RouteListResultPage type. +func NewRouteListResultPage(cur RouteListResult, getNextPage func(context.Context, RouteListResult) (RouteListResult, error)) RouteListResultPage { + return RouteListResultPage{ + fn: getNextPage, + rlr: cur, + } +} + +// RouteProperties the JSON object that contains the properties of the Routes to create. +type RouteProperties struct { + // EndpointName - READ-ONLY; The name of the endpoint which holds the route. + EndpointName *string `json:"endpointName,omitempty"` + // CustomDomains - Domains referenced by this endpoint. + CustomDomains *[]ActivatedResourceReference `json:"customDomains,omitempty"` + // OriginGroup - A reference to the origin group. + OriginGroup *ResourceReference `json:"originGroup,omitempty"` + // OriginPath - A directory path on the origin that AzureFrontDoor can use to retrieve content from, e.g. contoso.cloudapp.net/originpath. + OriginPath *string `json:"originPath,omitempty"` + // RuleSets - rule sets referenced by this endpoint. + RuleSets *[]ResourceReference `json:"ruleSets,omitempty"` + // SupportedProtocols - List of supported protocols for this route. + SupportedProtocols *[]AFDEndpointProtocols `json:"supportedProtocols,omitempty"` + // PatternsToMatch - The route patterns of the rule. + PatternsToMatch *[]string `json:"patternsToMatch,omitempty"` + // CacheConfiguration - The caching configuration for this route. To disable caching, do not provide a cacheConfiguration object. + CacheConfiguration *AfdRouteCacheConfiguration `json:"cacheConfiguration,omitempty"` + // ForwardingProtocol - Protocol this rule will use when forwarding traffic to backends. Possible values include: 'ForwardingProtocolHTTPOnly', 'ForwardingProtocolHTTPSOnly', 'ForwardingProtocolMatchRequest' + ForwardingProtocol ForwardingProtocol `json:"forwardingProtocol,omitempty"` + // LinkToDefaultDomain - whether this route will be linked to the default endpoint domain. Possible values include: 'LinkToDefaultDomainEnabled', 'LinkToDefaultDomainDisabled' + LinkToDefaultDomain LinkToDefaultDomain `json:"linkToDefaultDomain,omitempty"` + // HTTPSRedirect - Whether to automatically redirect HTTP traffic to HTTPS traffic. Note that this is a easy way to set up this rule and it will be the first rule that gets executed. Possible values include: 'HTTPSRedirectEnabled', 'HTTPSRedirectDisabled' + HTTPSRedirect HTTPSRedirect `json:"httpsRedirect,omitempty"` + // EnabledState - Whether to enable use of this rule. Permitted values are 'Enabled' or 'Disabled'. Possible values include: 'EnabledStateEnabled', 'EnabledStateDisabled' + EnabledState EnabledState `json:"enabledState,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning status. Possible values include: 'AfdProvisioningStateSucceeded', 'AfdProvisioningStateFailed', 'AfdProvisioningStateUpdating', 'AfdProvisioningStateDeleting', 'AfdProvisioningStateCreating' + ProvisioningState AfdProvisioningState `json:"provisioningState,omitempty"` + // DeploymentStatus - READ-ONLY; Possible values include: 'DeploymentStatusNotStarted', 'DeploymentStatusInProgress', 'DeploymentStatusSucceeded', 'DeploymentStatusFailed' + DeploymentStatus DeploymentStatus `json:"deploymentStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for RouteProperties. +func (rp RouteProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rp.CustomDomains != nil { + objectMap["customDomains"] = rp.CustomDomains + } + if rp.OriginGroup != nil { + objectMap["originGroup"] = rp.OriginGroup + } + if rp.OriginPath != nil { + objectMap["originPath"] = rp.OriginPath + } + if rp.RuleSets != nil { + objectMap["ruleSets"] = rp.RuleSets + } + if rp.SupportedProtocols != nil { + objectMap["supportedProtocols"] = rp.SupportedProtocols + } + if rp.PatternsToMatch != nil { + objectMap["patternsToMatch"] = rp.PatternsToMatch + } + if rp.CacheConfiguration != nil { + objectMap["cacheConfiguration"] = rp.CacheConfiguration + } + if rp.ForwardingProtocol != "" { + objectMap["forwardingProtocol"] = rp.ForwardingProtocol + } + if rp.LinkToDefaultDomain != "" { + objectMap["linkToDefaultDomain"] = rp.LinkToDefaultDomain + } + if rp.HTTPSRedirect != "" { + objectMap["httpsRedirect"] = rp.HTTPSRedirect + } + if rp.EnabledState != "" { + objectMap["enabledState"] = rp.EnabledState + } + return json.Marshal(objectMap) +} + +// RoutesCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type RoutesCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RoutesClient) (Route, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RoutesCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RoutesCreateFuture.Result. +func (future *RoutesCreateFuture) result(client RoutesClient) (r Route, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + r.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.RoutesCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { + r, err = client.CreateResponder(r.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesCreateFuture", "Result", r.Response.Response, "Failure responding to request") + } + } + return +} + +// RoutesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type RoutesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RoutesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RoutesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RoutesDeleteFuture.Result. +func (future *RoutesDeleteFuture) result(client RoutesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.RoutesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// RoutesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type RoutesUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RoutesClient) (Route, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RoutesUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RoutesUpdateFuture.Result. +func (future *RoutesUpdateFuture) result(client RoutesClient) (r Route, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + r.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.RoutesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { + r, err = client.UpdateResponder(r.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesUpdateFuture", "Result", r.Response.Response, "Failure responding to request") + } + } + return +} + +// RouteUpdateParameters the domain JSON object required for domain creation or update. +type RouteUpdateParameters struct { + *RouteUpdatePropertiesParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for RouteUpdateParameters. +func (rup RouteUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rup.RouteUpdatePropertiesParameters != nil { + objectMap["properties"] = rup.RouteUpdatePropertiesParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RouteUpdateParameters struct. +func (rup *RouteUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var routeUpdatePropertiesParameters RouteUpdatePropertiesParameters + err = json.Unmarshal(*v, &routeUpdatePropertiesParameters) + if err != nil { + return err + } + rup.RouteUpdatePropertiesParameters = &routeUpdatePropertiesParameters + } + } + } + + return nil +} + +// RouteUpdatePropertiesParameters the JSON object that contains the properties of the domain to create. +type RouteUpdatePropertiesParameters struct { + // EndpointName - READ-ONLY; The name of the endpoint which holds the route. + EndpointName *string `json:"endpointName,omitempty"` + // CustomDomains - Domains referenced by this endpoint. + CustomDomains *[]ActivatedResourceReference `json:"customDomains,omitempty"` + // OriginGroup - A reference to the origin group. + OriginGroup *ResourceReference `json:"originGroup,omitempty"` + // OriginPath - A directory path on the origin that AzureFrontDoor can use to retrieve content from, e.g. contoso.cloudapp.net/originpath. + OriginPath *string `json:"originPath,omitempty"` + // RuleSets - rule sets referenced by this endpoint. + RuleSets *[]ResourceReference `json:"ruleSets,omitempty"` + // SupportedProtocols - List of supported protocols for this route. + SupportedProtocols *[]AFDEndpointProtocols `json:"supportedProtocols,omitempty"` + // PatternsToMatch - The route patterns of the rule. + PatternsToMatch *[]string `json:"patternsToMatch,omitempty"` + // CacheConfiguration - The caching configuration for this route. To disable caching, do not provide a cacheConfiguration object. + CacheConfiguration *AfdRouteCacheConfiguration `json:"cacheConfiguration,omitempty"` + // ForwardingProtocol - Protocol this rule will use when forwarding traffic to backends. Possible values include: 'ForwardingProtocolHTTPOnly', 'ForwardingProtocolHTTPSOnly', 'ForwardingProtocolMatchRequest' + ForwardingProtocol ForwardingProtocol `json:"forwardingProtocol,omitempty"` + // LinkToDefaultDomain - whether this route will be linked to the default endpoint domain. Possible values include: 'LinkToDefaultDomainEnabled', 'LinkToDefaultDomainDisabled' + LinkToDefaultDomain LinkToDefaultDomain `json:"linkToDefaultDomain,omitempty"` + // HTTPSRedirect - Whether to automatically redirect HTTP traffic to HTTPS traffic. Note that this is a easy way to set up this rule and it will be the first rule that gets executed. Possible values include: 'HTTPSRedirectEnabled', 'HTTPSRedirectDisabled' + HTTPSRedirect HTTPSRedirect `json:"httpsRedirect,omitempty"` + // EnabledState - Whether to enable use of this rule. Permitted values are 'Enabled' or 'Disabled'. Possible values include: 'EnabledStateEnabled', 'EnabledStateDisabled' + EnabledState EnabledState `json:"enabledState,omitempty"` +} + +// MarshalJSON is the custom marshaler for RouteUpdatePropertiesParameters. +func (rupp RouteUpdatePropertiesParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rupp.CustomDomains != nil { + objectMap["customDomains"] = rupp.CustomDomains + } + if rupp.OriginGroup != nil { + objectMap["originGroup"] = rupp.OriginGroup + } + if rupp.OriginPath != nil { + objectMap["originPath"] = rupp.OriginPath + } + if rupp.RuleSets != nil { + objectMap["ruleSets"] = rupp.RuleSets + } + if rupp.SupportedProtocols != nil { + objectMap["supportedProtocols"] = rupp.SupportedProtocols + } + if rupp.PatternsToMatch != nil { + objectMap["patternsToMatch"] = rupp.PatternsToMatch + } + if rupp.CacheConfiguration != nil { + objectMap["cacheConfiguration"] = rupp.CacheConfiguration + } + if rupp.ForwardingProtocol != "" { + objectMap["forwardingProtocol"] = rupp.ForwardingProtocol + } + if rupp.LinkToDefaultDomain != "" { + objectMap["linkToDefaultDomain"] = rupp.LinkToDefaultDomain + } + if rupp.HTTPSRedirect != "" { + objectMap["httpsRedirect"] = rupp.HTTPSRedirect + } + if rupp.EnabledState != "" { + objectMap["enabledState"] = rupp.EnabledState + } + return json.Marshal(objectMap) +} + +// Rule friendly Rules name mapping to the any Rules or secret related information. +type Rule struct { + autorest.Response `json:"-"` + *RuleProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Rule. +func (r Rule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.RuleProperties != nil { + objectMap["properties"] = r.RuleProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Rule struct. +func (r *Rule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var ruleProperties RuleProperties + err = json.Unmarshal(*v, &ruleProperties) + if err != nil { + return err + } + r.RuleProperties = &ruleProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + r.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + r.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + r.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + r.SystemData = &systemData + } + } + } + + return nil +} + +// RuleListResult result of the request to list rules. It contains a list of rule objects and a URL link to +// get the next set of results. +type RuleListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of AzureFrontDoor rules within a rule set. + Value *[]Rule `json:"value,omitempty"` + // NextLink - URL to get the next set of rule objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleListResult. +func (rlr RuleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rlr.NextLink != nil { + objectMap["nextLink"] = rlr.NextLink + } + return json.Marshal(objectMap) +} + +// RuleListResultIterator provides access to a complete listing of Rule values. +type RuleListResultIterator struct { + i int + page RuleListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RuleListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RuleListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RuleListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RuleListResultIterator) Response() RuleListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RuleListResultIterator) Value() Rule { + if !iter.page.NotDone() { + return Rule{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RuleListResultIterator type. +func NewRuleListResultIterator(page RuleListResultPage) RuleListResultIterator { + return RuleListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rlr RuleListResult) IsEmpty() bool { + return rlr.Value == nil || len(*rlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rlr RuleListResult) hasNextLink() bool { + return rlr.NextLink != nil && len(*rlr.NextLink) != 0 +} + +// ruleListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rlr RuleListResult) ruleListResultPreparer(ctx context.Context) (*http.Request, error) { + if !rlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rlr.NextLink))) +} + +// RuleListResultPage contains a page of Rule values. +type RuleListResultPage struct { + fn func(context.Context, RuleListResult) (RuleListResult, error) + rlr RuleListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RuleListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rlr) + if err != nil { + return err + } + page.rlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RuleListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RuleListResultPage) NotDone() bool { + return !page.rlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RuleListResultPage) Response() RuleListResult { + return page.rlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RuleListResultPage) Values() []Rule { + if page.rlr.IsEmpty() { + return nil + } + return *page.rlr.Value +} + +// Creates a new instance of the RuleListResultPage type. +func NewRuleListResultPage(cur RuleListResult, getNextPage func(context.Context, RuleListResult) (RuleListResult, error)) RuleListResultPage { + return RuleListResultPage{ + fn: getNextPage, + rlr: cur, + } +} + +// RuleProperties the JSON object that contains the properties of the Rules to create. +type RuleProperties struct { + // RuleSetName - READ-ONLY; The name of the rule set containing the rule. + RuleSetName *string `json:"ruleSetName,omitempty"` + // Order - The order in which the rules are applied for the endpoint. Possible values {0,1,2,3,………}. A rule with a lesser order will be applied before a rule with a greater order. Rule with order 0 is a special rule. It does not require any condition and actions listed in it will always be applied. + Order *int32 `json:"order,omitempty"` + // Conditions - A list of conditions that must be matched for the actions to be executed + Conditions *[]BasicDeliveryRuleCondition `json:"conditions,omitempty"` + // Actions - A list of actions that are executed when all the conditions of a rule are satisfied. + Actions *[]BasicDeliveryRuleAction `json:"actions,omitempty"` + // MatchProcessingBehavior - If this rule is a match should the rules engine continue running the remaining rules or stop. If not present, defaults to Continue. Possible values include: 'MatchProcessingBehaviorContinue', 'MatchProcessingBehaviorStop' + MatchProcessingBehavior MatchProcessingBehavior `json:"matchProcessingBehavior,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning status. Possible values include: 'AfdProvisioningStateSucceeded', 'AfdProvisioningStateFailed', 'AfdProvisioningStateUpdating', 'AfdProvisioningStateDeleting', 'AfdProvisioningStateCreating' + ProvisioningState AfdProvisioningState `json:"provisioningState,omitempty"` + // DeploymentStatus - READ-ONLY; Possible values include: 'DeploymentStatusNotStarted', 'DeploymentStatusInProgress', 'DeploymentStatusSucceeded', 'DeploymentStatusFailed' + DeploymentStatus DeploymentStatus `json:"deploymentStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleProperties. +func (rp RuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rp.Order != nil { + objectMap["order"] = rp.Order + } + if rp.Conditions != nil { + objectMap["conditions"] = rp.Conditions + } + if rp.Actions != nil { + objectMap["actions"] = rp.Actions + } + if rp.MatchProcessingBehavior != "" { + objectMap["matchProcessingBehavior"] = rp.MatchProcessingBehavior + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RuleProperties struct. +func (rp *RuleProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "ruleSetName": + if v != nil { + var ruleSetName string + err = json.Unmarshal(*v, &ruleSetName) + if err != nil { + return err + } + rp.RuleSetName = &ruleSetName + } + case "order": + if v != nil { + var order int32 + err = json.Unmarshal(*v, &order) + if err != nil { + return err + } + rp.Order = &order + } + case "conditions": + if v != nil { + conditions, err := unmarshalBasicDeliveryRuleConditionArray(*v) + if err != nil { + return err + } + rp.Conditions = &conditions + } + case "actions": + if v != nil { + actions, err := unmarshalBasicDeliveryRuleActionArray(*v) + if err != nil { + return err + } + rp.Actions = &actions + } + case "matchProcessingBehavior": + if v != nil { + var matchProcessingBehavior MatchProcessingBehavior + err = json.Unmarshal(*v, &matchProcessingBehavior) + if err != nil { + return err + } + rp.MatchProcessingBehavior = matchProcessingBehavior + } + case "provisioningState": + if v != nil { + var provisioningState AfdProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + rp.ProvisioningState = provisioningState + } + case "deploymentStatus": + if v != nil { + var deploymentStatus DeploymentStatus + err = json.Unmarshal(*v, &deploymentStatus) + if err != nil { + return err + } + rp.DeploymentStatus = deploymentStatus + } + } + } + + return nil +} + +// RulesCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type RulesCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RulesClient) (Rule, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RulesCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RulesCreateFuture.Result. +func (future *RulesCreateFuture) result(client RulesClient) (r Rule, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + r.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.RulesCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { + r, err = client.CreateResponder(r.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesCreateFuture", "Result", r.Response.Response, "Failure responding to request") + } + } + return +} + +// RulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type RulesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RulesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RulesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RulesDeleteFuture.Result. +func (future *RulesDeleteFuture) result(client RulesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.RulesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// RuleSet friendly RuleSet name mapping to the any RuleSet or secret related information. +type RuleSet struct { + autorest.Response `json:"-"` + *RuleSetProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleSet. +func (rs RuleSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rs.RuleSetProperties != nil { + objectMap["properties"] = rs.RuleSetProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RuleSet struct. +func (rs *RuleSet) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var ruleSetProperties RuleSetProperties + err = json.Unmarshal(*v, &ruleSetProperties) + if err != nil { + return err + } + rs.RuleSetProperties = &ruleSetProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rs.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rs.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rs.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + rs.SystemData = &systemData + } + } + } + + return nil +} + +// RuleSetListResult result of the request to list rule sets. It contains a list of rule set objects and a +// URL link to get the next set of results. +type RuleSetListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of AzureFrontDoor rule sets within a profile. + Value *[]RuleSet `json:"value,omitempty"` + // NextLink - URL to get the next set of rule set objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleSetListResult. +func (rslr RuleSetListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rslr.NextLink != nil { + objectMap["nextLink"] = rslr.NextLink + } + return json.Marshal(objectMap) +} + +// RuleSetListResultIterator provides access to a complete listing of RuleSet values. +type RuleSetListResultIterator struct { + i int + page RuleSetListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RuleSetListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleSetListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RuleSetListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RuleSetListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RuleSetListResultIterator) Response() RuleSetListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RuleSetListResultIterator) Value() RuleSet { + if !iter.page.NotDone() { + return RuleSet{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RuleSetListResultIterator type. +func NewRuleSetListResultIterator(page RuleSetListResultPage) RuleSetListResultIterator { + return RuleSetListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rslr RuleSetListResult) IsEmpty() bool { + return rslr.Value == nil || len(*rslr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rslr RuleSetListResult) hasNextLink() bool { + return rslr.NextLink != nil && len(*rslr.NextLink) != 0 +} + +// ruleSetListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rslr RuleSetListResult) ruleSetListResultPreparer(ctx context.Context) (*http.Request, error) { + if !rslr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rslr.NextLink))) +} + +// RuleSetListResultPage contains a page of RuleSet values. +type RuleSetListResultPage struct { + fn func(context.Context, RuleSetListResult) (RuleSetListResult, error) + rslr RuleSetListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RuleSetListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleSetListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rslr) + if err != nil { + return err + } + page.rslr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RuleSetListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RuleSetListResultPage) NotDone() bool { + return !page.rslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RuleSetListResultPage) Response() RuleSetListResult { + return page.rslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RuleSetListResultPage) Values() []RuleSet { + if page.rslr.IsEmpty() { + return nil + } + return *page.rslr.Value +} + +// Creates a new instance of the RuleSetListResultPage type. +func NewRuleSetListResultPage(cur RuleSetListResult, getNextPage func(context.Context, RuleSetListResult) (RuleSetListResult, error)) RuleSetListResultPage { + return RuleSetListResultPage{ + fn: getNextPage, + rslr: cur, + } +} + +// RuleSetProperties the JSON object that contains the properties of the Rule Set to create. +type RuleSetProperties struct { + // ProfileName - READ-ONLY; The name of the profile which holds the rule set. + ProfileName *string `json:"profileName,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning status. Possible values include: 'AfdProvisioningStateSucceeded', 'AfdProvisioningStateFailed', 'AfdProvisioningStateUpdating', 'AfdProvisioningStateDeleting', 'AfdProvisioningStateCreating' + ProvisioningState AfdProvisioningState `json:"provisioningState,omitempty"` + // DeploymentStatus - READ-ONLY; Possible values include: 'DeploymentStatusNotStarted', 'DeploymentStatusInProgress', 'DeploymentStatusSucceeded', 'DeploymentStatusFailed' + DeploymentStatus DeploymentStatus `json:"deploymentStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleSetProperties. +func (rsp RuleSetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// RuleSetsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type RuleSetsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RuleSetsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RuleSetsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RuleSetsDeleteFuture.Result. +func (future *RuleSetsDeleteFuture) result(client RuleSetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RuleSetsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.RuleSetsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// RulesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type RulesUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RulesClient) (Rule, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RulesUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RulesUpdateFuture.Result. +func (future *RulesUpdateFuture) result(client RulesClient) (r Rule, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + r.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.RulesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { + r, err = client.UpdateResponder(r.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesUpdateFuture", "Result", r.Response.Response, "Failure responding to request") + } + } + return +} + +// RuleUpdateParameters the domain JSON object required for domain creation or update. +type RuleUpdateParameters struct { + *RuleUpdatePropertiesParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleUpdateParameters. +func (rup RuleUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rup.RuleUpdatePropertiesParameters != nil { + objectMap["properties"] = rup.RuleUpdatePropertiesParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RuleUpdateParameters struct. +func (rup *RuleUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var ruleUpdatePropertiesParameters RuleUpdatePropertiesParameters + err = json.Unmarshal(*v, &ruleUpdatePropertiesParameters) + if err != nil { + return err + } + rup.RuleUpdatePropertiesParameters = &ruleUpdatePropertiesParameters + } + } + } + + return nil +} + +// RuleUpdatePropertiesParameters the JSON object that contains the properties of the rule to update. +type RuleUpdatePropertiesParameters struct { + // RuleSetName - READ-ONLY; The name of the rule set containing the rule. + RuleSetName *string `json:"ruleSetName,omitempty"` + // Order - The order in which the rules are applied for the endpoint. Possible values {0,1,2,3,………}. A rule with a lesser order will be applied before a rule with a greater order. Rule with order 0 is a special rule. It does not require any condition and actions listed in it will always be applied. + Order *int32 `json:"order,omitempty"` + // Conditions - A list of conditions that must be matched for the actions to be executed + Conditions *[]BasicDeliveryRuleCondition `json:"conditions,omitempty"` + // Actions - A list of actions that are executed when all the conditions of a rule are satisfied. + Actions *[]BasicDeliveryRuleAction `json:"actions,omitempty"` + // MatchProcessingBehavior - If this rule is a match should the rules engine continue running the remaining rules or stop. If not present, defaults to Continue. Possible values include: 'MatchProcessingBehaviorContinue', 'MatchProcessingBehaviorStop' + MatchProcessingBehavior MatchProcessingBehavior `json:"matchProcessingBehavior,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleUpdatePropertiesParameters. +func (rupp RuleUpdatePropertiesParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rupp.Order != nil { + objectMap["order"] = rupp.Order + } + if rupp.Conditions != nil { + objectMap["conditions"] = rupp.Conditions + } + if rupp.Actions != nil { + objectMap["actions"] = rupp.Actions + } + if rupp.MatchProcessingBehavior != "" { + objectMap["matchProcessingBehavior"] = rupp.MatchProcessingBehavior + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RuleUpdatePropertiesParameters struct. +func (rupp *RuleUpdatePropertiesParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "ruleSetName": + if v != nil { + var ruleSetName string + err = json.Unmarshal(*v, &ruleSetName) + if err != nil { + return err + } + rupp.RuleSetName = &ruleSetName + } + case "order": + if v != nil { + var order int32 + err = json.Unmarshal(*v, &order) + if err != nil { + return err + } + rupp.Order = &order + } + case "conditions": + if v != nil { + conditions, err := unmarshalBasicDeliveryRuleConditionArray(*v) + if err != nil { + return err + } + rupp.Conditions = &conditions + } + case "actions": + if v != nil { + actions, err := unmarshalBasicDeliveryRuleActionArray(*v) + if err != nil { + return err + } + rupp.Actions = &actions + } + case "matchProcessingBehavior": + if v != nil { + var matchProcessingBehavior MatchProcessingBehavior + err = json.Unmarshal(*v, &matchProcessingBehavior) + if err != nil { + return err + } + rupp.MatchProcessingBehavior = matchProcessingBehavior + } + } + } + + return nil +} + +// Secret friendly Secret name mapping to the any Secret or secret related information. +type Secret struct { + autorest.Response `json:"-"` + *SecretProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Secret. +func (s Secret) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if s.SecretProperties != nil { + objectMap["properties"] = s.SecretProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Secret struct. +func (s *Secret) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var secretProperties SecretProperties + err = json.Unmarshal(*v, &secretProperties) + if err != nil { + return err + } + s.SecretProperties = &secretProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + s.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + s.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + s.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + s.SystemData = &systemData + } + } + } + + return nil +} + +// SecretListResult result of the request to list secrets. It contains a list of Secret objects and a URL +// link to get the next set of results. +type SecretListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of AzureFrontDoor secrets within a profile. + Value *[]Secret `json:"value,omitempty"` + // NextLink - URL to get the next set of Secret objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecretListResult. +func (slr SecretListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if slr.NextLink != nil { + objectMap["nextLink"] = slr.NextLink + } + return json.Marshal(objectMap) +} + +// SecretListResultIterator provides access to a complete listing of Secret values. +type SecretListResultIterator struct { + i int + page SecretListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SecretListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecretListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SecretListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SecretListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SecretListResultIterator) Response() SecretListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SecretListResultIterator) Value() Secret { + if !iter.page.NotDone() { + return Secret{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SecretListResultIterator type. +func NewSecretListResultIterator(page SecretListResultPage) SecretListResultIterator { + return SecretListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (slr SecretListResult) IsEmpty() bool { + return slr.Value == nil || len(*slr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (slr SecretListResult) hasNextLink() bool { + return slr.NextLink != nil && len(*slr.NextLink) != 0 +} + +// secretListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (slr SecretListResult) secretListResultPreparer(ctx context.Context) (*http.Request, error) { + if !slr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(slr.NextLink))) +} + +// SecretListResultPage contains a page of Secret values. +type SecretListResultPage struct { + fn func(context.Context, SecretListResult) (SecretListResult, error) + slr SecretListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SecretListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecretListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.slr) + if err != nil { + return err + } + page.slr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SecretListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SecretListResultPage) NotDone() bool { + return !page.slr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SecretListResultPage) Response() SecretListResult { + return page.slr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SecretListResultPage) Values() []Secret { + if page.slr.IsEmpty() { + return nil + } + return *page.slr.Value +} + +// Creates a new instance of the SecretListResultPage type. +func NewSecretListResultPage(cur SecretListResult, getNextPage func(context.Context, SecretListResult) (SecretListResult, error)) SecretListResultPage { + return SecretListResultPage{ + fn: getNextPage, + slr: cur, + } +} + +// BasicSecretParameters the json object containing secret parameters +type BasicSecretParameters interface { + AsURLSigningKeyParameters() (*URLSigningKeyParameters, bool) + AsManagedCertificateParameters() (*ManagedCertificateParameters, bool) + AsCustomerCertificateParameters() (*CustomerCertificateParameters, bool) + AsAzureFirstPartyManagedCertificateParameters() (*AzureFirstPartyManagedCertificateParameters, bool) + AsSecretParameters() (*SecretParameters, bool) +} + +// SecretParameters the json object containing secret parameters +type SecretParameters struct { + // Type - Possible values include: 'TypeBasicSecretParametersTypeSecretParameters', 'TypeBasicSecretParametersTypeURLSigningKey', 'TypeBasicSecretParametersTypeManagedCertificate', 'TypeBasicSecretParametersTypeCustomerCertificate', 'TypeBasicSecretParametersTypeAzureFirstPartyManagedCertificate' + Type TypeBasicSecretParameters `json:"type,omitempty"` +} + +func unmarshalBasicSecretParameters(body []byte) (BasicSecretParameters, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeBasicSecretParametersTypeURLSigningKey): + var uskp URLSigningKeyParameters + err := json.Unmarshal(body, &uskp) + return uskp, err + case string(TypeBasicSecretParametersTypeManagedCertificate): + var mcp ManagedCertificateParameters + err := json.Unmarshal(body, &mcp) + return mcp, err + case string(TypeBasicSecretParametersTypeCustomerCertificate): + var ccp CustomerCertificateParameters + err := json.Unmarshal(body, &ccp) + return ccp, err + case string(TypeBasicSecretParametersTypeAzureFirstPartyManagedCertificate): + var afpmcp AzureFirstPartyManagedCertificateParameters + err := json.Unmarshal(body, &afpmcp) + return afpmcp, err + default: + var sp SecretParameters + err := json.Unmarshal(body, &sp) + return sp, err + } +} +func unmarshalBasicSecretParametersArray(body []byte) ([]BasicSecretParameters, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + spArray := make([]BasicSecretParameters, len(rawMessages)) + + for index, rawMessage := range rawMessages { + sp, err := unmarshalBasicSecretParameters(*rawMessage) + if err != nil { + return nil, err + } + spArray[index] = sp + } + return spArray, nil +} + +// MarshalJSON is the custom marshaler for SecretParameters. +func (sp SecretParameters) MarshalJSON() ([]byte, error) { + sp.Type = TypeBasicSecretParametersTypeSecretParameters + objectMap := make(map[string]interface{}) + if sp.Type != "" { + objectMap["type"] = sp.Type + } + return json.Marshal(objectMap) +} + +// AsURLSigningKeyParameters is the BasicSecretParameters implementation for SecretParameters. +func (sp SecretParameters) AsURLSigningKeyParameters() (*URLSigningKeyParameters, bool) { + return nil, false +} + +// AsManagedCertificateParameters is the BasicSecretParameters implementation for SecretParameters. +func (sp SecretParameters) AsManagedCertificateParameters() (*ManagedCertificateParameters, bool) { + return nil, false +} + +// AsCustomerCertificateParameters is the BasicSecretParameters implementation for SecretParameters. +func (sp SecretParameters) AsCustomerCertificateParameters() (*CustomerCertificateParameters, bool) { + return nil, false +} + +// AsAzureFirstPartyManagedCertificateParameters is the BasicSecretParameters implementation for SecretParameters. +func (sp SecretParameters) AsAzureFirstPartyManagedCertificateParameters() (*AzureFirstPartyManagedCertificateParameters, bool) { + return nil, false +} + +// AsSecretParameters is the BasicSecretParameters implementation for SecretParameters. +func (sp SecretParameters) AsSecretParameters() (*SecretParameters, bool) { + return &sp, true +} + +// AsBasicSecretParameters is the BasicSecretParameters implementation for SecretParameters. +func (sp SecretParameters) AsBasicSecretParameters() (BasicSecretParameters, bool) { + return &sp, true +} + +// SecretProperties the JSON object that contains the properties of the Secret to create. +type SecretProperties struct { + // ProfileName - READ-ONLY; The name of the profile which holds the secret. + ProfileName *string `json:"profileName,omitempty"` + // Parameters - object which contains secret parameters + Parameters BasicSecretParameters `json:"parameters,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning status. Possible values include: 'AfdProvisioningStateSucceeded', 'AfdProvisioningStateFailed', 'AfdProvisioningStateUpdating', 'AfdProvisioningStateDeleting', 'AfdProvisioningStateCreating' + ProvisioningState AfdProvisioningState `json:"provisioningState,omitempty"` + // DeploymentStatus - READ-ONLY; Possible values include: 'DeploymentStatusNotStarted', 'DeploymentStatusInProgress', 'DeploymentStatusSucceeded', 'DeploymentStatusFailed' + DeploymentStatus DeploymentStatus `json:"deploymentStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecretProperties. +func (sp SecretProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["parameters"] = sp.Parameters + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SecretProperties struct. +func (sp *SecretProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "profileName": + if v != nil { + var profileName string + err = json.Unmarshal(*v, &profileName) + if err != nil { + return err + } + sp.ProfileName = &profileName + } + case "parameters": + if v != nil { + parameters, err := unmarshalBasicSecretParameters(*v) + if err != nil { + return err + } + sp.Parameters = parameters + } + case "provisioningState": + if v != nil { + var provisioningState AfdProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + sp.ProvisioningState = provisioningState + } + case "deploymentStatus": + if v != nil { + var deploymentStatus DeploymentStatus + err = json.Unmarshal(*v, &deploymentStatus) + if err != nil { + return err + } + sp.DeploymentStatus = deploymentStatus + } + } + } + + return nil +} + +// SecretsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SecretsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SecretsClient) (Secret, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SecretsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SecretsCreateFuture.Result. +func (future *SecretsCreateFuture) result(client SecretsClient) (s Secret, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecretsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.SecretsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.CreateResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecretsCreateFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// SecretsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SecretsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SecretsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SecretsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SecretsDeleteFuture.Result. +func (future *SecretsDeleteFuture) result(client SecretsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecretsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.SecretsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SecurityPoliciesCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SecurityPoliciesCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SecurityPoliciesClient) (SecurityPolicy, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SecurityPoliciesCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SecurityPoliciesCreateFuture.Result. +func (future *SecurityPoliciesCreateFuture) result(client SecurityPoliciesClient) (sp SecurityPolicy, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.SecurityPoliciesCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sp.Response.Response, err = future.GetResult(sender); err == nil && sp.Response.Response.StatusCode != http.StatusNoContent { + sp, err = client.CreateResponder(sp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesCreateFuture", "Result", sp.Response.Response, "Failure responding to request") + } + } + return +} + +// SecurityPoliciesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SecurityPoliciesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SecurityPoliciesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SecurityPoliciesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SecurityPoliciesDeleteFuture.Result. +func (future *SecurityPoliciesDeleteFuture) result(client SecurityPoliciesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.SecurityPoliciesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SecurityPoliciesPatchFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SecurityPoliciesPatchFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SecurityPoliciesClient) (SecurityPolicy, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SecurityPoliciesPatchFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SecurityPoliciesPatchFuture.Result. +func (future *SecurityPoliciesPatchFuture) result(client SecurityPoliciesClient) (sp SecurityPolicy, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesPatchFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.SecurityPoliciesPatchFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sp.Response.Response, err = future.GetResult(sender); err == nil && sp.Response.Response.StatusCode != http.StatusNoContent { + sp, err = client.PatchResponder(sp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesPatchFuture", "Result", sp.Response.Response, "Failure responding to request") + } + } + return +} + +// SecurityPolicy securityPolicy association for AzureFrontDoor profile +type SecurityPolicy struct { + autorest.Response `json:"-"` + *SecurityPolicyProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecurityPolicy. +func (sp SecurityPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sp.SecurityPolicyProperties != nil { + objectMap["properties"] = sp.SecurityPolicyProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SecurityPolicy struct. +func (sp *SecurityPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var securityPolicyProperties SecurityPolicyProperties + err = json.Unmarshal(*v, &securityPolicyProperties) + if err != nil { + return err + } + sp.SecurityPolicyProperties = &securityPolicyProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sp.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + sp.SystemData = &systemData + } + } + } + + return nil +} + +// SecurityPolicyListResult result of the request to list security policies. It contains a list of security +// policy objects and a URL link to get the next set of results. +type SecurityPolicyListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Security policies within a profile + Value *[]SecurityPolicy `json:"value,omitempty"` + // NextLink - URL to get the next set of security policy objects if there is any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecurityPolicyListResult. +func (splr SecurityPolicyListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if splr.NextLink != nil { + objectMap["nextLink"] = splr.NextLink + } + return json.Marshal(objectMap) +} + +// SecurityPolicyListResultIterator provides access to a complete listing of SecurityPolicy values. +type SecurityPolicyListResultIterator struct { + i int + page SecurityPolicyListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SecurityPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityPolicyListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SecurityPolicyListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SecurityPolicyListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SecurityPolicyListResultIterator) Response() SecurityPolicyListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SecurityPolicyListResultIterator) Value() SecurityPolicy { + if !iter.page.NotDone() { + return SecurityPolicy{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SecurityPolicyListResultIterator type. +func NewSecurityPolicyListResultIterator(page SecurityPolicyListResultPage) SecurityPolicyListResultIterator { + return SecurityPolicyListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (splr SecurityPolicyListResult) IsEmpty() bool { + return splr.Value == nil || len(*splr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (splr SecurityPolicyListResult) hasNextLink() bool { + return splr.NextLink != nil && len(*splr.NextLink) != 0 +} + +// securityPolicyListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (splr SecurityPolicyListResult) securityPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { + if !splr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(splr.NextLink))) +} + +// SecurityPolicyListResultPage contains a page of SecurityPolicy values. +type SecurityPolicyListResultPage struct { + fn func(context.Context, SecurityPolicyListResult) (SecurityPolicyListResult, error) + splr SecurityPolicyListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SecurityPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityPolicyListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.splr) + if err != nil { + return err + } + page.splr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SecurityPolicyListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SecurityPolicyListResultPage) NotDone() bool { + return !page.splr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SecurityPolicyListResultPage) Response() SecurityPolicyListResult { + return page.splr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SecurityPolicyListResultPage) Values() []SecurityPolicy { + if page.splr.IsEmpty() { + return nil + } + return *page.splr.Value +} + +// Creates a new instance of the SecurityPolicyListResultPage type. +func NewSecurityPolicyListResultPage(cur SecurityPolicyListResult, getNextPage func(context.Context, SecurityPolicyListResult) (SecurityPolicyListResult, error)) SecurityPolicyListResultPage { + return SecurityPolicyListResultPage{ + fn: getNextPage, + splr: cur, + } +} + +// SecurityPolicyProperties the json object that contains properties required to create a security policy +type SecurityPolicyProperties struct { + // ProfileName - READ-ONLY; The name of the profile which holds the security policy. + ProfileName *string `json:"profileName,omitempty"` + // Parameters - object which contains security policy parameters + Parameters BasicSecurityPolicyPropertiesParameters `json:"parameters,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning status. Possible values include: 'AfdProvisioningStateSucceeded', 'AfdProvisioningStateFailed', 'AfdProvisioningStateUpdating', 'AfdProvisioningStateDeleting', 'AfdProvisioningStateCreating' + ProvisioningState AfdProvisioningState `json:"provisioningState,omitempty"` + // DeploymentStatus - READ-ONLY; Possible values include: 'DeploymentStatusNotStarted', 'DeploymentStatusInProgress', 'DeploymentStatusSucceeded', 'DeploymentStatusFailed' + DeploymentStatus DeploymentStatus `json:"deploymentStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecurityPolicyProperties. +func (spp SecurityPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["parameters"] = spp.Parameters + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SecurityPolicyProperties struct. +func (spp *SecurityPolicyProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "profileName": + if v != nil { + var profileName string + err = json.Unmarshal(*v, &profileName) + if err != nil { + return err + } + spp.ProfileName = &profileName + } + case "parameters": + if v != nil { + parameters, err := unmarshalBasicSecurityPolicyPropertiesParameters(*v) + if err != nil { + return err + } + spp.Parameters = parameters + } + case "provisioningState": + if v != nil { + var provisioningState AfdProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + spp.ProvisioningState = provisioningState + } + case "deploymentStatus": + if v != nil { + var deploymentStatus DeploymentStatus + err = json.Unmarshal(*v, &deploymentStatus) + if err != nil { + return err + } + spp.DeploymentStatus = deploymentStatus + } + } + } + + return nil +} + +// BasicSecurityPolicyPropertiesParameters the json object containing security policy parameters +type BasicSecurityPolicyPropertiesParameters interface { + AsSecurityPolicyWebApplicationFirewallParameters() (*SecurityPolicyWebApplicationFirewallParameters, bool) + AsSecurityPolicyPropertiesParameters() (*SecurityPolicyPropertiesParameters, bool) +} + +// SecurityPolicyPropertiesParameters the json object containing security policy parameters +type SecurityPolicyPropertiesParameters struct { + // Type - Possible values include: 'TypeSecurityPolicyPropertiesParameters', 'TypeWebApplicationFirewall' + Type Type `json:"type,omitempty"` +} + +func unmarshalBasicSecurityPolicyPropertiesParameters(body []byte) (BasicSecurityPolicyPropertiesParameters, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeWebApplicationFirewall): + var spwafp SecurityPolicyWebApplicationFirewallParameters + err := json.Unmarshal(body, &spwafp) + return spwafp, err + default: + var sppp SecurityPolicyPropertiesParameters + err := json.Unmarshal(body, &sppp) + return sppp, err + } +} +func unmarshalBasicSecurityPolicyPropertiesParametersArray(body []byte) ([]BasicSecurityPolicyPropertiesParameters, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + spppArray := make([]BasicSecurityPolicyPropertiesParameters, len(rawMessages)) + + for index, rawMessage := range rawMessages { + sppp, err := unmarshalBasicSecurityPolicyPropertiesParameters(*rawMessage) + if err != nil { + return nil, err + } + spppArray[index] = sppp + } + return spppArray, nil +} + +// MarshalJSON is the custom marshaler for SecurityPolicyPropertiesParameters. +func (sppp SecurityPolicyPropertiesParameters) MarshalJSON() ([]byte, error) { + sppp.Type = TypeSecurityPolicyPropertiesParameters + objectMap := make(map[string]interface{}) + if sppp.Type != "" { + objectMap["type"] = sppp.Type + } + return json.Marshal(objectMap) +} + +// AsSecurityPolicyWebApplicationFirewallParameters is the BasicSecurityPolicyPropertiesParameters implementation for SecurityPolicyPropertiesParameters. +func (sppp SecurityPolicyPropertiesParameters) AsSecurityPolicyWebApplicationFirewallParameters() (*SecurityPolicyWebApplicationFirewallParameters, bool) { + return nil, false +} + +// AsSecurityPolicyPropertiesParameters is the BasicSecurityPolicyPropertiesParameters implementation for SecurityPolicyPropertiesParameters. +func (sppp SecurityPolicyPropertiesParameters) AsSecurityPolicyPropertiesParameters() (*SecurityPolicyPropertiesParameters, bool) { + return &sppp, true +} + +// AsBasicSecurityPolicyPropertiesParameters is the BasicSecurityPolicyPropertiesParameters implementation for SecurityPolicyPropertiesParameters. +func (sppp SecurityPolicyPropertiesParameters) AsBasicSecurityPolicyPropertiesParameters() (BasicSecurityPolicyPropertiesParameters, bool) { + return &sppp, true +} + +// SecurityPolicyUpdateParameters the JSON object containing security policy update parameters. +type SecurityPolicyUpdateParameters struct { + *SecurityPolicyUpdateProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecurityPolicyUpdateParameters. +func (spup SecurityPolicyUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if spup.SecurityPolicyUpdateProperties != nil { + objectMap["properties"] = spup.SecurityPolicyUpdateProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SecurityPolicyUpdateParameters struct. +func (spup *SecurityPolicyUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var securityPolicyUpdateProperties SecurityPolicyUpdateProperties + err = json.Unmarshal(*v, &securityPolicyUpdateProperties) + if err != nil { + return err + } + spup.SecurityPolicyUpdateProperties = &securityPolicyUpdateProperties + } + } + } + + return nil +} + +// SecurityPolicyUpdateProperties the json object that contains properties required to update a security +// policy +type SecurityPolicyUpdateProperties struct { + // Parameters - object which contains security policy parameters + Parameters BasicSecurityPolicyPropertiesParameters `json:"parameters,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for SecurityPolicyUpdateProperties struct. +func (spup *SecurityPolicyUpdateProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "parameters": + if v != nil { + parameters, err := unmarshalBasicSecurityPolicyPropertiesParameters(*v) + if err != nil { + return err + } + spup.Parameters = parameters + } + } + } + + return nil +} + +// SecurityPolicyWebApplicationFirewallAssociation settings for security policy patterns to match +type SecurityPolicyWebApplicationFirewallAssociation struct { + // Domains - List of domains. + Domains *[]ActivatedResourceReference `json:"domains,omitempty"` + // PatternsToMatch - List of paths + PatternsToMatch *[]string `json:"patternsToMatch,omitempty"` +} + +// SecurityPolicyWebApplicationFirewallParameters the json object containing security policy waf parameters +type SecurityPolicyWebApplicationFirewallParameters struct { + // WafPolicy - Resource ID. + WafPolicy *ResourceReference `json:"wafPolicy,omitempty"` + // Associations - Waf associations + Associations *[]SecurityPolicyWebApplicationFirewallAssociation `json:"associations,omitempty"` + // Type - Possible values include: 'TypeSecurityPolicyPropertiesParameters', 'TypeWebApplicationFirewall' + Type Type `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecurityPolicyWebApplicationFirewallParameters. +func (spwafp SecurityPolicyWebApplicationFirewallParameters) MarshalJSON() ([]byte, error) { + spwafp.Type = TypeWebApplicationFirewall + objectMap := make(map[string]interface{}) + if spwafp.WafPolicy != nil { + objectMap["wafPolicy"] = spwafp.WafPolicy + } + if spwafp.Associations != nil { + objectMap["associations"] = spwafp.Associations + } + if spwafp.Type != "" { + objectMap["type"] = spwafp.Type + } + return json.Marshal(objectMap) +} + +// AsSecurityPolicyWebApplicationFirewallParameters is the BasicSecurityPolicyPropertiesParameters implementation for SecurityPolicyWebApplicationFirewallParameters. +func (spwafp SecurityPolicyWebApplicationFirewallParameters) AsSecurityPolicyWebApplicationFirewallParameters() (*SecurityPolicyWebApplicationFirewallParameters, bool) { + return &spwafp, true +} + +// AsSecurityPolicyPropertiesParameters is the BasicSecurityPolicyPropertiesParameters implementation for SecurityPolicyWebApplicationFirewallParameters. +func (spwafp SecurityPolicyWebApplicationFirewallParameters) AsSecurityPolicyPropertiesParameters() (*SecurityPolicyPropertiesParameters, bool) { + return nil, false +} + +// AsBasicSecurityPolicyPropertiesParameters is the BasicSecurityPolicyPropertiesParameters implementation for SecurityPolicyWebApplicationFirewallParameters. +func (spwafp SecurityPolicyWebApplicationFirewallParameters) AsBasicSecurityPolicyPropertiesParameters() (BasicSecurityPolicyPropertiesParameters, bool) { + return &spwafp, true +} + +// ServerPortMatchConditionParameters defines the parameters for ServerPort match conditions +type ServerPortMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched. Possible values include: 'ServerPortOperatorAny', 'ServerPortOperatorEqual', 'ServerPortOperatorContains', 'ServerPortOperatorBeginsWith', 'ServerPortOperatorEndsWith', 'ServerPortOperatorLessThan', 'ServerPortOperatorLessThanOrEqual', 'ServerPortOperatorGreaterThan', 'ServerPortOperatorGreaterThanOrEqual', 'ServerPortOperatorRegEx' + Operator ServerPortOperator `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// ServiceSpecification one property of operation, include log specifications. +type ServiceSpecification struct { + // LogSpecifications - Log specifications of operation. + LogSpecifications *[]LogSpecification `json:"logSpecifications,omitempty"` + // MetricSpecifications - Metric specifications of operation. + MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"` +} + +// SharedPrivateLinkResourceProperties describes the properties of an existing Shared Private Link Resource +// to use when connecting to a private origin. +type SharedPrivateLinkResourceProperties struct { + // PrivateLink - The resource id of the resource the shared private link resource is for. + PrivateLink *ResourceReference `json:"privateLink,omitempty"` + // PrivateLinkLocation - The location of the shared private link resource + PrivateLinkLocation *string `json:"privateLinkLocation,omitempty"` + // GroupID - The group id from the provider of resource the shared private link resource is for. + GroupID *string `json:"groupId,omitempty"` + // RequestMessage - The request message for requesting approval of the shared private link resource. + RequestMessage *string `json:"requestMessage,omitempty"` + // Status - Status of the shared private link resource. Can be Pending, Approved, Rejected, Disconnected, or Timeout. Possible values include: 'SharedPrivateLinkResourceStatusPending', 'SharedPrivateLinkResourceStatusApproved', 'SharedPrivateLinkResourceStatusRejected', 'SharedPrivateLinkResourceStatusDisconnected', 'SharedPrivateLinkResourceStatusTimeout' + Status SharedPrivateLinkResourceStatus `json:"status,omitempty"` +} + +// Sku standard_Verizon = The SKU name for a Standard Verizon CDN profile. +// Premium_Verizon = The SKU name for a Premium Verizon CDN profile. +// Custom_Verizon = The SKU name for a Custom Verizon CDN profile. +// Standard_Akamai = The SKU name for an Akamai CDN profile. +// Standard_ChinaCdn = The SKU name for a China CDN profile for VOD, Web and download scenarios using GB +// based billing model. +// Standard_Microsoft = The SKU name for a Standard Microsoft CDN profile. +// Standard_AzureFrontDoor = The SKU name for an Azure Front Door Standard profile. +// Premium_AzureFrontDoor = The SKU name for an Azure Front Door Premium profile. +// Standard_955BandWidth_ChinaCdn = The SKU name for a China CDN profile for VOD, Web and download +// scenarios using 95-5 peak bandwidth billing model. +// Standard_AvgBandWidth_ChinaCdn = The SKU name for a China CDN profile for VOD, Web and download +// scenarios using monthly average peak bandwidth billing model. +// StandardPlus_ChinaCdn = The SKU name for a China CDN profile for live-streaming using GB based billing +// model. +// StandardPlus_955BandWidth_ChinaCdn = The SKU name for a China CDN live-streaming profile using 95-5 peak +// bandwidth billing model. +// StandardPlus_AvgBandWidth_ChinaCdn = The SKU name for a China CDN live-streaming profile using monthly +// average peak bandwidth billing model. +type Sku struct { + // Name - Name of the pricing tier. Possible values include: 'SkuNameStandardVerizon', 'SkuNamePremiumVerizon', 'SkuNameCustomVerizon', 'SkuNameStandardAkamai', 'SkuNameStandardChinaCdn', 'SkuNameStandardMicrosoft', 'SkuNameStandardAzureFrontDoor', 'SkuNamePremiumAzureFrontDoor', 'SkuNameStandard955BandWidthChinaCdn', 'SkuNameStandardAvgBandWidthChinaCdn', 'SkuNameStandardPlusChinaCdn', 'SkuNameStandardPlus955BandWidthChinaCdn', 'SkuNameStandardPlusAvgBandWidthChinaCdn' + Name SkuName `json:"name,omitempty"` +} + +// SocketAddrMatchConditionParameters defines the parameters for SocketAddress match conditions +type SocketAddrMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched. Possible values include: 'SocketAddrOperatorAny', 'SocketAddrOperatorIPMatch' + Operator SocketAddrOperator `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// SslProtocolMatchConditionParameters defines the parameters for SslProtocol match conditions +type SslProtocolMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched + Operator *string `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]SslProtocol `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// SsoURI the URI required to login to the supplemental portal from the Azure portal. +type SsoURI struct { + autorest.Response `json:"-"` + // SsoURIValue - READ-ONLY; The URI used to login to the supplemental portal. + SsoURIValue *string `json:"ssoUriValue,omitempty"` +} + +// MarshalJSON is the custom marshaler for SsoURI. +func (su SsoURI) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SupportedOptimizationTypesListResult the result of the GetSupportedOptimizationTypes API +type SupportedOptimizationTypesListResult struct { + autorest.Response `json:"-"` + // SupportedOptimizationTypes - READ-ONLY; Supported optimization types for a profile. + SupportedOptimizationTypes *[]OptimizationType `json:"supportedOptimizationTypes,omitempty"` +} + +// MarshalJSON is the custom marshaler for SupportedOptimizationTypesListResult. +func (sotlr SupportedOptimizationTypesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SystemData read only system data +type SystemData struct { + // CreatedBy - An identifier for the identity that created the resource + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'IdentityTypeUser', 'IdentityTypeApplication', 'IdentityTypeManagedIdentity', 'IdentityTypeKey' + CreatedByType IdentityType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC) + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - An identifier for the identity that last modified the resource + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'IdentityTypeUser', 'IdentityTypeApplication', 'IdentityTypeManagedIdentity', 'IdentityTypeKey' + LastModifiedByType IdentityType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TrackedResource the resource model definition for a ARM tracked top level resource. +type TrackedResource struct { + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Location != nil { + objectMap["location"] = tr.Location + } + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + return json.Marshal(objectMap) +} + +// URLFileExtensionMatchConditionParameters defines the parameters for UrlFileExtension match conditions +type URLFileExtensionMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched. Possible values include: 'URLFileExtensionOperatorAny', 'URLFileExtensionOperatorEqual', 'URLFileExtensionOperatorContains', 'URLFileExtensionOperatorBeginsWith', 'URLFileExtensionOperatorEndsWith', 'URLFileExtensionOperatorLessThan', 'URLFileExtensionOperatorLessThanOrEqual', 'URLFileExtensionOperatorGreaterThan', 'URLFileExtensionOperatorGreaterThanOrEqual', 'URLFileExtensionOperatorRegEx' + Operator URLFileExtensionOperator `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// URLFileNameMatchConditionParameters defines the parameters for UrlFilename match conditions +type URLFileNameMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched. Possible values include: 'URLFileNameOperatorAny', 'URLFileNameOperatorEqual', 'URLFileNameOperatorContains', 'URLFileNameOperatorBeginsWith', 'URLFileNameOperatorEndsWith', 'URLFileNameOperatorLessThan', 'URLFileNameOperatorLessThanOrEqual', 'URLFileNameOperatorGreaterThan', 'URLFileNameOperatorGreaterThanOrEqual', 'URLFileNameOperatorRegEx' + Operator URLFileNameOperator `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// URLPathMatchConditionParameters defines the parameters for UrlPath match conditions +type URLPathMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched. Possible values include: 'URLPathOperatorAny', 'URLPathOperatorEqual', 'URLPathOperatorContains', 'URLPathOperatorBeginsWith', 'URLPathOperatorEndsWith', 'URLPathOperatorLessThan', 'URLPathOperatorLessThanOrEqual', 'URLPathOperatorGreaterThan', 'URLPathOperatorGreaterThanOrEqual', 'URLPathOperatorWildcard', 'URLPathOperatorRegEx' + Operator URLPathOperator `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// URLRedirectAction defines the url redirect action for the delivery rule. +type URLRedirectAction struct { + // Parameters - Defines the parameters for the action. + Parameters *URLRedirectActionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameBasicDeliveryRuleActionNameDeliveryRuleAction', 'NameBasicDeliveryRuleActionNameRouteConfigurationOverride', 'NameBasicDeliveryRuleActionNameCacheKeyQueryString', 'NameBasicDeliveryRuleActionNameCacheExpiration', 'NameBasicDeliveryRuleActionNameModifyResponseHeader', 'NameBasicDeliveryRuleActionNameModifyRequestHeader', 'NameBasicDeliveryRuleActionNameURLRewrite', 'NameBasicDeliveryRuleActionNameOriginGroupOverride', 'NameBasicDeliveryRuleActionNameURLSigning', 'NameBasicDeliveryRuleActionNameURLRedirect' + Name NameBasicDeliveryRuleAction `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for URLRedirectAction. +func (ura URLRedirectAction) MarshalJSON() ([]byte, error) { + ura.Name = NameBasicDeliveryRuleActionNameURLRedirect + objectMap := make(map[string]interface{}) + if ura.Parameters != nil { + objectMap["parameters"] = ura.Parameters + } + if ura.Name != "" { + objectMap["name"] = ura.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleRouteConfigurationOverrideAction is the BasicDeliveryRuleAction implementation for URLRedirectAction. +func (ura URLRedirectAction) AsDeliveryRuleRouteConfigurationOverrideAction() (*DeliveryRuleRouteConfigurationOverrideAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheKeyQueryStringAction is the BasicDeliveryRuleAction implementation for URLRedirectAction. +func (ura URLRedirectAction) AsDeliveryRuleCacheKeyQueryStringAction() (*DeliveryRuleCacheKeyQueryStringAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheExpirationAction is the BasicDeliveryRuleAction implementation for URLRedirectAction. +func (ura URLRedirectAction) AsDeliveryRuleCacheExpirationAction() (*DeliveryRuleCacheExpirationAction, bool) { + return nil, false +} + +// AsDeliveryRuleResponseHeaderAction is the BasicDeliveryRuleAction implementation for URLRedirectAction. +func (ura URLRedirectAction) AsDeliveryRuleResponseHeaderAction() (*DeliveryRuleResponseHeaderAction, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderAction is the BasicDeliveryRuleAction implementation for URLRedirectAction. +func (ura URLRedirectAction) AsDeliveryRuleRequestHeaderAction() (*DeliveryRuleRequestHeaderAction, bool) { + return nil, false +} + +// AsURLRewriteAction is the BasicDeliveryRuleAction implementation for URLRedirectAction. +func (ura URLRedirectAction) AsURLRewriteAction() (*URLRewriteAction, bool) { + return nil, false +} + +// AsOriginGroupOverrideAction is the BasicDeliveryRuleAction implementation for URLRedirectAction. +func (ura URLRedirectAction) AsOriginGroupOverrideAction() (*OriginGroupOverrideAction, bool) { + return nil, false +} + +// AsURLSigningAction is the BasicDeliveryRuleAction implementation for URLRedirectAction. +func (ura URLRedirectAction) AsURLSigningAction() (*URLSigningAction, bool) { + return nil, false +} + +// AsURLRedirectAction is the BasicDeliveryRuleAction implementation for URLRedirectAction. +func (ura URLRedirectAction) AsURLRedirectAction() (*URLRedirectAction, bool) { + return &ura, true +} + +// AsDeliveryRuleAction is the BasicDeliveryRuleAction implementation for URLRedirectAction. +func (ura URLRedirectAction) AsDeliveryRuleAction() (*DeliveryRuleAction, bool) { + return nil, false +} + +// AsBasicDeliveryRuleAction is the BasicDeliveryRuleAction implementation for URLRedirectAction. +func (ura URLRedirectAction) AsBasicDeliveryRuleAction() (BasicDeliveryRuleAction, bool) { + return &ura, true +} + +// URLRedirectActionParameters defines the parameters for the url redirect action. +type URLRedirectActionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // RedirectType - The redirect type the rule will use when redirecting traffic. Possible values include: 'RedirectTypeMoved', 'RedirectTypeFound', 'RedirectTypeTemporaryRedirect', 'RedirectTypePermanentRedirect' + RedirectType RedirectType `json:"redirectType,omitempty"` + // DestinationProtocol - Protocol to use for the redirect. The default value is MatchRequest. Possible values include: 'DestinationProtocolMatchRequest', 'DestinationProtocolHTTP', 'DestinationProtocolHTTPS' + DestinationProtocol DestinationProtocol `json:"destinationProtocol,omitempty"` + // CustomPath - The full path to redirect. Path cannot be empty and must start with /. Leave empty to use the incoming path as destination path. + CustomPath *string `json:"customPath,omitempty"` + // CustomHostname - Host to redirect. Leave empty to use the incoming host as the destination host. + CustomHostname *string `json:"customHostname,omitempty"` + // CustomQueryString - The set of query strings to be placed in the redirect URL. Setting this value would replace any existing query string; leave empty to preserve the incoming query string. Query string must be in = format. ? and & will be added automatically so do not include them. + CustomQueryString *string `json:"customQueryString,omitempty"` + // CustomFragment - Fragment to add to the redirect URL. Fragment is the part of the URL that comes after #. Do not include the #. + CustomFragment *string `json:"customFragment,omitempty"` +} + +// URLRewriteAction defines the url rewrite action for the delivery rule. +type URLRewriteAction struct { + // Parameters - Defines the parameters for the action. + Parameters *URLRewriteActionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameBasicDeliveryRuleActionNameDeliveryRuleAction', 'NameBasicDeliveryRuleActionNameRouteConfigurationOverride', 'NameBasicDeliveryRuleActionNameCacheKeyQueryString', 'NameBasicDeliveryRuleActionNameCacheExpiration', 'NameBasicDeliveryRuleActionNameModifyResponseHeader', 'NameBasicDeliveryRuleActionNameModifyRequestHeader', 'NameBasicDeliveryRuleActionNameURLRewrite', 'NameBasicDeliveryRuleActionNameOriginGroupOverride', 'NameBasicDeliveryRuleActionNameURLSigning', 'NameBasicDeliveryRuleActionNameURLRedirect' + Name NameBasicDeliveryRuleAction `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for URLRewriteAction. +func (ura URLRewriteAction) MarshalJSON() ([]byte, error) { + ura.Name = NameBasicDeliveryRuleActionNameURLRewrite + objectMap := make(map[string]interface{}) + if ura.Parameters != nil { + objectMap["parameters"] = ura.Parameters + } + if ura.Name != "" { + objectMap["name"] = ura.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleRouteConfigurationOverrideAction is the BasicDeliveryRuleAction implementation for URLRewriteAction. +func (ura URLRewriteAction) AsDeliveryRuleRouteConfigurationOverrideAction() (*DeliveryRuleRouteConfigurationOverrideAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheKeyQueryStringAction is the BasicDeliveryRuleAction implementation for URLRewriteAction. +func (ura URLRewriteAction) AsDeliveryRuleCacheKeyQueryStringAction() (*DeliveryRuleCacheKeyQueryStringAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheExpirationAction is the BasicDeliveryRuleAction implementation for URLRewriteAction. +func (ura URLRewriteAction) AsDeliveryRuleCacheExpirationAction() (*DeliveryRuleCacheExpirationAction, bool) { + return nil, false +} + +// AsDeliveryRuleResponseHeaderAction is the BasicDeliveryRuleAction implementation for URLRewriteAction. +func (ura URLRewriteAction) AsDeliveryRuleResponseHeaderAction() (*DeliveryRuleResponseHeaderAction, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderAction is the BasicDeliveryRuleAction implementation for URLRewriteAction. +func (ura URLRewriteAction) AsDeliveryRuleRequestHeaderAction() (*DeliveryRuleRequestHeaderAction, bool) { + return nil, false +} + +// AsURLRewriteAction is the BasicDeliveryRuleAction implementation for URLRewriteAction. +func (ura URLRewriteAction) AsURLRewriteAction() (*URLRewriteAction, bool) { + return &ura, true +} + +// AsOriginGroupOverrideAction is the BasicDeliveryRuleAction implementation for URLRewriteAction. +func (ura URLRewriteAction) AsOriginGroupOverrideAction() (*OriginGroupOverrideAction, bool) { + return nil, false +} + +// AsURLSigningAction is the BasicDeliveryRuleAction implementation for URLRewriteAction. +func (ura URLRewriteAction) AsURLSigningAction() (*URLSigningAction, bool) { + return nil, false +} + +// AsURLRedirectAction is the BasicDeliveryRuleAction implementation for URLRewriteAction. +func (ura URLRewriteAction) AsURLRedirectAction() (*URLRedirectAction, bool) { + return nil, false +} + +// AsDeliveryRuleAction is the BasicDeliveryRuleAction implementation for URLRewriteAction. +func (ura URLRewriteAction) AsDeliveryRuleAction() (*DeliveryRuleAction, bool) { + return nil, false +} + +// AsBasicDeliveryRuleAction is the BasicDeliveryRuleAction implementation for URLRewriteAction. +func (ura URLRewriteAction) AsBasicDeliveryRuleAction() (BasicDeliveryRuleAction, bool) { + return &ura, true +} + +// URLRewriteActionParameters defines the parameters for the url rewrite action. +type URLRewriteActionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // SourcePattern - define a request URI pattern that identifies the type of requests that may be rewritten. If value is blank, all strings are matched. + SourcePattern *string `json:"sourcePattern,omitempty"` + // Destination - Define the relative URL to which the above requests will be rewritten by. + Destination *string `json:"destination,omitempty"` + // PreserveUnmatchedPath - Whether to preserve unmatched path. Default value is true. + PreserveUnmatchedPath *bool `json:"preserveUnmatchedPath,omitempty"` +} + +// URLSigningAction defines the url signing action for the delivery rule. +type URLSigningAction struct { + // Parameters - Defines the parameters for the action. + Parameters *URLSigningActionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameBasicDeliveryRuleActionNameDeliveryRuleAction', 'NameBasicDeliveryRuleActionNameRouteConfigurationOverride', 'NameBasicDeliveryRuleActionNameCacheKeyQueryString', 'NameBasicDeliveryRuleActionNameCacheExpiration', 'NameBasicDeliveryRuleActionNameModifyResponseHeader', 'NameBasicDeliveryRuleActionNameModifyRequestHeader', 'NameBasicDeliveryRuleActionNameURLRewrite', 'NameBasicDeliveryRuleActionNameOriginGroupOverride', 'NameBasicDeliveryRuleActionNameURLSigning', 'NameBasicDeliveryRuleActionNameURLRedirect' + Name NameBasicDeliveryRuleAction `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for URLSigningAction. +func (usa URLSigningAction) MarshalJSON() ([]byte, error) { + usa.Name = NameBasicDeliveryRuleActionNameURLSigning + objectMap := make(map[string]interface{}) + if usa.Parameters != nil { + objectMap["parameters"] = usa.Parameters + } + if usa.Name != "" { + objectMap["name"] = usa.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleRouteConfigurationOverrideAction is the BasicDeliveryRuleAction implementation for URLSigningAction. +func (usa URLSigningAction) AsDeliveryRuleRouteConfigurationOverrideAction() (*DeliveryRuleRouteConfigurationOverrideAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheKeyQueryStringAction is the BasicDeliveryRuleAction implementation for URLSigningAction. +func (usa URLSigningAction) AsDeliveryRuleCacheKeyQueryStringAction() (*DeliveryRuleCacheKeyQueryStringAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheExpirationAction is the BasicDeliveryRuleAction implementation for URLSigningAction. +func (usa URLSigningAction) AsDeliveryRuleCacheExpirationAction() (*DeliveryRuleCacheExpirationAction, bool) { + return nil, false +} + +// AsDeliveryRuleResponseHeaderAction is the BasicDeliveryRuleAction implementation for URLSigningAction. +func (usa URLSigningAction) AsDeliveryRuleResponseHeaderAction() (*DeliveryRuleResponseHeaderAction, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderAction is the BasicDeliveryRuleAction implementation for URLSigningAction. +func (usa URLSigningAction) AsDeliveryRuleRequestHeaderAction() (*DeliveryRuleRequestHeaderAction, bool) { + return nil, false +} + +// AsURLRewriteAction is the BasicDeliveryRuleAction implementation for URLSigningAction. +func (usa URLSigningAction) AsURLRewriteAction() (*URLRewriteAction, bool) { + return nil, false +} + +// AsOriginGroupOverrideAction is the BasicDeliveryRuleAction implementation for URLSigningAction. +func (usa URLSigningAction) AsOriginGroupOverrideAction() (*OriginGroupOverrideAction, bool) { + return nil, false +} + +// AsURLSigningAction is the BasicDeliveryRuleAction implementation for URLSigningAction. +func (usa URLSigningAction) AsURLSigningAction() (*URLSigningAction, bool) { + return &usa, true +} + +// AsURLRedirectAction is the BasicDeliveryRuleAction implementation for URLSigningAction. +func (usa URLSigningAction) AsURLRedirectAction() (*URLRedirectAction, bool) { + return nil, false +} + +// AsDeliveryRuleAction is the BasicDeliveryRuleAction implementation for URLSigningAction. +func (usa URLSigningAction) AsDeliveryRuleAction() (*DeliveryRuleAction, bool) { + return nil, false +} + +// AsBasicDeliveryRuleAction is the BasicDeliveryRuleAction implementation for URLSigningAction. +func (usa URLSigningAction) AsBasicDeliveryRuleAction() (BasicDeliveryRuleAction, bool) { + return &usa, true +} + +// URLSigningActionParameters defines the parameters for the Url Signing action. +type URLSigningActionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Algorithm - Algorithm to use for URL signing. Possible values include: 'AlgorithmSHA256' + Algorithm Algorithm `json:"algorithm,omitempty"` + // ParameterNameOverride - Defines which query string parameters in the url to be considered for expires, key id etc. + ParameterNameOverride *[]URLSigningParamIdentifier `json:"parameterNameOverride,omitempty"` +} + +// URLSigningKey url signing key +type URLSigningKey struct { + // KeyID - Defines the customer defined key Id. This id will exist in the incoming request to indicate the key used to form the hash. + KeyID *string `json:"keyId,omitempty"` + // KeySourceParameters - Defines the parameters for using customer key vault for Url Signing Key. + KeySourceParameters *KeyVaultSigningKeyParameters `json:"keySourceParameters,omitempty"` +} + +// URLSigningKeyParameters url signing key parameters +type URLSigningKeyParameters struct { + // KeyID - Defines the customer defined key Id. This id will exist in the incoming request to indicate the key used to form the hash. + KeyID *string `json:"keyId,omitempty"` + // SecretSource - Resource reference to the Azure Key Vault secret. Expected to be in format of /subscriptions/{​​​​​​​​​subscriptionId}​​​​​​​​​/resourceGroups/{​​​​​​​​​resourceGroupName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/providers/Microsoft.KeyVault/vaults/{vaultName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/secrets/{secretName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​ + SecretSource *ResourceReference `json:"secretSource,omitempty"` + // SecretVersion - Version of the secret to be used + SecretVersion *string `json:"secretVersion,omitempty"` + // Type - Possible values include: 'TypeBasicSecretParametersTypeSecretParameters', 'TypeBasicSecretParametersTypeURLSigningKey', 'TypeBasicSecretParametersTypeManagedCertificate', 'TypeBasicSecretParametersTypeCustomerCertificate', 'TypeBasicSecretParametersTypeAzureFirstPartyManagedCertificate' + Type TypeBasicSecretParameters `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for URLSigningKeyParameters. +func (uskp URLSigningKeyParameters) MarshalJSON() ([]byte, error) { + uskp.Type = TypeBasicSecretParametersTypeURLSigningKey + objectMap := make(map[string]interface{}) + if uskp.KeyID != nil { + objectMap["keyId"] = uskp.KeyID + } + if uskp.SecretSource != nil { + objectMap["secretSource"] = uskp.SecretSource + } + if uskp.SecretVersion != nil { + objectMap["secretVersion"] = uskp.SecretVersion + } + if uskp.Type != "" { + objectMap["type"] = uskp.Type + } + return json.Marshal(objectMap) +} + +// AsURLSigningKeyParameters is the BasicSecretParameters implementation for URLSigningKeyParameters. +func (uskp URLSigningKeyParameters) AsURLSigningKeyParameters() (*URLSigningKeyParameters, bool) { + return &uskp, true +} + +// AsManagedCertificateParameters is the BasicSecretParameters implementation for URLSigningKeyParameters. +func (uskp URLSigningKeyParameters) AsManagedCertificateParameters() (*ManagedCertificateParameters, bool) { + return nil, false +} + +// AsCustomerCertificateParameters is the BasicSecretParameters implementation for URLSigningKeyParameters. +func (uskp URLSigningKeyParameters) AsCustomerCertificateParameters() (*CustomerCertificateParameters, bool) { + return nil, false +} + +// AsAzureFirstPartyManagedCertificateParameters is the BasicSecretParameters implementation for URLSigningKeyParameters. +func (uskp URLSigningKeyParameters) AsAzureFirstPartyManagedCertificateParameters() (*AzureFirstPartyManagedCertificateParameters, bool) { + return nil, false +} + +// AsSecretParameters is the BasicSecretParameters implementation for URLSigningKeyParameters. +func (uskp URLSigningKeyParameters) AsSecretParameters() (*SecretParameters, bool) { + return nil, false +} + +// AsBasicSecretParameters is the BasicSecretParameters implementation for URLSigningKeyParameters. +func (uskp URLSigningKeyParameters) AsBasicSecretParameters() (BasicSecretParameters, bool) { + return &uskp, true +} + +// URLSigningParamIdentifier defines how to identify a parameter for a specific purpose e.g. expires +type URLSigningParamIdentifier struct { + // ParamIndicator - Indicates the purpose of the parameter. Possible values include: 'ParamIndicatorExpires', 'ParamIndicatorKeyID', 'ParamIndicatorSignature' + ParamIndicator ParamIndicator `json:"paramIndicator,omitempty"` + // ParamName - Parameter name + ParamName *string `json:"paramName,omitempty"` +} + +// Usage describes resource usage. +type Usage struct { + // ID - READ-ONLY; Resource identifier. + ID *string `json:"id,omitempty"` + // Unit - An enum describing the unit of measurement. + Unit *string `json:"unit,omitempty"` + // CurrentValue - The current value of the usage. + CurrentValue *int64 `json:"currentValue,omitempty"` + // Limit - The limit of usage. + Limit *int64 `json:"limit,omitempty"` + // Name - The name of the type of usage. + Name *UsageName `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for Usage. +func (u Usage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if u.Unit != nil { + objectMap["unit"] = u.Unit + } + if u.CurrentValue != nil { + objectMap["currentValue"] = u.CurrentValue + } + if u.Limit != nil { + objectMap["limit"] = u.Limit + } + if u.Name != nil { + objectMap["name"] = u.Name + } + return json.Marshal(objectMap) +} + +// UsageName the usage names. +type UsageName struct { + // Value - A string describing the resource name. + Value *string `json:"value,omitempty"` + // LocalizedValue - A localized string describing the resource name. + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// UsagesListResult the list usages operation response. +type UsagesListResult struct { + autorest.Response `json:"-"` + // Value - The list of resource usages. + Value *[]Usage `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// UsagesListResultIterator provides access to a complete listing of Usage values. +type UsagesListResultIterator struct { + i int + page UsagesListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *UsagesListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsagesListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *UsagesListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter UsagesListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter UsagesListResultIterator) Response() UsagesListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter UsagesListResultIterator) Value() Usage { + if !iter.page.NotDone() { + return Usage{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the UsagesListResultIterator type. +func NewUsagesListResultIterator(page UsagesListResultPage) UsagesListResultIterator { + return UsagesListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ulr UsagesListResult) IsEmpty() bool { + return ulr.Value == nil || len(*ulr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ulr UsagesListResult) hasNextLink() bool { + return ulr.NextLink != nil && len(*ulr.NextLink) != 0 +} + +// usagesListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ulr UsagesListResult) usagesListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ulr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ulr.NextLink))) +} + +// UsagesListResultPage contains a page of Usage values. +type UsagesListResultPage struct { + fn func(context.Context, UsagesListResult) (UsagesListResult, error) + ulr UsagesListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *UsagesListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsagesListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ulr) + if err != nil { + return err + } + page.ulr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *UsagesListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page UsagesListResultPage) NotDone() bool { + return !page.ulr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page UsagesListResultPage) Response() UsagesListResult { + return page.ulr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page UsagesListResultPage) Values() []Usage { + if page.ulr.IsEmpty() { + return nil + } + return *page.ulr.Value +} + +// Creates a new instance of the UsagesListResultPage type. +func NewUsagesListResultPage(cur UsagesListResult, getNextPage func(context.Context, UsagesListResult) (UsagesListResult, error)) UsagesListResultPage { + return UsagesListResultPage{ + fn: getNextPage, + ulr: cur, + } +} + +// UserManagedHTTPSParameters defines the certificate source parameters using user's keyvault certificate +// for enabling SSL. +type UserManagedHTTPSParameters struct { + // CertificateSourceParameters - Defines the certificate source parameters using user's keyvault certificate for enabling SSL. + CertificateSourceParameters *KeyVaultCertificateSourceParameters `json:"certificateSourceParameters,omitempty"` + // ProtocolType - Defines the TLS extension protocol that is used for secure delivery. Possible values include: 'ProtocolTypeServerNameIndication', 'ProtocolTypeIPBased' + ProtocolType ProtocolType `json:"protocolType,omitempty"` + // MinimumTLSVersion - TLS protocol version that will be used for Https. Possible values include: 'MinimumTLSVersionNone', 'MinimumTLSVersionTLS10', 'MinimumTLSVersionTLS12' + MinimumTLSVersion MinimumTLSVersion `json:"minimumTlsVersion,omitempty"` + // CertificateSource - Possible values include: 'CertificateSourceCustomDomainHTTPSParameters', 'CertificateSourceAzureKeyVault', 'CertificateSourceCdn' + CertificateSource CertificateSource `json:"certificateSource,omitempty"` +} + +// MarshalJSON is the custom marshaler for UserManagedHTTPSParameters. +func (umhp UserManagedHTTPSParameters) MarshalJSON() ([]byte, error) { + umhp.CertificateSource = CertificateSourceAzureKeyVault + objectMap := make(map[string]interface{}) + if umhp.CertificateSourceParameters != nil { + objectMap["certificateSourceParameters"] = umhp.CertificateSourceParameters + } + if umhp.ProtocolType != "" { + objectMap["protocolType"] = umhp.ProtocolType + } + if umhp.MinimumTLSVersion != "" { + objectMap["minimumTlsVersion"] = umhp.MinimumTLSVersion + } + if umhp.CertificateSource != "" { + objectMap["certificateSource"] = umhp.CertificateSource + } + return json.Marshal(objectMap) +} + +// AsUserManagedHTTPSParameters is the BasicCustomDomainHTTPSParameters implementation for UserManagedHTTPSParameters. +func (umhp UserManagedHTTPSParameters) AsUserManagedHTTPSParameters() (*UserManagedHTTPSParameters, bool) { + return &umhp, true +} + +// AsManagedHTTPSParameters is the BasicCustomDomainHTTPSParameters implementation for UserManagedHTTPSParameters. +func (umhp UserManagedHTTPSParameters) AsManagedHTTPSParameters() (*ManagedHTTPSParameters, bool) { + return nil, false +} + +// AsCustomDomainHTTPSParameters is the BasicCustomDomainHTTPSParameters implementation for UserManagedHTTPSParameters. +func (umhp UserManagedHTTPSParameters) AsCustomDomainHTTPSParameters() (*CustomDomainHTTPSParameters, bool) { + return nil, false +} + +// AsBasicCustomDomainHTTPSParameters is the BasicCustomDomainHTTPSParameters implementation for UserManagedHTTPSParameters. +func (umhp UserManagedHTTPSParameters) AsBasicCustomDomainHTTPSParameters() (BasicCustomDomainHTTPSParameters, bool) { + return &umhp, true +} + +// ValidateCustomDomainInput input of the custom domain to be validated for DNS mapping. +type ValidateCustomDomainInput struct { + // HostName - The host name of the custom domain. Must be a domain name. + HostName *string `json:"hostName,omitempty"` +} + +// ValidateCustomDomainOutput output of custom domain validation. +type ValidateCustomDomainOutput struct { + autorest.Response `json:"-"` + // CustomDomainValidated - READ-ONLY; Indicates whether the custom domain is valid or not. + CustomDomainValidated *bool `json:"customDomainValidated,omitempty"` + // Reason - READ-ONLY; The reason why the custom domain is not valid. + Reason *string `json:"reason,omitempty"` + // Message - READ-ONLY; Error message describing why the custom domain is not valid. + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for ValidateCustomDomainOutput. +func (vcdo ValidateCustomDomainOutput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ValidateProbeInput input of the validate probe API. +type ValidateProbeInput struct { + // ProbeURL - The probe URL to validate. + ProbeURL *string `json:"probeURL,omitempty"` +} + +// ValidateProbeOutput output of the validate probe API. +type ValidateProbeOutput struct { + autorest.Response `json:"-"` + // IsValid - READ-ONLY; Indicates whether the probe URL is accepted or not. + IsValid *bool `json:"isValid,omitempty"` + // ErrorCode - READ-ONLY; Specifies the error code when the probe url is not accepted. + ErrorCode *string `json:"errorCode,omitempty"` + // Message - READ-ONLY; The detailed error message describing why the probe URL is not accepted. + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for ValidateProbeOutput. +func (vpo ValidateProbeOutput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ValidateSecretInput input of the secret to be validated. +type ValidateSecretInput struct { + // SecretType - The secret type. Possible values include: 'SecretTypeURLSigningKey', 'SecretTypeCustomerCertificate', 'SecretTypeManagedCertificate', 'SecretTypeAzureFirstPartyManagedCertificate' + SecretType SecretType `json:"secretType,omitempty"` + // SecretSource - Resource reference to the Azure Key Vault secret. Expected to be in format of /subscriptions/{​​​​​​​​​subscriptionId}​​​​​​​​​/resourceGroups/{​​​​​​​​​resourceGroupName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/providers/Microsoft.KeyVault/vaults/{vaultName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/secrets/{secretName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​ + SecretSource *ResourceReference `json:"secretSource,omitempty"` + // SecretVersion - Secret version, if customer is using a specific version. + SecretVersion *string `json:"secretVersion,omitempty"` +} + +// ValidateSecretOutput output of the validated secret. +type ValidateSecretOutput struct { + autorest.Response `json:"-"` + // Status - The validation status. Possible values include: 'StatusValid', 'StatusInvalid', 'StatusAccessDenied', 'StatusCertificateExpired' + Status Status `json:"status,omitempty"` + // Message - Detailed error message + Message *string `json:"message,omitempty"` +} + +// ValidationToken the validation token. +type ValidationToken struct { + // Token - READ-ONLY + Token *string `json:"token,omitempty"` +} + +// MarshalJSON is the custom marshaler for ValidationToken. +func (vt ValidationToken) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// WafMetricsResponse waf Metrics Response +type WafMetricsResponse struct { + autorest.Response `json:"-"` + DateTimeBegin *date.Time `json:"dateTimeBegin,omitempty"` + DateTimeEnd *date.Time `json:"dateTimeEnd,omitempty"` + // Granularity - Possible values include: 'Granularity1PT5M', 'Granularity1PT1H', 'Granularity1P1D' + Granularity Granularity1 `json:"granularity,omitempty"` + Series *[]WafMetricsResponseSeriesItem `json:"series,omitempty"` +} + +// WafMetricsResponseSeriesItem ... +type WafMetricsResponseSeriesItem struct { + Metric *string `json:"metric,omitempty"` + // Unit - Possible values include: 'Unit1Count' + Unit Unit1 `json:"unit,omitempty"` + Groups *[]WafMetricsResponseSeriesItemGroupsItem `json:"groups,omitempty"` + Data *[]WafMetricsResponseSeriesItemDataItem `json:"data,omitempty"` +} + +// WafMetricsResponseSeriesItemDataItem ... +type WafMetricsResponseSeriesItemDataItem struct { + DateTime *date.Time `json:"dateTime,omitempty"` + Value *float64 `json:"value,omitempty"` +} + +// WafMetricsResponseSeriesItemGroupsItem ... +type WafMetricsResponseSeriesItemGroupsItem struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +// WafRankingsResponse waf Rankings Response +type WafRankingsResponse struct { + autorest.Response `json:"-"` + DateTimeBegin *date.Time `json:"dateTimeBegin,omitempty"` + DateTimeEnd *date.Time `json:"dateTimeEnd,omitempty"` + Groups *[]string `json:"groups,omitempty"` + Data *[]WafRankingsResponseDataItem `json:"data,omitempty"` +} + +// WafRankingsResponseDataItem ... +type WafRankingsResponseDataItem struct { + GroupValues *[]string `json:"groupValues,omitempty"` + Metrics *[]WafRankingsResponseDataItemMetricsItem `json:"metrics,omitempty"` +} + +// WafRankingsResponseDataItemMetricsItem ... +type WafRankingsResponseDataItemMetricsItem struct { + Metric *string `json:"metric,omitempty"` + Value *int64 `json:"value,omitempty"` + Percentage *float64 `json:"percentage,omitempty"` +} + +// WebApplicationFirewallPolicy defines web application firewall policy for Azure CDN. +type WebApplicationFirewallPolicy struct { + autorest.Response `json:"-"` + // WebApplicationFirewallPolicyProperties - Properties of the web application firewall policy. + *WebApplicationFirewallPolicyProperties `json:"properties,omitempty"` + // Etag - Gets a unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Sku - The pricing tier (defines a CDN provider, feature list and rate) of the CdnWebApplicationFirewallPolicy. + Sku *Sku `json:"sku,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebApplicationFirewallPolicy. +func (wafp WebApplicationFirewallPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wafp.WebApplicationFirewallPolicyProperties != nil { + objectMap["properties"] = wafp.WebApplicationFirewallPolicyProperties + } + if wafp.Etag != nil { + objectMap["etag"] = wafp.Etag + } + if wafp.Sku != nil { + objectMap["sku"] = wafp.Sku + } + if wafp.Location != nil { + objectMap["location"] = wafp.Location + } + if wafp.Tags != nil { + objectMap["tags"] = wafp.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for WebApplicationFirewallPolicy struct. +func (wafp *WebApplicationFirewallPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var webApplicationFirewallPolicyProperties WebApplicationFirewallPolicyProperties + err = json.Unmarshal(*v, &webApplicationFirewallPolicyProperties) + if err != nil { + return err + } + wafp.WebApplicationFirewallPolicyProperties = &webApplicationFirewallPolicyProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + wafp.Etag = &etag + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + wafp.Sku = &sku + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + wafp.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + wafp.Tags = tags + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + wafp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + wafp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + wafp.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + wafp.SystemData = &systemData + } + } + } + + return nil +} + +// WebApplicationFirewallPolicyList defines a list of WebApplicationFirewallPolicies for Azure CDN. It +// contains a list of WebApplicationFirewallPolicy objects and a URL link to get the next set of results. +type WebApplicationFirewallPolicyList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Azure CDN WebApplicationFirewallPolicies within a resource group. + Value *[]WebApplicationFirewallPolicy `json:"value,omitempty"` + // NextLink - URL to get the next set of WebApplicationFirewallPolicy objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebApplicationFirewallPolicyList. +func (wafpl WebApplicationFirewallPolicyList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wafpl.NextLink != nil { + objectMap["nextLink"] = wafpl.NextLink + } + return json.Marshal(objectMap) +} + +// WebApplicationFirewallPolicyListIterator provides access to a complete listing of +// WebApplicationFirewallPolicy values. +type WebApplicationFirewallPolicyListIterator struct { + i int + page WebApplicationFirewallPolicyListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *WebApplicationFirewallPolicyListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebApplicationFirewallPolicyListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *WebApplicationFirewallPolicyListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter WebApplicationFirewallPolicyListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter WebApplicationFirewallPolicyListIterator) Response() WebApplicationFirewallPolicyList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter WebApplicationFirewallPolicyListIterator) Value() WebApplicationFirewallPolicy { + if !iter.page.NotDone() { + return WebApplicationFirewallPolicy{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the WebApplicationFirewallPolicyListIterator type. +func NewWebApplicationFirewallPolicyListIterator(page WebApplicationFirewallPolicyListPage) WebApplicationFirewallPolicyListIterator { + return WebApplicationFirewallPolicyListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (wafpl WebApplicationFirewallPolicyList) IsEmpty() bool { + return wafpl.Value == nil || len(*wafpl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (wafpl WebApplicationFirewallPolicyList) hasNextLink() bool { + return wafpl.NextLink != nil && len(*wafpl.NextLink) != 0 +} + +// webApplicationFirewallPolicyListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (wafpl WebApplicationFirewallPolicyList) webApplicationFirewallPolicyListPreparer(ctx context.Context) (*http.Request, error) { + if !wafpl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(wafpl.NextLink))) +} + +// WebApplicationFirewallPolicyListPage contains a page of WebApplicationFirewallPolicy values. +type WebApplicationFirewallPolicyListPage struct { + fn func(context.Context, WebApplicationFirewallPolicyList) (WebApplicationFirewallPolicyList, error) + wafpl WebApplicationFirewallPolicyList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *WebApplicationFirewallPolicyListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebApplicationFirewallPolicyListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.wafpl) + if err != nil { + return err + } + page.wafpl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *WebApplicationFirewallPolicyListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page WebApplicationFirewallPolicyListPage) NotDone() bool { + return !page.wafpl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page WebApplicationFirewallPolicyListPage) Response() WebApplicationFirewallPolicyList { + return page.wafpl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page WebApplicationFirewallPolicyListPage) Values() []WebApplicationFirewallPolicy { + if page.wafpl.IsEmpty() { + return nil + } + return *page.wafpl.Value +} + +// Creates a new instance of the WebApplicationFirewallPolicyListPage type. +func NewWebApplicationFirewallPolicyListPage(cur WebApplicationFirewallPolicyList, getNextPage func(context.Context, WebApplicationFirewallPolicyList) (WebApplicationFirewallPolicyList, error)) WebApplicationFirewallPolicyListPage { + return WebApplicationFirewallPolicyListPage{ + fn: getNextPage, + wafpl: cur, + } +} + +// WebApplicationFirewallPolicyPatchParameters properties required to update a +// CdnWebApplicationFirewallPolicy. +type WebApplicationFirewallPolicyPatchParameters struct { + // Tags - CdnWebApplicationFirewallPolicy tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for WebApplicationFirewallPolicyPatchParameters. +func (wafppp WebApplicationFirewallPolicyPatchParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wafppp.Tags != nil { + objectMap["tags"] = wafppp.Tags + } + return json.Marshal(objectMap) +} + +// WebApplicationFirewallPolicyProperties defines CDN web application firewall policy properties. +type WebApplicationFirewallPolicyProperties struct { + // PolicySettings - Describes policySettings for policy + PolicySettings *PolicySettings `json:"policySettings,omitempty"` + // RateLimitRules - Describes rate limit rules inside the policy. + RateLimitRules *RateLimitRuleList `json:"rateLimitRules,omitempty"` + // CustomRules - Describes custom rules inside the policy. + CustomRules *CustomRuleList `json:"customRules,omitempty"` + // ManagedRules - Describes managed rules inside the policy. + ManagedRules *ManagedRuleSetList `json:"managedRules,omitempty"` + // EndpointLinks - READ-ONLY; Describes Azure CDN endpoints associated with this Web Application Firewall policy. + EndpointLinks *[]EndpointType `json:"endpointLinks,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the WebApplicationFirewallPolicy. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ResourceState - READ-ONLY; Possible values include: 'PolicyResourceStateCreating', 'PolicyResourceStateEnabling', 'PolicyResourceStateEnabled', 'PolicyResourceStateDisabling', 'PolicyResourceStateDisabled', 'PolicyResourceStateDeleting' + ResourceState PolicyResourceState `json:"resourceState,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebApplicationFirewallPolicyProperties. +func (wafpp WebApplicationFirewallPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wafpp.PolicySettings != nil { + objectMap["policySettings"] = wafpp.PolicySettings + } + if wafpp.RateLimitRules != nil { + objectMap["rateLimitRules"] = wafpp.RateLimitRules + } + if wafpp.CustomRules != nil { + objectMap["customRules"] = wafpp.CustomRules + } + if wafpp.ManagedRules != nil { + objectMap["managedRules"] = wafpp.ManagedRules + } + return json.Marshal(objectMap) +} diff --git a/services/cdn/mgmt/2021-06-01/cdn/operations.go b/services/cdn/mgmt/2021-06-01/cdn/operations.go new file mode 100644 index 000000000000..d9e4f38bbab4 --- /dev/null +++ b/services/cdn/mgmt/2021-06-01/cdn/operations.go @@ -0,0 +1,140 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the cdn Management Client +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available CDN REST API operations. +func (client OperationsClient) List(ctx context.Context) (result OperationsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.olr.Response.Response != nil { + sc = result.olr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.olr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.olr.hasNextLink() && result.olr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Cdn/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationsListResult) (result OperationsListResult, err error) { + req, err := lastResults.operationsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result OperationsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/cdn/mgmt/2021-06-01/cdn/origingroups.go b/services/cdn/mgmt/2021-06-01/cdn/origingroups.go new file mode 100644 index 000000000000..8c75811b3a68 --- /dev/null +++ b/services/cdn/mgmt/2021-06-01/cdn/origingroups.go @@ -0,0 +1,526 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OriginGroupsClient is the cdn Management Client +type OriginGroupsClient struct { + BaseClient +} + +// NewOriginGroupsClient creates an instance of the OriginGroupsClient client. +func NewOriginGroupsClient(subscriptionID string) OriginGroupsClient { + return NewOriginGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOriginGroupsClientWithBaseURI creates an instance of the OriginGroupsClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOriginGroupsClientWithBaseURI(baseURI string, subscriptionID string) OriginGroupsClient { + return OriginGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new origin group within the specified endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// originGroupName - name of the origin group which is unique within the endpoint. +// originGroup - origin group properties +func (client OriginGroupsClient) Create(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originGroupName string, originGroup OriginGroup) (result OriginGroupsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginGroupsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.OriginGroupsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, profileName, endpointName, originGroupName, originGroup) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client OriginGroupsClient) CreatePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originGroupName string, originGroup OriginGroup) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "originGroupName": autorest.Encode("path", originGroupName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}", pathParameters), + autorest.WithJSON(originGroup), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client OriginGroupsClient) CreateSender(req *http.Request) (future OriginGroupsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client OriginGroupsClient) CreateResponder(resp *http.Response) (result OriginGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing origin group within an endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// originGroupName - name of the origin group which is unique within the endpoint. +func (client OriginGroupsClient) Delete(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originGroupName string) (result OriginGroupsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginGroupsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.OriginGroupsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName, endpointName, originGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client OriginGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "originGroupName": autorest.Encode("path", originGroupName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client OriginGroupsClient) DeleteSender(req *http.Request) (future OriginGroupsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client OriginGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an existing origin group within an endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// originGroupName - name of the origin group which is unique within the endpoint. +func (client OriginGroupsClient) Get(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originGroupName string) (result OriginGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginGroupsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.OriginGroupsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName, endpointName, originGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client OriginGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "originGroupName": autorest.Encode("path", originGroupName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client OriginGroupsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client OriginGroupsClient) GetResponder(resp *http.Response) (result OriginGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByEndpoint lists all of the existing origin groups within an endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +func (client OriginGroupsClient) ListByEndpoint(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result OriginGroupListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginGroupsClient.ListByEndpoint") + defer func() { + sc := -1 + if result.oglr.Response.Response != nil { + sc = result.oglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.OriginGroupsClient", "ListByEndpoint", err.Error()) + } + + result.fn = client.listByEndpointNextResults + req, err := client.ListByEndpointPreparer(ctx, resourceGroupName, profileName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "ListByEndpoint", nil, "Failure preparing request") + return + } + + resp, err := client.ListByEndpointSender(req) + if err != nil { + result.oglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "ListByEndpoint", resp, "Failure sending request") + return + } + + result.oglr, err = client.ListByEndpointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "ListByEndpoint", resp, "Failure responding to request") + return + } + if result.oglr.hasNextLink() && result.oglr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByEndpointPreparer prepares the ListByEndpoint request. +func (client OriginGroupsClient) ListByEndpointPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByEndpointSender sends the ListByEndpoint request. The method will close the +// http.Response Body if it receives an error. +func (client OriginGroupsClient) ListByEndpointSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByEndpointResponder handles the response to the ListByEndpoint request. The method always +// closes the http.Response Body. +func (client OriginGroupsClient) ListByEndpointResponder(resp *http.Response) (result OriginGroupListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByEndpointNextResults retrieves the next set of results, if any. +func (client OriginGroupsClient) listByEndpointNextResults(ctx context.Context, lastResults OriginGroupListResult) (result OriginGroupListResult, err error) { + req, err := lastResults.originGroupListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "listByEndpointNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByEndpointSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "listByEndpointNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByEndpointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "listByEndpointNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByEndpointComplete enumerates all values, automatically crossing page boundaries as required. +func (client OriginGroupsClient) ListByEndpointComplete(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result OriginGroupListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginGroupsClient.ListByEndpoint") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByEndpoint(ctx, resourceGroupName, profileName, endpointName) + return +} + +// Update updates an existing origin group within an endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// originGroupName - name of the origin group which is unique within the endpoint. +// originGroupUpdateProperties - origin group properties +func (client OriginGroupsClient) Update(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originGroupName string, originGroupUpdateProperties OriginGroupUpdateParameters) (result OriginGroupsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginGroupsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.OriginGroupsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, profileName, endpointName, originGroupName, originGroupUpdateProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client OriginGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originGroupName string, originGroupUpdateProperties OriginGroupUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "originGroupName": autorest.Encode("path", originGroupName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}", pathParameters), + autorest.WithJSON(originGroupUpdateProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client OriginGroupsClient) UpdateSender(req *http.Request) (future OriginGroupsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client OriginGroupsClient) UpdateResponder(resp *http.Response) (result OriginGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/cdn/mgmt/2021-06-01/cdn/origins.go b/services/cdn/mgmt/2021-06-01/cdn/origins.go new file mode 100644 index 000000000000..d0a5c06706cc --- /dev/null +++ b/services/cdn/mgmt/2021-06-01/cdn/origins.go @@ -0,0 +1,526 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OriginsClient is the cdn Management Client +type OriginsClient struct { + BaseClient +} + +// NewOriginsClient creates an instance of the OriginsClient client. +func NewOriginsClient(subscriptionID string) OriginsClient { + return NewOriginsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOriginsClientWithBaseURI creates an instance of the OriginsClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOriginsClientWithBaseURI(baseURI string, subscriptionID string) OriginsClient { + return OriginsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new origin within the specified endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// originName - name of the origin that is unique within the endpoint. +// origin - origin properties +func (client OriginsClient) Create(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originName string, origin Origin) (result OriginsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.OriginsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, profileName, endpointName, originName, origin) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client OriginsClient) CreatePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originName string, origin Origin) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "originName": autorest.Encode("path", originName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}", pathParameters), + autorest.WithJSON(origin), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client OriginsClient) CreateSender(req *http.Request) (future OriginsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client OriginsClient) CreateResponder(resp *http.Response) (result Origin, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing origin within an endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// originName - name of the origin which is unique within the endpoint. +func (client OriginsClient) Delete(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originName string) (result OriginsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.OriginsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName, endpointName, originName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client OriginsClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "originName": autorest.Encode("path", originName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client OriginsClient) DeleteSender(req *http.Request) (future OriginsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client OriginsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an existing origin within an endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// originName - name of the origin which is unique within the endpoint. +func (client OriginsClient) Get(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originName string) (result Origin, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.OriginsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName, endpointName, originName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client OriginsClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "originName": autorest.Encode("path", originName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client OriginsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client OriginsClient) GetResponder(resp *http.Response) (result Origin, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByEndpoint lists all of the existing origins within an endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +func (client OriginsClient) ListByEndpoint(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result OriginListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginsClient.ListByEndpoint") + defer func() { + sc := -1 + if result.olr.Response.Response != nil { + sc = result.olr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.OriginsClient", "ListByEndpoint", err.Error()) + } + + result.fn = client.listByEndpointNextResults + req, err := client.ListByEndpointPreparer(ctx, resourceGroupName, profileName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "ListByEndpoint", nil, "Failure preparing request") + return + } + + resp, err := client.ListByEndpointSender(req) + if err != nil { + result.olr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "ListByEndpoint", resp, "Failure sending request") + return + } + + result.olr, err = client.ListByEndpointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "ListByEndpoint", resp, "Failure responding to request") + return + } + if result.olr.hasNextLink() && result.olr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByEndpointPreparer prepares the ListByEndpoint request. +func (client OriginsClient) ListByEndpointPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByEndpointSender sends the ListByEndpoint request. The method will close the +// http.Response Body if it receives an error. +func (client OriginsClient) ListByEndpointSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByEndpointResponder handles the response to the ListByEndpoint request. The method always +// closes the http.Response Body. +func (client OriginsClient) ListByEndpointResponder(resp *http.Response) (result OriginListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByEndpointNextResults retrieves the next set of results, if any. +func (client OriginsClient) listByEndpointNextResults(ctx context.Context, lastResults OriginListResult) (result OriginListResult, err error) { + req, err := lastResults.originListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.OriginsClient", "listByEndpointNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByEndpointSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.OriginsClient", "listByEndpointNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByEndpointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "listByEndpointNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByEndpointComplete enumerates all values, automatically crossing page boundaries as required. +func (client OriginsClient) ListByEndpointComplete(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result OriginListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginsClient.ListByEndpoint") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByEndpoint(ctx, resourceGroupName, profileName, endpointName) + return +} + +// Update updates an existing origin within an endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// originName - name of the origin which is unique within the endpoint. +// originUpdateProperties - origin properties +func (client OriginsClient) Update(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originName string, originUpdateProperties OriginUpdateParameters) (result OriginsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.OriginsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, profileName, endpointName, originName, originUpdateProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client OriginsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originName string, originUpdateProperties OriginUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "originName": autorest.Encode("path", originName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}", pathParameters), + autorest.WithJSON(originUpdateProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client OriginsClient) UpdateSender(req *http.Request) (future OriginsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client OriginsClient) UpdateResponder(resp *http.Response) (result Origin, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/cdn/mgmt/2021-06-01/cdn/policies.go b/services/cdn/mgmt/2021-06-01/cdn/policies.go new file mode 100644 index 000000000000..da7694f354ff --- /dev/null +++ b/services/cdn/mgmt/2021-06-01/cdn/policies.go @@ -0,0 +1,520 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PoliciesClient is the cdn Management Client +type PoliciesClient struct { + BaseClient +} + +// NewPoliciesClient creates an instance of the PoliciesClient client. +func NewPoliciesClient(subscriptionID string) PoliciesClient { + return NewPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPoliciesClientWithBaseURI creates an instance of the PoliciesClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewPoliciesClientWithBaseURI(baseURI string, subscriptionID string) PoliciesClient { + return PoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update policy with specified rule set name within a resource group. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// policyName - the name of the CdnWebApplicationFirewallPolicy. +// cdnWebApplicationFirewallPolicy - policy to be created. +func (client PoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, policyName string, cdnWebApplicationFirewallPolicy WebApplicationFirewallPolicy) (result PoliciesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoliciesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: policyName, + Constraints: []validation.Constraint{{Target: "policyName", Name: validation.MaxLength, Rule: 128, Chain: nil}}}, + {TargetValue: cdnWebApplicationFirewallPolicy, + Constraints: []validation.Constraint{{Target: "cdnWebApplicationFirewallPolicy.WebApplicationFirewallPolicyProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cdnWebApplicationFirewallPolicy.WebApplicationFirewallPolicyProperties.PolicySettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cdnWebApplicationFirewallPolicy.WebApplicationFirewallPolicyProperties.PolicySettings.DefaultCustomBlockResponseBody", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cdnWebApplicationFirewallPolicy.WebApplicationFirewallPolicyProperties.PolicySettings.DefaultCustomBlockResponseBody", Name: validation.Pattern, Rule: `^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$`, Chain: nil}}}, + }}, + }}, + {Target: "cdnWebApplicationFirewallPolicy.Sku", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.PoliciesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, policyName, cdnWebApplicationFirewallPolicy) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.PoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.PoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, policyName string, cdnWebApplicationFirewallPolicy WebApplicationFirewallPolicy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "policyName": autorest.Encode("path", policyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName}", pathParameters), + autorest.WithJSON(cdnWebApplicationFirewallPolicy), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client PoliciesClient) CreateOrUpdateSender(req *http.Request) (future PoliciesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client PoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result WebApplicationFirewallPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes Policy +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// policyName - the name of the CdnWebApplicationFirewallPolicy. +func (client PoliciesClient) Delete(ctx context.Context, resourceGroupName string, policyName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoliciesClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: policyName, + Constraints: []validation.Constraint{{Target: "policyName", Name: validation.MaxLength, Rule: 128, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.PoliciesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, policyName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.PoliciesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "cdn.PoliciesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.PoliciesClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PoliciesClient) DeletePreparer(ctx context.Context, resourceGroupName string, policyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "policyName": autorest.Encode("path", policyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PoliciesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PoliciesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieve protection policy with specified name within a resource group. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// policyName - the name of the CdnWebApplicationFirewallPolicy. +func (client PoliciesClient) Get(ctx context.Context, resourceGroupName string, policyName string) (result WebApplicationFirewallPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoliciesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: policyName, + Constraints: []validation.Constraint{{Target: "policyName", Name: validation.MaxLength, Rule: 128, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.PoliciesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, policyName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.PoliciesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.PoliciesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.PoliciesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, policyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "policyName": autorest.Encode("path", policyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PoliciesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PoliciesClient) GetResponder(resp *http.Response) (result WebApplicationFirewallPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all of the protection policies within a resource group. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +func (client PoliciesClient) List(ctx context.Context, resourceGroupName string) (result WebApplicationFirewallPolicyListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoliciesClient.List") + defer func() { + sc := -1 + if result.wafpl.Response.Response != nil { + sc = result.wafpl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.PoliciesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.PoliciesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.wafpl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.PoliciesClient", "List", resp, "Failure sending request") + return + } + + result.wafpl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.PoliciesClient", "List", resp, "Failure responding to request") + return + } + if result.wafpl.hasNextLink() && result.wafpl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PoliciesClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PoliciesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PoliciesClient) ListResponder(resp *http.Response) (result WebApplicationFirewallPolicyList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client PoliciesClient) listNextResults(ctx context.Context, lastResults WebApplicationFirewallPolicyList) (result WebApplicationFirewallPolicyList, err error) { + req, err := lastResults.webApplicationFirewallPolicyListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.PoliciesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.PoliciesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.PoliciesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PoliciesClient) ListComplete(ctx context.Context, resourceGroupName string) (result WebApplicationFirewallPolicyListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoliciesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// Update update an existing CdnWebApplicationFirewallPolicy with the specified policy name under the specified +// subscription and resource group +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// policyName - the name of the CdnWebApplicationFirewallPolicy. +// cdnWebApplicationFirewallPolicyPatchParameters - cdnWebApplicationFirewallPolicy parameters to be patched. +func (client PoliciesClient) Update(ctx context.Context, resourceGroupName string, policyName string, cdnWebApplicationFirewallPolicyPatchParameters WebApplicationFirewallPolicyPatchParameters) (result PoliciesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoliciesClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: policyName, + Constraints: []validation.Constraint{{Target: "policyName", Name: validation.MaxLength, Rule: 128, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.PoliciesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, policyName, cdnWebApplicationFirewallPolicyPatchParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.PoliciesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.PoliciesClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client PoliciesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, policyName string, cdnWebApplicationFirewallPolicyPatchParameters WebApplicationFirewallPolicyPatchParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "policyName": autorest.Encode("path", policyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName}", pathParameters), + autorest.WithJSON(cdnWebApplicationFirewallPolicyPatchParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client PoliciesClient) UpdateSender(req *http.Request) (future PoliciesUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client PoliciesClient) UpdateResponder(resp *http.Response) (result WebApplicationFirewallPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/cdn/mgmt/2021-06-01/cdn/profiles.go b/services/cdn/mgmt/2021-06-01/cdn/profiles.go new file mode 100644 index 000000000000..ef90caf19ff5 --- /dev/null +++ b/services/cdn/mgmt/2021-06-01/cdn/profiles.go @@ -0,0 +1,938 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ProfilesClient is the cdn Management Client +type ProfilesClient struct { + BaseClient +} + +// NewProfilesClient creates an instance of the ProfilesClient client. +func NewProfilesClient(subscriptionID string) ProfilesClient { + return NewProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProfilesClientWithBaseURI creates an instance of the ProfilesClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewProfilesClientWithBaseURI(baseURI string, subscriptionID string) ProfilesClient { + return ProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new Azure Front Door Standard or Azure Front Door Premium or CDN profile with a profile name under +// the specified subscription and resource group. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium or CDN profile which is +// unique within the resource group. +// profile - profile properties needed to create a new profile. +func (client ProfilesClient) Create(ctx context.Context, resourceGroupName string, profileName string, profile Profile) (result ProfilesCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: profile, + Constraints: []validation.Constraint{{Target: "profile.Sku", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "profile.ProfileProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "profile.ProfileProperties.OriginResponseTimeoutSeconds", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "profile.ProfileProperties.OriginResponseTimeoutSeconds", Name: validation.InclusiveMinimum, Rule: int64(16), Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("cdn.ProfilesClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, profileName, profile) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ProfilesClient) CreatePreparer(ctx context.Context, resourceGroupName string, profileName string, profile Profile) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + profile.Kind = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}", pathParameters), + autorest.WithJSON(profile), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) CreateSender(req *http.Request) (future ProfilesCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ProfilesClient) CreateResponder(resp *http.Response) (result Profile, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing Azure Front Door Standard or Azure Front Door Premium or CDN profile with the specified +// parameters. Deleting a profile will result in the deletion of all of the sub-resources including endpoints, origins +// and custom domains. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium or CDN profile which is +// unique within the resource group. +func (client ProfilesClient) Delete(ctx context.Context, resourceGroupName string, profileName string) (result ProfilesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.ProfilesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ProfilesClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) DeleteSender(req *http.Request) (future ProfilesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ProfilesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// GenerateSsoURI generates a dynamic SSO URI used to sign in to the CDN supplemental portal. Supplemental portal is +// used to configure advanced feature capabilities that are not yet available in the Azure portal, such as core reports +// in a standard profile; rules engine, advanced HTTP reports, and real-time stats and alerts in a premium profile. The +// SSO URI changes approximately every 10 minutes. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +func (client ProfilesClient) GenerateSsoURI(ctx context.Context, resourceGroupName string, profileName string) (result SsoURI, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.GenerateSsoURI") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.ProfilesClient", "GenerateSsoURI", err.Error()) + } + + req, err := client.GenerateSsoURIPreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "GenerateSsoURI", nil, "Failure preparing request") + return + } + + resp, err := client.GenerateSsoURISender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "GenerateSsoURI", resp, "Failure sending request") + return + } + + result, err = client.GenerateSsoURIResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "GenerateSsoURI", resp, "Failure responding to request") + return + } + + return +} + +// GenerateSsoURIPreparer prepares the GenerateSsoURI request. +func (client ProfilesClient) GenerateSsoURIPreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/generateSsoUri", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GenerateSsoURISender sends the GenerateSsoURI request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) GenerateSsoURISender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GenerateSsoURIResponder handles the response to the GenerateSsoURI request. The method always +// closes the http.Response Body. +func (client ProfilesClient) GenerateSsoURIResponder(resp *http.Response) (result SsoURI, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets an Azure Front Door Standard or Azure Front Door Premium or CDN profile with the specified profile name +// under the specified subscription and resource group. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium or CDN profile which is +// unique within the resource group. +func (client ProfilesClient) Get(ctx context.Context, resourceGroupName string, profileName string) (result Profile, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.ProfilesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ProfilesClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ProfilesClient) GetResponder(resp *http.Response) (result Profile, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all of the Azure Front Door Standard, Azure Front Door Premium, and CDN profiles within an Azure +// subscription. +func (client ProfilesClient) List(ctx context.Context) (result ProfileListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.List") + defer func() { + sc := -1 + if result.plr.Response.Response != nil { + sc = result.plr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.plr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "List", resp, "Failure sending request") + return + } + + result.plr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "List", resp, "Failure responding to request") + return + } + if result.plr.hasNextLink() && result.plr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ProfilesClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/profiles", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ProfilesClient) ListResponder(resp *http.Response) (result ProfileListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ProfilesClient) listNextResults(ctx context.Context, lastResults ProfileListResult) (result ProfileListResult, err error) { + req, err := lastResults.profileListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ProfilesClient) ListComplete(ctx context.Context) (result ProfileListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup lists all of the Azure Front Door Standard, Azure Front Door Premium, and CDN profiles within a +// resource group. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +func (client ProfilesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ProfileListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.plr.Response.Response != nil { + sc = result.plr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.ProfilesClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.plr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.plr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.plr.hasNextLink() && result.plr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ProfilesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ProfilesClient) ListByResourceGroupResponder(resp *http.Response) (result ProfileListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client ProfilesClient) listByResourceGroupNextResults(ctx context.Context, lastResults ProfileListResult) (result ProfileListResult, err error) { + req, err := lastResults.profileListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ProfilesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ProfileListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListResourceUsage checks the quota and actual usage of endpoints under the given Azure Front Door Standard or Azure +// Front Door Premium or CDN profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium or CDN profile which is +// unique within the resource group. +func (client ProfilesClient) ListResourceUsage(ctx context.Context, resourceGroupName string, profileName string) (result ResourceUsageListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.ListResourceUsage") + defer func() { + sc := -1 + if result.rulr.Response.Response != nil { + sc = result.rulr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.ProfilesClient", "ListResourceUsage", err.Error()) + } + + result.fn = client.listResourceUsageNextResults + req, err := client.ListResourceUsagePreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListResourceUsage", nil, "Failure preparing request") + return + } + + resp, err := client.ListResourceUsageSender(req) + if err != nil { + result.rulr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListResourceUsage", resp, "Failure sending request") + return + } + + result.rulr, err = client.ListResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListResourceUsage", resp, "Failure responding to request") + return + } + if result.rulr.hasNextLink() && result.rulr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListResourceUsagePreparer prepares the ListResourceUsage request. +func (client ProfilesClient) ListResourceUsagePreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/checkResourceUsage", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListResourceUsageSender sends the ListResourceUsage request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) ListResourceUsageSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResourceUsageResponder handles the response to the ListResourceUsage request. The method always +// closes the http.Response Body. +func (client ProfilesClient) ListResourceUsageResponder(resp *http.Response) (result ResourceUsageListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listResourceUsageNextResults retrieves the next set of results, if any. +func (client ProfilesClient) listResourceUsageNextResults(ctx context.Context, lastResults ResourceUsageListResult) (result ResourceUsageListResult, err error) { + req, err := lastResults.resourceUsageListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "listResourceUsageNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListResourceUsageSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "listResourceUsageNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "listResourceUsageNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListResourceUsageComplete enumerates all values, automatically crossing page boundaries as required. +func (client ProfilesClient) ListResourceUsageComplete(ctx context.Context, resourceGroupName string, profileName string) (result ResourceUsageListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.ListResourceUsage") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListResourceUsage(ctx, resourceGroupName, profileName) + return +} + +// ListSupportedOptimizationTypes gets the supported optimization types for the current profile. A user can create an +// endpoint with an optimization type from the listed values. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium or CDN profile which is +// unique within the resource group. +func (client ProfilesClient) ListSupportedOptimizationTypes(ctx context.Context, resourceGroupName string, profileName string) (result SupportedOptimizationTypesListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.ListSupportedOptimizationTypes") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.ProfilesClient", "ListSupportedOptimizationTypes", err.Error()) + } + + req, err := client.ListSupportedOptimizationTypesPreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListSupportedOptimizationTypes", nil, "Failure preparing request") + return + } + + resp, err := client.ListSupportedOptimizationTypesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListSupportedOptimizationTypes", resp, "Failure sending request") + return + } + + result, err = client.ListSupportedOptimizationTypesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListSupportedOptimizationTypes", resp, "Failure responding to request") + return + } + + return +} + +// ListSupportedOptimizationTypesPreparer prepares the ListSupportedOptimizationTypes request. +func (client ProfilesClient) ListSupportedOptimizationTypesPreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getSupportedOptimizationTypes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSupportedOptimizationTypesSender sends the ListSupportedOptimizationTypes request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) ListSupportedOptimizationTypesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSupportedOptimizationTypesResponder handles the response to the ListSupportedOptimizationTypes request. The method always +// closes the http.Response Body. +func (client ProfilesClient) ListSupportedOptimizationTypesResponder(resp *http.Response) (result SupportedOptimizationTypesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates an existing Azure Front Door Standard or Azure Front Door Premium or CDN profile with the specified +// profile name under the specified subscription and resource group. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium or CDN profile which is +// unique within the resource group. +// profileUpdateParameters - profile properties needed to update an existing profile. +func (client ProfilesClient) Update(ctx context.Context, resourceGroupName string, profileName string, profileUpdateParameters ProfileUpdateParameters) (result ProfilesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.ProfilesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, profileName, profileUpdateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ProfilesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, profileUpdateParameters ProfileUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}", pathParameters), + autorest.WithJSON(profileUpdateParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) UpdateSender(req *http.Request) (future ProfilesUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ProfilesClient) UpdateResponder(resp *http.Response) (result Profile, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/cdn/mgmt/2021-06-01/cdn/resourceusage.go b/services/cdn/mgmt/2021-06-01/cdn/resourceusage.go new file mode 100644 index 000000000000..6507ba14dfc9 --- /dev/null +++ b/services/cdn/mgmt/2021-06-01/cdn/resourceusage.go @@ -0,0 +1,144 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ResourceUsageClient is the cdn Management Client +type ResourceUsageClient struct { + BaseClient +} + +// NewResourceUsageClient creates an instance of the ResourceUsageClient client. +func NewResourceUsageClient(subscriptionID string) ResourceUsageClient { + return NewResourceUsageClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewResourceUsageClientWithBaseURI creates an instance of the ResourceUsageClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewResourceUsageClientWithBaseURI(baseURI string, subscriptionID string) ResourceUsageClient { + return ResourceUsageClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List check the quota and actual usage of the CDN profiles under the given subscription. +func (client ResourceUsageClient) List(ctx context.Context) (result ResourceUsageListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceUsageClient.List") + defer func() { + sc := -1 + if result.rulr.Response.Response != nil { + sc = result.rulr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ResourceUsageClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rulr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.ResourceUsageClient", "List", resp, "Failure sending request") + return + } + + result.rulr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ResourceUsageClient", "List", resp, "Failure responding to request") + return + } + if result.rulr.hasNextLink() && result.rulr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ResourceUsageClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkResourceUsage", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceUsageClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ResourceUsageClient) ListResponder(resp *http.Response) (result ResourceUsageListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ResourceUsageClient) listNextResults(ctx context.Context, lastResults ResourceUsageListResult) (result ResourceUsageListResult, err error) { + req, err := lastResults.resourceUsageListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.ResourceUsageClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.ResourceUsageClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ResourceUsageClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ResourceUsageClient) ListComplete(ctx context.Context) (result ResourceUsageListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceUsageClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/cdn/mgmt/2021-06-01/cdn/routes.go b/services/cdn/mgmt/2021-06-01/cdn/routes.go new file mode 100644 index 000000000000..aa270800aea1 --- /dev/null +++ b/services/cdn/mgmt/2021-06-01/cdn/routes.go @@ -0,0 +1,538 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// RoutesClient is the cdn Management Client +type RoutesClient struct { + BaseClient +} + +// NewRoutesClient creates an instance of the RoutesClient client. +func NewRoutesClient(subscriptionID string) RoutesClient { + return NewRoutesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRoutesClientWithBaseURI creates an instance of the RoutesClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewRoutesClientWithBaseURI(baseURI string, subscriptionID string) RoutesClient { + return RoutesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new route with the specified route name under the specified subscription, resource group, profile, +// and AzureFrontDoor endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// routeName - name of the routing rule. +// route - route properties +func (client RoutesClient) Create(ctx context.Context, resourceGroupName string, profileName string, endpointName string, routeName string, route Route) (result RoutesCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoutesClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: route, + Constraints: []validation.Constraint{{Target: "route.RouteProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "route.RouteProperties.OriginGroup", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("cdn.RoutesClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, profileName, endpointName, routeName, route) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client RoutesClient) CreatePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, routeName string, route Route) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeName": autorest.Encode("path", routeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}", pathParameters), + autorest.WithJSON(route), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client RoutesClient) CreateSender(req *http.Request) (future RoutesCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client RoutesClient) CreateResponder(resp *http.Response) (result Route, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing route with the specified route name under the specified subscription, resource group, +// profile, and AzureFrontDoor endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// routeName - name of the routing rule. +func (client RoutesClient) Delete(ctx context.Context, resourceGroupName string, profileName string, endpointName string, routeName string) (result RoutesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoutesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.RoutesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName, endpointName, routeName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client RoutesClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, routeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeName": autorest.Encode("path", routeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client RoutesClient) DeleteSender(req *http.Request) (future RoutesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RoutesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an existing route with the specified route name under the specified subscription, resource group, profile, +// and AzureFrontDoor endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// routeName - name of the routing rule. +func (client RoutesClient) Get(ctx context.Context, resourceGroupName string, profileName string, endpointName string, routeName string) (result Route, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoutesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.RoutesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName, endpointName, routeName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.RoutesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client RoutesClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, routeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeName": autorest.Encode("path", routeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RoutesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RoutesClient) GetResponder(resp *http.Response) (result Route, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByEndpoint lists all of the existing origins within a profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +func (client RoutesClient) ListByEndpoint(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result RouteListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoutesClient.ListByEndpoint") + defer func() { + sc := -1 + if result.rlr.Response.Response != nil { + sc = result.rlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.RoutesClient", "ListByEndpoint", err.Error()) + } + + result.fn = client.listByEndpointNextResults + req, err := client.ListByEndpointPreparer(ctx, resourceGroupName, profileName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesClient", "ListByEndpoint", nil, "Failure preparing request") + return + } + + resp, err := client.ListByEndpointSender(req) + if err != nil { + result.rlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.RoutesClient", "ListByEndpoint", resp, "Failure sending request") + return + } + + result.rlr, err = client.ListByEndpointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesClient", "ListByEndpoint", resp, "Failure responding to request") + return + } + if result.rlr.hasNextLink() && result.rlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByEndpointPreparer prepares the ListByEndpoint request. +func (client RoutesClient) ListByEndpointPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByEndpointSender sends the ListByEndpoint request. The method will close the +// http.Response Body if it receives an error. +func (client RoutesClient) ListByEndpointSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByEndpointResponder handles the response to the ListByEndpoint request. The method always +// closes the http.Response Body. +func (client RoutesClient) ListByEndpointResponder(resp *http.Response) (result RouteListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByEndpointNextResults retrieves the next set of results, if any. +func (client RoutesClient) listByEndpointNextResults(ctx context.Context, lastResults RouteListResult) (result RouteListResult, err error) { + req, err := lastResults.routeListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.RoutesClient", "listByEndpointNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByEndpointSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.RoutesClient", "listByEndpointNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByEndpointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesClient", "listByEndpointNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByEndpointComplete enumerates all values, automatically crossing page boundaries as required. +func (client RoutesClient) ListByEndpointComplete(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result RouteListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoutesClient.ListByEndpoint") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByEndpoint(ctx, resourceGroupName, profileName, endpointName) + return +} + +// Update updates an existing route with the specified route name under the specified subscription, resource group, +// profile, and AzureFrontDoor endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// routeName - name of the routing rule. +// routeUpdateProperties - route update properties +func (client RoutesClient) Update(ctx context.Context, resourceGroupName string, profileName string, endpointName string, routeName string, routeUpdateProperties RouteUpdateParameters) (result RoutesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoutesClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.RoutesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, profileName, endpointName, routeName, routeUpdateProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client RoutesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, routeName string, routeUpdateProperties RouteUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeName": autorest.Encode("path", routeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}", pathParameters), + autorest.WithJSON(routeUpdateProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client RoutesClient) UpdateSender(req *http.Request) (future RoutesUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client RoutesClient) UpdateResponder(resp *http.Response) (result Route, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/cdn/mgmt/2021-06-01/cdn/rules.go b/services/cdn/mgmt/2021-06-01/cdn/rules.go new file mode 100644 index 000000000000..e3e894517995 --- /dev/null +++ b/services/cdn/mgmt/2021-06-01/cdn/rules.go @@ -0,0 +1,536 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// RulesClient is the cdn Management Client +type RulesClient struct { + BaseClient +} + +// NewRulesClient creates an instance of the RulesClient client. +func NewRulesClient(subscriptionID string) RulesClient { + return NewRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRulesClientWithBaseURI creates an instance of the RulesClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewRulesClientWithBaseURI(baseURI string, subscriptionID string) RulesClient { + return RulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new delivery rule within the specified rule set. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// ruleSetName - name of the rule set under the profile. +// ruleName - name of the delivery rule which is unique within the endpoint. +// rule - the delivery rule properties. +func (client RulesClient) Create(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string, ruleName string, rule Rule) (result RulesCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RulesClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: rule, + Constraints: []validation.Constraint{{Target: "rule.RuleProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "rule.RuleProperties.Order", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "rule.RuleProperties.Actions", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("cdn.RulesClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, profileName, ruleSetName, ruleName, rule) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client RulesClient) CreatePreparer(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string, ruleName string, rule Rule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "ruleSetName": autorest.Encode("path", ruleSetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}", pathParameters), + autorest.WithJSON(rule), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client RulesClient) CreateSender(req *http.Request) (future RulesCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client RulesClient) CreateResponder(resp *http.Response) (result Rule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing delivery rule within a rule set. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// ruleSetName - name of the rule set under the profile. +// ruleName - name of the delivery rule which is unique within the endpoint. +func (client RulesClient) Delete(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string, ruleName string) (result RulesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RulesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.RulesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName, ruleSetName, ruleName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client RulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string, ruleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "ruleSetName": autorest.Encode("path", ruleSetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client RulesClient) DeleteSender(req *http.Request) (future RulesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an existing delivery rule within a rule set. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// ruleSetName - name of the rule set under the profile. +// ruleName - name of the delivery rule which is unique within the endpoint. +func (client RulesClient) Get(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string, ruleName string) (result Rule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RulesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.RulesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName, ruleSetName, ruleName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.RulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client RulesClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string, ruleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "ruleSetName": autorest.Encode("path", ruleSetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RulesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RulesClient) GetResponder(resp *http.Response) (result Rule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByRuleSet lists all of the existing delivery rules within a rule set. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// ruleSetName - name of the rule set under the profile. +func (client RulesClient) ListByRuleSet(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (result RuleListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RulesClient.ListByRuleSet") + defer func() { + sc := -1 + if result.rlr.Response.Response != nil { + sc = result.rlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.RulesClient", "ListByRuleSet", err.Error()) + } + + result.fn = client.listByRuleSetNextResults + req, err := client.ListByRuleSetPreparer(ctx, resourceGroupName, profileName, ruleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesClient", "ListByRuleSet", nil, "Failure preparing request") + return + } + + resp, err := client.ListByRuleSetSender(req) + if err != nil { + result.rlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.RulesClient", "ListByRuleSet", resp, "Failure sending request") + return + } + + result.rlr, err = client.ListByRuleSetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesClient", "ListByRuleSet", resp, "Failure responding to request") + return + } + if result.rlr.hasNextLink() && result.rlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByRuleSetPreparer prepares the ListByRuleSet request. +func (client RulesClient) ListByRuleSetPreparer(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleSetName": autorest.Encode("path", ruleSetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByRuleSetSender sends the ListByRuleSet request. The method will close the +// http.Response Body if it receives an error. +func (client RulesClient) ListByRuleSetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByRuleSetResponder handles the response to the ListByRuleSet request. The method always +// closes the http.Response Body. +func (client RulesClient) ListByRuleSetResponder(resp *http.Response) (result RuleListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByRuleSetNextResults retrieves the next set of results, if any. +func (client RulesClient) listByRuleSetNextResults(ctx context.Context, lastResults RuleListResult) (result RuleListResult, err error) { + req, err := lastResults.ruleListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.RulesClient", "listByRuleSetNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByRuleSetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.RulesClient", "listByRuleSetNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByRuleSetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesClient", "listByRuleSetNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByRuleSetComplete enumerates all values, automatically crossing page boundaries as required. +func (client RulesClient) ListByRuleSetComplete(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (result RuleListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RulesClient.ListByRuleSet") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByRuleSet(ctx, resourceGroupName, profileName, ruleSetName) + return +} + +// Update updates an existing delivery rule within a rule set. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// ruleSetName - name of the rule set under the profile. +// ruleName - name of the delivery rule which is unique within the endpoint. +// ruleUpdateProperties - delivery rule properties +func (client RulesClient) Update(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string, ruleName string, ruleUpdateProperties RuleUpdateParameters) (result RulesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RulesClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.RulesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, profileName, ruleSetName, ruleName, ruleUpdateProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client RulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string, ruleName string, ruleUpdateProperties RuleUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "ruleSetName": autorest.Encode("path", ruleSetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}", pathParameters), + autorest.WithJSON(ruleUpdateProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client RulesClient) UpdateSender(req *http.Request) (future RulesUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client RulesClient) UpdateResponder(resp *http.Response) (result Rule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/cdn/mgmt/2021-06-01/cdn/rulesets.go b/services/cdn/mgmt/2021-06-01/cdn/rulesets.go new file mode 100644 index 000000000000..b42a1bf78c3c --- /dev/null +++ b/services/cdn/mgmt/2021-06-01/cdn/rulesets.go @@ -0,0 +1,553 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// RuleSetsClient is the cdn Management Client +type RuleSetsClient struct { + BaseClient +} + +// NewRuleSetsClient creates an instance of the RuleSetsClient client. +func NewRuleSetsClient(subscriptionID string) RuleSetsClient { + return NewRuleSetsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRuleSetsClientWithBaseURI creates an instance of the RuleSetsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewRuleSetsClientWithBaseURI(baseURI string, subscriptionID string) RuleSetsClient { + return RuleSetsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new rule set within the specified profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// ruleSetName - name of the rule set under the profile which is unique globally +func (client RuleSetsClient) Create(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (result RuleSet, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleSetsClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.RuleSetsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, profileName, ruleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client RuleSetsClient) CreatePreparer(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleSetName": autorest.Encode("path", ruleSetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client RuleSetsClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client RuleSetsClient) CreateResponder(resp *http.Response) (result RuleSet, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing AzureFrontDoor rule set with the specified rule set name under the specified +// subscription, resource group and profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// ruleSetName - name of the rule set under the profile which is unique globally. +func (client RuleSetsClient) Delete(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (result RuleSetsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleSetsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.RuleSetsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName, ruleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client RuleSetsClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleSetName": autorest.Encode("path", ruleSetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client RuleSetsClient) DeleteSender(req *http.Request) (future RuleSetsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RuleSetsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an existing AzureFrontDoor rule set with the specified rule set name under the specified subscription, +// resource group and profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// ruleSetName - name of the rule set under the profile which is unique globally. +func (client RuleSetsClient) Get(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (result RuleSet, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleSetsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.RuleSetsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName, ruleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client RuleSetsClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleSetName": autorest.Encode("path", ruleSetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RuleSetsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RuleSetsClient) GetResponder(resp *http.Response) (result RuleSet, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByProfile lists existing AzureFrontDoor rule sets within a profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +func (client RuleSetsClient) ListByProfile(ctx context.Context, resourceGroupName string, profileName string) (result RuleSetListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleSetsClient.ListByProfile") + defer func() { + sc := -1 + if result.rslr.Response.Response != nil { + sc = result.rslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.RuleSetsClient", "ListByProfile", err.Error()) + } + + result.fn = client.listByProfileNextResults + req, err := client.ListByProfilePreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "ListByProfile", nil, "Failure preparing request") + return + } + + resp, err := client.ListByProfileSender(req) + if err != nil { + result.rslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "ListByProfile", resp, "Failure sending request") + return + } + + result.rslr, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "ListByProfile", resp, "Failure responding to request") + return + } + if result.rslr.hasNextLink() && result.rslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByProfilePreparer prepares the ListByProfile request. +func (client RuleSetsClient) ListByProfilePreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByProfileSender sends the ListByProfile request. The method will close the +// http.Response Body if it receives an error. +func (client RuleSetsClient) ListByProfileSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByProfileResponder handles the response to the ListByProfile request. The method always +// closes the http.Response Body. +func (client RuleSetsClient) ListByProfileResponder(resp *http.Response) (result RuleSetListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByProfileNextResults retrieves the next set of results, if any. +func (client RuleSetsClient) listByProfileNextResults(ctx context.Context, lastResults RuleSetListResult) (result RuleSetListResult, err error) { + req, err := lastResults.ruleSetListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "listByProfileNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByProfileSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "listByProfileNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "listByProfileNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByProfileComplete enumerates all values, automatically crossing page boundaries as required. +func (client RuleSetsClient) ListByProfileComplete(ctx context.Context, resourceGroupName string, profileName string) (result RuleSetListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleSetsClient.ListByProfile") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByProfile(ctx, resourceGroupName, profileName) + return +} + +// ListResourceUsage checks the quota and actual usage of endpoints under the given CDN profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// ruleSetName - name of the rule set under the profile which is unique globally. +func (client RuleSetsClient) ListResourceUsage(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (result UsagesListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleSetsClient.ListResourceUsage") + defer func() { + sc := -1 + if result.ulr.Response.Response != nil { + sc = result.ulr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.RuleSetsClient", "ListResourceUsage", err.Error()) + } + + result.fn = client.listResourceUsageNextResults + req, err := client.ListResourceUsagePreparer(ctx, resourceGroupName, profileName, ruleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "ListResourceUsage", nil, "Failure preparing request") + return + } + + resp, err := client.ListResourceUsageSender(req) + if err != nil { + result.ulr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "ListResourceUsage", resp, "Failure sending request") + return + } + + result.ulr, err = client.ListResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "ListResourceUsage", resp, "Failure responding to request") + return + } + if result.ulr.hasNextLink() && result.ulr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListResourceUsagePreparer prepares the ListResourceUsage request. +func (client RuleSetsClient) ListResourceUsagePreparer(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleSetName": autorest.Encode("path", ruleSetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListResourceUsageSender sends the ListResourceUsage request. The method will close the +// http.Response Body if it receives an error. +func (client RuleSetsClient) ListResourceUsageSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResourceUsageResponder handles the response to the ListResourceUsage request. The method always +// closes the http.Response Body. +func (client RuleSetsClient) ListResourceUsageResponder(resp *http.Response) (result UsagesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listResourceUsageNextResults retrieves the next set of results, if any. +func (client RuleSetsClient) listResourceUsageNextResults(ctx context.Context, lastResults UsagesListResult) (result UsagesListResult, err error) { + req, err := lastResults.usagesListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "listResourceUsageNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListResourceUsageSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "listResourceUsageNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "listResourceUsageNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListResourceUsageComplete enumerates all values, automatically crossing page boundaries as required. +func (client RuleSetsClient) ListResourceUsageComplete(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (result UsagesListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleSetsClient.ListResourceUsage") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListResourceUsage(ctx, resourceGroupName, profileName, ruleSetName) + return +} diff --git a/services/cdn/mgmt/2021-06-01/cdn/secrets.go b/services/cdn/mgmt/2021-06-01/cdn/secrets.go new file mode 100644 index 000000000000..7706c4e7efad --- /dev/null +++ b/services/cdn/mgmt/2021-06-01/cdn/secrets.go @@ -0,0 +1,428 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SecretsClient is the cdn Management Client +type SecretsClient struct { + BaseClient +} + +// NewSecretsClient creates an instance of the SecretsClient client. +func NewSecretsClient(subscriptionID string) SecretsClient { + return NewSecretsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSecretsClientWithBaseURI creates an instance of the SecretsClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewSecretsClientWithBaseURI(baseURI string, subscriptionID string) SecretsClient { + return SecretsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new Secret within the specified profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// secretName - name of the Secret under the profile. +// secret - the Secret properties. +func (client SecretsClient) Create(ctx context.Context, resourceGroupName string, profileName string, secretName string, secret Secret) (result SecretsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.SecretsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, profileName, secretName, secret) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecretsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecretsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client SecretsClient) CreatePreparer(ctx context.Context, resourceGroupName string, profileName string, secretName string, secret Secret) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "secretName": autorest.Encode("path", secretName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}", pathParameters), + autorest.WithJSON(secret), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client SecretsClient) CreateSender(req *http.Request) (future SecretsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client SecretsClient) CreateResponder(resp *http.Response) (result Secret, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing Secret within profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// secretName - name of the Secret under the profile. +func (client SecretsClient) Delete(ctx context.Context, resourceGroupName string, profileName string, secretName string) (result SecretsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.SecretsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName, secretName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecretsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecretsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SecretsClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string, secretName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "secretName": autorest.Encode("path", secretName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SecretsClient) DeleteSender(req *http.Request) (future SecretsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SecretsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an existing Secret within a profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// secretName - name of the Secret under the profile. +func (client SecretsClient) Get(ctx context.Context, resourceGroupName string, profileName string, secretName string) (result Secret, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.SecretsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName, secretName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecretsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.SecretsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecretsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SecretsClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, secretName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "secretName": autorest.Encode("path", secretName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SecretsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SecretsClient) GetResponder(resp *http.Response) (result Secret, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByProfile lists existing AzureFrontDoor secrets. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +func (client SecretsClient) ListByProfile(ctx context.Context, resourceGroupName string, profileName string) (result SecretListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.ListByProfile") + defer func() { + sc := -1 + if result.slr.Response.Response != nil { + sc = result.slr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.SecretsClient", "ListByProfile", err.Error()) + } + + result.fn = client.listByProfileNextResults + req, err := client.ListByProfilePreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecretsClient", "ListByProfile", nil, "Failure preparing request") + return + } + + resp, err := client.ListByProfileSender(req) + if err != nil { + result.slr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.SecretsClient", "ListByProfile", resp, "Failure sending request") + return + } + + result.slr, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecretsClient", "ListByProfile", resp, "Failure responding to request") + return + } + if result.slr.hasNextLink() && result.slr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByProfilePreparer prepares the ListByProfile request. +func (client SecretsClient) ListByProfilePreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByProfileSender sends the ListByProfile request. The method will close the +// http.Response Body if it receives an error. +func (client SecretsClient) ListByProfileSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByProfileResponder handles the response to the ListByProfile request. The method always +// closes the http.Response Body. +func (client SecretsClient) ListByProfileResponder(resp *http.Response) (result SecretListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByProfileNextResults retrieves the next set of results, if any. +func (client SecretsClient) listByProfileNextResults(ctx context.Context, lastResults SecretListResult) (result SecretListResult, err error) { + req, err := lastResults.secretListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.SecretsClient", "listByProfileNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByProfileSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.SecretsClient", "listByProfileNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecretsClient", "listByProfileNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByProfileComplete enumerates all values, automatically crossing page boundaries as required. +func (client SecretsClient) ListByProfileComplete(ctx context.Context, resourceGroupName string, profileName string) (result SecretListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.ListByProfile") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByProfile(ctx, resourceGroupName, profileName) + return +} diff --git a/services/cdn/mgmt/2021-06-01/cdn/securitypolicies.go b/services/cdn/mgmt/2021-06-01/cdn/securitypolicies.go new file mode 100644 index 000000000000..fae4f8d8c600 --- /dev/null +++ b/services/cdn/mgmt/2021-06-01/cdn/securitypolicies.go @@ -0,0 +1,522 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SecurityPoliciesClient is the cdn Management Client +type SecurityPoliciesClient struct { + BaseClient +} + +// NewSecurityPoliciesClient creates an instance of the SecurityPoliciesClient client. +func NewSecurityPoliciesClient(subscriptionID string) SecurityPoliciesClient { + return NewSecurityPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSecurityPoliciesClientWithBaseURI creates an instance of the SecurityPoliciesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewSecurityPoliciesClientWithBaseURI(baseURI string, subscriptionID string) SecurityPoliciesClient { + return SecurityPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new security policy within the specified profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// securityPolicyName - name of the security policy under the profile. +// securityPolicy - the security policy properties. +func (client SecurityPoliciesClient) Create(ctx context.Context, resourceGroupName string, profileName string, securityPolicyName string, securityPolicy SecurityPolicy) (result SecurityPoliciesCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityPoliciesClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.SecurityPoliciesClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, profileName, securityPolicyName, securityPolicy) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client SecurityPoliciesClient) CreatePreparer(ctx context.Context, resourceGroupName string, profileName string, securityPolicyName string, securityPolicy SecurityPolicy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "securityPolicyName": autorest.Encode("path", securityPolicyName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}", pathParameters), + autorest.WithJSON(securityPolicy), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityPoliciesClient) CreateSender(req *http.Request) (future SecurityPoliciesCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client SecurityPoliciesClient) CreateResponder(resp *http.Response) (result SecurityPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing security policy within profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// securityPolicyName - name of the security policy under the profile. +func (client SecurityPoliciesClient) Delete(ctx context.Context, resourceGroupName string, profileName string, securityPolicyName string) (result SecurityPoliciesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityPoliciesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.SecurityPoliciesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName, securityPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SecurityPoliciesClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string, securityPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "securityPolicyName": autorest.Encode("path", securityPolicyName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityPoliciesClient) DeleteSender(req *http.Request) (future SecurityPoliciesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SecurityPoliciesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an existing security policy within a profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// securityPolicyName - name of the security policy under the profile. +func (client SecurityPoliciesClient) Get(ctx context.Context, resourceGroupName string, profileName string, securityPolicyName string) (result SecurityPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityPoliciesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.SecurityPoliciesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName, securityPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SecurityPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, securityPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "securityPolicyName": autorest.Encode("path", securityPolicyName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SecurityPoliciesClient) GetResponder(resp *http.Response) (result SecurityPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByProfile lists security policies associated with the profile +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +func (client SecurityPoliciesClient) ListByProfile(ctx context.Context, resourceGroupName string, profileName string) (result SecurityPolicyListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityPoliciesClient.ListByProfile") + defer func() { + sc := -1 + if result.splr.Response.Response != nil { + sc = result.splr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.SecurityPoliciesClient", "ListByProfile", err.Error()) + } + + result.fn = client.listByProfileNextResults + req, err := client.ListByProfilePreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesClient", "ListByProfile", nil, "Failure preparing request") + return + } + + resp, err := client.ListByProfileSender(req) + if err != nil { + result.splr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesClient", "ListByProfile", resp, "Failure sending request") + return + } + + result.splr, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesClient", "ListByProfile", resp, "Failure responding to request") + return + } + if result.splr.hasNextLink() && result.splr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByProfilePreparer prepares the ListByProfile request. +func (client SecurityPoliciesClient) ListByProfilePreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByProfileSender sends the ListByProfile request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityPoliciesClient) ListByProfileSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByProfileResponder handles the response to the ListByProfile request. The method always +// closes the http.Response Body. +func (client SecurityPoliciesClient) ListByProfileResponder(resp *http.Response) (result SecurityPolicyListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByProfileNextResults retrieves the next set of results, if any. +func (client SecurityPoliciesClient) listByProfileNextResults(ctx context.Context, lastResults SecurityPolicyListResult) (result SecurityPolicyListResult, err error) { + req, err := lastResults.securityPolicyListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.SecurityPoliciesClient", "listByProfileNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByProfileSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.SecurityPoliciesClient", "listByProfileNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesClient", "listByProfileNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByProfileComplete enumerates all values, automatically crossing page boundaries as required. +func (client SecurityPoliciesClient) ListByProfileComplete(ctx context.Context, resourceGroupName string, profileName string) (result SecurityPolicyListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityPoliciesClient.ListByProfile") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByProfile(ctx, resourceGroupName, profileName) + return +} + +// Patch updates an existing security policy within a profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// securityPolicyName - name of the security policy under the profile. +// securityPolicyUpdateProperties - security policy update properties +func (client SecurityPoliciesClient) Patch(ctx context.Context, resourceGroupName string, profileName string, securityPolicyName string, securityPolicyUpdateProperties SecurityPolicyUpdateParameters) (result SecurityPoliciesPatchFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityPoliciesClient.Patch") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.SecurityPoliciesClient", "Patch", err.Error()) + } + + req, err := client.PatchPreparer(ctx, resourceGroupName, profileName, securityPolicyName, securityPolicyUpdateProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesClient", "Patch", nil, "Failure preparing request") + return + } + + result, err = client.PatchSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesClient", "Patch", result.Response(), "Failure sending request") + return + } + + return +} + +// PatchPreparer prepares the Patch request. +func (client SecurityPoliciesClient) PatchPreparer(ctx context.Context, resourceGroupName string, profileName string, securityPolicyName string, securityPolicyUpdateProperties SecurityPolicyUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "securityPolicyName": autorest.Encode("path", securityPolicyName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}", pathParameters), + autorest.WithJSON(securityPolicyUpdateProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PatchSender sends the Patch request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityPoliciesClient) PatchSender(req *http.Request) (future SecurityPoliciesPatchFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// PatchResponder handles the response to the Patch request. The method always +// closes the http.Response Body. +func (client SecurityPoliciesClient) PatchResponder(resp *http.Response) (result SecurityPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/cdn/mgmt/2021-06-01/cdn/validate.go b/services/cdn/mgmt/2021-06-01/cdn/validate.go new file mode 100644 index 000000000000..3811b70cf397 --- /dev/null +++ b/services/cdn/mgmt/2021-06-01/cdn/validate.go @@ -0,0 +1,113 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ValidateClient is the cdn Management Client +type ValidateClient struct { + BaseClient +} + +// NewValidateClient creates an instance of the ValidateClient client. +func NewValidateClient(subscriptionID string) ValidateClient { + return NewValidateClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewValidateClientWithBaseURI creates an instance of the ValidateClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewValidateClientWithBaseURI(baseURI string, subscriptionID string) ValidateClient { + return ValidateClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// SecretMethod validate a Secret in the profile. +// Parameters: +// validateSecretInput - the Secret source. +func (client ValidateClient) SecretMethod(ctx context.Context, validateSecretInput ValidateSecretInput) (result ValidateSecretOutput, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ValidateClient.SecretMethod") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: validateSecretInput, + Constraints: []validation.Constraint{{Target: "validateSecretInput.SecretSource", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.ValidateClient", "SecretMethod", err.Error()) + } + + req, err := client.SecretMethodPreparer(ctx, validateSecretInput) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ValidateClient", "SecretMethod", nil, "Failure preparing request") + return + } + + resp, err := client.SecretMethodSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.ValidateClient", "SecretMethod", resp, "Failure sending request") + return + } + + result, err = client.SecretMethodResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ValidateClient", "SecretMethod", resp, "Failure responding to request") + return + } + + return +} + +// SecretMethodPreparer prepares the SecretMethod request. +func (client ValidateClient) SecretMethodPreparer(ctx context.Context, validateSecretInput ValidateSecretInput) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/validateSecret", pathParameters), + autorest.WithJSON(validateSecretInput), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SecretMethodSender sends the SecretMethod request. The method will close the +// http.Response Body if it receives an error. +func (client ValidateClient) SecretMethodSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// SecretMethodResponder handles the response to the SecretMethod request. The method always +// closes the http.Response Body. +func (client ValidateClient) SecretMethodResponder(resp *http.Response) (result ValidateSecretOutput, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/cdn/mgmt/2021-06-01/cdn/version.go b/services/cdn/mgmt/2021-06-01/cdn/version.go new file mode 100644 index 000000000000..40472d9c3503 --- /dev/null +++ b/services/cdn/mgmt/2021-06-01/cdn/version.go @@ -0,0 +1,19 @@ +package cdn + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights 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. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " cdn/2021-06-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/CHANGELOG.md b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/CHANGELOG.md new file mode 100644 index 000000000000..52911e4cc5e4 --- /dev/null +++ b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/CHANGELOG.md @@ -0,0 +1,2 @@ +# Change History + diff --git a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/_meta.json b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/_meta.json new file mode 100644 index 000000000000..34196e12a8ab --- /dev/null +++ b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "162460648e39b3cd20ef3d302008add138e90223", + "readme": "/_/azure-rest-api-specs/specification/applicationinsights/resource-manager/readme.md", + "tag": "package-2022-02-01", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2022-02-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/applicationinsights/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" + } +} \ No newline at end of file diff --git a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/analyticsitems.go b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/analyticsitems.go new file mode 100644 index 000000000000..2e08deb5b096 --- /dev/null +++ b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/analyticsitems.go @@ -0,0 +1,429 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AnalyticsItemsClient is the composite Swagger for Application Insights Management Client +type AnalyticsItemsClient struct { + BaseClient +} + +// NewAnalyticsItemsClient creates an instance of the AnalyticsItemsClient client. +func NewAnalyticsItemsClient(subscriptionID string) AnalyticsItemsClient { + return NewAnalyticsItemsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAnalyticsItemsClientWithBaseURI creates an instance of the AnalyticsItemsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAnalyticsItemsClientWithBaseURI(baseURI string, subscriptionID string) AnalyticsItemsClient { + return AnalyticsItemsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Delete deletes a specific Analytics Items defined within an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// scopePath - enum indicating if this item definition is owned by a specific user or is shared between all +// users with access to the Application Insights component. +// ID - the Id of a specific item defined in the Application Insights component +// name - the name of a specific item defined in the Application Insights component +func (client AnalyticsItemsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, ID string, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AnalyticsItemsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AnalyticsItemsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, scopePath, ID, name) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AnalyticsItemsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, ID string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "scopePath": autorest.Encode("path", scopePath), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(ID) > 0 { + queryParameters["id"] = autorest.Encode("query", ID) + } + if len(name) > 0 { + queryParameters["name"] = autorest.Encode("query", name) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}/item", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AnalyticsItemsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AnalyticsItemsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a specific Analytics Items defined within an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// scopePath - enum indicating if this item definition is owned by a specific user or is shared between all +// users with access to the Application Insights component. +// ID - the Id of a specific item defined in the Application Insights component +// name - the name of a specific item defined in the Application Insights component +func (client AnalyticsItemsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, ID string, name string) (result ApplicationInsightsComponentAnalyticsItem, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AnalyticsItemsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AnalyticsItemsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, scopePath, ID, name) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AnalyticsItemsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, ID string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "scopePath": autorest.Encode("path", scopePath), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(ID) > 0 { + queryParameters["id"] = autorest.Encode("query", ID) + } + if len(name) > 0 { + queryParameters["name"] = autorest.Encode("query", name) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}/item", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AnalyticsItemsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AnalyticsItemsClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentAnalyticsItem, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of Analytics Items defined within an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// scopePath - enum indicating if this item definition is owned by a specific user or is shared between all +// users with access to the Application Insights component. +// scope - enum indicating if this item definition is owned by a specific user or is shared between all users +// with access to the Application Insights component. +// typeParameter - enum indicating the type of the Analytics item. +// includeContent - flag indicating whether or not to return the content of each applicable item. If false, +// only return the item information. +func (client AnalyticsItemsClient) List(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, scope ItemScope, typeParameter ItemTypeParameter, includeContent *bool) (result ListApplicationInsightsComponentAnalyticsItem, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AnalyticsItemsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AnalyticsItemsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName, scopePath, scope, typeParameter, includeContent) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AnalyticsItemsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, scope ItemScope, typeParameter ItemTypeParameter, includeContent *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "scopePath": autorest.Encode("path", scopePath), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(string(scope)) > 0 { + queryParameters["scope"] = autorest.Encode("query", scope) + } else { + queryParameters["scope"] = autorest.Encode("query", "shared") + } + if len(string(typeParameter)) > 0 { + queryParameters["type"] = autorest.Encode("query", typeParameter) + } else { + queryParameters["type"] = autorest.Encode("query", "none") + } + if includeContent != nil { + queryParameters["includeContent"] = autorest.Encode("query", *includeContent) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AnalyticsItemsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AnalyticsItemsClient) ListResponder(resp *http.Response) (result ListApplicationInsightsComponentAnalyticsItem, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Put adds or Updates a specific Analytics Item within an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// scopePath - enum indicating if this item definition is owned by a specific user or is shared between all +// users with access to the Application Insights component. +// itemProperties - properties that need to be specified to create a new item and add it to an Application +// Insights component. +// overrideItem - flag indicating whether or not to force save an item. This allows overriding an item if it +// already exists. +func (client AnalyticsItemsClient) Put(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, itemProperties ApplicationInsightsComponentAnalyticsItem, overrideItem *bool) (result ApplicationInsightsComponentAnalyticsItem, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AnalyticsItemsClient.Put") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AnalyticsItemsClient", "Put", err.Error()) + } + + req, err := client.PutPreparer(ctx, resourceGroupName, resourceName, scopePath, itemProperties, overrideItem) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "Put", nil, "Failure preparing request") + return + } + + resp, err := client.PutSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "Put", resp, "Failure sending request") + return + } + + result, err = client.PutResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "Put", resp, "Failure responding to request") + return + } + + return +} + +// PutPreparer prepares the Put request. +func (client AnalyticsItemsClient) PutPreparer(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, itemProperties ApplicationInsightsComponentAnalyticsItem, overrideItem *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "scopePath": autorest.Encode("path", scopePath), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if overrideItem != nil { + queryParameters["overrideItem"] = autorest.Encode("query", *overrideItem) + } + + itemProperties.Version = nil + itemProperties.TimeCreated = nil + itemProperties.TimeModified = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}/item", pathParameters), + autorest.WithJSON(itemProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PutSender sends the Put request. The method will close the +// http.Response Body if it receives an error. +func (client AnalyticsItemsClient) PutSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// PutResponder handles the response to the Put request. The method always +// closes the http.Response Body. +func (client AnalyticsItemsClient) PutResponder(resp *http.Response) (result ApplicationInsightsComponentAnalyticsItem, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/annotations.go b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/annotations.go new file mode 100644 index 000000000000..aa31fd7d0e74 --- /dev/null +++ b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/annotations.go @@ -0,0 +1,383 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AnnotationsClient is the composite Swagger for Application Insights Management Client +type AnnotationsClient struct { + BaseClient +} + +// NewAnnotationsClient creates an instance of the AnnotationsClient client. +func NewAnnotationsClient(subscriptionID string) AnnotationsClient { + return NewAnnotationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAnnotationsClientWithBaseURI creates an instance of the AnnotationsClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAnnotationsClientWithBaseURI(baseURI string, subscriptionID string) AnnotationsClient { + return AnnotationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create an Annotation of an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// annotationProperties - properties that need to be specified to create an annotation of a Application +// Insights component. +func (client AnnotationsClient) Create(ctx context.Context, resourceGroupName string, resourceName string, annotationProperties Annotation) (result ListAnnotation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AnnotationsClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AnnotationsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, resourceName, annotationProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client AnnotationsClient) CreatePreparer(ctx context.Context, resourceGroupName string, resourceName string, annotationProperties Annotation) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/Annotations", pathParameters), + autorest.WithJSON(annotationProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client AnnotationsClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client AnnotationsClient) CreateResponder(resp *http.Response) (result ListAnnotation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete an Annotation of an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// annotationID - the unique annotation ID. This is unique within a Application Insights component. +func (client AnnotationsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, annotationID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AnnotationsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AnnotationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, annotationID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AnnotationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, annotationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "annotationId": autorest.Encode("path", annotationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/Annotations/{annotationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AnnotationsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AnnotationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the annotation for given id. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// annotationID - the unique annotation ID. This is unique within a Application Insights component. +func (client AnnotationsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, annotationID string) (result ListAnnotation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AnnotationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AnnotationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, annotationID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AnnotationsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, annotationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "annotationId": autorest.Encode("path", annotationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/Annotations/{annotationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AnnotationsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AnnotationsClient) GetResponder(resp *http.Response) (result ListAnnotation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets the list of annotations for a component for given time range +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// start - the start time to query from for annotations, cannot be older than 90 days from current date. +// end - the end time to query for annotations. +func (client AnnotationsClient) List(ctx context.Context, resourceGroupName string, resourceName string, start string, end string) (result AnnotationsListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AnnotationsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AnnotationsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName, start, end) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AnnotationsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string, start string, end string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "end": autorest.Encode("query", end), + "start": autorest.Encode("query", start), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/Annotations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AnnotationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AnnotationsClient) ListResponder(resp *http.Response) (result AnnotationsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/apikeys.go b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/apikeys.go new file mode 100644 index 000000000000..ca33d3c4c68d --- /dev/null +++ b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/apikeys.go @@ -0,0 +1,380 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// APIKeysClient is the composite Swagger for Application Insights Management Client +type APIKeysClient struct { + BaseClient +} + +// NewAPIKeysClient creates an instance of the APIKeysClient client. +func NewAPIKeysClient(subscriptionID string) APIKeysClient { + return NewAPIKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAPIKeysClientWithBaseURI creates an instance of the APIKeysClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAPIKeysClientWithBaseURI(baseURI string, subscriptionID string) APIKeysClient { + return APIKeysClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create an API Key of an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// APIKeyProperties - properties that need to be specified to create an API key of a Application Insights +// component. +func (client APIKeysClient) Create(ctx context.Context, resourceGroupName string, resourceName string, APIKeyProperties APIKeyRequest) (result ApplicationInsightsComponentAPIKey, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIKeysClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.APIKeysClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, resourceName, APIKeyProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client APIKeysClient) CreatePreparer(ctx context.Context, resourceGroupName string, resourceName string, APIKeyProperties APIKeyRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ApiKeys", pathParameters), + autorest.WithJSON(APIKeyProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client APIKeysClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client APIKeysClient) CreateResponder(resp *http.Response) (result ApplicationInsightsComponentAPIKey, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete an API Key of an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// keyID - the API Key ID. This is unique within a Application Insights component. +func (client APIKeysClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, keyID string) (result ApplicationInsightsComponentAPIKey, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIKeysClient.Delete") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.APIKeysClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, keyID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client APIKeysClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, keyID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "keyId": autorest.Encode("path", keyID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/APIKeys/{keyId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client APIKeysClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client APIKeysClient) DeleteResponder(resp *http.Response) (result ApplicationInsightsComponentAPIKey, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get the API Key for this key id. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// keyID - the API Key ID. This is unique within a Application Insights component. +func (client APIKeysClient) Get(ctx context.Context, resourceGroupName string, resourceName string, keyID string) (result ApplicationInsightsComponentAPIKey, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIKeysClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.APIKeysClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, keyID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client APIKeysClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, keyID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "keyId": autorest.Encode("path", keyID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/APIKeys/{keyId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client APIKeysClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client APIKeysClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentAPIKey, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of API keys of an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client APIKeysClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result ApplicationInsightsComponentAPIKeyListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIKeysClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.APIKeysClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client APIKeysClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ApiKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client APIKeysClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client APIKeysClient) ListResponder(resp *http.Response) (result ApplicationInsightsComponentAPIKeyListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/client.go b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/client.go new file mode 100644 index 000000000000..9203ed850c0c --- /dev/null +++ b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/client.go @@ -0,0 +1,41 @@ +// Package insights implements the Azure ARM Insights service API version . +// +// Composite Swagger for Application Insights Management Client +package insights + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Insights + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Insights. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/componentavailablefeatures.go b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/componentavailablefeatures.go new file mode 100644 index 000000000000..997a483b327f --- /dev/null +++ b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/componentavailablefeatures.go @@ -0,0 +1,118 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ComponentAvailableFeaturesClient is the composite Swagger for Application Insights Management Client +type ComponentAvailableFeaturesClient struct { + BaseClient +} + +// NewComponentAvailableFeaturesClient creates an instance of the ComponentAvailableFeaturesClient client. +func NewComponentAvailableFeaturesClient(subscriptionID string) ComponentAvailableFeaturesClient { + return NewComponentAvailableFeaturesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewComponentAvailableFeaturesClientWithBaseURI creates an instance of the ComponentAvailableFeaturesClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewComponentAvailableFeaturesClientWithBaseURI(baseURI string, subscriptionID string) ComponentAvailableFeaturesClient { + return ComponentAvailableFeaturesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get returns all available features of the application insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client ComponentAvailableFeaturesClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result ApplicationInsightsComponentAvailableFeatures, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentAvailableFeaturesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentAvailableFeaturesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentAvailableFeaturesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ComponentAvailableFeaturesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentAvailableFeaturesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ComponentAvailableFeaturesClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/getavailablebillingfeatures", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ComponentAvailableFeaturesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ComponentAvailableFeaturesClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentAvailableFeatures, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/componentcurrentbillingfeatures.go b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/componentcurrentbillingfeatures.go new file mode 100644 index 000000000000..3416a616be9c --- /dev/null +++ b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/componentcurrentbillingfeatures.go @@ -0,0 +1,207 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ComponentCurrentBillingFeaturesClient is the composite Swagger for Application Insights Management Client +type ComponentCurrentBillingFeaturesClient struct { + BaseClient +} + +// NewComponentCurrentBillingFeaturesClient creates an instance of the ComponentCurrentBillingFeaturesClient client. +func NewComponentCurrentBillingFeaturesClient(subscriptionID string) ComponentCurrentBillingFeaturesClient { + return NewComponentCurrentBillingFeaturesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewComponentCurrentBillingFeaturesClientWithBaseURI creates an instance of the ComponentCurrentBillingFeaturesClient +// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI +// (sovereign clouds, Azure stack). +func NewComponentCurrentBillingFeaturesClientWithBaseURI(baseURI string, subscriptionID string) ComponentCurrentBillingFeaturesClient { + return ComponentCurrentBillingFeaturesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get returns current billing features for an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client ComponentCurrentBillingFeaturesClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result ApplicationInsightsComponentBillingFeatures, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentCurrentBillingFeaturesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentCurrentBillingFeaturesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentCurrentBillingFeaturesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ComponentCurrentBillingFeaturesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentCurrentBillingFeaturesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ComponentCurrentBillingFeaturesClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/currentbillingfeatures", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ComponentCurrentBillingFeaturesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ComponentCurrentBillingFeaturesClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentBillingFeatures, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update update current billing features for an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// billingFeaturesProperties - properties that need to be specified to update billing features for an +// Application Insights component. +func (client ComponentCurrentBillingFeaturesClient) Update(ctx context.Context, resourceGroupName string, resourceName string, billingFeaturesProperties ApplicationInsightsComponentBillingFeatures) (result ApplicationInsightsComponentBillingFeatures, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentCurrentBillingFeaturesClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentCurrentBillingFeaturesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, billingFeaturesProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentCurrentBillingFeaturesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ComponentCurrentBillingFeaturesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentCurrentBillingFeaturesClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ComponentCurrentBillingFeaturesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, billingFeaturesProperties ApplicationInsightsComponentBillingFeatures) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/currentbillingfeatures", pathParameters), + autorest.WithJSON(billingFeaturesProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ComponentCurrentBillingFeaturesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ComponentCurrentBillingFeaturesClient) UpdateResponder(resp *http.Response) (result ApplicationInsightsComponentBillingFeatures, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/componentfeaturecapabilities.go b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/componentfeaturecapabilities.go new file mode 100644 index 000000000000..0620681495e8 --- /dev/null +++ b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/componentfeaturecapabilities.go @@ -0,0 +1,118 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ComponentFeatureCapabilitiesClient is the composite Swagger for Application Insights Management Client +type ComponentFeatureCapabilitiesClient struct { + BaseClient +} + +// NewComponentFeatureCapabilitiesClient creates an instance of the ComponentFeatureCapabilitiesClient client. +func NewComponentFeatureCapabilitiesClient(subscriptionID string) ComponentFeatureCapabilitiesClient { + return NewComponentFeatureCapabilitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewComponentFeatureCapabilitiesClientWithBaseURI creates an instance of the ComponentFeatureCapabilitiesClient +// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI +// (sovereign clouds, Azure stack). +func NewComponentFeatureCapabilitiesClientWithBaseURI(baseURI string, subscriptionID string) ComponentFeatureCapabilitiesClient { + return ComponentFeatureCapabilitiesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get returns feature capabilities of the application insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client ComponentFeatureCapabilitiesClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result ApplicationInsightsComponentFeatureCapabilities, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentFeatureCapabilitiesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentFeatureCapabilitiesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentFeatureCapabilitiesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ComponentFeatureCapabilitiesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentFeatureCapabilitiesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ComponentFeatureCapabilitiesClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/featurecapabilities", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ComponentFeatureCapabilitiesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ComponentFeatureCapabilitiesClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentFeatureCapabilities, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/componentlinkedstorageaccounts.go b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/componentlinkedstorageaccounts.go new file mode 100644 index 000000000000..52a5a107c3fd --- /dev/null +++ b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/componentlinkedstorageaccounts.go @@ -0,0 +1,384 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ComponentLinkedStorageAccountsClient is the composite Swagger for Application Insights Management Client +type ComponentLinkedStorageAccountsClient struct { + BaseClient +} + +// NewComponentLinkedStorageAccountsClient creates an instance of the ComponentLinkedStorageAccountsClient client. +func NewComponentLinkedStorageAccountsClient(subscriptionID string) ComponentLinkedStorageAccountsClient { + return NewComponentLinkedStorageAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewComponentLinkedStorageAccountsClientWithBaseURI creates an instance of the ComponentLinkedStorageAccountsClient +// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI +// (sovereign clouds, Azure stack). +func NewComponentLinkedStorageAccountsClientWithBaseURI(baseURI string, subscriptionID string) ComponentLinkedStorageAccountsClient { + return ComponentLinkedStorageAccountsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateAndUpdate replace current linked storage account for an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// linkedStorageAccountsProperties - properties that need to be specified to update linked storage accounts for +// an Application Insights component. +func (client ComponentLinkedStorageAccountsClient) CreateAndUpdate(ctx context.Context, resourceGroupName string, resourceName string, linkedStorageAccountsProperties ComponentLinkedStorageAccounts) (result ComponentLinkedStorageAccounts, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentLinkedStorageAccountsClient.CreateAndUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentLinkedStorageAccountsClient", "CreateAndUpdate", err.Error()) + } + + req, err := client.CreateAndUpdatePreparer(ctx, resourceGroupName, resourceName, linkedStorageAccountsProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "CreateAndUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateAndUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "CreateAndUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateAndUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "CreateAndUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateAndUpdatePreparer prepares the CreateAndUpdate request. +func (client ComponentLinkedStorageAccountsClient) CreateAndUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, linkedStorageAccountsProperties ComponentLinkedStorageAccounts) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "storageType": autorest.Encode("path", "ServiceProfiler"), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/linkedStorageAccounts/{storageType}", pathParameters), + autorest.WithJSON(linkedStorageAccountsProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateAndUpdateSender sends the CreateAndUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ComponentLinkedStorageAccountsClient) CreateAndUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateAndUpdateResponder handles the response to the CreateAndUpdate request. The method always +// closes the http.Response Body. +func (client ComponentLinkedStorageAccountsClient) CreateAndUpdateResponder(resp *http.Response) (result ComponentLinkedStorageAccounts, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete linked storage accounts for an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client ComponentLinkedStorageAccountsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentLinkedStorageAccountsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentLinkedStorageAccountsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ComponentLinkedStorageAccountsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "storageType": autorest.Encode("path", "ServiceProfiler"), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/linkedStorageAccounts/{storageType}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ComponentLinkedStorageAccountsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ComponentLinkedStorageAccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get returns the current linked storage settings for an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client ComponentLinkedStorageAccountsClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result ComponentLinkedStorageAccounts, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentLinkedStorageAccountsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentLinkedStorageAccountsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ComponentLinkedStorageAccountsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "storageType": autorest.Encode("path", "ServiceProfiler"), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/linkedStorageAccounts/{storageType}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ComponentLinkedStorageAccountsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ComponentLinkedStorageAccountsClient) GetResponder(resp *http.Response) (result ComponentLinkedStorageAccounts, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update update linked storage accounts for an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// linkedStorageAccountsProperties - properties that need to be specified to update a linked storage accounts +// for an Application Insights component. +func (client ComponentLinkedStorageAccountsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, linkedStorageAccountsProperties ComponentLinkedStorageAccountsPatch) (result ComponentLinkedStorageAccounts, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentLinkedStorageAccountsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentLinkedStorageAccountsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, linkedStorageAccountsProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ComponentLinkedStorageAccountsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, linkedStorageAccountsProperties ComponentLinkedStorageAccountsPatch) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "storageType": autorest.Encode("path", "ServiceProfiler"), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/linkedStorageAccounts/{storageType}", pathParameters), + autorest.WithJSON(linkedStorageAccountsProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ComponentLinkedStorageAccountsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ComponentLinkedStorageAccountsClient) UpdateResponder(resp *http.Response) (result ComponentLinkedStorageAccounts, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/componentquotastatus.go b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/componentquotastatus.go new file mode 100644 index 000000000000..98d79dda19cd --- /dev/null +++ b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/componentquotastatus.go @@ -0,0 +1,118 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ComponentQuotaStatusClient is the composite Swagger for Application Insights Management Client +type ComponentQuotaStatusClient struct { + BaseClient +} + +// NewComponentQuotaStatusClient creates an instance of the ComponentQuotaStatusClient client. +func NewComponentQuotaStatusClient(subscriptionID string) ComponentQuotaStatusClient { + return NewComponentQuotaStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewComponentQuotaStatusClientWithBaseURI creates an instance of the ComponentQuotaStatusClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewComponentQuotaStatusClientWithBaseURI(baseURI string, subscriptionID string) ComponentQuotaStatusClient { + return ComponentQuotaStatusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get returns daily data volume cap (quota) status for an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client ComponentQuotaStatusClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result ApplicationInsightsComponentQuotaStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentQuotaStatusClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentQuotaStatusClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentQuotaStatusClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ComponentQuotaStatusClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentQuotaStatusClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ComponentQuotaStatusClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/quotastatus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ComponentQuotaStatusClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ComponentQuotaStatusClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentQuotaStatus, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/components.go b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/components.go new file mode 100644 index 000000000000..edd860490ce2 --- /dev/null +++ b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/components.go @@ -0,0 +1,807 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ComponentsClient is the composite Swagger for Application Insights Management Client +type ComponentsClient struct { + BaseClient +} + +// NewComponentsClient creates an instance of the ComponentsClient client. +func NewComponentsClient(subscriptionID string) ComponentsClient { + return NewComponentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewComponentsClientWithBaseURI creates an instance of the ComponentsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewComponentsClientWithBaseURI(baseURI string, subscriptionID string) ComponentsClient { + return ComponentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates (or updates) an Application Insights component. Note: You cannot specify a different value +// for InstrumentationKey nor AppId in the Put operation. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// insightProperties - properties that need to be specified to create an Application Insights component. +func (client ComponentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, insightProperties ApplicationInsightsComponent) (result ApplicationInsightsComponent, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: insightProperties, + Constraints: []validation.Constraint{{Target: "insightProperties.Kind", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, insightProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ComponentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, insightProperties ApplicationInsightsComponent) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", pathParameters), + autorest.WithJSON(insightProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ComponentsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ComponentsClient) CreateOrUpdateResponder(resp *http.Response) (result ApplicationInsightsComponent, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client ComponentsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ComponentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ComponentsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ComponentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get returns an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client ComponentsClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result ApplicationInsightsComponent, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ComponentsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ComponentsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ComponentsClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponent, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPurgeStatus get status for an ongoing purge operation. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// purgeID - in a purge status request, this is the Id of the operation the status of which is returned. +func (client ComponentsClient) GetPurgeStatus(ctx context.Context, resourceGroupName string, resourceName string, purgeID string) (result ComponentPurgeStatusResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentsClient.GetPurgeStatus") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentsClient", "GetPurgeStatus", err.Error()) + } + + req, err := client.GetPurgeStatusPreparer(ctx, resourceGroupName, resourceName, purgeID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "GetPurgeStatus", nil, "Failure preparing request") + return + } + + resp, err := client.GetPurgeStatusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "GetPurgeStatus", resp, "Failure sending request") + return + } + + result, err = client.GetPurgeStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "GetPurgeStatus", resp, "Failure responding to request") + return + } + + return +} + +// GetPurgeStatusPreparer prepares the GetPurgeStatus request. +func (client ComponentsClient) GetPurgeStatusPreparer(ctx context.Context, resourceGroupName string, resourceName string, purgeID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "purgeId": autorest.Encode("path", purgeID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/operations/{purgeId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPurgeStatusSender sends the GetPurgeStatus request. The method will close the +// http.Response Body if it receives an error. +func (client ComponentsClient) GetPurgeStatusSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetPurgeStatusResponder handles the response to the GetPurgeStatus request. The method always +// closes the http.Response Body. +func (client ComponentsClient) GetPurgeStatusResponder(resp *http.Response) (result ComponentPurgeStatusResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of all Application Insights components within a subscription. +func (client ComponentsClient) List(ctx context.Context) (result ApplicationInsightsComponentListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentsClient.List") + defer func() { + sc := -1 + if result.aiclr.Response.Response != nil { + sc = result.aiclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.aiclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "List", resp, "Failure sending request") + return + } + + result.aiclr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "List", resp, "Failure responding to request") + return + } + if result.aiclr.hasNextLink() && result.aiclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ComponentsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/components", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ComponentsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ComponentsClient) ListResponder(resp *http.Response) (result ApplicationInsightsComponentListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ComponentsClient) listNextResults(ctx context.Context, lastResults ApplicationInsightsComponentListResult) (result ApplicationInsightsComponentListResult, err error) { + req, err := lastResults.applicationInsightsComponentListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.ComponentsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "insights.ComponentsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ComponentsClient) ListComplete(ctx context.Context) (result ApplicationInsightsComponentListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup gets a list of Application Insights components within a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client ComponentsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ApplicationInsightsComponentListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.aiclr.Response.Response != nil { + sc = result.aiclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.aiclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.aiclr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.aiclr.hasNextLink() && result.aiclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ComponentsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ComponentsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ComponentsClient) ListByResourceGroupResponder(resp *http.Response) (result ApplicationInsightsComponentListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client ComponentsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ApplicationInsightsComponentListResult) (result ApplicationInsightsComponentListResult, err error) { + req, err := lastResults.applicationInsightsComponentListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.ComponentsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "insights.ComponentsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ComponentsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ApplicationInsightsComponentListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// Purge purges data in an Application Insights component by a set of user-defined filters. +// +// In order to manage system resources, purge requests are throttled at 50 requests per hour. You should batch the +// execution of purge requests by sending a single command whose predicate includes all user identities that require +// purging. Use the in operator to specify multiple identities. You should run the query prior to using for a purge +// request to verify that the results are expected. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// body - describes the body of a request to purge data in a single table of an Application Insights component +func (client ComponentsClient) Purge(ctx context.Context, resourceGroupName string, resourceName string, body ComponentPurgeBody) (result ComponentPurgeResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentsClient.Purge") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Table", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "body.Filters", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentsClient", "Purge", err.Error()) + } + + req, err := client.PurgePreparer(ctx, resourceGroupName, resourceName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "Purge", nil, "Failure preparing request") + return + } + + resp, err := client.PurgeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "Purge", resp, "Failure sending request") + return + } + + result, err = client.PurgeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "Purge", resp, "Failure responding to request") + return + } + + return +} + +// PurgePreparer prepares the Purge request. +func (client ComponentsClient) PurgePreparer(ctx context.Context, resourceGroupName string, resourceName string, body ComponentPurgeBody) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/purge", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PurgeSender sends the Purge request. The method will close the +// http.Response Body if it receives an error. +func (client ComponentsClient) PurgeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// PurgeResponder handles the response to the Purge request. The method always +// closes the http.Response Body. +func (client ComponentsClient) PurgeResponder(resp *http.Response) (result ComponentPurgeResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateTags updates an existing component's tags. To update other fields use the CreateOrUpdate method. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// componentTags - updated tag information to set into the component instance. +func (client ComponentsClient) UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, componentTags TagsResource) (result ApplicationInsightsComponent, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentsClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentsClient", "UpdateTags", err.Error()) + } + + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, resourceName, componentTags) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client ComponentsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, resourceName string, componentTags TagsResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", pathParameters), + autorest.WithJSON(componentTags), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client ComponentsClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client ComponentsClient) UpdateTagsResponder(resp *http.Response) (result ApplicationInsightsComponent, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/enums.go b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/enums.go new file mode 100644 index 000000000000..8ff1337f5969 --- /dev/null +++ b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/enums.go @@ -0,0 +1,324 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights 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. + +// ApplicationType enumerates the values for application type. +type ApplicationType string + +const ( + // ApplicationTypeOther ... + ApplicationTypeOther ApplicationType = "other" + // ApplicationTypeWeb ... + ApplicationTypeWeb ApplicationType = "web" +) + +// PossibleApplicationTypeValues returns an array of possible values for the ApplicationType const type. +func PossibleApplicationTypeValues() []ApplicationType { + return []ApplicationType{ApplicationTypeOther, ApplicationTypeWeb} +} + +// CategoryType enumerates the values for category type. +type CategoryType string + +const ( + // CategoryTypePerformance ... + CategoryTypePerformance CategoryType = "performance" + // CategoryTypeRetention ... + CategoryTypeRetention CategoryType = "retention" + // CategoryTypeTSG ... + CategoryTypeTSG CategoryType = "TSG" + // CategoryTypeWorkbook ... + CategoryTypeWorkbook CategoryType = "workbook" +) + +// PossibleCategoryTypeValues returns an array of possible values for the CategoryType const type. +func PossibleCategoryTypeValues() []CategoryType { + return []CategoryType{CategoryTypePerformance, CategoryTypeRetention, CategoryTypeTSG, CategoryTypeWorkbook} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // CreatedByTypeApplication ... + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey ... + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity ... + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + // CreatedByTypeUser ... + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} +} + +// FavoriteSourceType enumerates the values for favorite source type. +type FavoriteSourceType string + +const ( + // FavoriteSourceTypeEvents ... + FavoriteSourceTypeEvents FavoriteSourceType = "events" + // FavoriteSourceTypeFunnel ... + FavoriteSourceTypeFunnel FavoriteSourceType = "funnel" + // FavoriteSourceTypeImpact ... + FavoriteSourceTypeImpact FavoriteSourceType = "impact" + // FavoriteSourceTypeNotebook ... + FavoriteSourceTypeNotebook FavoriteSourceType = "notebook" + // FavoriteSourceTypeRetention ... + FavoriteSourceTypeRetention FavoriteSourceType = "retention" + // FavoriteSourceTypeSegmentation ... + FavoriteSourceTypeSegmentation FavoriteSourceType = "segmentation" + // FavoriteSourceTypeSessions ... + FavoriteSourceTypeSessions FavoriteSourceType = "sessions" + // FavoriteSourceTypeUserflows ... + FavoriteSourceTypeUserflows FavoriteSourceType = "userflows" +) + +// PossibleFavoriteSourceTypeValues returns an array of possible values for the FavoriteSourceType const type. +func PossibleFavoriteSourceTypeValues() []FavoriteSourceType { + return []FavoriteSourceType{FavoriteSourceTypeEvents, FavoriteSourceTypeFunnel, FavoriteSourceTypeImpact, FavoriteSourceTypeNotebook, FavoriteSourceTypeRetention, FavoriteSourceTypeSegmentation, FavoriteSourceTypeSessions, FavoriteSourceTypeUserflows} +} + +// FavoriteType enumerates the values for favorite type. +type FavoriteType string + +const ( + // FavoriteTypeShared ... + FavoriteTypeShared FavoriteType = "shared" + // FavoriteTypeUser ... + FavoriteTypeUser FavoriteType = "user" +) + +// PossibleFavoriteTypeValues returns an array of possible values for the FavoriteType const type. +func PossibleFavoriteTypeValues() []FavoriteType { + return []FavoriteType{FavoriteTypeShared, FavoriteTypeUser} +} + +// FlowType enumerates the values for flow type. +type FlowType string + +const ( + // FlowTypeBluefield ... + FlowTypeBluefield FlowType = "Bluefield" +) + +// PossibleFlowTypeValues returns an array of possible values for the FlowType const type. +func PossibleFlowTypeValues() []FlowType { + return []FlowType{FlowTypeBluefield} +} + +// IngestionMode enumerates the values for ingestion mode. +type IngestionMode string + +const ( + // IngestionModeApplicationInsights ... + IngestionModeApplicationInsights IngestionMode = "ApplicationInsights" + // IngestionModeApplicationInsightsWithDiagnosticSettings ... + IngestionModeApplicationInsightsWithDiagnosticSettings IngestionMode = "ApplicationInsightsWithDiagnosticSettings" + // IngestionModeLogAnalytics ... + IngestionModeLogAnalytics IngestionMode = "LogAnalytics" +) + +// PossibleIngestionModeValues returns an array of possible values for the IngestionMode const type. +func PossibleIngestionModeValues() []IngestionMode { + return []IngestionMode{IngestionModeApplicationInsights, IngestionModeApplicationInsightsWithDiagnosticSettings, IngestionModeLogAnalytics} +} + +// ItemScope enumerates the values for item scope. +type ItemScope string + +const ( + // ItemScopeShared ... + ItemScopeShared ItemScope = "shared" + // ItemScopeUser ... + ItemScopeUser ItemScope = "user" +) + +// PossibleItemScopeValues returns an array of possible values for the ItemScope const type. +func PossibleItemScopeValues() []ItemScope { + return []ItemScope{ItemScopeShared, ItemScopeUser} +} + +// ItemScopePath enumerates the values for item scope path. +type ItemScopePath string + +const ( + // ItemScopePathAnalyticsItems ... + ItemScopePathAnalyticsItems ItemScopePath = "analyticsItems" + // ItemScopePathMyanalyticsItems ... + ItemScopePathMyanalyticsItems ItemScopePath = "myanalyticsItems" +) + +// PossibleItemScopePathValues returns an array of possible values for the ItemScopePath const type. +func PossibleItemScopePathValues() []ItemScopePath { + return []ItemScopePath{ItemScopePathAnalyticsItems, ItemScopePathMyanalyticsItems} +} + +// ItemType enumerates the values for item type. +type ItemType string + +const ( + // ItemTypeFunction ... + ItemTypeFunction ItemType = "function" + // ItemTypeNone ... + ItemTypeNone ItemType = "none" + // ItemTypeQuery ... + ItemTypeQuery ItemType = "query" + // ItemTypeRecent ... + ItemTypeRecent ItemType = "recent" +) + +// PossibleItemTypeValues returns an array of possible values for the ItemType const type. +func PossibleItemTypeValues() []ItemType { + return []ItemType{ItemTypeFunction, ItemTypeNone, ItemTypeQuery, ItemTypeRecent} +} + +// ItemTypeParameter enumerates the values for item type parameter. +type ItemTypeParameter string + +const ( + // ItemTypeParameterFolder ... + ItemTypeParameterFolder ItemTypeParameter = "folder" + // ItemTypeParameterFunction ... + ItemTypeParameterFunction ItemTypeParameter = "function" + // ItemTypeParameterNone ... + ItemTypeParameterNone ItemTypeParameter = "none" + // ItemTypeParameterQuery ... + ItemTypeParameterQuery ItemTypeParameter = "query" + // ItemTypeParameterRecent ... + ItemTypeParameterRecent ItemTypeParameter = "recent" +) + +// PossibleItemTypeParameterValues returns an array of possible values for the ItemTypeParameter const type. +func PossibleItemTypeParameterValues() []ItemTypeParameter { + return []ItemTypeParameter{ItemTypeParameterFolder, ItemTypeParameterFunction, ItemTypeParameterNone, ItemTypeParameterQuery, ItemTypeParameterRecent} +} + +// Kind enumerates the values for kind. +type Kind string + +const ( + // KindShared ... + KindShared Kind = "shared" + // KindUser ... + KindUser Kind = "user" +) + +// PossibleKindValues returns an array of possible values for the Kind const type. +func PossibleKindValues() []Kind { + return []Kind{KindShared, KindUser} +} + +// ManagedServiceIdentityType enumerates the values for managed service identity type. +type ManagedServiceIdentityType string + +const ( + // ManagedServiceIdentityTypeNone ... + ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" + // ManagedServiceIdentityTypeSystemAssigned ... + ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + // ManagedServiceIdentityTypeSystemAssignedUserAssigned ... + ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" + // ManagedServiceIdentityTypeUserAssigned ... + ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" +) + +// PossibleManagedServiceIdentityTypeValues returns an array of possible values for the ManagedServiceIdentityType const type. +func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { + return []ManagedServiceIdentityType{ManagedServiceIdentityTypeNone, ManagedServiceIdentityTypeSystemAssigned, ManagedServiceIdentityTypeSystemAssignedUserAssigned, ManagedServiceIdentityTypeUserAssigned} +} + +// PublicNetworkAccessType enumerates the values for public network access type. +type PublicNetworkAccessType string + +const ( + // PublicNetworkAccessTypeDisabled Disables public connectivity to Application Insights through public DNS. + PublicNetworkAccessTypeDisabled PublicNetworkAccessType = "Disabled" + // PublicNetworkAccessTypeEnabled Enables connectivity to Application Insights through public DNS. + PublicNetworkAccessTypeEnabled PublicNetworkAccessType = "Enabled" +) + +// PossiblePublicNetworkAccessTypeValues returns an array of possible values for the PublicNetworkAccessType const type. +func PossiblePublicNetworkAccessTypeValues() []PublicNetworkAccessType { + return []PublicNetworkAccessType{PublicNetworkAccessTypeDisabled, PublicNetworkAccessTypeEnabled} +} + +// PurgeState enumerates the values for purge state. +type PurgeState string + +const ( + // PurgeStateCompleted ... + PurgeStateCompleted PurgeState = "completed" + // PurgeStatePending ... + PurgeStatePending PurgeState = "pending" +) + +// PossiblePurgeStateValues returns an array of possible values for the PurgeState const type. +func PossiblePurgeStateValues() []PurgeState { + return []PurgeState{PurgeStateCompleted, PurgeStatePending} +} + +// RequestSource enumerates the values for request source. +type RequestSource string + +const ( + // RequestSourceRest ... + RequestSourceRest RequestSource = "rest" +) + +// PossibleRequestSourceValues returns an array of possible values for the RequestSource const type. +func PossibleRequestSourceValues() []RequestSource { + return []RequestSource{RequestSourceRest} +} + +// SharedTypeKind enumerates the values for shared type kind. +type SharedTypeKind string + +const ( + // SharedTypeKindShared ... + SharedTypeKindShared SharedTypeKind = "shared" + // SharedTypeKindUser ... + SharedTypeKindUser SharedTypeKind = "user" +) + +// PossibleSharedTypeKindValues returns an array of possible values for the SharedTypeKind const type. +func PossibleSharedTypeKindValues() []SharedTypeKind { + return []SharedTypeKind{SharedTypeKindShared, SharedTypeKindUser} +} + +// Type enumerates the values for type. +type Type string + +const ( + // TypeNone ... + TypeNone Type = "None" + // TypeUserAssigned ... + TypeUserAssigned Type = "UserAssigned" +) + +// PossibleTypeValues returns an array of possible values for the Type const type. +func PossibleTypeValues() []Type { + return []Type{TypeNone, TypeUserAssigned} +} + +// WebTestKind enumerates the values for web test kind. +type WebTestKind string + +const ( + // WebTestKindMultistep ... + WebTestKindMultistep WebTestKind = "multistep" + // WebTestKindPing ... + WebTestKindPing WebTestKind = "ping" +) + +// PossibleWebTestKindValues returns an array of possible values for the WebTestKind const type. +func PossibleWebTestKindValues() []WebTestKind { + return []WebTestKind{WebTestKindMultistep, WebTestKindPing} +} diff --git a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/exportconfigurations.go b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/exportconfigurations.go new file mode 100644 index 000000000000..8543b8d411df --- /dev/null +++ b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/exportconfigurations.go @@ -0,0 +1,471 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ExportConfigurationsClient is the composite Swagger for Application Insights Management Client +type ExportConfigurationsClient struct { + BaseClient +} + +// NewExportConfigurationsClient creates an instance of the ExportConfigurationsClient client. +func NewExportConfigurationsClient(subscriptionID string) ExportConfigurationsClient { + return NewExportConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExportConfigurationsClientWithBaseURI creates an instance of the ExportConfigurationsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewExportConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) ExportConfigurationsClient { + return ExportConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create a Continuous Export configuration of an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// exportProperties - properties that need to be specified to create a Continuous Export configuration of a +// Application Insights component. +func (client ExportConfigurationsClient) Create(ctx context.Context, resourceGroupName string, resourceName string, exportProperties ApplicationInsightsComponentExportRequest) (result ListApplicationInsightsComponentExportConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExportConfigurationsClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ExportConfigurationsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, resourceName, exportProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ExportConfigurationsClient) CreatePreparer(ctx context.Context, resourceGroupName string, resourceName string, exportProperties ApplicationInsightsComponentExportRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration", pathParameters), + autorest.WithJSON(exportProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ExportConfigurationsClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ExportConfigurationsClient) CreateResponder(resp *http.Response) (result ListApplicationInsightsComponentExportConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a Continuous Export configuration of an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// exportID - the Continuous Export configuration ID. This is unique within a Application Insights component. +func (client ExportConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, exportID string) (result ApplicationInsightsComponentExportConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExportConfigurationsClient.Delete") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ExportConfigurationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, exportID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ExportConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, exportID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "exportId": autorest.Encode("path", exportID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration/{exportId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ExportConfigurationsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ExportConfigurationsClient) DeleteResponder(resp *http.Response) (result ApplicationInsightsComponentExportConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get the Continuous Export configuration for this export id. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// exportID - the Continuous Export configuration ID. This is unique within a Application Insights component. +func (client ExportConfigurationsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, exportID string) (result ApplicationInsightsComponentExportConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExportConfigurationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ExportConfigurationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, exportID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExportConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, exportID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "exportId": autorest.Encode("path", exportID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration/{exportId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ExportConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ExportConfigurationsClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentExportConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of Continuous Export configuration of an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client ExportConfigurationsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result ListApplicationInsightsComponentExportConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExportConfigurationsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ExportConfigurationsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExportConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ExportConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ExportConfigurationsClient) ListResponder(resp *http.Response) (result ListApplicationInsightsComponentExportConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update update the Continuous Export configuration for this export id. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// exportID - the Continuous Export configuration ID. This is unique within a Application Insights component. +// exportProperties - properties that need to be specified to update the Continuous Export configuration. +func (client ExportConfigurationsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, exportID string, exportProperties ApplicationInsightsComponentExportRequest) (result ApplicationInsightsComponentExportConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExportConfigurationsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ExportConfigurationsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, exportID, exportProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ExportConfigurationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, exportID string, exportProperties ApplicationInsightsComponentExportRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "exportId": autorest.Encode("path", exportID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration/{exportId}", pathParameters), + autorest.WithJSON(exportProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ExportConfigurationsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ExportConfigurationsClient) UpdateResponder(resp *http.Response) (result ApplicationInsightsComponentExportConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/favorites.go b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/favorites.go new file mode 100644 index 000000000000..732fca754804 --- /dev/null +++ b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/favorites.go @@ -0,0 +1,497 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// FavoritesClient is the composite Swagger for Application Insights Management Client +type FavoritesClient struct { + BaseClient +} + +// NewFavoritesClient creates an instance of the FavoritesClient client. +func NewFavoritesClient(subscriptionID string) FavoritesClient { + return NewFavoritesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFavoritesClientWithBaseURI creates an instance of the FavoritesClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewFavoritesClientWithBaseURI(baseURI string, subscriptionID string) FavoritesClient { + return FavoritesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Add adds a new favorites to an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// favoriteID - the Id of a specific favorite defined in the Application Insights component +// favoriteProperties - properties that need to be specified to create a new favorite and add it to an +// Application Insights component. +func (client FavoritesClient) Add(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties ApplicationInsightsComponentFavorite) (result ApplicationInsightsComponentFavorite, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FavoritesClient.Add") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.FavoritesClient", "Add", err.Error()) + } + + req, err := client.AddPreparer(ctx, resourceGroupName, resourceName, favoriteID, favoriteProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Add", nil, "Failure preparing request") + return + } + + resp, err := client.AddSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Add", resp, "Failure sending request") + return + } + + result, err = client.AddResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Add", resp, "Failure responding to request") + return + } + + return +} + +// AddPreparer prepares the Add request. +func (client FavoritesClient) AddPreparer(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties ApplicationInsightsComponentFavorite) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "favoriteId": autorest.Encode("path", favoriteID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + favoriteProperties.FavoriteID = nil + favoriteProperties.TimeModified = nil + favoriteProperties.UserID = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}", pathParameters), + autorest.WithJSON(favoriteProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddSender sends the Add request. The method will close the +// http.Response Body if it receives an error. +func (client FavoritesClient) AddSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// AddResponder handles the response to the Add request. The method always +// closes the http.Response Body. +func (client FavoritesClient) AddResponder(resp *http.Response) (result ApplicationInsightsComponentFavorite, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete remove a favorite that is associated to an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// favoriteID - the Id of a specific favorite defined in the Application Insights component +func (client FavoritesClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FavoritesClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.FavoritesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, favoriteID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client FavoritesClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "favoriteId": autorest.Encode("path", favoriteID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client FavoritesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client FavoritesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a single favorite by its FavoriteId, defined within an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// favoriteID - the Id of a specific favorite defined in the Application Insights component +func (client FavoritesClient) Get(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string) (result ApplicationInsightsComponentFavorite, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FavoritesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.FavoritesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, favoriteID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client FavoritesClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "favoriteId": autorest.Encode("path", favoriteID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client FavoritesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client FavoritesClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentFavorite, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of favorites defined within an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// favoriteType - the type of favorite. Value can be either shared or user. +// sourceType - source type of favorite to return. When left out, the source type defaults to 'other' (not +// present in this enum). +// canFetchContent - flag indicating whether or not to return the full content for each applicable favorite. If +// false, only return summary content for favorites. +// tags - tags that must be present on each favorite returned. +func (client FavoritesClient) List(ctx context.Context, resourceGroupName string, resourceName string, favoriteType FavoriteType, sourceType FavoriteSourceType, canFetchContent *bool, tags []string) (result ListApplicationInsightsComponentFavorite, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FavoritesClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.FavoritesClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName, favoriteType, sourceType, canFetchContent, tags) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client FavoritesClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string, favoriteType FavoriteType, sourceType FavoriteSourceType, canFetchContent *bool, tags []string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(string(favoriteType)) > 0 { + queryParameters["favoriteType"] = autorest.Encode("query", favoriteType) + } else { + queryParameters["favoriteType"] = autorest.Encode("query", "shared") + } + if len(string(sourceType)) > 0 { + queryParameters["sourceType"] = autorest.Encode("query", sourceType) + } + if canFetchContent != nil { + queryParameters["canFetchContent"] = autorest.Encode("query", *canFetchContent) + } + if tags != nil && len(tags) > 0 { + queryParameters["tags"] = autorest.Encode("query", tags, ",") + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client FavoritesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client FavoritesClient) ListResponder(resp *http.Response) (result ListApplicationInsightsComponentFavorite, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates a favorite that has already been added to an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// favoriteID - the Id of a specific favorite defined in the Application Insights component +// favoriteProperties - properties that need to be specified to update the existing favorite. +func (client FavoritesClient) Update(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties ApplicationInsightsComponentFavorite) (result ApplicationInsightsComponentFavorite, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FavoritesClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.FavoritesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, favoriteID, favoriteProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client FavoritesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties ApplicationInsightsComponentFavorite) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "favoriteId": autorest.Encode("path", favoriteID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + favoriteProperties.FavoriteID = nil + favoriteProperties.TimeModified = nil + favoriteProperties.UserID = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}", pathParameters), + autorest.WithJSON(favoriteProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client FavoritesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client FavoritesClient) UpdateResponder(resp *http.Response) (result ApplicationInsightsComponentFavorite, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/insightsapi/interfaces.go b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/insightsapi/interfaces.go new file mode 100644 index 000000000000..8b6ceaecb04d --- /dev/null +++ b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/insightsapi/interfaces.go @@ -0,0 +1,221 @@ +package insightsapi + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/preview/appinsights/mgmt/2022-02-01-preview/insights" + "github.com/Azure/go-autorest/autorest" +) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result insights.OperationListResultPage, err error) + ListComplete(ctx context.Context) (result insights.OperationListResultIterator, err error) +} + +var _ OperationsClientAPI = (*insights.OperationsClient)(nil) + +// AnnotationsClientAPI contains the set of methods on the AnnotationsClient type. +type AnnotationsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, resourceName string, annotationProperties insights.Annotation) (result insights.ListAnnotation, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string, annotationID string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, annotationID string) (result insights.ListAnnotation, err error) + List(ctx context.Context, resourceGroupName string, resourceName string, start string, end string) (result insights.AnnotationsListResult, err error) +} + +var _ AnnotationsClientAPI = (*insights.AnnotationsClient)(nil) + +// APIKeysClientAPI contains the set of methods on the APIKeysClient type. +type APIKeysClientAPI interface { + Create(ctx context.Context, resourceGroupName string, resourceName string, APIKeyProperties insights.APIKeyRequest) (result insights.ApplicationInsightsComponentAPIKey, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string, keyID string) (result insights.ApplicationInsightsComponentAPIKey, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, keyID string) (result insights.ApplicationInsightsComponentAPIKey, err error) + List(ctx context.Context, resourceGroupName string, resourceName string) (result insights.ApplicationInsightsComponentAPIKeyListResult, err error) +} + +var _ APIKeysClientAPI = (*insights.APIKeysClient)(nil) + +// ExportConfigurationsClientAPI contains the set of methods on the ExportConfigurationsClient type. +type ExportConfigurationsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, resourceName string, exportProperties insights.ApplicationInsightsComponentExportRequest) (result insights.ListApplicationInsightsComponentExportConfiguration, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string, exportID string) (result insights.ApplicationInsightsComponentExportConfiguration, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, exportID string) (result insights.ApplicationInsightsComponentExportConfiguration, err error) + List(ctx context.Context, resourceGroupName string, resourceName string) (result insights.ListApplicationInsightsComponentExportConfiguration, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, exportID string, exportProperties insights.ApplicationInsightsComponentExportRequest) (result insights.ApplicationInsightsComponentExportConfiguration, err error) +} + +var _ ExportConfigurationsClientAPI = (*insights.ExportConfigurationsClient)(nil) + +// ComponentCurrentBillingFeaturesClientAPI contains the set of methods on the ComponentCurrentBillingFeaturesClient type. +type ComponentCurrentBillingFeaturesClientAPI interface { + Get(ctx context.Context, resourceGroupName string, resourceName string) (result insights.ApplicationInsightsComponentBillingFeatures, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, billingFeaturesProperties insights.ApplicationInsightsComponentBillingFeatures) (result insights.ApplicationInsightsComponentBillingFeatures, err error) +} + +var _ ComponentCurrentBillingFeaturesClientAPI = (*insights.ComponentCurrentBillingFeaturesClient)(nil) + +// ComponentQuotaStatusClientAPI contains the set of methods on the ComponentQuotaStatusClient type. +type ComponentQuotaStatusClientAPI interface { + Get(ctx context.Context, resourceGroupName string, resourceName string) (result insights.ApplicationInsightsComponentQuotaStatus, err error) +} + +var _ ComponentQuotaStatusClientAPI = (*insights.ComponentQuotaStatusClient)(nil) + +// ComponentFeatureCapabilitiesClientAPI contains the set of methods on the ComponentFeatureCapabilitiesClient type. +type ComponentFeatureCapabilitiesClientAPI interface { + Get(ctx context.Context, resourceGroupName string, resourceName string) (result insights.ApplicationInsightsComponentFeatureCapabilities, err error) +} + +var _ ComponentFeatureCapabilitiesClientAPI = (*insights.ComponentFeatureCapabilitiesClient)(nil) + +// ComponentAvailableFeaturesClientAPI contains the set of methods on the ComponentAvailableFeaturesClient type. +type ComponentAvailableFeaturesClientAPI interface { + Get(ctx context.Context, resourceGroupName string, resourceName string) (result insights.ApplicationInsightsComponentAvailableFeatures, err error) +} + +var _ ComponentAvailableFeaturesClientAPI = (*insights.ComponentAvailableFeaturesClient)(nil) + +// ProactiveDetectionConfigurationsClientAPI contains the set of methods on the ProactiveDetectionConfigurationsClient type. +type ProactiveDetectionConfigurationsClientAPI interface { + Get(ctx context.Context, resourceGroupName string, resourceName string, configurationID string) (result insights.ApplicationInsightsComponentProactiveDetectionConfiguration, err error) + List(ctx context.Context, resourceGroupName string, resourceName string) (result insights.ListApplicationInsightsComponentProactiveDetectionConfiguration, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, configurationID string, proactiveDetectionProperties insights.ApplicationInsightsComponentProactiveDetectionConfiguration) (result insights.ApplicationInsightsComponentProactiveDetectionConfiguration, err error) +} + +var _ ProactiveDetectionConfigurationsClientAPI = (*insights.ProactiveDetectionConfigurationsClient)(nil) + +// WorkItemConfigurationsClientAPI contains the set of methods on the WorkItemConfigurationsClient type. +type WorkItemConfigurationsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigurationProperties insights.WorkItemCreateConfiguration) (result insights.WorkItemConfiguration, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigID string) (result autorest.Response, err error) + GetDefault(ctx context.Context, resourceGroupName string, resourceName string) (result insights.WorkItemConfiguration, err error) + GetItem(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigID string) (result insights.WorkItemConfiguration, err error) + List(ctx context.Context, resourceGroupName string, resourceName string) (result insights.WorkItemConfigurationsListResult, err error) + UpdateItem(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigID string, workItemConfigurationProperties insights.WorkItemCreateConfiguration) (result insights.WorkItemConfiguration, err error) +} + +var _ WorkItemConfigurationsClientAPI = (*insights.WorkItemConfigurationsClient)(nil) + +// FavoritesClientAPI contains the set of methods on the FavoritesClient type. +type FavoritesClientAPI interface { + Add(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties insights.ApplicationInsightsComponentFavorite) (result insights.ApplicationInsightsComponentFavorite, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string) (result insights.ApplicationInsightsComponentFavorite, err error) + List(ctx context.Context, resourceGroupName string, resourceName string, favoriteType insights.FavoriteType, sourceType insights.FavoriteSourceType, canFetchContent *bool, tags []string) (result insights.ListApplicationInsightsComponentFavorite, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties insights.ApplicationInsightsComponentFavorite) (result insights.ApplicationInsightsComponentFavorite, err error) +} + +var _ FavoritesClientAPI = (*insights.FavoritesClient)(nil) + +// WebTestLocationsClientAPI contains the set of methods on the WebTestLocationsClient type. +type WebTestLocationsClientAPI interface { + List(ctx context.Context, resourceGroupName string, resourceName string) (result insights.ApplicationInsightsWebTestLocationsListResult, err error) +} + +var _ WebTestLocationsClientAPI = (*insights.WebTestLocationsClient)(nil) + +// WebTestsClientAPI contains the set of methods on the WebTestsClient type. +type WebTestsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, webTestName string, webTestDefinition insights.WebTest) (result insights.WebTest, err error) + Delete(ctx context.Context, resourceGroupName string, webTestName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, webTestName string) (result insights.WebTest, err error) + List(ctx context.Context) (result insights.WebTestListResultPage, err error) + ListComplete(ctx context.Context) (result insights.WebTestListResultIterator, err error) + ListByComponent(ctx context.Context, componentName string, resourceGroupName string) (result insights.WebTestListResultPage, err error) + ListByComponentComplete(ctx context.Context, componentName string, resourceGroupName string) (result insights.WebTestListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.WebTestListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result insights.WebTestListResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, webTestName string, webTestTags insights.TagsResource) (result insights.WebTest, err error) +} + +var _ WebTestsClientAPI = (*insights.WebTestsClient)(nil) + +// AnalyticsItemsClientAPI contains the set of methods on the AnalyticsItemsClient type. +type AnalyticsItemsClientAPI interface { + Delete(ctx context.Context, resourceGroupName string, resourceName string, scopePath insights.ItemScopePath, ID string, name string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, scopePath insights.ItemScopePath, ID string, name string) (result insights.ApplicationInsightsComponentAnalyticsItem, err error) + List(ctx context.Context, resourceGroupName string, resourceName string, scopePath insights.ItemScopePath, scope insights.ItemScope, typeParameter insights.ItemTypeParameter, includeContent *bool) (result insights.ListApplicationInsightsComponentAnalyticsItem, err error) + Put(ctx context.Context, resourceGroupName string, resourceName string, scopePath insights.ItemScopePath, itemProperties insights.ApplicationInsightsComponentAnalyticsItem, overrideItem *bool) (result insights.ApplicationInsightsComponentAnalyticsItem, err error) +} + +var _ AnalyticsItemsClientAPI = (*insights.AnalyticsItemsClient)(nil) + +// WorkbookTemplatesClientAPI contains the set of methods on the WorkbookTemplatesClient type. +type WorkbookTemplatesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, workbookTemplateProperties insights.WorkbookTemplate) (result insights.WorkbookTemplate, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string) (result insights.WorkbookTemplate, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.WorkbookTemplatesListResult, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, workbookTemplateUpdateParameters *insights.WorkbookTemplateUpdateParameters) (result insights.WorkbookTemplate, err error) +} + +var _ WorkbookTemplatesClientAPI = (*insights.WorkbookTemplatesClient)(nil) + +// MyWorkbooksClientAPI contains the set of methods on the MyWorkbooksClient type. +type MyWorkbooksClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties insights.MyWorkbook, sourceID string) (result insights.MyWorkbook, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string) (result insights.MyWorkbook, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string, category insights.CategoryType, tags []string, sourceID string, canFetchContent *bool) (result insights.MyWorkbooksListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, category insights.CategoryType, tags []string, sourceID string, canFetchContent *bool) (result insights.MyWorkbooksListResultIterator, err error) + ListBySubscription(ctx context.Context, category insights.CategoryType, tags []string, canFetchContent *bool) (result insights.MyWorkbooksListResultPage, err error) + ListBySubscriptionComplete(ctx context.Context, category insights.CategoryType, tags []string, canFetchContent *bool) (result insights.MyWorkbooksListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties insights.MyWorkbook, sourceID string) (result insights.MyWorkbook, err error) +} + +var _ MyWorkbooksClientAPI = (*insights.MyWorkbooksClient)(nil) + +// WorkbooksClientAPI contains the set of methods on the WorkbooksClient type. +type WorkbooksClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties insights.Workbook, sourceID string) (result insights.Workbook, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, canFetchContent *bool) (result insights.Workbook, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string, category insights.CategoryType, tags []string, sourceID string, canFetchContent *bool) (result insights.WorkbooksListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, category insights.CategoryType, tags []string, sourceID string, canFetchContent *bool) (result insights.WorkbooksListResultIterator, err error) + ListBySubscription(ctx context.Context, category insights.CategoryType, tags []string, canFetchContent *bool) (result insights.WorkbooksListResultPage, err error) + ListBySubscriptionComplete(ctx context.Context, category insights.CategoryType, tags []string, canFetchContent *bool) (result insights.WorkbooksListResultIterator, err error) + RevisionGet(ctx context.Context, resourceGroupName string, resourceName string, revisionID string) (result insights.Workbook, err error) + RevisionsList(ctx context.Context, resourceGroupName string, resourceName string) (result insights.WorkbooksListResultPage, err error) + RevisionsListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result insights.WorkbooksListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, sourceID string, workbookUpdateParameters *insights.WorkbookUpdateParameters) (result insights.Workbook, err error) +} + +var _ WorkbooksClientAPI = (*insights.WorkbooksClient)(nil) + +// ComponentsClientAPI contains the set of methods on the ComponentsClient type. +type ComponentsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, insightProperties insights.ApplicationInsightsComponent) (result insights.ApplicationInsightsComponent, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string) (result insights.ApplicationInsightsComponent, err error) + GetPurgeStatus(ctx context.Context, resourceGroupName string, resourceName string, purgeID string) (result insights.ComponentPurgeStatusResponse, err error) + List(ctx context.Context) (result insights.ApplicationInsightsComponentListResultPage, err error) + ListComplete(ctx context.Context) (result insights.ApplicationInsightsComponentListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.ApplicationInsightsComponentListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result insights.ApplicationInsightsComponentListResultIterator, err error) + Purge(ctx context.Context, resourceGroupName string, resourceName string, body insights.ComponentPurgeBody) (result insights.ComponentPurgeResponse, err error) + UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, componentTags insights.TagsResource) (result insights.ApplicationInsightsComponent, err error) +} + +var _ ComponentsClientAPI = (*insights.ComponentsClient)(nil) + +// ComponentLinkedStorageAccountsClientAPI contains the set of methods on the ComponentLinkedStorageAccountsClient type. +type ComponentLinkedStorageAccountsClientAPI interface { + CreateAndUpdate(ctx context.Context, resourceGroupName string, resourceName string, linkedStorageAccountsProperties insights.ComponentLinkedStorageAccounts) (result insights.ComponentLinkedStorageAccounts, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string) (result insights.ComponentLinkedStorageAccounts, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, linkedStorageAccountsProperties insights.ComponentLinkedStorageAccountsPatch) (result insights.ComponentLinkedStorageAccounts, err error) +} + +var _ ComponentLinkedStorageAccountsClientAPI = (*insights.ComponentLinkedStorageAccountsClient)(nil) + +// LiveTokenClientAPI contains the set of methods on the LiveTokenClient type. +type LiveTokenClientAPI interface { + Get(ctx context.Context, resourceURI string) (result insights.LiveTokenResponse, err error) +} + +var _ LiveTokenClientAPI = (*insights.LiveTokenClient)(nil) diff --git a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/livetoken.go b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/livetoken.go new file mode 100644 index 000000000000..3bd68bc830b8 --- /dev/null +++ b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/livetoken.go @@ -0,0 +1,104 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// LiveTokenClient is the composite Swagger for Application Insights Management Client +type LiveTokenClient struct { + BaseClient +} + +// NewLiveTokenClient creates an instance of the LiveTokenClient client. +func NewLiveTokenClient(subscriptionID string) LiveTokenClient { + return NewLiveTokenClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLiveTokenClientWithBaseURI creates an instance of the LiveTokenClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewLiveTokenClientWithBaseURI(baseURI string, subscriptionID string) LiveTokenClient { + return LiveTokenClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get **Gets an access token for live metrics stream data.** +// Parameters: +// resourceURI - the identifier of the resource. +func (client LiveTokenClient) Get(ctx context.Context, resourceURI string) (result LiveTokenResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LiveTokenClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceURI) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.LiveTokenClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.LiveTokenClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.LiveTokenClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client LiveTokenClient) GetPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceUri": resourceURI, + } + + const APIVersion = "2021-10-14" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/generatelivetoken", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client LiveTokenClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client LiveTokenClient) GetResponder(resp *http.Response) (result LiveTokenResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/models.go b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/models.go new file mode 100644 index 000000000000..b6115b9d0531 --- /dev/null +++ b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/models.go @@ -0,0 +1,3321 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "github.com/gofrs/uuid" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/appinsights/mgmt/2022-02-01-preview/insights" + +// Annotation annotation associated with an application insights resource. +type Annotation struct { + // AnnotationName - Name of annotation + AnnotationName *string `json:"AnnotationName,omitempty"` + // Category - Category of annotation, free form + Category *string `json:"Category,omitempty"` + // EventTime - Time when event occurred + EventTime *date.Time `json:"EventTime,omitempty"` + // ID - Unique Id for annotation + ID *string `json:"Id,omitempty"` + // Properties - Serialized JSON object for detailed properties + Properties *string `json:"Properties,omitempty"` + // RelatedAnnotation - Related parent annotation if any + RelatedAnnotation *string `json:"RelatedAnnotation,omitempty"` +} + +// AnnotationError error associated with trying to create annotation with Id that already exist +type AnnotationError struct { + // Code - Error detail code and explanation + Code *string `json:"code,omitempty"` + // Message - Error message + Message *string `json:"message,omitempty"` + Innererror *InnerError `json:"innererror,omitempty"` +} + +// AnnotationsListResult annotations list result. +type AnnotationsListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; An array of annotations. + Value *[]Annotation `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for AnnotationsListResult. +func (alr AnnotationsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// APIKeyRequest an Application Insights component API Key creation request definition. +type APIKeyRequest struct { + // Name - The name of the API Key. + Name *string `json:"name,omitempty"` + // LinkedReadProperties - The read access rights of this API Key. + LinkedReadProperties *[]string `json:"linkedReadProperties,omitempty"` + // LinkedWriteProperties - The write access rights of this API Key. + LinkedWriteProperties *[]string `json:"linkedWriteProperties,omitempty"` +} + +// ApplicationInsightsComponent an Application Insights component definition. +type ApplicationInsightsComponent struct { + autorest.Response `json:"-"` + // Kind - The kind of application that this component refers to, used to customize UI. This value is a freeform string, values should typically be one of the following: web, ios, other, store, java, phone. + Kind *string `json:"kind,omitempty"` + // Etag - Resource etag + Etag *string `json:"etag,omitempty"` + // ApplicationInsightsComponentProperties - Properties that define an Application Insights component resource. + *ApplicationInsightsComponentProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ApplicationInsightsComponent. +func (aic ApplicationInsightsComponent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aic.Kind != nil { + objectMap["kind"] = aic.Kind + } + if aic.Etag != nil { + objectMap["etag"] = aic.Etag + } + if aic.ApplicationInsightsComponentProperties != nil { + objectMap["properties"] = aic.ApplicationInsightsComponentProperties + } + if aic.Location != nil { + objectMap["location"] = aic.Location + } + if aic.Tags != nil { + objectMap["tags"] = aic.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationInsightsComponent struct. +func (aic *ApplicationInsightsComponent) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + aic.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + aic.Etag = &etag + } + case "properties": + if v != nil { + var applicationInsightsComponentProperties ApplicationInsightsComponentProperties + err = json.Unmarshal(*v, &applicationInsightsComponentProperties) + if err != nil { + return err + } + aic.ApplicationInsightsComponentProperties = &applicationInsightsComponentProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + aic.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + aic.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + aic.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + aic.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + aic.Tags = tags + } + } + } + + return nil +} + +// ApplicationInsightsComponentAnalyticsItem properties that define an Analytics item that is associated to +// an Application Insights component. +type ApplicationInsightsComponentAnalyticsItem struct { + autorest.Response `json:"-"` + // ID - Internally assigned unique id of the item definition. + ID *string `json:"Id,omitempty"` + // Name - The user-defined name of the item. + Name *string `json:"Name,omitempty"` + // Content - The content of this item + Content *string `json:"Content,omitempty"` + // Version - READ-ONLY; This instance's version of the data model. This can change as new features are added. + Version *string `json:"Version,omitempty"` + // Scope - Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component. Possible values include: 'ItemScopeShared', 'ItemScopeUser' + Scope ItemScope `json:"Scope,omitempty"` + // Type - Enum indicating the type of the Analytics item. Possible values include: 'ItemTypeNone', 'ItemTypeQuery', 'ItemTypeRecent', 'ItemTypeFunction' + Type ItemType `json:"Type,omitempty"` + // TimeCreated - READ-ONLY; Date and time in UTC when this item was created. + TimeCreated *string `json:"TimeCreated,omitempty"` + // TimeModified - READ-ONLY; Date and time in UTC of the last modification that was made to this item. + TimeModified *string `json:"TimeModified,omitempty"` + Properties *ApplicationInsightsComponentAnalyticsItemProperties `json:"Properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationInsightsComponentAnalyticsItem. +func (aicai ApplicationInsightsComponentAnalyticsItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aicai.ID != nil { + objectMap["Id"] = aicai.ID + } + if aicai.Name != nil { + objectMap["Name"] = aicai.Name + } + if aicai.Content != nil { + objectMap["Content"] = aicai.Content + } + if aicai.Scope != "" { + objectMap["Scope"] = aicai.Scope + } + if aicai.Type != "" { + objectMap["Type"] = aicai.Type + } + if aicai.Properties != nil { + objectMap["Properties"] = aicai.Properties + } + return json.Marshal(objectMap) +} + +// ApplicationInsightsComponentAnalyticsItemProperties a set of properties that can be defined in the +// context of a specific item type. Each type may have its own properties. +type ApplicationInsightsComponentAnalyticsItemProperties struct { + // FunctionAlias - A function alias, used when the type of the item is Function + FunctionAlias *string `json:"functionAlias,omitempty"` +} + +// ApplicationInsightsComponentAPIKey properties that define an API key of an Application Insights +// Component. +type ApplicationInsightsComponentAPIKey struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The unique ID of the API key inside an Application Insights component. It is auto generated when the API key is created. + ID *string `json:"id,omitempty"` + // APIKey - READ-ONLY; The API key value. It will be only return once when the API Key was created. + APIKey *string `json:"apiKey,omitempty"` + // CreatedDate - The create date of this API key. + CreatedDate *string `json:"createdDate,omitempty"` + // Name - The name of the API key. + Name *string `json:"name,omitempty"` + // LinkedReadProperties - The read access rights of this API Key. + LinkedReadProperties *[]string `json:"linkedReadProperties,omitempty"` + // LinkedWriteProperties - The write access rights of this API Key. + LinkedWriteProperties *[]string `json:"linkedWriteProperties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationInsightsComponentAPIKey. +func (aicak ApplicationInsightsComponentAPIKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aicak.CreatedDate != nil { + objectMap["createdDate"] = aicak.CreatedDate + } + if aicak.Name != nil { + objectMap["name"] = aicak.Name + } + if aicak.LinkedReadProperties != nil { + objectMap["linkedReadProperties"] = aicak.LinkedReadProperties + } + if aicak.LinkedWriteProperties != nil { + objectMap["linkedWriteProperties"] = aicak.LinkedWriteProperties + } + return json.Marshal(objectMap) +} + +// ApplicationInsightsComponentAPIKeyListResult describes the list of API Keys of an Application Insights +// Component. +type ApplicationInsightsComponentAPIKeyListResult struct { + autorest.Response `json:"-"` + // Value - List of API Key definitions. + Value *[]ApplicationInsightsComponentAPIKey `json:"value,omitempty"` +} + +// ApplicationInsightsComponentAvailableFeatures an Application Insights component available features. +type ApplicationInsightsComponentAvailableFeatures struct { + autorest.Response `json:"-"` + // Result - READ-ONLY; A list of Application Insights component feature. + Result *[]ApplicationInsightsComponentFeature `json:"Result,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationInsightsComponentAvailableFeatures. +func (aicaf ApplicationInsightsComponentAvailableFeatures) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ApplicationInsightsComponentBillingFeatures an Application Insights component billing features +type ApplicationInsightsComponentBillingFeatures struct { + autorest.Response `json:"-"` + // DataVolumeCap - An Application Insights component daily data volume cap + DataVolumeCap *ApplicationInsightsComponentDataVolumeCap `json:"DataVolumeCap,omitempty"` + // CurrentBillingFeatures - Current enabled pricing plan. When the component is in the Enterprise plan, this will list both 'Basic' and 'Application Insights Enterprise'. + CurrentBillingFeatures *[]string `json:"CurrentBillingFeatures,omitempty"` +} + +// ApplicationInsightsComponentDataVolumeCap an Application Insights component daily data volume cap +type ApplicationInsightsComponentDataVolumeCap struct { + // Cap - Daily data volume cap in GB. + Cap *float64 `json:"Cap,omitempty"` + // ResetTime - READ-ONLY; Daily data volume cap UTC reset hour. + ResetTime *int32 `json:"ResetTime,omitempty"` + // WarningThreshold - Reserved, not used for now. + WarningThreshold *int32 `json:"WarningThreshold,omitempty"` + // StopSendNotificationWhenHitThreshold - Reserved, not used for now. + StopSendNotificationWhenHitThreshold *bool `json:"StopSendNotificationWhenHitThreshold,omitempty"` + // StopSendNotificationWhenHitCap - Do not send a notification email when the daily data volume cap is met. + StopSendNotificationWhenHitCap *bool `json:"StopSendNotificationWhenHitCap,omitempty"` + // MaxHistoryCap - READ-ONLY; Maximum daily data volume cap that the user can set for this component. + MaxHistoryCap *float64 `json:"MaxHistoryCap,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationInsightsComponentDataVolumeCap. +func (aicdvc ApplicationInsightsComponentDataVolumeCap) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aicdvc.Cap != nil { + objectMap["Cap"] = aicdvc.Cap + } + if aicdvc.WarningThreshold != nil { + objectMap["WarningThreshold"] = aicdvc.WarningThreshold + } + if aicdvc.StopSendNotificationWhenHitThreshold != nil { + objectMap["StopSendNotificationWhenHitThreshold"] = aicdvc.StopSendNotificationWhenHitThreshold + } + if aicdvc.StopSendNotificationWhenHitCap != nil { + objectMap["StopSendNotificationWhenHitCap"] = aicdvc.StopSendNotificationWhenHitCap + } + return json.Marshal(objectMap) +} + +// ApplicationInsightsComponentExportConfiguration properties that define a Continuous Export +// configuration. +type ApplicationInsightsComponentExportConfiguration struct { + autorest.Response `json:"-"` + // ExportID - READ-ONLY; The unique ID of the export configuration inside an Application Insights component. It is auto generated when the Continuous Export configuration is created. + ExportID *string `json:"ExportId,omitempty"` + // InstrumentationKey - READ-ONLY; The instrumentation key of the Application Insights component. + InstrumentationKey *string `json:"InstrumentationKey,omitempty"` + // RecordTypes - This comma separated list of document types that will be exported. The possible values include 'Requests', 'Event', 'Exceptions', 'Metrics', 'PageViews', 'PageViewPerformance', 'Rdd', 'PerformanceCounters', 'Availability', 'Messages'. + RecordTypes *string `json:"RecordTypes,omitempty"` + // ApplicationName - READ-ONLY; The name of the Application Insights component. + ApplicationName *string `json:"ApplicationName,omitempty"` + // SubscriptionID - READ-ONLY; The subscription of the Application Insights component. + SubscriptionID *string `json:"SubscriptionId,omitempty"` + // ResourceGroup - READ-ONLY; The resource group of the Application Insights component. + ResourceGroup *string `json:"ResourceGroup,omitempty"` + // DestinationStorageSubscriptionID - READ-ONLY; The destination storage account subscription ID. + DestinationStorageSubscriptionID *string `json:"DestinationStorageSubscriptionId,omitempty"` + // DestinationStorageLocationID - READ-ONLY; The destination account location ID. + DestinationStorageLocationID *string `json:"DestinationStorageLocationId,omitempty"` + // DestinationAccountID - READ-ONLY; The name of destination account. + DestinationAccountID *string `json:"DestinationAccountId,omitempty"` + // DestinationType - READ-ONLY; The destination type. + DestinationType *string `json:"DestinationType,omitempty"` + // IsUserEnabled - READ-ONLY; This will be 'true' if the Continuous Export configuration is enabled, otherwise it will be 'false'. + IsUserEnabled *string `json:"IsUserEnabled,omitempty"` + // LastUserUpdate - READ-ONLY; Last time the Continuous Export configuration was updated. + LastUserUpdate *string `json:"LastUserUpdate,omitempty"` + // NotificationQueueEnabled - Deprecated + NotificationQueueEnabled *string `json:"NotificationQueueEnabled,omitempty"` + // ExportStatus - READ-ONLY; This indicates current Continuous Export configuration status. The possible values are 'Preparing', 'Success', 'Failure'. + ExportStatus *string `json:"ExportStatus,omitempty"` + // LastSuccessTime - READ-ONLY; The last time data was successfully delivered to the destination storage container for this Continuous Export configuration. + LastSuccessTime *string `json:"LastSuccessTime,omitempty"` + // LastGapTime - READ-ONLY; The last time the Continuous Export configuration started failing. + LastGapTime *string `json:"LastGapTime,omitempty"` + // PermanentErrorReason - READ-ONLY; This is the reason the Continuous Export configuration started failing. It can be 'AzureStorageNotFound' or 'AzureStorageAccessDenied'. + PermanentErrorReason *string `json:"PermanentErrorReason,omitempty"` + // StorageName - READ-ONLY; The name of the destination storage account. + StorageName *string `json:"StorageName,omitempty"` + // ContainerName - READ-ONLY; The name of the destination storage container. + ContainerName *string `json:"ContainerName,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationInsightsComponentExportConfiguration. +func (aicec ApplicationInsightsComponentExportConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aicec.RecordTypes != nil { + objectMap["RecordTypes"] = aicec.RecordTypes + } + if aicec.NotificationQueueEnabled != nil { + objectMap["NotificationQueueEnabled"] = aicec.NotificationQueueEnabled + } + return json.Marshal(objectMap) +} + +// ApplicationInsightsComponentExportRequest an Application Insights component Continuous Export +// configuration request definition. +type ApplicationInsightsComponentExportRequest struct { + // RecordTypes - The document types to be exported, as comma separated values. Allowed values include 'Requests', 'Event', 'Exceptions', 'Metrics', 'PageViews', 'PageViewPerformance', 'Rdd', 'PerformanceCounters', 'Availability', 'Messages'. + RecordTypes *string `json:"RecordTypes,omitempty"` + // DestinationType - The Continuous Export destination type. This has to be 'Blob'. + DestinationType *string `json:"DestinationType,omitempty"` + // DestinationAddress - The SAS URL for the destination storage container. It must grant write permission. + DestinationAddress *string `json:"DestinationAddress,omitempty"` + // IsEnabled - Set to 'true' to create a Continuous Export configuration as enabled, otherwise set it to 'false'. + IsEnabled *string `json:"IsEnabled,omitempty"` + // NotificationQueueEnabled - Deprecated + NotificationQueueEnabled *string `json:"NotificationQueueEnabled,omitempty"` + // NotificationQueueURI - Deprecated + NotificationQueueURI *string `json:"NotificationQueueUri,omitempty"` + // DestinationStorageSubscriptionID - The subscription ID of the destination storage container. + DestinationStorageSubscriptionID *string `json:"DestinationStorageSubscriptionId,omitempty"` + // DestinationStorageLocationID - The location ID of the destination storage container. + DestinationStorageLocationID *string `json:"DestinationStorageLocationId,omitempty"` + // DestinationAccountID - The name of destination storage account. + DestinationAccountID *string `json:"DestinationAccountId,omitempty"` +} + +// ApplicationInsightsComponentFavorite properties that define a favorite that is associated to an +// Application Insights component. +type ApplicationInsightsComponentFavorite struct { + autorest.Response `json:"-"` + // Name - The user-defined name of the favorite. + Name *string `json:"Name,omitempty"` + // Config - Configuration of this particular favorite, which are driven by the Azure portal UX. Configuration data is a string containing valid JSON + Config *string `json:"Config,omitempty"` + // Version - This instance's version of the data model. This can change as new features are added that can be marked favorite. Current examples include MetricsExplorer (ME) and Search. + Version *string `json:"Version,omitempty"` + // FavoriteID - READ-ONLY; Internally assigned unique id of the favorite definition. + FavoriteID *string `json:"FavoriteId,omitempty"` + // FavoriteType - Enum indicating if this favorite definition is owned by a specific user or is shared between all users with access to the Application Insights component. Possible values include: 'FavoriteTypeShared', 'FavoriteTypeUser' + FavoriteType FavoriteType `json:"FavoriteType,omitempty"` + // SourceType - The source of the favorite definition. + SourceType *string `json:"SourceType,omitempty"` + // TimeModified - READ-ONLY; Date and time in UTC of the last modification that was made to this favorite definition. + TimeModified *string `json:"TimeModified,omitempty"` + // Tags - A list of 0 or more tags that are associated with this favorite definition + Tags *[]string `json:"Tags,omitempty"` + // Category - Favorite category, as defined by the user at creation time. + Category *string `json:"Category,omitempty"` + // IsGeneratedFromTemplate - Flag denoting wether or not this favorite was generated from a template. + IsGeneratedFromTemplate *bool `json:"IsGeneratedFromTemplate,omitempty"` + // UserID - READ-ONLY; Unique user id of the specific user that owns this favorite. + UserID *string `json:"UserId,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationInsightsComponentFavorite. +func (aicf ApplicationInsightsComponentFavorite) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aicf.Name != nil { + objectMap["Name"] = aicf.Name + } + if aicf.Config != nil { + objectMap["Config"] = aicf.Config + } + if aicf.Version != nil { + objectMap["Version"] = aicf.Version + } + if aicf.FavoriteType != "" { + objectMap["FavoriteType"] = aicf.FavoriteType + } + if aicf.SourceType != nil { + objectMap["SourceType"] = aicf.SourceType + } + if aicf.Tags != nil { + objectMap["Tags"] = aicf.Tags + } + if aicf.Category != nil { + objectMap["Category"] = aicf.Category + } + if aicf.IsGeneratedFromTemplate != nil { + objectMap["IsGeneratedFromTemplate"] = aicf.IsGeneratedFromTemplate + } + return json.Marshal(objectMap) +} + +// ApplicationInsightsComponentFeature an Application Insights component daily data volume cap status +type ApplicationInsightsComponentFeature struct { + // FeatureName - READ-ONLY; The pricing feature name. + FeatureName *string `json:"FeatureName,omitempty"` + // MeterID - READ-ONLY; The meter id used for the feature. + MeterID *string `json:"MeterId,omitempty"` + // MeterRateFrequency - READ-ONLY; The meter rate for the feature's meter. + MeterRateFrequency *string `json:"MeterRateFrequency,omitempty"` + // ResouceID - READ-ONLY; Reserved, not used now. + ResouceID *string `json:"ResouceId,omitempty"` + // IsHidden - READ-ONLY; Reserved, not used now. + IsHidden *bool `json:"IsHidden,omitempty"` + // Capabilities - READ-ONLY; A list of Application Insights component feature capability. + Capabilities *[]ApplicationInsightsComponentFeatureCapability `json:"Capabilities,omitempty"` + // Title - READ-ONLY; Display name of the feature. + Title *string `json:"Title,omitempty"` + // IsMainFeature - READ-ONLY; Whether can apply addon feature on to it. + IsMainFeature *bool `json:"IsMainFeature,omitempty"` + // SupportedAddonFeatures - READ-ONLY; The add on features on main feature. + SupportedAddonFeatures *string `json:"SupportedAddonFeatures,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationInsightsComponentFeature. +func (aicf ApplicationInsightsComponentFeature) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ApplicationInsightsComponentFeatureCapabilities an Application Insights component feature capabilities +type ApplicationInsightsComponentFeatureCapabilities struct { + autorest.Response `json:"-"` + // SupportExportData - READ-ONLY; Whether allow to use continuous export feature. + SupportExportData *bool `json:"SupportExportData,omitempty"` + // BurstThrottlePolicy - READ-ONLY; Reserved, not used now. + BurstThrottlePolicy *string `json:"BurstThrottlePolicy,omitempty"` + // MetadataClass - READ-ONLY; Reserved, not used now. + MetadataClass *string `json:"MetadataClass,omitempty"` + // LiveStreamMetrics - READ-ONLY; Reserved, not used now. + LiveStreamMetrics *bool `json:"LiveStreamMetrics,omitempty"` + // ApplicationMap - READ-ONLY; Reserved, not used now. + ApplicationMap *bool `json:"ApplicationMap,omitempty"` + // WorkItemIntegration - READ-ONLY; Whether allow to use work item integration feature. + WorkItemIntegration *bool `json:"WorkItemIntegration,omitempty"` + // PowerBIIntegration - READ-ONLY; Reserved, not used now. + PowerBIIntegration *bool `json:"PowerBIIntegration,omitempty"` + // OpenSchema - READ-ONLY; Reserved, not used now. + OpenSchema *bool `json:"OpenSchema,omitempty"` + // ProactiveDetection - READ-ONLY; Reserved, not used now. + ProactiveDetection *bool `json:"ProactiveDetection,omitempty"` + // AnalyticsIntegration - READ-ONLY; Reserved, not used now. + AnalyticsIntegration *bool `json:"AnalyticsIntegration,omitempty"` + // MultipleStepWebTest - READ-ONLY; Whether allow to use multiple steps web test feature. + MultipleStepWebTest *bool `json:"MultipleStepWebTest,omitempty"` + // APIAccessLevel - READ-ONLY; Reserved, not used now. + APIAccessLevel *string `json:"ApiAccessLevel,omitempty"` + // TrackingType - READ-ONLY; The application insights component used tracking type. + TrackingType *string `json:"TrackingType,omitempty"` + // DailyCap - READ-ONLY; Daily data volume cap in GB. + DailyCap *float64 `json:"DailyCap,omitempty"` + // DailyCapResetTime - READ-ONLY; Daily data volume cap UTC reset hour. + DailyCapResetTime *float64 `json:"DailyCapResetTime,omitempty"` + // ThrottleRate - READ-ONLY; Reserved, not used now. + ThrottleRate *float64 `json:"ThrottleRate,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationInsightsComponentFeatureCapabilities. +func (aicfc ApplicationInsightsComponentFeatureCapabilities) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ApplicationInsightsComponentFeatureCapability an Application Insights component feature capability +type ApplicationInsightsComponentFeatureCapability struct { + // Name - READ-ONLY; The name of the capability. + Name *string `json:"Name,omitempty"` + // Description - READ-ONLY; The description of the capability. + Description *string `json:"Description,omitempty"` + // Value - READ-ONLY; The value of the capability. + Value *string `json:"Value,omitempty"` + // Unit - READ-ONLY; The unit of the capability. + Unit *string `json:"Unit,omitempty"` + // MeterID - READ-ONLY; The meter used for the capability. + MeterID *string `json:"MeterId,omitempty"` + // MeterRateFrequency - READ-ONLY; The meter rate of the meter. + MeterRateFrequency *string `json:"MeterRateFrequency,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationInsightsComponentFeatureCapability. +func (aicfc ApplicationInsightsComponentFeatureCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ApplicationInsightsComponentListResult describes the list of Application Insights Resources. +type ApplicationInsightsComponentListResult struct { + autorest.Response `json:"-"` + // Value - List of Application Insights component definitions. + Value *[]ApplicationInsightsComponent `json:"value,omitempty"` + // NextLink - The URI to get the next set of Application Insights component definitions if too many components where returned in the result set. + NextLink *string `json:"nextLink,omitempty"` +} + +// ApplicationInsightsComponentListResultIterator provides access to a complete listing of +// ApplicationInsightsComponent values. +type ApplicationInsightsComponentListResultIterator struct { + i int + page ApplicationInsightsComponentListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ApplicationInsightsComponentListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationInsightsComponentListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ApplicationInsightsComponentListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ApplicationInsightsComponentListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ApplicationInsightsComponentListResultIterator) Response() ApplicationInsightsComponentListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ApplicationInsightsComponentListResultIterator) Value() ApplicationInsightsComponent { + if !iter.page.NotDone() { + return ApplicationInsightsComponent{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ApplicationInsightsComponentListResultIterator type. +func NewApplicationInsightsComponentListResultIterator(page ApplicationInsightsComponentListResultPage) ApplicationInsightsComponentListResultIterator { + return ApplicationInsightsComponentListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (aiclr ApplicationInsightsComponentListResult) IsEmpty() bool { + return aiclr.Value == nil || len(*aiclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (aiclr ApplicationInsightsComponentListResult) hasNextLink() bool { + return aiclr.NextLink != nil && len(*aiclr.NextLink) != 0 +} + +// applicationInsightsComponentListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (aiclr ApplicationInsightsComponentListResult) applicationInsightsComponentListResultPreparer(ctx context.Context) (*http.Request, error) { + if !aiclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(aiclr.NextLink))) +} + +// ApplicationInsightsComponentListResultPage contains a page of ApplicationInsightsComponent values. +type ApplicationInsightsComponentListResultPage struct { + fn func(context.Context, ApplicationInsightsComponentListResult) (ApplicationInsightsComponentListResult, error) + aiclr ApplicationInsightsComponentListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ApplicationInsightsComponentListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationInsightsComponentListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.aiclr) + if err != nil { + return err + } + page.aiclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ApplicationInsightsComponentListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ApplicationInsightsComponentListResultPage) NotDone() bool { + return !page.aiclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ApplicationInsightsComponentListResultPage) Response() ApplicationInsightsComponentListResult { + return page.aiclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ApplicationInsightsComponentListResultPage) Values() []ApplicationInsightsComponent { + if page.aiclr.IsEmpty() { + return nil + } + return *page.aiclr.Value +} + +// Creates a new instance of the ApplicationInsightsComponentListResultPage type. +func NewApplicationInsightsComponentListResultPage(cur ApplicationInsightsComponentListResult, getNextPage func(context.Context, ApplicationInsightsComponentListResult) (ApplicationInsightsComponentListResult, error)) ApplicationInsightsComponentListResultPage { + return ApplicationInsightsComponentListResultPage{ + fn: getNextPage, + aiclr: cur, + } +} + +// ApplicationInsightsComponentProactiveDetectionConfiguration properties that define a ProactiveDetection +// configuration. +type ApplicationInsightsComponentProactiveDetectionConfiguration struct { + autorest.Response `json:"-"` + // Name - The rule name + Name *string `json:"Name,omitempty"` + // Enabled - A flag that indicates whether this rule is enabled by the user + Enabled *bool `json:"Enabled,omitempty"` + // SendEmailsToSubscriptionOwners - A flag that indicated whether notifications on this rule should be sent to subscription owners + SendEmailsToSubscriptionOwners *bool `json:"SendEmailsToSubscriptionOwners,omitempty"` + // CustomEmails - Custom email addresses for this rule notifications + CustomEmails *[]string `json:"CustomEmails,omitempty"` + // LastUpdatedTime - The last time this rule was updated + LastUpdatedTime *string `json:"LastUpdatedTime,omitempty"` + // RuleDefinitions - Static definitions of the ProactiveDetection configuration rule (same values for all components). + RuleDefinitions *ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions `json:"RuleDefinitions,omitempty"` +} + +// ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions static definitions of the +// ProactiveDetection configuration rule (same values for all components). +type ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions struct { + // Name - The rule name + Name *string `json:"Name,omitempty"` + // DisplayName - The rule name as it is displayed in UI + DisplayName *string `json:"DisplayName,omitempty"` + // Description - The rule description + Description *string `json:"Description,omitempty"` + // HelpURL - URL which displays additional info about the proactive detection rule + HelpURL *string `json:"HelpUrl,omitempty"` + // IsHidden - A flag indicating whether the rule is hidden (from the UI) + IsHidden *bool `json:"IsHidden,omitempty"` + // IsEnabledByDefault - A flag indicating whether the rule is enabled by default + IsEnabledByDefault *bool `json:"IsEnabledByDefault,omitempty"` + // IsInPreview - A flag indicating whether the rule is in preview + IsInPreview *bool `json:"IsInPreview,omitempty"` + // SupportsEmailNotifications - A flag indicating whether email notifications are supported for detections for this rule + SupportsEmailNotifications *bool `json:"SupportsEmailNotifications,omitempty"` +} + +// ApplicationInsightsComponentProperties properties that define an Application Insights component +// resource. +type ApplicationInsightsComponentProperties struct { + // ApplicationID - READ-ONLY; The unique ID of your application. This field mirrors the 'Name' field and cannot be changed. + ApplicationID *string `json:"ApplicationId,omitempty"` + // AppID - READ-ONLY; Application Insights Unique ID for your Application. + AppID *string `json:"AppId,omitempty"` + // Name - READ-ONLY; Application name. + Name *string `json:"Name,omitempty"` + // ApplicationType - Type of application being monitored. Possible values include: 'ApplicationTypeWeb', 'ApplicationTypeOther' + ApplicationType ApplicationType `json:"Application_Type,omitempty"` + // FlowType - Used by the Application Insights system to determine what kind of flow this component was created by. This is to be set to 'Bluefield' when creating/updating a component via the REST API. Possible values include: 'FlowTypeBluefield' + FlowType FlowType `json:"Flow_Type,omitempty"` + // RequestSource - Describes what tool created this Application Insights component. Customers using this API should set this to the default 'rest'. Possible values include: 'RequestSourceRest' + RequestSource RequestSource `json:"Request_Source,omitempty"` + // InstrumentationKey - READ-ONLY; Application Insights Instrumentation key. A read-only value that applications can use to identify the destination for all telemetry sent to Azure Application Insights. This value will be supplied upon construction of each new Application Insights component. + InstrumentationKey *string `json:"InstrumentationKey,omitempty"` + // CreationDate - READ-ONLY; Creation Date for the Application Insights component, in ISO 8601 format. + CreationDate *date.Time `json:"CreationDate,omitempty"` + // TenantID - READ-ONLY; Azure Tenant Id. + TenantID *string `json:"TenantId,omitempty"` + // HockeyAppID - The unique application ID created when a new application is added to HockeyApp, used for communications with HockeyApp. + HockeyAppID *string `json:"HockeyAppId,omitempty"` + // HockeyAppToken - READ-ONLY; Token used to authenticate communications with between Application Insights and HockeyApp. + HockeyAppToken *string `json:"HockeyAppToken,omitempty"` + // ProvisioningState - READ-ONLY; Current state of this component: whether or not is has been provisioned within the resource group it is defined. Users cannot change this value but are able to read from it. Values will include Succeeded, Deploying, Canceled, and Failed. + ProvisioningState *string `json:"provisioningState,omitempty"` + // SamplingPercentage - Percentage of the data produced by the application being monitored that is being sampled for Application Insights telemetry. + SamplingPercentage *float64 `json:"SamplingPercentage,omitempty"` + // ConnectionString - READ-ONLY; Application Insights component connection string. + ConnectionString *string `json:"ConnectionString,omitempty"` + // RetentionInDays - Retention period in days. + RetentionInDays *int32 `json:"RetentionInDays,omitempty"` + // DisableIPMasking - Disable IP masking. + DisableIPMasking *bool `json:"DisableIpMasking,omitempty"` + // ImmediatePurgeDataOn30Days - Purge data immediately after 30 days. + ImmediatePurgeDataOn30Days *bool `json:"ImmediatePurgeDataOn30Days,omitempty"` + // WorkspaceResourceID - Resource Id of the log analytics workspace which the data will be ingested to. This property is required to create an application with this API version. Applications from older versions will not have this property. + WorkspaceResourceID *string `json:"WorkspaceResourceId,omitempty"` + // LaMigrationDate - READ-ONLY; The date which the component got migrated to LA, in ISO 8601 format. + LaMigrationDate *date.Time `json:"LaMigrationDate,omitempty"` + // PrivateLinkScopedResources - READ-ONLY; List of linked private link scope resources. + PrivateLinkScopedResources *[]PrivateLinkScopedResource `json:"PrivateLinkScopedResources,omitempty"` + // PublicNetworkAccessForIngestion - The network access type for accessing Application Insights ingestion. Possible values include: 'PublicNetworkAccessTypeEnabled', 'PublicNetworkAccessTypeDisabled' + PublicNetworkAccessForIngestion PublicNetworkAccessType `json:"publicNetworkAccessForIngestion,omitempty"` + // PublicNetworkAccessForQuery - The network access type for accessing Application Insights query. Possible values include: 'PublicNetworkAccessTypeEnabled', 'PublicNetworkAccessTypeDisabled' + PublicNetworkAccessForQuery PublicNetworkAccessType `json:"publicNetworkAccessForQuery,omitempty"` + // IngestionMode - Indicates the flow of the ingestion. Possible values include: 'IngestionModeApplicationInsights', 'IngestionModeApplicationInsightsWithDiagnosticSettings', 'IngestionModeLogAnalytics' + IngestionMode IngestionMode `json:"IngestionMode,omitempty"` + // DisableLocalAuth - Disable Non-AAD based Auth. + DisableLocalAuth *bool `json:"DisableLocalAuth,omitempty"` + // ForceCustomerStorageForProfiler - Force users to create their own storage account for profiler and debugger. + ForceCustomerStorageForProfiler *bool `json:"ForceCustomerStorageForProfiler,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationInsightsComponentProperties. +func (aicp ApplicationInsightsComponentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aicp.ApplicationType != "" { + objectMap["Application_Type"] = aicp.ApplicationType + } + if aicp.FlowType != "" { + objectMap["Flow_Type"] = aicp.FlowType + } + if aicp.RequestSource != "" { + objectMap["Request_Source"] = aicp.RequestSource + } + if aicp.HockeyAppID != nil { + objectMap["HockeyAppId"] = aicp.HockeyAppID + } + if aicp.SamplingPercentage != nil { + objectMap["SamplingPercentage"] = aicp.SamplingPercentage + } + if aicp.RetentionInDays != nil { + objectMap["RetentionInDays"] = aicp.RetentionInDays + } + if aicp.DisableIPMasking != nil { + objectMap["DisableIpMasking"] = aicp.DisableIPMasking + } + if aicp.ImmediatePurgeDataOn30Days != nil { + objectMap["ImmediatePurgeDataOn30Days"] = aicp.ImmediatePurgeDataOn30Days + } + if aicp.WorkspaceResourceID != nil { + objectMap["WorkspaceResourceId"] = aicp.WorkspaceResourceID + } + if aicp.PublicNetworkAccessForIngestion != "" { + objectMap["publicNetworkAccessForIngestion"] = aicp.PublicNetworkAccessForIngestion + } + if aicp.PublicNetworkAccessForQuery != "" { + objectMap["publicNetworkAccessForQuery"] = aicp.PublicNetworkAccessForQuery + } + if aicp.IngestionMode != "" { + objectMap["IngestionMode"] = aicp.IngestionMode + } + if aicp.DisableLocalAuth != nil { + objectMap["DisableLocalAuth"] = aicp.DisableLocalAuth + } + if aicp.ForceCustomerStorageForProfiler != nil { + objectMap["ForceCustomerStorageForProfiler"] = aicp.ForceCustomerStorageForProfiler + } + return json.Marshal(objectMap) +} + +// ApplicationInsightsComponentQuotaStatus an Application Insights component daily data volume cap status +type ApplicationInsightsComponentQuotaStatus struct { + autorest.Response `json:"-"` + // AppID - READ-ONLY; The Application ID for the Application Insights component. + AppID *string `json:"AppId,omitempty"` + // ShouldBeThrottled - READ-ONLY; The daily data volume cap is met, and data ingestion will be stopped. + ShouldBeThrottled *bool `json:"ShouldBeThrottled,omitempty"` + // ExpirationTime - READ-ONLY; Date and time when the daily data volume cap will be reset, and data ingestion will resume. + ExpirationTime *string `json:"ExpirationTime,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationInsightsComponentQuotaStatus. +func (aicqs ApplicationInsightsComponentQuotaStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ApplicationInsightsComponentWebTestLocation properties that define a web test location available to an +// Application Insights Component. +type ApplicationInsightsComponentWebTestLocation struct { + // DisplayName - READ-ONLY; The display name of the web test location. + DisplayName *string `json:"DisplayName,omitempty"` + // Tag - READ-ONLY; Internally defined geographic location tag. + Tag *string `json:"Tag,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationInsightsComponentWebTestLocation. +func (aicwtl ApplicationInsightsComponentWebTestLocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ApplicationInsightsWebTestLocationsListResult describes the list of web test locations available to an +// Application Insights Component. +type ApplicationInsightsWebTestLocationsListResult struct { + autorest.Response `json:"-"` + // Value - List of web test locations. + Value *[]ApplicationInsightsComponentWebTestLocation `json:"value,omitempty"` +} + +// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. +type AzureEntityResource struct { + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureEntityResource. +func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ComponentLinkedStorageAccounts an Application Insights component linked storage accounts +type ComponentLinkedStorageAccounts struct { + autorest.Response `json:"-"` + // LinkedStorageAccountsProperties - The properties of the linked storage accounts. + *LinkedStorageAccountsProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComponentLinkedStorageAccounts. +func (clsa ComponentLinkedStorageAccounts) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if clsa.LinkedStorageAccountsProperties != nil { + objectMap["properties"] = clsa.LinkedStorageAccountsProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ComponentLinkedStorageAccounts struct. +func (clsa *ComponentLinkedStorageAccounts) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var linkedStorageAccountsProperties LinkedStorageAccountsProperties + err = json.Unmarshal(*v, &linkedStorageAccountsProperties) + if err != nil { + return err + } + clsa.LinkedStorageAccountsProperties = &linkedStorageAccountsProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + clsa.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + clsa.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + clsa.Type = &typeVar + } + } + } + + return nil +} + +// ComponentLinkedStorageAccountsPatch an Application Insights component linked storage accounts patch +type ComponentLinkedStorageAccountsPatch struct { + // LinkedStorageAccountsProperties - The properties of the linked storage accounts. + *LinkedStorageAccountsProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComponentLinkedStorageAccountsPatch. +func (clsap ComponentLinkedStorageAccountsPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if clsap.LinkedStorageAccountsProperties != nil { + objectMap["properties"] = clsap.LinkedStorageAccountsProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ComponentLinkedStorageAccountsPatch struct. +func (clsap *ComponentLinkedStorageAccountsPatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var linkedStorageAccountsProperties LinkedStorageAccountsProperties + err = json.Unmarshal(*v, &linkedStorageAccountsProperties) + if err != nil { + return err + } + clsap.LinkedStorageAccountsProperties = &linkedStorageAccountsProperties + } + } + } + + return nil +} + +// ComponentPurgeBody describes the body of a purge request for an App Insights component +type ComponentPurgeBody struct { + // Table - Table from which to purge data. + Table *string `json:"table,omitempty"` + // Filters - The set of columns and filters (queries) to run over them to purge the resulting data. + Filters *[]ComponentPurgeBodyFilters `json:"filters,omitempty"` +} + +// ComponentPurgeBodyFilters user-defined filters to return data which will be purged from the table. +type ComponentPurgeBodyFilters struct { + // Column - The column of the table over which the given query should run + Column *string `json:"column,omitempty"` + // Operator - A query operator to evaluate over the provided column and value(s). Supported operators are ==, =~, in, in~, >, >=, <, <=, between, and have the same behavior as they would in a KQL query. + Operator *string `json:"operator,omitempty"` + // Value - the value for the operator to function over. This can be a number (e.g., > 100), a string (timestamp >= '2017-09-01') or array of values. + Value interface{} `json:"value,omitempty"` + // Key - When filtering over custom dimensions, this key will be used as the name of the custom dimension. + Key *string `json:"key,omitempty"` +} + +// ComponentPurgeResponse response containing operationId for a specific purge action. +type ComponentPurgeResponse struct { + autorest.Response `json:"-"` + // OperationID - Id to use when querying for status for a particular purge operation. + OperationID *string `json:"operationId,omitempty"` +} + +// ComponentPurgeStatusResponse response containing status for a specific purge operation. +type ComponentPurgeStatusResponse struct { + autorest.Response `json:"-"` + // Status - Status of the operation represented by the requested Id. Possible values include: 'PurgeStatePending', 'PurgeStateCompleted' + Status PurgeState `json:"status,omitempty"` +} + +// ComponentsResource an azure resource object +type ComponentsResource struct { + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ComponentsResource. +func (cr ComponentsResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cr.Location != nil { + objectMap["location"] = cr.Location + } + if cr.Tags != nil { + objectMap["tags"] = cr.Tags + } + return json.Marshal(objectMap) +} + +// ErrorDefinition error definition. +type ErrorDefinition struct { + // Code - READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; Description of the error. + Message *string `json:"message,omitempty"` + // Innererror - READ-ONLY; Internal error details. + Innererror interface{} `json:"innererror,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDefinition. +func (ed ErrorDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponse error response indicates Insights service is not able to process the incoming request. The +// reason is provided in the error message. +type ErrorResponse struct { + // Code - Error code. + Code *string `json:"code,omitempty"` + // Message - Error message indicating why the operation failed. + Message *string `json:"message,omitempty"` +} + +// ErrorResponseComponents ... +type ErrorResponseComponents struct { + // Error - Error response indicates Insights service is not able to process the incoming request. The reason is provided in the error message. + Error *ErrorResponseComponentsError `json:"error,omitempty"` +} + +// ErrorResponseComponentsError error response indicates Insights service is not able to process the +// incoming request. The reason is provided in the error message. +type ErrorResponseComponentsError struct { + // Code - READ-ONLY; Error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; Error message indicating why the operation failed. + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorResponseComponentsError. +func (erc ErrorResponseComponentsError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponseLinkedStorage ... +type ErrorResponseLinkedStorage struct { + // Error - Error response indicates Insights service is not able to process the incoming request. The reason is provided in the error message. + Error *ErrorResponseLinkedStorageError `json:"error,omitempty"` +} + +// ErrorResponseLinkedStorageError error response indicates Insights service is not able to process the +// incoming request. The reason is provided in the error message. +type ErrorResponseLinkedStorageError struct { + // Code - READ-ONLY; Error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; Error message indicating why the operation failed. + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorResponseLinkedStorageError. +func (erls ErrorResponseLinkedStorageError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// InnerError inner error +type InnerError struct { + // Diagnosticcontext - Provides correlation for request + Diagnosticcontext *string `json:"diagnosticcontext,omitempty"` + // Time - Request time + Time *date.Time `json:"time,omitempty"` +} + +// InnerErrorTrace error details +type InnerErrorTrace struct { + // Trace - READ-ONLY; detailed error trace + Trace *[]string `json:"trace,omitempty"` +} + +// MarshalJSON is the custom marshaler for InnerErrorTrace. +func (iet InnerErrorTrace) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// LinkedStorageAccountsProperties an Application Insights component linked storage account +type LinkedStorageAccountsProperties struct { + // LinkedStorageAccount - Linked storage account resource ID + LinkedStorageAccount *string `json:"linkedStorageAccount,omitempty"` +} + +// ListAnnotation ... +type ListAnnotation struct { + autorest.Response `json:"-"` + Value *[]Annotation `json:"value,omitempty"` +} + +// ListApplicationInsightsComponentAnalyticsItem ... +type ListApplicationInsightsComponentAnalyticsItem struct { + autorest.Response `json:"-"` + Value *[]ApplicationInsightsComponentAnalyticsItem `json:"value,omitempty"` +} + +// ListApplicationInsightsComponentExportConfiguration ... +type ListApplicationInsightsComponentExportConfiguration struct { + autorest.Response `json:"-"` + Value *[]ApplicationInsightsComponentExportConfiguration `json:"value,omitempty"` +} + +// ListApplicationInsightsComponentFavorite ... +type ListApplicationInsightsComponentFavorite struct { + autorest.Response `json:"-"` + Value *[]ApplicationInsightsComponentFavorite `json:"value,omitempty"` +} + +// ListApplicationInsightsComponentProactiveDetectionConfiguration ... +type ListApplicationInsightsComponentProactiveDetectionConfiguration struct { + autorest.Response `json:"-"` + Value *[]ApplicationInsightsComponentProactiveDetectionConfiguration `json:"value,omitempty"` +} + +// LiveTokenResponse the response to a live token query. +type LiveTokenResponse struct { + autorest.Response `json:"-"` + // LiveToken - READ-ONLY; JWT token for accessing live metrics stream data. + LiveToken *string `json:"liveToken,omitempty"` +} + +// MarshalJSON is the custom marshaler for LiveTokenResponse. +func (ltr LiveTokenResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ManagedServiceIdentity managed service identity (system assigned and/or user assigned identities) +type ManagedServiceIdentity struct { + // PrincipalID - READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. + PrincipalID *uuid.UUID `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *uuid.UUID `json:"tenantId,omitempty"` + // Type - Possible values include: 'ManagedServiceIdentityTypeNone', 'ManagedServiceIdentityTypeSystemAssigned', 'ManagedServiceIdentityTypeUserAssigned', 'ManagedServiceIdentityTypeSystemAssignedUserAssigned' + Type ManagedServiceIdentityType `json:"type,omitempty"` + UserAssignedIdentities map[string]*UserAssignedIdentity `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for ManagedServiceIdentity. +func (msi ManagedServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if msi.Type != "" { + objectMap["type"] = msi.Type + } + if msi.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = msi.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// MyWorkbook an Application Insights private workbook definition. +type MyWorkbook struct { + autorest.Response `json:"-"` + // Kind - The kind of workbook. Choices are user and shared. Possible values include: 'KindUser', 'KindShared' + Kind Kind `json:"kind,omitempty"` + // MyWorkbookProperties - Metadata describing a workbook for an Azure resource. + *MyWorkbookProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` + // Identity - Identity used for BYOS + Identity *MyWorkbookManagedIdentity `json:"identity,omitempty"` + // ID - Azure resource Id + ID *string `json:"id,omitempty"` + // Name - Azure resource name + Name *string `json:"name,omitempty"` + // Type - Azure resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // Etag - Resource etag + Etag map[string]*string `json:"etag"` +} + +// MarshalJSON is the custom marshaler for MyWorkbook. +func (mw MyWorkbook) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mw.Kind != "" { + objectMap["kind"] = mw.Kind + } + if mw.MyWorkbookProperties != nil { + objectMap["properties"] = mw.MyWorkbookProperties + } + if mw.Identity != nil { + objectMap["identity"] = mw.Identity + } + if mw.ID != nil { + objectMap["id"] = mw.ID + } + if mw.Name != nil { + objectMap["name"] = mw.Name + } + if mw.Type != nil { + objectMap["type"] = mw.Type + } + if mw.Location != nil { + objectMap["location"] = mw.Location + } + if mw.Tags != nil { + objectMap["tags"] = mw.Tags + } + if mw.Etag != nil { + objectMap["etag"] = mw.Etag + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MyWorkbook struct. +func (mw *MyWorkbook) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "kind": + if v != nil { + var kind Kind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + mw.Kind = kind + } + case "properties": + if v != nil { + var myWorkbookProperties MyWorkbookProperties + err = json.Unmarshal(*v, &myWorkbookProperties) + if err != nil { + return err + } + mw.MyWorkbookProperties = &myWorkbookProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mw.SystemData = &systemData + } + case "identity": + if v != nil { + var identity MyWorkbookManagedIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + mw.Identity = &identity + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mw.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mw.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mw.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + mw.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + mw.Tags = tags + } + case "etag": + if v != nil { + var etag map[string]*string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + mw.Etag = etag + } + } + } + + return nil +} + +// MyWorkbookError error response. +type MyWorkbookError struct { + // Error - The error details. + Error *ErrorDefinition `json:"error,omitempty"` +} + +// MyWorkbookManagedIdentity customer Managed Identity +type MyWorkbookManagedIdentity struct { + UserAssignedIdentities *MyWorkbookUserAssignedIdentities `json:"userAssignedIdentities,omitempty"` + // Type - The identity type. Possible values include: 'TypeUserAssigned', 'TypeNone' + Type Type `json:"type,omitempty"` +} + +// MyWorkbookProperties properties that contain a private workbook. +type MyWorkbookProperties struct { + // DisplayName - The user-defined name of the private workbook. + DisplayName *string `json:"displayName,omitempty"` + // SerializedData - Configuration of this particular private workbook. Configuration data is a string containing valid JSON + SerializedData *string `json:"serializedData,omitempty"` + // Version - This instance's version of the data model. This can change as new features are added that can be marked private workbook. + Version *string `json:"version,omitempty"` + // TimeModified - READ-ONLY; Date and time in UTC of the last modification that was made to this private workbook definition. + TimeModified *string `json:"timeModified,omitempty"` + // Category - Workbook category, as defined by the user at creation time. + Category *string `json:"category,omitempty"` + // Tags - A list of 0 or more tags that are associated with this private workbook definition + Tags *[]string `json:"tags,omitempty"` + // UserID - READ-ONLY; Unique user id of the specific user that owns this private workbook. + UserID *string `json:"userId,omitempty"` + // SourceID - Optional resourceId for a source resource. + SourceID *string `json:"sourceId,omitempty"` + // StorageURI - BYOS Storage Account URI + StorageURI *string `json:"storageUri,omitempty"` +} + +// MarshalJSON is the custom marshaler for MyWorkbookProperties. +func (mwp MyWorkbookProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mwp.DisplayName != nil { + objectMap["displayName"] = mwp.DisplayName + } + if mwp.SerializedData != nil { + objectMap["serializedData"] = mwp.SerializedData + } + if mwp.Version != nil { + objectMap["version"] = mwp.Version + } + if mwp.Category != nil { + objectMap["category"] = mwp.Category + } + if mwp.Tags != nil { + objectMap["tags"] = mwp.Tags + } + if mwp.SourceID != nil { + objectMap["sourceId"] = mwp.SourceID + } + if mwp.StorageURI != nil { + objectMap["storageUri"] = mwp.StorageURI + } + return json.Marshal(objectMap) +} + +// MyWorkbookResource an azure resource object +type MyWorkbookResource struct { + // Identity - Identity used for BYOS + Identity *MyWorkbookManagedIdentity `json:"identity,omitempty"` + // ID - Azure resource Id + ID *string `json:"id,omitempty"` + // Name - Azure resource name + Name *string `json:"name,omitempty"` + // Type - Azure resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // Etag - Resource etag + Etag map[string]*string `json:"etag"` +} + +// MarshalJSON is the custom marshaler for MyWorkbookResource. +func (mwr MyWorkbookResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mwr.Identity != nil { + objectMap["identity"] = mwr.Identity + } + if mwr.ID != nil { + objectMap["id"] = mwr.ID + } + if mwr.Name != nil { + objectMap["name"] = mwr.Name + } + if mwr.Type != nil { + objectMap["type"] = mwr.Type + } + if mwr.Location != nil { + objectMap["location"] = mwr.Location + } + if mwr.Tags != nil { + objectMap["tags"] = mwr.Tags + } + if mwr.Etag != nil { + objectMap["etag"] = mwr.Etag + } + return json.Marshal(objectMap) +} + +// MyWorkbooksListResult workbook list result. +type MyWorkbooksListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; An array of private workbooks. + Value *[]MyWorkbook `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for MyWorkbooksListResult. +func (mwlr MyWorkbooksListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mwlr.NextLink != nil { + objectMap["nextLink"] = mwlr.NextLink + } + return json.Marshal(objectMap) +} + +// MyWorkbooksListResultIterator provides access to a complete listing of MyWorkbook values. +type MyWorkbooksListResultIterator struct { + i int + page MyWorkbooksListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *MyWorkbooksListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MyWorkbooksListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *MyWorkbooksListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter MyWorkbooksListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter MyWorkbooksListResultIterator) Response() MyWorkbooksListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter MyWorkbooksListResultIterator) Value() MyWorkbook { + if !iter.page.NotDone() { + return MyWorkbook{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the MyWorkbooksListResultIterator type. +func NewMyWorkbooksListResultIterator(page MyWorkbooksListResultPage) MyWorkbooksListResultIterator { + return MyWorkbooksListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mwlr MyWorkbooksListResult) IsEmpty() bool { + return mwlr.Value == nil || len(*mwlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mwlr MyWorkbooksListResult) hasNextLink() bool { + return mwlr.NextLink != nil && len(*mwlr.NextLink) != 0 +} + +// myWorkbooksListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mwlr MyWorkbooksListResult) myWorkbooksListResultPreparer(ctx context.Context) (*http.Request, error) { + if !mwlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mwlr.NextLink))) +} + +// MyWorkbooksListResultPage contains a page of MyWorkbook values. +type MyWorkbooksListResultPage struct { + fn func(context.Context, MyWorkbooksListResult) (MyWorkbooksListResult, error) + mwlr MyWorkbooksListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *MyWorkbooksListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MyWorkbooksListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.mwlr) + if err != nil { + return err + } + page.mwlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *MyWorkbooksListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page MyWorkbooksListResultPage) NotDone() bool { + return !page.mwlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page MyWorkbooksListResultPage) Response() MyWorkbooksListResult { + return page.mwlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page MyWorkbooksListResultPage) Values() []MyWorkbook { + if page.mwlr.IsEmpty() { + return nil + } + return *page.mwlr.Value +} + +// Creates a new instance of the MyWorkbooksListResultPage type. +func NewMyWorkbooksListResultPage(cur MyWorkbooksListResult, getNextPage func(context.Context, MyWorkbooksListResult) (MyWorkbooksListResult, error)) MyWorkbooksListResultPage { + return MyWorkbooksListResultPage{ + fn: getNextPage, + mwlr: cur, + } +} + +// MyWorkbookUserAssignedIdentities customer Managed Identity +type MyWorkbookUserAssignedIdentities struct { + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` +} + +// MarshalJSON is the custom marshaler for MyWorkbookUserAssignedIdentities. +func (mwuai MyWorkbookUserAssignedIdentities) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Operation CDN REST API operation +type Operation struct { + // Name - Operation name: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - The object that represents the operation. + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay the object that represents the operation. +type OperationDisplay struct { + // Provider - Service provider: Microsoft.Cdn + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed: Profile, endpoint, etc. + Resource *string `json:"resource,omitempty"` + // Operation - Operation type: Read, write, delete, etc. + Operation *string `json:"operation,omitempty"` +} + +// OperationInfo information about an operation +type OperationInfo struct { + // Provider - Name of the provider + Provider *string `json:"provider,omitempty"` + // Resource - Name of the resource type + Resource *string `json:"resource,omitempty"` + // Operation - Name of the operation + Operation *string `json:"operation,omitempty"` + // Description - Description of the operation + Description *string `json:"description,omitempty"` +} + +// OperationListResult result of the request to list CDN operations. It contains a list of operations and a +// URL link to get the next set of results. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - List of CDN operations supported by the CDN resource provider. + Value *[]Operation `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultIterator provides access to a complete listing of Operation values. +type OperationListResultIterator struct { + i int + page OperationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationListResultIterator) Response() OperationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationListResultIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationListResultIterator type. +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return OperationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OperationListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (olr OperationListResult) hasNextLink() bool { + return olr.NextLink != nil && len(*olr.NextLink) != 0 +} + +// operationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !olr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationListResultPage contains a page of Operation values. +type OperationListResultPage struct { + fn func(context.Context, OperationListResult) (OperationListResult, error) + olr OperationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.olr) + if err != nil { + return err + } + page.olr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListResultPage) Response() OperationListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListResultPage) Values() []Operation { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OperationListResultPage type. +func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return OperationListResultPage{ + fn: getNextPage, + olr: cur, + } +} + +// OperationLive represents an operation returned by the GetOperations request +type OperationLive struct { + // Name - Name of the operation + Name *string `json:"name,omitempty"` + // IsDataAction - Indicates whether the operation is a data action + IsDataAction *bool `json:"isDataAction,omitempty"` + // Display - Display name of the operation + Display *OperationInfo `json:"display,omitempty"` + // Origin - Origin of the operation + Origin *string `json:"origin,omitempty"` + // Properties - Properties of the operation + Properties interface{} `json:"properties,omitempty"` +} + +// OperationsListResult result of the List Operations operation +type OperationsListResult struct { + // Value - A collection of operations + Value *[]OperationLive `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// PrivateLinkScopedResource the private link scope resource reference. +type PrivateLinkScopedResource struct { + // ResourceID - The full resource Id of the private link scope resource. + ResourceID *string `json:"ResourceId,omitempty"` + // ScopeID - The private link scope unique Identifier. + ScopeID *string `json:"ScopeId,omitempty"` +} + +// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not +// have tags and a location +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Resource common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TagsResource a container holding only the Tags for a resource, allowing the user to update the tags on a +// WebTest instance. +type TagsResource struct { + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for TagsResource. +func (tr TagsResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + return json.Marshal(objectMap) +} + +// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource +// which has 'tags' and a 'location' +type TrackedResource struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} + +// UserAssignedIdentity user assigned identity properties +type UserAssignedIdentity struct { + // PrincipalID - READ-ONLY; The principal ID of the assigned identity. + PrincipalID *uuid.UUID `json:"principalId,omitempty"` + // ClientID - READ-ONLY; The client ID of the assigned identity. + ClientID *uuid.UUID `json:"clientId,omitempty"` +} + +// MarshalJSON is the custom marshaler for UserAssignedIdentity. +func (uai UserAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// WebTest an Application Insights web test definition. +type WebTest struct { + autorest.Response `json:"-"` + // Kind - The kind of web test that this web test watches. Choices are ping and multistep. Possible values include: 'WebTestKindPing', 'WebTestKindMultistep' + Kind WebTestKind `json:"kind,omitempty"` + // WebTestProperties - Metadata describing a web test for an Azure resource. + *WebTestProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for WebTest. +func (wt WebTest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wt.Kind != "" { + objectMap["kind"] = wt.Kind + } + if wt.WebTestProperties != nil { + objectMap["properties"] = wt.WebTestProperties + } + if wt.Location != nil { + objectMap["location"] = wt.Location + } + if wt.Tags != nil { + objectMap["tags"] = wt.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for WebTest struct. +func (wt *WebTest) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "kind": + if v != nil { + var kind WebTestKind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + wt.Kind = kind + } + case "properties": + if v != nil { + var webTestProperties WebTestProperties + err = json.Unmarshal(*v, &webTestProperties) + if err != nil { + return err + } + wt.WebTestProperties = &webTestProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + wt.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + wt.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + wt.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + wt.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + wt.Tags = tags + } + } + } + + return nil +} + +// WebTestGeolocation geo-physical location to run a web test from. You must specify one or more locations +// for the test to run from. +type WebTestGeolocation struct { + // Location - Location ID for the webtest to run from. + Location *string `json:"Id,omitempty"` +} + +// WebTestListResult a list of 0 or more Application Insights web test definitions. +type WebTestListResult struct { + autorest.Response `json:"-"` + // Value - Set of Application Insights web test definitions. + Value *[]WebTest `json:"value,omitempty"` + // NextLink - The link to get the next part of the returned list of web tests, should the return set be too large for a single request. May be null. + NextLink *string `json:"nextLink,omitempty"` +} + +// WebTestListResultIterator provides access to a complete listing of WebTest values. +type WebTestListResultIterator struct { + i int + page WebTestListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *WebTestListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebTestListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *WebTestListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter WebTestListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter WebTestListResultIterator) Response() WebTestListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter WebTestListResultIterator) Value() WebTest { + if !iter.page.NotDone() { + return WebTest{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the WebTestListResultIterator type. +func NewWebTestListResultIterator(page WebTestListResultPage) WebTestListResultIterator { + return WebTestListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (wtlr WebTestListResult) IsEmpty() bool { + return wtlr.Value == nil || len(*wtlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (wtlr WebTestListResult) hasNextLink() bool { + return wtlr.NextLink != nil && len(*wtlr.NextLink) != 0 +} + +// webTestListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (wtlr WebTestListResult) webTestListResultPreparer(ctx context.Context) (*http.Request, error) { + if !wtlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(wtlr.NextLink))) +} + +// WebTestListResultPage contains a page of WebTest values. +type WebTestListResultPage struct { + fn func(context.Context, WebTestListResult) (WebTestListResult, error) + wtlr WebTestListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *WebTestListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebTestListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.wtlr) + if err != nil { + return err + } + page.wtlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *WebTestListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page WebTestListResultPage) NotDone() bool { + return !page.wtlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page WebTestListResultPage) Response() WebTestListResult { + return page.wtlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page WebTestListResultPage) Values() []WebTest { + if page.wtlr.IsEmpty() { + return nil + } + return *page.wtlr.Value +} + +// Creates a new instance of the WebTestListResultPage type. +func NewWebTestListResultPage(cur WebTestListResult, getNextPage func(context.Context, WebTestListResult) (WebTestListResult, error)) WebTestListResultPage { + return WebTestListResultPage{ + fn: getNextPage, + wtlr: cur, + } +} + +// WebTestProperties metadata describing a web test for an Azure resource. +type WebTestProperties struct { + // SyntheticMonitorID - Unique ID of this WebTest. This is typically the same value as the Name field. + SyntheticMonitorID *string `json:"SyntheticMonitorId,omitempty"` + // WebTestName - User defined name if this WebTest. + WebTestName *string `json:"Name,omitempty"` + // Description - Purpose/user defined descriptive test for this WebTest. + Description *string `json:"Description,omitempty"` + // Enabled - Is the test actively being monitored. + Enabled *bool `json:"Enabled,omitempty"` + // Frequency - Interval in seconds between test runs for this WebTest. Default value is 300. + Frequency *int32 `json:"Frequency,omitempty"` + // Timeout - Seconds until this WebTest will timeout and fail. Default value is 30. + Timeout *int32 `json:"Timeout,omitempty"` + // WebTestKind - The kind of web test this is, valid choices are ping and multistep. Possible values include: 'WebTestKindPing', 'WebTestKindMultistep' + WebTestKind WebTestKind `json:"Kind,omitempty"` + // RetryEnabled - Allow for retries should this WebTest fail. + RetryEnabled *bool `json:"RetryEnabled,omitempty"` + // Locations - A list of where to physically run the tests from to give global coverage for accessibility of your application. + Locations *[]WebTestGeolocation `json:"Locations,omitempty"` + // Configuration - An XML configuration specification for a WebTest. + Configuration *WebTestPropertiesConfiguration `json:"Configuration,omitempty"` + // ProvisioningState - READ-ONLY; Current state of this component, whether or not is has been provisioned within the resource group it is defined. Users cannot change this value but are able to read from it. Values will include Succeeded, Deploying, Canceled, and Failed. + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebTestProperties. +func (wtp WebTestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wtp.SyntheticMonitorID != nil { + objectMap["SyntheticMonitorId"] = wtp.SyntheticMonitorID + } + if wtp.WebTestName != nil { + objectMap["Name"] = wtp.WebTestName + } + if wtp.Description != nil { + objectMap["Description"] = wtp.Description + } + if wtp.Enabled != nil { + objectMap["Enabled"] = wtp.Enabled + } + if wtp.Frequency != nil { + objectMap["Frequency"] = wtp.Frequency + } + if wtp.Timeout != nil { + objectMap["Timeout"] = wtp.Timeout + } + if wtp.WebTestKind != "" { + objectMap["Kind"] = wtp.WebTestKind + } + if wtp.RetryEnabled != nil { + objectMap["RetryEnabled"] = wtp.RetryEnabled + } + if wtp.Locations != nil { + objectMap["Locations"] = wtp.Locations + } + if wtp.Configuration != nil { + objectMap["Configuration"] = wtp.Configuration + } + return json.Marshal(objectMap) +} + +// WebTestPropertiesConfiguration an XML configuration specification for a WebTest. +type WebTestPropertiesConfiguration struct { + // WebTest - The XML specification of a WebTest to run against an application. + WebTest *string `json:"WebTest,omitempty"` +} + +// WebtestsResource an azure resource object +type WebtestsResource struct { + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for WebtestsResource. +func (wr WebtestsResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wr.Location != nil { + objectMap["location"] = wr.Location + } + if wr.Tags != nil { + objectMap["tags"] = wr.Tags + } + return json.Marshal(objectMap) +} + +// Workbook an Application Insights workbook definition. +type Workbook struct { + autorest.Response `json:"-"` + // WorkbookProperties - Metadata describing a workbook for an Azure resource. + *WorkbookProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` + // Identity - Identity used for BYOS + Identity *WorkbookResourceIdentity `json:"identity,omitempty"` + // Kind - The kind of workbook. Only valid value is shared. Possible values include: 'KindUser', 'KindShared' + Kind Kind `json:"kind,omitempty"` + // Etag - Resource etag + Etag map[string]*string `json:"etag"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Workbook. +func (w Workbook) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if w.WorkbookProperties != nil { + objectMap["properties"] = w.WorkbookProperties + } + if w.Identity != nil { + objectMap["identity"] = w.Identity + } + if w.Kind != "" { + objectMap["kind"] = w.Kind + } + if w.Etag != nil { + objectMap["etag"] = w.Etag + } + if w.Tags != nil { + objectMap["tags"] = w.Tags + } + if w.Location != nil { + objectMap["location"] = w.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Workbook struct. +func (w *Workbook) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var workbookProperties WorkbookProperties + err = json.Unmarshal(*v, &workbookProperties) + if err != nil { + return err + } + w.WorkbookProperties = &workbookProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + w.SystemData = &systemData + } + case "identity": + if v != nil { + var identity WorkbookResourceIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + w.Identity = &identity + } + case "kind": + if v != nil { + var kind Kind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + w.Kind = kind + } + case "etag": + if v != nil { + var etag map[string]*string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + w.Etag = etag + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + w.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + w.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + w.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + w.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + w.Type = &typeVar + } + } + } + + return nil +} + +// WorkbookError error response. +type WorkbookError struct { + // Error - The error details. + Error *WorkbookErrorDefinition `json:"error,omitempty"` +} + +// WorkbookErrorDefinition error definition. +type WorkbookErrorDefinition struct { + // Code - READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; Description of the error. + Message *string `json:"message,omitempty"` + // InnerError - READ-ONLY; Internal error details. + InnerError interface{} `json:"innerError,omitempty"` +} + +// MarshalJSON is the custom marshaler for WorkbookErrorDefinition. +func (wed WorkbookErrorDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// WorkbookInnerErrorTrace error details +type WorkbookInnerErrorTrace struct { + // Trace - READ-ONLY; detailed error trace + Trace *[]string `json:"trace,omitempty"` +} + +// MarshalJSON is the custom marshaler for WorkbookInnerErrorTrace. +func (wiet WorkbookInnerErrorTrace) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// WorkbookProperties properties that contain a workbook. +type WorkbookProperties struct { + // DisplayName - The user-defined name (display name) of the workbook. + DisplayName *string `json:"displayName,omitempty"` + // SerializedData - Configuration of this particular workbook. Configuration data is a string containing valid JSON + SerializedData *string `json:"serializedData,omitempty"` + // Version - Workbook schema version format, like 'Notebook/1.0', which should match the workbook in serializedData + Version *string `json:"version,omitempty"` + // TimeModified - READ-ONLY; Date and time in UTC of the last modification that was made to this workbook definition. + TimeModified *date.Time `json:"timeModified,omitempty"` + // Category - Workbook category, as defined by the user at creation time. + Category *string `json:"category,omitempty"` + // Tags - Being deprecated, please use the other tags field + Tags *[]string `json:"tags,omitempty"` + // UserID - READ-ONLY; Unique user id of the specific user that owns this workbook. + UserID *string `json:"userId,omitempty"` + // SourceID - ResourceId for a source resource. + SourceID *string `json:"sourceId,omitempty"` + // StorageURI - The resourceId to the storage account when bring your own storage is used + StorageURI *string `json:"storageUri,omitempty"` + // Description - The description of the workbook. + Description *string `json:"description,omitempty"` + // Revision - READ-ONLY; The unique revision id for this workbook definition + Revision *string `json:"revision,omitempty"` +} + +// MarshalJSON is the custom marshaler for WorkbookProperties. +func (wp WorkbookProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wp.DisplayName != nil { + objectMap["displayName"] = wp.DisplayName + } + if wp.SerializedData != nil { + objectMap["serializedData"] = wp.SerializedData + } + if wp.Version != nil { + objectMap["version"] = wp.Version + } + if wp.Category != nil { + objectMap["category"] = wp.Category + } + if wp.Tags != nil { + objectMap["tags"] = wp.Tags + } + if wp.SourceID != nil { + objectMap["sourceId"] = wp.SourceID + } + if wp.StorageURI != nil { + objectMap["storageUri"] = wp.StorageURI + } + if wp.Description != nil { + objectMap["description"] = wp.Description + } + return json.Marshal(objectMap) +} + +// WorkbookPropertiesUpdateParameters properties that contain a workbook for PATCH operation. +type WorkbookPropertiesUpdateParameters struct { + // DisplayName - The user-defined name (display name) of the workbook. + DisplayName *string `json:"displayName,omitempty"` + // SerializedData - Configuration of this particular workbook. Configuration data is a string containing valid JSON + SerializedData *string `json:"serializedData,omitempty"` + // Category - Workbook category, as defined by the user at creation time. + Category *string `json:"category,omitempty"` + // Tags - A list of 0 or more tags that are associated with this workbook definition + Tags *[]string `json:"tags,omitempty"` + // Description - The description of the workbook. + Description *string `json:"description,omitempty"` + // Revision - The unique revision id for this workbook definition + Revision *string `json:"revision,omitempty"` +} + +// WorkbookResource an azure resource object +type WorkbookResource struct { + // Identity - Identity used for BYOS + Identity *WorkbookResourceIdentity `json:"identity,omitempty"` + // Kind - The kind of workbook. Only valid value is shared. Possible values include: 'KindUser', 'KindShared' + Kind Kind `json:"kind,omitempty"` + // Etag - Resource etag + Etag map[string]*string `json:"etag"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for WorkbookResource. +func (wr WorkbookResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wr.Identity != nil { + objectMap["identity"] = wr.Identity + } + if wr.Kind != "" { + objectMap["kind"] = wr.Kind + } + if wr.Etag != nil { + objectMap["etag"] = wr.Etag + } + if wr.Tags != nil { + objectMap["tags"] = wr.Tags + } + if wr.Location != nil { + objectMap["location"] = wr.Location + } + return json.Marshal(objectMap) +} + +// WorkbookResourceIdentity identity used for BYOS +type WorkbookResourceIdentity struct { + // PrincipalID - READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. + PrincipalID *uuid.UUID `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *uuid.UUID `json:"tenantId,omitempty"` + // Type - Possible values include: 'ManagedServiceIdentityTypeNone', 'ManagedServiceIdentityTypeSystemAssigned', 'ManagedServiceIdentityTypeUserAssigned', 'ManagedServiceIdentityTypeSystemAssignedUserAssigned' + Type ManagedServiceIdentityType `json:"type,omitempty"` + UserAssignedIdentities map[string]*UserAssignedIdentity `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for WorkbookResourceIdentity. +func (wr WorkbookResourceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wr.Type != "" { + objectMap["type"] = wr.Type + } + if wr.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = wr.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// WorkbooksListResult workbook list result. +type WorkbooksListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; An array of workbooks. + Value *[]Workbook `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for WorkbooksListResult. +func (wlr WorkbooksListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wlr.NextLink != nil { + objectMap["nextLink"] = wlr.NextLink + } + return json.Marshal(objectMap) +} + +// WorkbooksListResultIterator provides access to a complete listing of Workbook values. +type WorkbooksListResultIterator struct { + i int + page WorkbooksListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *WorkbooksListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkbooksListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *WorkbooksListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter WorkbooksListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter WorkbooksListResultIterator) Response() WorkbooksListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter WorkbooksListResultIterator) Value() Workbook { + if !iter.page.NotDone() { + return Workbook{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the WorkbooksListResultIterator type. +func NewWorkbooksListResultIterator(page WorkbooksListResultPage) WorkbooksListResultIterator { + return WorkbooksListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (wlr WorkbooksListResult) IsEmpty() bool { + return wlr.Value == nil || len(*wlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (wlr WorkbooksListResult) hasNextLink() bool { + return wlr.NextLink != nil && len(*wlr.NextLink) != 0 +} + +// workbooksListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (wlr WorkbooksListResult) workbooksListResultPreparer(ctx context.Context) (*http.Request, error) { + if !wlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(wlr.NextLink))) +} + +// WorkbooksListResultPage contains a page of Workbook values. +type WorkbooksListResultPage struct { + fn func(context.Context, WorkbooksListResult) (WorkbooksListResult, error) + wlr WorkbooksListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *WorkbooksListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkbooksListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.wlr) + if err != nil { + return err + } + page.wlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *WorkbooksListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page WorkbooksListResultPage) NotDone() bool { + return !page.wlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page WorkbooksListResultPage) Response() WorkbooksListResult { + return page.wlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page WorkbooksListResultPage) Values() []Workbook { + if page.wlr.IsEmpty() { + return nil + } + return *page.wlr.Value +} + +// Creates a new instance of the WorkbooksListResultPage type. +func NewWorkbooksListResultPage(cur WorkbooksListResult, getNextPage func(context.Context, WorkbooksListResult) (WorkbooksListResult, error)) WorkbooksListResultPage { + return WorkbooksListResultPage{ + fn: getNextPage, + wlr: cur, + } +} + +// WorkbookTemplate an Application Insights workbook template definition. +type WorkbookTemplate struct { + autorest.Response `json:"-"` + // WorkbookTemplateProperties - Metadata describing a workbook template for an Azure resource. + *WorkbookTemplateProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for WorkbookTemplate. +func (wt WorkbookTemplate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wt.WorkbookTemplateProperties != nil { + objectMap["properties"] = wt.WorkbookTemplateProperties + } + if wt.Location != nil { + objectMap["location"] = wt.Location + } + if wt.Tags != nil { + objectMap["tags"] = wt.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for WorkbookTemplate struct. +func (wt *WorkbookTemplate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var workbookTemplateProperties WorkbookTemplateProperties + err = json.Unmarshal(*v, &workbookTemplateProperties) + if err != nil { + return err + } + wt.WorkbookTemplateProperties = &workbookTemplateProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + wt.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + wt.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + wt.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + wt.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + wt.Tags = tags + } + } + } + + return nil +} + +// WorkbookTemplateError error message that will indicate why the operation failed. +type WorkbookTemplateError struct { + // Error - Error message object that will indicate why the operation failed. + Error *WorkbookTemplateErrorBody `json:"error,omitempty"` +} + +// WorkbookTemplateErrorBody error message body that will indicate why the operation failed. +type WorkbookTemplateErrorBody struct { + // Code - Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response. + Code *string `json:"code,omitempty"` + // Message - Human-readable representation of the error. + Message *string `json:"message,omitempty"` + // Details - The list of invalid fields send in request, in case of validation error. + Details *[]WorkbookTemplateErrorFieldContract `json:"details,omitempty"` +} + +// WorkbookTemplateErrorFieldContract error Field contract. +type WorkbookTemplateErrorFieldContract struct { + // Code - Property level error code. + Code *string `json:"code,omitempty"` + // Message - Human-readable representation of property-level error. + Message *string `json:"message,omitempty"` + // Target - Property name. + Target *string `json:"target,omitempty"` +} + +// WorkbookTemplateGallery gallery information for a workbook template. +type WorkbookTemplateGallery struct { + // Name - Name of the workbook template in the gallery. + Name *string `json:"name,omitempty"` + // Category - Category for the gallery. + Category *string `json:"category,omitempty"` + // Type - Type of workbook supported by the workbook template. + Type *string `json:"type,omitempty"` + // Order - Order of the template within the gallery. + Order *int32 `json:"order,omitempty"` + // ResourceType - Azure resource type supported by the gallery. + ResourceType *string `json:"resourceType,omitempty"` +} + +// WorkbookTemplateLocalizedGallery localized template data and gallery information. +type WorkbookTemplateLocalizedGallery struct { + // TemplateData - Valid JSON object containing workbook template payload. + TemplateData interface{} `json:"templateData,omitempty"` + // Galleries - Workbook galleries supported by the template. + Galleries *[]WorkbookTemplateGallery `json:"galleries,omitempty"` +} + +// WorkbookTemplateProperties properties that contain a workbook template. +type WorkbookTemplateProperties struct { + // Priority - Priority of the template. Determines which template to open when a workbook gallery is opened in viewer mode. + Priority *int32 `json:"priority,omitempty"` + // Author - Information about the author of the workbook template. + Author *string `json:"author,omitempty"` + // TemplateData - Valid JSON object containing workbook template payload. + TemplateData interface{} `json:"templateData,omitempty"` + // Galleries - Workbook galleries supported by the template. + Galleries *[]WorkbookTemplateGallery `json:"galleries,omitempty"` + // Localized - Key value pair of localized gallery. Each key is the locale code of languages supported by the Azure portal. + Localized map[string][]WorkbookTemplateLocalizedGallery `json:"localized"` +} + +// MarshalJSON is the custom marshaler for WorkbookTemplateProperties. +func (wtp WorkbookTemplateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wtp.Priority != nil { + objectMap["priority"] = wtp.Priority + } + if wtp.Author != nil { + objectMap["author"] = wtp.Author + } + if wtp.TemplateData != nil { + objectMap["templateData"] = wtp.TemplateData + } + if wtp.Galleries != nil { + objectMap["galleries"] = wtp.Galleries + } + if wtp.Localized != nil { + objectMap["localized"] = wtp.Localized + } + return json.Marshal(objectMap) +} + +// WorkbookTemplateResource an azure resource object +type WorkbookTemplateResource struct { + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for WorkbookTemplateResource. +func (wtr WorkbookTemplateResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wtr.Location != nil { + objectMap["location"] = wtr.Location + } + if wtr.Tags != nil { + objectMap["tags"] = wtr.Tags + } + return json.Marshal(objectMap) +} + +// WorkbookTemplatesListResult workbookTemplate list result. +type WorkbookTemplatesListResult struct { + autorest.Response `json:"-"` + // Value - An array of workbook templates. + Value *[]WorkbookTemplate `json:"value,omitempty"` +} + +// WorkbookTemplateUpdateParameters the parameters that can be provided when updating workbook template. +type WorkbookTemplateUpdateParameters struct { + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // WorkbookTemplateProperties - Metadata describing a workbook for an Azure resource. + *WorkbookTemplateProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for WorkbookTemplateUpdateParameters. +func (wtup WorkbookTemplateUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wtup.Tags != nil { + objectMap["tags"] = wtup.Tags + } + if wtup.WorkbookTemplateProperties != nil { + objectMap["properties"] = wtup.WorkbookTemplateProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for WorkbookTemplateUpdateParameters struct. +func (wtup *WorkbookTemplateUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + wtup.Tags = tags + } + case "properties": + if v != nil { + var workbookTemplateProperties WorkbookTemplateProperties + err = json.Unmarshal(*v, &workbookTemplateProperties) + if err != nil { + return err + } + wtup.WorkbookTemplateProperties = &workbookTemplateProperties + } + } + } + + return nil +} + +// WorkbookUpdateParameters the parameters that can be provided when updating workbook properties +// properties. +type WorkbookUpdateParameters struct { + // Kind - The kind of workbook. Only valid value is shared. Possible values include: 'SharedTypeKindUser', 'SharedTypeKindShared' + Kind SharedTypeKind `json:"kind,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // WorkbookPropertiesUpdateParameters - Metadata describing a workbook for an Azure resource. + *WorkbookPropertiesUpdateParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for WorkbookUpdateParameters. +func (wup WorkbookUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wup.Kind != "" { + objectMap["kind"] = wup.Kind + } + if wup.Tags != nil { + objectMap["tags"] = wup.Tags + } + if wup.WorkbookPropertiesUpdateParameters != nil { + objectMap["properties"] = wup.WorkbookPropertiesUpdateParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for WorkbookUpdateParameters struct. +func (wup *WorkbookUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "kind": + if v != nil { + var kind SharedTypeKind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + wup.Kind = kind + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + wup.Tags = tags + } + case "properties": + if v != nil { + var workbookPropertiesUpdateParameters WorkbookPropertiesUpdateParameters + err = json.Unmarshal(*v, &workbookPropertiesUpdateParameters) + if err != nil { + return err + } + wup.WorkbookPropertiesUpdateParameters = &workbookPropertiesUpdateParameters + } + } + } + + return nil +} + +// WorkItemConfiguration work item configuration associated with an application insights resource. +type WorkItemConfiguration struct { + autorest.Response `json:"-"` + // ConnectorID - Connector identifier where work item is created + ConnectorID *string `json:"ConnectorId,omitempty"` + // ConfigDisplayName - Configuration friendly name + ConfigDisplayName *string `json:"ConfigDisplayName,omitempty"` + // IsDefault - Boolean value indicating whether configuration is default + IsDefault *bool `json:"IsDefault,omitempty"` + // ID - Unique Id for work item + ID *string `json:"Id,omitempty"` + // ConfigProperties - Serialized JSON object for detailed properties + ConfigProperties *string `json:"ConfigProperties,omitempty"` +} + +// WorkItemConfigurationError error associated with trying to get work item configuration or configurations +type WorkItemConfigurationError struct { + // Code - Error detail code and explanation + Code *string `json:"code,omitempty"` + // Message - Error message + Message *string `json:"message,omitempty"` + Innererror *InnerError `json:"innererror,omitempty"` +} + +// WorkItemConfigurationsListResult work item configuration list result. +type WorkItemConfigurationsListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; An array of work item configurations. + Value *[]WorkItemConfiguration `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for WorkItemConfigurationsListResult. +func (wiclr WorkItemConfigurationsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// WorkItemCreateConfiguration work item configuration creation payload +type WorkItemCreateConfiguration struct { + // ConnectorID - Unique connector id + ConnectorID *string `json:"ConnectorId,omitempty"` + // ConnectorDataConfiguration - Serialized JSON object for detailed properties + ConnectorDataConfiguration *string `json:"ConnectorDataConfiguration,omitempty"` + // ValidateOnly - Boolean indicating validate only + ValidateOnly *bool `json:"ValidateOnly,omitempty"` + // WorkItemProperties - Custom work item properties + WorkItemProperties map[string]*string `json:"WorkItemProperties"` +} + +// MarshalJSON is the custom marshaler for WorkItemCreateConfiguration. +func (wicc WorkItemCreateConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wicc.ConnectorID != nil { + objectMap["ConnectorId"] = wicc.ConnectorID + } + if wicc.ConnectorDataConfiguration != nil { + objectMap["ConnectorDataConfiguration"] = wicc.ConnectorDataConfiguration + } + if wicc.ValidateOnly != nil { + objectMap["ValidateOnly"] = wicc.ValidateOnly + } + if wicc.WorkItemProperties != nil { + objectMap["WorkItemProperties"] = wicc.WorkItemProperties + } + return json.Marshal(objectMap) +} diff --git a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/myworkbooks.go b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/myworkbooks.go new file mode 100644 index 000000000000..88b3aeaac28b --- /dev/null +++ b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/myworkbooks.go @@ -0,0 +1,664 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// MyWorkbooksClient is the composite Swagger for Application Insights Management Client +type MyWorkbooksClient struct { + BaseClient +} + +// NewMyWorkbooksClient creates an instance of the MyWorkbooksClient client. +func NewMyWorkbooksClient(subscriptionID string) MyWorkbooksClient { + return NewMyWorkbooksClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMyWorkbooksClientWithBaseURI creates an instance of the MyWorkbooksClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewMyWorkbooksClientWithBaseURI(baseURI string, subscriptionID string) MyWorkbooksClient { + return MyWorkbooksClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new private workbook. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// workbookProperties - properties that need to be specified to create a new private workbook. +// sourceID - azure Resource Id that will fetch all linked workbooks. +func (client MyWorkbooksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties MyWorkbook, sourceID string) (result MyWorkbook, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MyWorkbooksClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workbookProperties, + Constraints: []validation.Constraint{{Target: "workbookProperties.MyWorkbookProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "workbookProperties.MyWorkbookProperties.DisplayName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "workbookProperties.MyWorkbookProperties.SerializedData", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "workbookProperties.MyWorkbookProperties.Category", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("insights.MyWorkbooksClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, workbookProperties, sourceID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client MyWorkbooksClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties MyWorkbook, sourceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-08" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(sourceID) > 0 { + queryParameters["sourceId"] = autorest.Encode("query", sourceID) + } + + workbookProperties.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}", pathParameters), + autorest.WithJSON(workbookProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client MyWorkbooksClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client MyWorkbooksClient) CreateOrUpdateResponder(resp *http.Response) (result MyWorkbook, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a private workbook. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client MyWorkbooksClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MyWorkbooksClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MyWorkbooksClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client MyWorkbooksClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-08" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client MyWorkbooksClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client MyWorkbooksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a single private workbook by its resourceName. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client MyWorkbooksClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result MyWorkbook, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MyWorkbooksClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MyWorkbooksClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client MyWorkbooksClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-08" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client MyWorkbooksClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client MyWorkbooksClient) GetResponder(resp *http.Response) (result MyWorkbook, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup get all private workbooks defined within a specified resource group and category. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// category - category of workbook to return. +// tags - tags presents on each workbook returned. +// sourceID - azure Resource Id that will fetch all linked workbooks. +// canFetchContent - flag indicating whether or not to return the full content for each applicable workbook. If +// false, only return summary content for workbooks. +func (client MyWorkbooksClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, category CategoryType, tags []string, sourceID string, canFetchContent *bool) (result MyWorkbooksListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MyWorkbooksClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.mwlr.Response.Response != nil { + sc = result.mwlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MyWorkbooksClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, category, tags, sourceID, canFetchContent) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.mwlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.mwlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.mwlr.hasNextLink() && result.mwlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client MyWorkbooksClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, category CategoryType, tags []string, sourceID string, canFetchContent *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-08" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "category": autorest.Encode("query", category), + } + if tags != nil && len(tags) > 0 { + queryParameters["tags"] = autorest.Encode("query", tags, ",") + } + if len(sourceID) > 0 { + queryParameters["sourceId"] = autorest.Encode("query", sourceID) + } + if canFetchContent != nil { + queryParameters["canFetchContent"] = autorest.Encode("query", *canFetchContent) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client MyWorkbooksClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client MyWorkbooksClient) ListByResourceGroupResponder(resp *http.Response) (result MyWorkbooksListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client MyWorkbooksClient) listByResourceGroupNextResults(ctx context.Context, lastResults MyWorkbooksListResult) (result MyWorkbooksListResult, err error) { + req, err := lastResults.myWorkbooksListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client MyWorkbooksClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, category CategoryType, tags []string, sourceID string, canFetchContent *bool) (result MyWorkbooksListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MyWorkbooksClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, category, tags, sourceID, canFetchContent) + return +} + +// ListBySubscription get all private workbooks defined within a specified subscription and category. +// Parameters: +// category - category of workbook to return. +// tags - tags presents on each workbook returned. +// canFetchContent - flag indicating whether or not to return the full content for each applicable workbook. If +// false, only return summary content for workbooks. +func (client MyWorkbooksClient) ListBySubscription(ctx context.Context, category CategoryType, tags []string, canFetchContent *bool) (result MyWorkbooksListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MyWorkbooksClient.ListBySubscription") + defer func() { + sc := -1 + if result.mwlr.Response.Response != nil { + sc = result.mwlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MyWorkbooksClient", "ListBySubscription", err.Error()) + } + + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx, category, tags, canFetchContent) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.mwlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.mwlr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.mwlr.hasNextLink() && result.mwlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client MyWorkbooksClient) ListBySubscriptionPreparer(ctx context.Context, category CategoryType, tags []string, canFetchContent *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-08" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "category": autorest.Encode("query", category), + } + if tags != nil && len(tags) > 0 { + queryParameters["tags"] = autorest.Encode("query", tags, ",") + } + if canFetchContent != nil { + queryParameters["canFetchContent"] = autorest.Encode("query", *canFetchContent) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/myWorkbooks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client MyWorkbooksClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client MyWorkbooksClient) ListBySubscriptionResponder(resp *http.Response) (result MyWorkbooksListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client MyWorkbooksClient) listBySubscriptionNextResults(ctx context.Context, lastResults MyWorkbooksListResult) (result MyWorkbooksListResult, err error) { + req, err := lastResults.myWorkbooksListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client MyWorkbooksClient) ListBySubscriptionComplete(ctx context.Context, category CategoryType, tags []string, canFetchContent *bool) (result MyWorkbooksListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MyWorkbooksClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx, category, tags, canFetchContent) + return +} + +// Update updates a private workbook that has already been added. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// workbookProperties - properties that need to be specified to create a new private workbook. +// sourceID - azure Resource Id that will fetch all linked workbooks. +func (client MyWorkbooksClient) Update(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties MyWorkbook, sourceID string) (result MyWorkbook, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MyWorkbooksClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MyWorkbooksClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, workbookProperties, sourceID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client MyWorkbooksClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties MyWorkbook, sourceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-08" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(sourceID) > 0 { + queryParameters["sourceId"] = autorest.Encode("query", sourceID) + } + + workbookProperties.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}", pathParameters), + autorest.WithJSON(workbookProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client MyWorkbooksClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client MyWorkbooksClient) UpdateResponder(resp *http.Response) (result MyWorkbook, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/operations.go b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/operations.go new file mode 100644 index 000000000000..b7459628872f --- /dev/null +++ b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/operations.go @@ -0,0 +1,140 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the composite Swagger for Application Insights Management Client +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available insights REST API operations. +func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.olr.Response.Response != nil { + sc = result.olr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.olr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.olr.hasNextLink() && result.olr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Insights/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.operationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "insights.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/proactivedetectionconfigurations.go b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/proactivedetectionconfigurations.go new file mode 100644 index 000000000000..78223d23395b --- /dev/null +++ b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/proactivedetectionconfigurations.go @@ -0,0 +1,298 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ProactiveDetectionConfigurationsClient is the composite Swagger for Application Insights Management Client +type ProactiveDetectionConfigurationsClient struct { + BaseClient +} + +// NewProactiveDetectionConfigurationsClient creates an instance of the ProactiveDetectionConfigurationsClient client. +func NewProactiveDetectionConfigurationsClient(subscriptionID string) ProactiveDetectionConfigurationsClient { + return NewProactiveDetectionConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProactiveDetectionConfigurationsClientWithBaseURI creates an instance of the +// ProactiveDetectionConfigurationsClient client using a custom endpoint. Use this when interacting with an Azure +// cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewProactiveDetectionConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) ProactiveDetectionConfigurationsClient { + return ProactiveDetectionConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get the ProactiveDetection configuration for this configuration id. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// configurationID - the ProactiveDetection configuration ID. This is unique within a Application Insights +// component. +func (client ProactiveDetectionConfigurationsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, configurationID string) (result ApplicationInsightsComponentProactiveDetectionConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProactiveDetectionConfigurationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ProactiveDetectionConfigurationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, configurationID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ProactiveDetectionConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ProactiveDetectionConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ProactiveDetectionConfigurationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ProactiveDetectionConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, configurationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ConfigurationId": autorest.Encode("path", configurationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ProactiveDetectionConfigs/{ConfigurationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ProactiveDetectionConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ProactiveDetectionConfigurationsClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentProactiveDetectionConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of ProactiveDetection configurations of an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client ProactiveDetectionConfigurationsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result ListApplicationInsightsComponentProactiveDetectionConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProactiveDetectionConfigurationsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ProactiveDetectionConfigurationsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ProactiveDetectionConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ProactiveDetectionConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ProactiveDetectionConfigurationsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ProactiveDetectionConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ProactiveDetectionConfigs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ProactiveDetectionConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ProactiveDetectionConfigurationsClient) ListResponder(resp *http.Response) (result ListApplicationInsightsComponentProactiveDetectionConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update update the ProactiveDetection configuration for this configuration id. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// configurationID - the ProactiveDetection configuration ID. This is unique within a Application Insights +// component. +// proactiveDetectionProperties - properties that need to be specified to update the ProactiveDetection +// configuration. +func (client ProactiveDetectionConfigurationsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, configurationID string, proactiveDetectionProperties ApplicationInsightsComponentProactiveDetectionConfiguration) (result ApplicationInsightsComponentProactiveDetectionConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProactiveDetectionConfigurationsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ProactiveDetectionConfigurationsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, configurationID, proactiveDetectionProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ProactiveDetectionConfigurationsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ProactiveDetectionConfigurationsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ProactiveDetectionConfigurationsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ProactiveDetectionConfigurationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, configurationID string, proactiveDetectionProperties ApplicationInsightsComponentProactiveDetectionConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ConfigurationId": autorest.Encode("path", configurationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ProactiveDetectionConfigs/{ConfigurationId}", pathParameters), + autorest.WithJSON(proactiveDetectionProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ProactiveDetectionConfigurationsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ProactiveDetectionConfigurationsClient) UpdateResponder(resp *http.Response) (result ApplicationInsightsComponentProactiveDetectionConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/version.go b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/version.go new file mode 100644 index 000000000000..5cdc653a9cbb --- /dev/null +++ b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/version.go @@ -0,0 +1,19 @@ +package insights + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights 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. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " insights/2022-02-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/webtestlocations.go b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/webtestlocations.go new file mode 100644 index 000000000000..dcb3923ba146 --- /dev/null +++ b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/webtestlocations.go @@ -0,0 +1,118 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// WebTestLocationsClient is the composite Swagger for Application Insights Management Client +type WebTestLocationsClient struct { + BaseClient +} + +// NewWebTestLocationsClient creates an instance of the WebTestLocationsClient client. +func NewWebTestLocationsClient(subscriptionID string) WebTestLocationsClient { + return NewWebTestLocationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWebTestLocationsClientWithBaseURI creates an instance of the WebTestLocationsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewWebTestLocationsClientWithBaseURI(baseURI string, subscriptionID string) WebTestLocationsClient { + return WebTestLocationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets a list of web test locations available to this Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client WebTestLocationsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result ApplicationInsightsWebTestLocationsListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebTestLocationsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WebTestLocationsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestLocationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WebTestLocationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestLocationsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client WebTestLocationsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/syntheticmonitorlocations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client WebTestLocationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client WebTestLocationsClient) ListResponder(resp *http.Response) (result ApplicationInsightsWebTestLocationsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/webtests.go b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/webtests.go new file mode 100644 index 000000000000..cb9450fdee91 --- /dev/null +++ b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/webtests.go @@ -0,0 +1,755 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// WebTestsClient is the composite Swagger for Application Insights Management Client +type WebTestsClient struct { + BaseClient +} + +// NewWebTestsClient creates an instance of the WebTestsClient client. +func NewWebTestsClient(subscriptionID string) WebTestsClient { + return NewWebTestsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWebTestsClientWithBaseURI creates an instance of the WebTestsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWebTestsClientWithBaseURI(baseURI string, subscriptionID string) WebTestsClient { + return WebTestsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an Application Insights web test definition. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// webTestName - the name of the Application Insights webtest resource. +// webTestDefinition - properties that need to be specified to create or update an Application Insights web +// test definition. +func (client WebTestsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, webTestName string, webTestDefinition WebTest) (result WebTest, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebTestsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: webTestDefinition, + Constraints: []validation.Constraint{{Target: "webTestDefinition.WebTestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "webTestDefinition.WebTestProperties.SyntheticMonitorID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "webTestDefinition.WebTestProperties.WebTestName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "webTestDefinition.WebTestProperties.Locations", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("insights.WebTestsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, webTestName, webTestDefinition) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client WebTestsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, webTestName string, webTestDefinition WebTest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webTestName": autorest.Encode("path", webTestName), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", pathParameters), + autorest.WithJSON(webTestDefinition), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client WebTestsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client WebTestsClient) CreateOrUpdateResponder(resp *http.Response) (result WebTest, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an Application Insights web test. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// webTestName - the name of the Application Insights webtest resource. +func (client WebTestsClient) Delete(ctx context.Context, resourceGroupName string, webTestName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebTestsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WebTestsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, webTestName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client WebTestsClient) DeletePreparer(ctx context.Context, resourceGroupName string, webTestName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webTestName": autorest.Encode("path", webTestName), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client WebTestsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client WebTestsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a specific Application Insights web test definition. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// webTestName - the name of the Application Insights webtest resource. +func (client WebTestsClient) Get(ctx context.Context, resourceGroupName string, webTestName string) (result WebTest, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebTestsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WebTestsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, webTestName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client WebTestsClient) GetPreparer(ctx context.Context, resourceGroupName string, webTestName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webTestName": autorest.Encode("path", webTestName), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client WebTestsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client WebTestsClient) GetResponder(resp *http.Response) (result WebTest, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get all Application Insights web test alerts definitions within a subscription. +func (client WebTestsClient) List(ctx context.Context) (result WebTestListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebTestsClient.List") + defer func() { + sc := -1 + if result.wtlr.Response.Response != nil { + sc = result.wtlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WebTestsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.wtlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "List", resp, "Failure sending request") + return + } + + result.wtlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "List", resp, "Failure responding to request") + return + } + if result.wtlr.hasNextLink() && result.wtlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client WebTestsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/webtests", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client WebTestsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client WebTestsClient) ListResponder(resp *http.Response) (result WebTestListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client WebTestsClient) listNextResults(ctx context.Context, lastResults WebTestListResult) (result WebTestListResult, err error) { + req, err := lastResults.webTestListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.WebTestsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "insights.WebTestsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client WebTestsClient) ListComplete(ctx context.Context) (result WebTestListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebTestsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByComponent get all Application Insights web tests defined for the specified component. +// Parameters: +// componentName - the name of the Application Insights component resource. +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client WebTestsClient) ListByComponent(ctx context.Context, componentName string, resourceGroupName string) (result WebTestListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebTestsClient.ListByComponent") + defer func() { + sc := -1 + if result.wtlr.Response.Response != nil { + sc = result.wtlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WebTestsClient", "ListByComponent", err.Error()) + } + + result.fn = client.listByComponentNextResults + req, err := client.ListByComponentPreparer(ctx, componentName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "ListByComponent", nil, "Failure preparing request") + return + } + + resp, err := client.ListByComponentSender(req) + if err != nil { + result.wtlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "ListByComponent", resp, "Failure sending request") + return + } + + result.wtlr, err = client.ListByComponentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "ListByComponent", resp, "Failure responding to request") + return + } + if result.wtlr.hasNextLink() && result.wtlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByComponentPreparer prepares the ListByComponent request. +func (client WebTestsClient) ListByComponentPreparer(ctx context.Context, componentName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "componentName": autorest.Encode("path", componentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{componentName}/webtests", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByComponentSender sends the ListByComponent request. The method will close the +// http.Response Body if it receives an error. +func (client WebTestsClient) ListByComponentSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByComponentResponder handles the response to the ListByComponent request. The method always +// closes the http.Response Body. +func (client WebTestsClient) ListByComponentResponder(resp *http.Response) (result WebTestListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByComponentNextResults retrieves the next set of results, if any. +func (client WebTestsClient) listByComponentNextResults(ctx context.Context, lastResults WebTestListResult) (result WebTestListResult, err error) { + req, err := lastResults.webTestListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.WebTestsClient", "listByComponentNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByComponentSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "insights.WebTestsClient", "listByComponentNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByComponentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "listByComponentNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByComponentComplete enumerates all values, automatically crossing page boundaries as required. +func (client WebTestsClient) ListByComponentComplete(ctx context.Context, componentName string, resourceGroupName string) (result WebTestListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebTestsClient.ListByComponent") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByComponent(ctx, componentName, resourceGroupName) + return +} + +// ListByResourceGroup get all Application Insights web tests defined within a specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client WebTestsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result WebTestListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebTestsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.wtlr.Response.Response != nil { + sc = result.wtlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WebTestsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.wtlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.wtlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.wtlr.hasNextLink() && result.wtlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client WebTestsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client WebTestsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client WebTestsClient) ListByResourceGroupResponder(resp *http.Response) (result WebTestListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client WebTestsClient) listByResourceGroupNextResults(ctx context.Context, lastResults WebTestListResult) (result WebTestListResult, err error) { + req, err := lastResults.webTestListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.WebTestsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "insights.WebTestsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client WebTestsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result WebTestListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebTestsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// UpdateTags creates or updates an Application Insights web test definition. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// webTestName - the name of the Application Insights webtest resource. +// webTestTags - updated tag information to set into the web test instance. +func (client WebTestsClient) UpdateTags(ctx context.Context, resourceGroupName string, webTestName string, webTestTags TagsResource) (result WebTest, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebTestsClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WebTestsClient", "UpdateTags", err.Error()) + } + + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, webTestName, webTestTags) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client WebTestsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, webTestName string, webTestTags TagsResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webTestName": autorest.Encode("path", webTestName), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", pathParameters), + autorest.WithJSON(webTestTags), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client WebTestsClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client WebTestsClient) UpdateTagsResponder(resp *http.Response) (result WebTest, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/workbooks.go b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/workbooks.go new file mode 100644 index 000000000000..6c3e55d8662e --- /dev/null +++ b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/workbooks.go @@ -0,0 +1,885 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// WorkbooksClient is the composite Swagger for Application Insights Management Client +type WorkbooksClient struct { + BaseClient +} + +// NewWorkbooksClient creates an instance of the WorkbooksClient client. +func NewWorkbooksClient(subscriptionID string) WorkbooksClient { + return NewWorkbooksClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWorkbooksClientWithBaseURI creates an instance of the WorkbooksClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWorkbooksClientWithBaseURI(baseURI string, subscriptionID string) WorkbooksClient { + return WorkbooksClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new workbook. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// workbookProperties - properties that need to be specified to create a new workbook. +// sourceID - azure Resource Id that will fetch all linked workbooks. +func (client WorkbooksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties Workbook, sourceID string) (result Workbook, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkbooksClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workbookProperties, + Constraints: []validation.Constraint{{Target: "workbookProperties.WorkbookProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "workbookProperties.WorkbookProperties.DisplayName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "workbookProperties.WorkbookProperties.SerializedData", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "workbookProperties.WorkbookProperties.Category", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("insights.WorkbooksClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, workbookProperties, sourceID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client WorkbooksClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties Workbook, sourceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(sourceID) > 0 { + queryParameters["sourceId"] = autorest.Encode("query", sourceID) + } + + workbookProperties.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}", pathParameters), + autorest.WithJSON(workbookProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client WorkbooksClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client WorkbooksClient) CreateOrUpdateResponder(resp *http.Response) (result Workbook, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a workbook. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client WorkbooksClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkbooksClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WorkbooksClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client WorkbooksClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client WorkbooksClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client WorkbooksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a single workbook by its resourceName. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// canFetchContent - flag indicating whether or not to return the full content for each applicable workbook. If +// false, only return summary content for workbooks. +func (client WorkbooksClient) Get(ctx context.Context, resourceGroupName string, resourceName string, canFetchContent *bool) (result Workbook, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkbooksClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WorkbooksClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, canFetchContent) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client WorkbooksClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, canFetchContent *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if canFetchContent != nil { + queryParameters["canFetchContent"] = autorest.Encode("query", *canFetchContent) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client WorkbooksClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client WorkbooksClient) GetResponder(resp *http.Response) (result Workbook, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup get all Workbooks defined within a specified resource group and category. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// category - category of workbook to return. +// tags - tags presents on each workbook returned. +// sourceID - azure Resource Id that will fetch all linked workbooks. +// canFetchContent - flag indicating whether or not to return the full content for each applicable workbook. If +// false, only return summary content for workbooks. +func (client WorkbooksClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, category CategoryType, tags []string, sourceID string, canFetchContent *bool) (result WorkbooksListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkbooksClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.wlr.Response.Response != nil { + sc = result.wlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WorkbooksClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, category, tags, sourceID, canFetchContent) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.wlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.wlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.wlr.hasNextLink() && result.wlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client WorkbooksClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, category CategoryType, tags []string, sourceID string, canFetchContent *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "category": autorest.Encode("query", category), + } + if tags != nil && len(tags) > 0 { + queryParameters["tags"] = autorest.Encode("query", tags, ",") + } + if len(sourceID) > 0 { + queryParameters["sourceId"] = autorest.Encode("query", sourceID) + } + if canFetchContent != nil { + queryParameters["canFetchContent"] = autorest.Encode("query", *canFetchContent) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client WorkbooksClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client WorkbooksClient) ListByResourceGroupResponder(resp *http.Response) (result WorkbooksListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client WorkbooksClient) listByResourceGroupNextResults(ctx context.Context, lastResults WorkbooksListResult) (result WorkbooksListResult, err error) { + req, err := lastResults.workbooksListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.WorkbooksClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "insights.WorkbooksClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client WorkbooksClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, category CategoryType, tags []string, sourceID string, canFetchContent *bool) (result WorkbooksListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkbooksClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, category, tags, sourceID, canFetchContent) + return +} + +// ListBySubscription get all Workbooks defined within a specified subscription and category. +// Parameters: +// category - category of workbook to return. +// tags - tags presents on each workbook returned. +// canFetchContent - flag indicating whether or not to return the full content for each applicable workbook. If +// false, only return summary content for workbooks. +func (client WorkbooksClient) ListBySubscription(ctx context.Context, category CategoryType, tags []string, canFetchContent *bool) (result WorkbooksListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkbooksClient.ListBySubscription") + defer func() { + sc := -1 + if result.wlr.Response.Response != nil { + sc = result.wlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WorkbooksClient", "ListBySubscription", err.Error()) + } + + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx, category, tags, canFetchContent) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.wlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.wlr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.wlr.hasNextLink() && result.wlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client WorkbooksClient) ListBySubscriptionPreparer(ctx context.Context, category CategoryType, tags []string, canFetchContent *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "category": autorest.Encode("query", category), + } + if tags != nil && len(tags) > 0 { + queryParameters["tags"] = autorest.Encode("query", tags, ",") + } + if canFetchContent != nil { + queryParameters["canFetchContent"] = autorest.Encode("query", *canFetchContent) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/workbooks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client WorkbooksClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client WorkbooksClient) ListBySubscriptionResponder(resp *http.Response) (result WorkbooksListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client WorkbooksClient) listBySubscriptionNextResults(ctx context.Context, lastResults WorkbooksListResult) (result WorkbooksListResult, err error) { + req, err := lastResults.workbooksListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.WorkbooksClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "insights.WorkbooksClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client WorkbooksClient) ListBySubscriptionComplete(ctx context.Context, category CategoryType, tags []string, canFetchContent *bool) (result WorkbooksListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkbooksClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx, category, tags, canFetchContent) + return +} + +// RevisionGet get a single workbook revision defined by its revisionId. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// revisionID - the id of the workbook's revision. +func (client WorkbooksClient) RevisionGet(ctx context.Context, resourceGroupName string, resourceName string, revisionID string) (result Workbook, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkbooksClient.RevisionGet") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WorkbooksClient", "RevisionGet", err.Error()) + } + + req, err := client.RevisionGetPreparer(ctx, resourceGroupName, resourceName, revisionID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "RevisionGet", nil, "Failure preparing request") + return + } + + resp, err := client.RevisionGetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "RevisionGet", resp, "Failure sending request") + return + } + + result, err = client.RevisionGetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "RevisionGet", resp, "Failure responding to request") + return + } + + return +} + +// RevisionGetPreparer prepares the RevisionGet request. +func (client WorkbooksClient) RevisionGetPreparer(ctx context.Context, resourceGroupName string, resourceName string, revisionID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "revisionId": autorest.Encode("path", revisionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}/revisions/{revisionId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RevisionGetSender sends the RevisionGet request. The method will close the +// http.Response Body if it receives an error. +func (client WorkbooksClient) RevisionGetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RevisionGetResponder handles the response to the RevisionGet request. The method always +// closes the http.Response Body. +func (client WorkbooksClient) RevisionGetResponder(resp *http.Response) (result Workbook, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RevisionsList get the revisions for the workbook defined by its resourceName. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client WorkbooksClient) RevisionsList(ctx context.Context, resourceGroupName string, resourceName string) (result WorkbooksListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkbooksClient.RevisionsList") + defer func() { + sc := -1 + if result.wlr.Response.Response != nil { + sc = result.wlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WorkbooksClient", "RevisionsList", err.Error()) + } + + result.fn = client.revisionsListNextResults + req, err := client.RevisionsListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "RevisionsList", nil, "Failure preparing request") + return + } + + resp, err := client.RevisionsListSender(req) + if err != nil { + result.wlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "RevisionsList", resp, "Failure sending request") + return + } + + result.wlr, err = client.RevisionsListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "RevisionsList", resp, "Failure responding to request") + return + } + if result.wlr.hasNextLink() && result.wlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// RevisionsListPreparer prepares the RevisionsList request. +func (client WorkbooksClient) RevisionsListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}/revisions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RevisionsListSender sends the RevisionsList request. The method will close the +// http.Response Body if it receives an error. +func (client WorkbooksClient) RevisionsListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RevisionsListResponder handles the response to the RevisionsList request. The method always +// closes the http.Response Body. +func (client WorkbooksClient) RevisionsListResponder(resp *http.Response) (result WorkbooksListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// revisionsListNextResults retrieves the next set of results, if any. +func (client WorkbooksClient) revisionsListNextResults(ctx context.Context, lastResults WorkbooksListResult) (result WorkbooksListResult, err error) { + req, err := lastResults.workbooksListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.WorkbooksClient", "revisionsListNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.RevisionsListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "insights.WorkbooksClient", "revisionsListNextResults", resp, "Failure sending next results request") + } + result, err = client.RevisionsListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "revisionsListNextResults", resp, "Failure responding to next results request") + } + return +} + +// RevisionsListComplete enumerates all values, automatically crossing page boundaries as required. +func (client WorkbooksClient) RevisionsListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result WorkbooksListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkbooksClient.RevisionsList") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.RevisionsList(ctx, resourceGroupName, resourceName) + return +} + +// Update updates a workbook that has already been added. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// sourceID - azure Resource Id that will fetch all linked workbooks. +// workbookUpdateParameters - properties that need to be specified to create a new workbook. +func (client WorkbooksClient) Update(ctx context.Context, resourceGroupName string, resourceName string, sourceID string, workbookUpdateParameters *WorkbookUpdateParameters) (result Workbook, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkbooksClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WorkbooksClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, sourceID, workbookUpdateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client WorkbooksClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, sourceID string, workbookUpdateParameters *WorkbookUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(sourceID) > 0 { + queryParameters["sourceId"] = autorest.Encode("query", sourceID) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if workbookUpdateParameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(workbookUpdateParameters)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client WorkbooksClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client WorkbooksClient) UpdateResponder(resp *http.Response) (result Workbook, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/workbooktemplates.go b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/workbooktemplates.go new file mode 100644 index 000000000000..c9c7500e98f8 --- /dev/null +++ b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/workbooktemplates.go @@ -0,0 +1,469 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// WorkbookTemplatesClient is the composite Swagger for Application Insights Management Client +type WorkbookTemplatesClient struct { + BaseClient +} + +// NewWorkbookTemplatesClient creates an instance of the WorkbookTemplatesClient client. +func NewWorkbookTemplatesClient(subscriptionID string) WorkbookTemplatesClient { + return NewWorkbookTemplatesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWorkbookTemplatesClientWithBaseURI creates an instance of the WorkbookTemplatesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewWorkbookTemplatesClientWithBaseURI(baseURI string, subscriptionID string) WorkbookTemplatesClient { + return WorkbookTemplatesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new workbook template. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// workbookTemplateProperties - properties that need to be specified to create a new workbook. +func (client WorkbookTemplatesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, workbookTemplateProperties WorkbookTemplate) (result WorkbookTemplate, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkbookTemplatesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workbookTemplateProperties, + Constraints: []validation.Constraint{{Target: "workbookTemplateProperties.WorkbookTemplateProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "workbookTemplateProperties.WorkbookTemplateProperties.TemplateData", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "workbookTemplateProperties.WorkbookTemplateProperties.Galleries", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("insights.WorkbookTemplatesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, workbookTemplateProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbookTemplatesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkbookTemplatesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbookTemplatesClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client WorkbookTemplatesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, workbookTemplateProperties WorkbookTemplate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-11-20" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooktemplates/{resourceName}", pathParameters), + autorest.WithJSON(workbookTemplateProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client WorkbookTemplatesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client WorkbookTemplatesClient) CreateOrUpdateResponder(resp *http.Response) (result WorkbookTemplate, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a workbook template. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client WorkbookTemplatesClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkbookTemplatesClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WorkbookTemplatesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbookTemplatesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.WorkbookTemplatesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbookTemplatesClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client WorkbookTemplatesClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-11-20" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooktemplates/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client WorkbookTemplatesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client WorkbookTemplatesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a single workbook template by its resourceName. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client WorkbookTemplatesClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result WorkbookTemplate, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkbookTemplatesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WorkbookTemplatesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbookTemplatesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkbookTemplatesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbookTemplatesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client WorkbookTemplatesClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-11-20" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooktemplates/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client WorkbookTemplatesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client WorkbookTemplatesClient) GetResponder(resp *http.Response) (result WorkbookTemplate, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup get all Workbook templates defined within a specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client WorkbookTemplatesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result WorkbookTemplatesListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkbookTemplatesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WorkbookTemplatesClient", "ListByResourceGroup", err.Error()) + } + + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbookTemplatesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkbookTemplatesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbookTemplatesClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client WorkbookTemplatesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-11-20" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooktemplates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client WorkbookTemplatesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client WorkbookTemplatesClient) ListByResourceGroupResponder(resp *http.Response) (result WorkbookTemplatesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates a workbook template that has already been added. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// workbookTemplateUpdateParameters - properties that need to be specified to patch a workbook template. +func (client WorkbookTemplatesClient) Update(ctx context.Context, resourceGroupName string, resourceName string, workbookTemplateUpdateParameters *WorkbookTemplateUpdateParameters) (result WorkbookTemplate, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkbookTemplatesClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WorkbookTemplatesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, workbookTemplateUpdateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbookTemplatesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkbookTemplatesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbookTemplatesClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client WorkbookTemplatesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, workbookTemplateUpdateParameters *WorkbookTemplateUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-11-20" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooktemplates/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if workbookTemplateUpdateParameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(workbookTemplateUpdateParameters)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client WorkbookTemplatesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client WorkbookTemplatesClient) UpdateResponder(resp *http.Response) (result WorkbookTemplate, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/workitemconfigurations.go b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/workitemconfigurations.go new file mode 100644 index 000000000000..c46789bddc6e --- /dev/null +++ b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/workitemconfigurations.go @@ -0,0 +1,559 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// WorkItemConfigurationsClient is the composite Swagger for Application Insights Management Client +type WorkItemConfigurationsClient struct { + BaseClient +} + +// NewWorkItemConfigurationsClient creates an instance of the WorkItemConfigurationsClient client. +func NewWorkItemConfigurationsClient(subscriptionID string) WorkItemConfigurationsClient { + return NewWorkItemConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWorkItemConfigurationsClientWithBaseURI creates an instance of the WorkItemConfigurationsClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewWorkItemConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) WorkItemConfigurationsClient { + return WorkItemConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create a work item configuration for an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// workItemConfigurationProperties - properties that need to be specified to create a work item configuration +// of a Application Insights component. +func (client WorkItemConfigurationsClient) Create(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigurationProperties WorkItemCreateConfiguration) (result WorkItemConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkItemConfigurationsClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WorkItemConfigurationsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, resourceName, workItemConfigurationProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client WorkItemConfigurationsClient) CreatePreparer(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigurationProperties WorkItemCreateConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs", pathParameters), + autorest.WithJSON(workItemConfigurationProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client WorkItemConfigurationsClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client WorkItemConfigurationsClient) CreateResponder(resp *http.Response) (result WorkItemConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a work item configuration of an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// workItemConfigID - the unique work item configuration Id. This can be either friendly name of connector as +// defined in connector configuration +func (client WorkItemConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkItemConfigurationsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WorkItemConfigurationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, workItemConfigID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client WorkItemConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workItemConfigId": autorest.Encode("path", workItemConfigID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs/{workItemConfigId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client WorkItemConfigurationsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client WorkItemConfigurationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// GetDefault gets default work item configurations that exist for the application +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client WorkItemConfigurationsClient) GetDefault(ctx context.Context, resourceGroupName string, resourceName string) (result WorkItemConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkItemConfigurationsClient.GetDefault") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WorkItemConfigurationsClient", "GetDefault", err.Error()) + } + + req, err := client.GetDefaultPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "GetDefault", nil, "Failure preparing request") + return + } + + resp, err := client.GetDefaultSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "GetDefault", resp, "Failure sending request") + return + } + + result, err = client.GetDefaultResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "GetDefault", resp, "Failure responding to request") + return + } + + return +} + +// GetDefaultPreparer prepares the GetDefault request. +func (client WorkItemConfigurationsClient) GetDefaultPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/DefaultWorkItemConfig", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDefaultSender sends the GetDefault request. The method will close the +// http.Response Body if it receives an error. +func (client WorkItemConfigurationsClient) GetDefaultSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetDefaultResponder handles the response to the GetDefault request. The method always +// closes the http.Response Body. +func (client WorkItemConfigurationsClient) GetDefaultResponder(resp *http.Response) (result WorkItemConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetItem gets specified work item configuration for an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// workItemConfigID - the unique work item configuration Id. This can be either friendly name of connector as +// defined in connector configuration +func (client WorkItemConfigurationsClient) GetItem(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigID string) (result WorkItemConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkItemConfigurationsClient.GetItem") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WorkItemConfigurationsClient", "GetItem", err.Error()) + } + + req, err := client.GetItemPreparer(ctx, resourceGroupName, resourceName, workItemConfigID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "GetItem", nil, "Failure preparing request") + return + } + + resp, err := client.GetItemSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "GetItem", resp, "Failure sending request") + return + } + + result, err = client.GetItemResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "GetItem", resp, "Failure responding to request") + return + } + + return +} + +// GetItemPreparer prepares the GetItem request. +func (client WorkItemConfigurationsClient) GetItemPreparer(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workItemConfigId": autorest.Encode("path", workItemConfigID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs/{workItemConfigId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetItemSender sends the GetItem request. The method will close the +// http.Response Body if it receives an error. +func (client WorkItemConfigurationsClient) GetItemSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetItemResponder handles the response to the GetItem request. The method always +// closes the http.Response Body. +func (client WorkItemConfigurationsClient) GetItemResponder(resp *http.Response) (result WorkItemConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets the list work item configurations that exist for the application +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client WorkItemConfigurationsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result WorkItemConfigurationsListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkItemConfigurationsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WorkItemConfigurationsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client WorkItemConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client WorkItemConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client WorkItemConfigurationsClient) ListResponder(resp *http.Response) (result WorkItemConfigurationsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateItem update a work item configuration for an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// workItemConfigID - the unique work item configuration Id. This can be either friendly name of connector as +// defined in connector configuration +// workItemConfigurationProperties - properties that need to be specified to update a work item configuration +// for this Application Insights component. +func (client WorkItemConfigurationsClient) UpdateItem(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigID string, workItemConfigurationProperties WorkItemCreateConfiguration) (result WorkItemConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkItemConfigurationsClient.UpdateItem") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WorkItemConfigurationsClient", "UpdateItem", err.Error()) + } + + req, err := client.UpdateItemPreparer(ctx, resourceGroupName, resourceName, workItemConfigID, workItemConfigurationProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "UpdateItem", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateItemSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "UpdateItem", resp, "Failure sending request") + return + } + + result, err = client.UpdateItemResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "UpdateItem", resp, "Failure responding to request") + return + } + + return +} + +// UpdateItemPreparer prepares the UpdateItem request. +func (client WorkItemConfigurationsClient) UpdateItemPreparer(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigID string, workItemConfigurationProperties WorkItemCreateConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workItemConfigId": autorest.Encode("path", workItemConfigID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs/{workItemConfigId}", pathParameters), + autorest.WithJSON(workItemConfigurationProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateItemSender sends the UpdateItem request. The method will close the +// http.Response Body if it receives an error. +func (client WorkItemConfigurationsClient) UpdateItemSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateItemResponder handles the response to the UpdateItem request. The method always +// closes the http.Response Body. +func (client WorkItemConfigurationsClient) UpdateItemResponder(resp *http.Response) (result WorkItemConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/msi/mgmt/2021-09-30-preview/msi/CHANGELOG.md b/services/preview/msi/mgmt/2021-09-30-preview/msi/CHANGELOG.md new file mode 100644 index 000000000000..52911e4cc5e4 --- /dev/null +++ b/services/preview/msi/mgmt/2021-09-30-preview/msi/CHANGELOG.md @@ -0,0 +1,2 @@ +# Change History + diff --git a/services/preview/msi/mgmt/2021-09-30-preview/msi/_meta.json b/services/preview/msi/mgmt/2021-09-30-preview/msi/_meta.json new file mode 100644 index 000000000000..f83150fa9769 --- /dev/null +++ b/services/preview/msi/mgmt/2021-09-30-preview/msi/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "162460648e39b3cd20ef3d302008add138e90223", + "readme": "/_/azure-rest-api-specs/specification/msi/resource-manager/readme.md", + "tag": "package-preview-2021-09", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-preview-2021-09 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/msi/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" + } +} \ No newline at end of file diff --git a/services/preview/msi/mgmt/2021-09-30-preview/msi/client.go b/services/preview/msi/mgmt/2021-09-30-preview/msi/client.go new file mode 100644 index 000000000000..ff23188a9081 --- /dev/null +++ b/services/preview/msi/mgmt/2021-09-30-preview/msi/client.go @@ -0,0 +1,41 @@ +// Package msi implements the Azure ARM Msi service API version 2021-09-30-preview. +// +// The Managed Service Identity Client. +package msi + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Msi + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Msi. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/preview/msi/mgmt/2021-09-30-preview/msi/models.go b/services/preview/msi/mgmt/2021-09-30-preview/msi/models.go new file mode 100644 index 000000000000..b0fe4c56fa1d --- /dev/null +++ b/services/preview/msi/mgmt/2021-09-30-preview/msi/models.go @@ -0,0 +1,971 @@ +package msi + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "github.com/gofrs/uuid" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2021-09-30-preview/msi" + +// AssociatedResourcesListResult azure resources returned by the resource action to get a list of assigned +// resources. +type AssociatedResourcesListResult struct { + autorest.Response `json:"-"` + // TotalCount - READ-ONLY; Total number of Azure resources assigned to the identity. + TotalCount *float64 `json:"totalCount,omitempty"` + // Value - READ-ONLY; The collection of Azure resources returned by the resource action to get a list of assigned resources. + Value *[]AzureResource `json:"value,omitempty"` + // NextLink - READ-ONLY; The url to get the next page of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for AssociatedResourcesListResult. +func (arlr AssociatedResourcesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AssociatedResourcesListResultIterator provides access to a complete listing of AzureResource values. +type AssociatedResourcesListResultIterator struct { + i int + page AssociatedResourcesListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AssociatedResourcesListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AssociatedResourcesListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AssociatedResourcesListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AssociatedResourcesListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AssociatedResourcesListResultIterator) Response() AssociatedResourcesListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AssociatedResourcesListResultIterator) Value() AzureResource { + if !iter.page.NotDone() { + return AzureResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AssociatedResourcesListResultIterator type. +func NewAssociatedResourcesListResultIterator(page AssociatedResourcesListResultPage) AssociatedResourcesListResultIterator { + return AssociatedResourcesListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (arlr AssociatedResourcesListResult) IsEmpty() bool { + return arlr.Value == nil || len(*arlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (arlr AssociatedResourcesListResult) hasNextLink() bool { + return arlr.NextLink != nil && len(*arlr.NextLink) != 0 +} + +// associatedResourcesListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (arlr AssociatedResourcesListResult) associatedResourcesListResultPreparer(ctx context.Context) (*http.Request, error) { + if !arlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(arlr.NextLink))) +} + +// AssociatedResourcesListResultPage contains a page of AzureResource values. +type AssociatedResourcesListResultPage struct { + fn func(context.Context, AssociatedResourcesListResult) (AssociatedResourcesListResult, error) + arlr AssociatedResourcesListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AssociatedResourcesListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AssociatedResourcesListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.arlr) + if err != nil { + return err + } + page.arlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AssociatedResourcesListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AssociatedResourcesListResultPage) NotDone() bool { + return !page.arlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AssociatedResourcesListResultPage) Response() AssociatedResourcesListResult { + return page.arlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AssociatedResourcesListResultPage) Values() []AzureResource { + if page.arlr.IsEmpty() { + return nil + } + return *page.arlr.Value +} + +// Creates a new instance of the AssociatedResourcesListResultPage type. +func NewAssociatedResourcesListResultPage(cur AssociatedResourcesListResult, getNextPage func(context.Context, AssociatedResourcesListResult) (AssociatedResourcesListResult, error)) AssociatedResourcesListResultPage { + return AssociatedResourcesListResultPage{ + fn: getNextPage, + arlr: cur, + } +} + +// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. +type AzureEntityResource struct { + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureEntityResource. +func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AzureResource describes an Azure resource that is attached to an identity. +type AzureResource struct { + // ID - READ-ONLY; The ID of this resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of this resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of this resource. + Type *string `json:"type,omitempty"` + // ResourceGroup - READ-ONLY; The name of the resource group this resource belongs to. + ResourceGroup *string `json:"resourceGroup,omitempty"` + // SubscriptionID - READ-ONLY; The ID of the subscription this resource belongs to. + SubscriptionID *string `json:"subscriptionId,omitempty"` + // SubscriptionDisplayName - READ-ONLY; The name of the subscription this resource belongs to. + SubscriptionDisplayName *string `json:"subscriptionDisplayName,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureResource. +func (ar AzureResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CloudError an error response from the ManagedServiceIdentity service. +type CloudError struct { + // Error - A list of additional details about the error. + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody an error response from the ManagedServiceIdentity service. +type CloudErrorBody struct { + // Code - An identifier for the error. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + // Target - The target of the particular error. For example, the name of the property in error. + Target *string `json:"target,omitempty"` + // Details - A list of additional details about the error. + Details *[]CloudErrorBody `json:"details,omitempty"` +} + +// Identity describes an identity resource. +type Identity struct { + autorest.Response `json:"-"` + // UserAssignedIdentityProperties - READ-ONLY; The properties associated with the identity. + *UserAssignedIdentityProperties `json:"properties,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if i.Tags != nil { + objectMap["tags"] = i.Tags + } + if i.Location != nil { + objectMap["location"] = i.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Identity struct. +func (i *Identity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var userAssignedIdentityProperties UserAssignedIdentityProperties + err = json.Unmarshal(*v, &userAssignedIdentityProperties) + if err != nil { + return err + } + i.UserAssignedIdentityProperties = &userAssignedIdentityProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + i.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + i.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + i.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + i.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + i.Type = &typeVar + } + } + } + + return nil +} + +// IdentityUpdate describes an identity resource. +type IdentityUpdate struct { + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // UserAssignedIdentityProperties - READ-ONLY; The properties associated with the identity. + *UserAssignedIdentityProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for IdentityUpdate. +func (iu IdentityUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if iu.Location != nil { + objectMap["location"] = iu.Location + } + if iu.Tags != nil { + objectMap["tags"] = iu.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for IdentityUpdate struct. +func (iu *IdentityUpdate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + iu.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + iu.Tags = tags + } + case "properties": + if v != nil { + var userAssignedIdentityProperties UserAssignedIdentityProperties + err = json.Unmarshal(*v, &userAssignedIdentityProperties) + if err != nil { + return err + } + iu.UserAssignedIdentityProperties = &userAssignedIdentityProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + iu.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + iu.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + iu.Type = &typeVar + } + } + } + + return nil +} + +// Operation operation supported by the Microsoft.ManagedIdentity REST API. +type Operation struct { + // Name - The name of the REST Operation. This is of the format {provider}/{resource}/{operation}. + Name *string `json:"name,omitempty"` + // Display - The object that describes the operation. + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay the object that describes the operation. +type OperationDisplay struct { + // Provider - Friendly name of the resource provider. + Provider *string `json:"provider,omitempty"` + // Operation - The type of operation. For example: read, write, delete. + Operation *string `json:"operation,omitempty"` + // Resource - The resource type on which the operation is performed. + Resource *string `json:"resource,omitempty"` + // Description - A description of the operation. + Description *string `json:"description,omitempty"` +} + +// OperationListResult a list of operations supported by Microsoft.ManagedIdentity Resource Provider. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - A list of operations supported by Microsoft.ManagedIdentity Resource Provider. + Value *[]Operation `json:"value,omitempty"` + // NextLink - The url to get the next page of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultIterator provides access to a complete listing of Operation values. +type OperationListResultIterator struct { + i int + page OperationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationListResultIterator) Response() OperationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationListResultIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationListResultIterator type. +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return OperationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OperationListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (olr OperationListResult) hasNextLink() bool { + return olr.NextLink != nil && len(*olr.NextLink) != 0 +} + +// operationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !olr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationListResultPage contains a page of Operation values. +type OperationListResultPage struct { + fn func(context.Context, OperationListResult) (OperationListResult, error) + olr OperationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.olr) + if err != nil { + return err + } + page.olr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListResultPage) Response() OperationListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListResultPage) Values() []Operation { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OperationListResultPage type. +func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return OperationListResultPage{ + fn: getNextPage, + olr: cur, + } +} + +// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not +// have tags and a location +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Resource common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SystemAssignedIdentity describes a system assigned identity resource. +type SystemAssignedIdentity struct { + autorest.Response `json:"-"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // SystemAssignedIdentityProperties - READ-ONLY; The properties associated with the identity. + *SystemAssignedIdentityProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SystemAssignedIdentity. +func (sai SystemAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sai.Location != nil { + objectMap["location"] = sai.Location + } + if sai.Tags != nil { + objectMap["tags"] = sai.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SystemAssignedIdentity struct. +func (sai *SystemAssignedIdentity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + sai.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + sai.Tags = tags + } + case "properties": + if v != nil { + var systemAssignedIdentityProperties SystemAssignedIdentityProperties + err = json.Unmarshal(*v, &systemAssignedIdentityProperties) + if err != nil { + return err + } + sai.SystemAssignedIdentityProperties = &systemAssignedIdentityProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sai.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sai.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sai.Type = &typeVar + } + } + } + + return nil +} + +// SystemAssignedIdentityProperties the properties associated with the system assigned identity. +type SystemAssignedIdentityProperties struct { + // TenantID - READ-ONLY; The id of the tenant which the identity belongs to. + TenantID *uuid.UUID `json:"tenantId,omitempty"` + // PrincipalID - READ-ONLY; The id of the service principal object associated with the created identity. + PrincipalID *uuid.UUID `json:"principalId,omitempty"` + // ClientID - READ-ONLY; The id of the app associated with the identity. This is a random generated UUID by MSI. + ClientID *uuid.UUID `json:"clientId,omitempty"` + // ClientSecretURL - READ-ONLY; The ManagedServiceIdentity DataPlane URL that can be queried to obtain the identity credentials. + ClientSecretURL *string `json:"clientSecretUrl,omitempty"` +} + +// MarshalJSON is the custom marshaler for SystemAssignedIdentityProperties. +func (saip SystemAssignedIdentityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource +// which has 'tags' and a 'location' +type TrackedResource struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} + +// UserAssignedIdentitiesListResult values returned by the List operation. +type UserAssignedIdentitiesListResult struct { + autorest.Response `json:"-"` + // Value - The collection of userAssignedIdentities returned by the listing operation. + Value *[]Identity `json:"value,omitempty"` + // NextLink - The url to get the next page of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// UserAssignedIdentitiesListResultIterator provides access to a complete listing of Identity values. +type UserAssignedIdentitiesListResultIterator struct { + i int + page UserAssignedIdentitiesListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *UserAssignedIdentitiesListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UserAssignedIdentitiesListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *UserAssignedIdentitiesListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter UserAssignedIdentitiesListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter UserAssignedIdentitiesListResultIterator) Response() UserAssignedIdentitiesListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter UserAssignedIdentitiesListResultIterator) Value() Identity { + if !iter.page.NotDone() { + return Identity{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the UserAssignedIdentitiesListResultIterator type. +func NewUserAssignedIdentitiesListResultIterator(page UserAssignedIdentitiesListResultPage) UserAssignedIdentitiesListResultIterator { + return UserAssignedIdentitiesListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (uailr UserAssignedIdentitiesListResult) IsEmpty() bool { + return uailr.Value == nil || len(*uailr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (uailr UserAssignedIdentitiesListResult) hasNextLink() bool { + return uailr.NextLink != nil && len(*uailr.NextLink) != 0 +} + +// userAssignedIdentitiesListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (uailr UserAssignedIdentitiesListResult) userAssignedIdentitiesListResultPreparer(ctx context.Context) (*http.Request, error) { + if !uailr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(uailr.NextLink))) +} + +// UserAssignedIdentitiesListResultPage contains a page of Identity values. +type UserAssignedIdentitiesListResultPage struct { + fn func(context.Context, UserAssignedIdentitiesListResult) (UserAssignedIdentitiesListResult, error) + uailr UserAssignedIdentitiesListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *UserAssignedIdentitiesListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UserAssignedIdentitiesListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.uailr) + if err != nil { + return err + } + page.uailr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *UserAssignedIdentitiesListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page UserAssignedIdentitiesListResultPage) NotDone() bool { + return !page.uailr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page UserAssignedIdentitiesListResultPage) Response() UserAssignedIdentitiesListResult { + return page.uailr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page UserAssignedIdentitiesListResultPage) Values() []Identity { + if page.uailr.IsEmpty() { + return nil + } + return *page.uailr.Value +} + +// Creates a new instance of the UserAssignedIdentitiesListResultPage type. +func NewUserAssignedIdentitiesListResultPage(cur UserAssignedIdentitiesListResult, getNextPage func(context.Context, UserAssignedIdentitiesListResult) (UserAssignedIdentitiesListResult, error)) UserAssignedIdentitiesListResultPage { + return UserAssignedIdentitiesListResultPage{ + fn: getNextPage, + uailr: cur, + } +} + +// UserAssignedIdentityProperties the properties associated with the user assigned identity. +type UserAssignedIdentityProperties struct { + // TenantID - READ-ONLY; The id of the tenant which the identity belongs to. + TenantID *uuid.UUID `json:"tenantId,omitempty"` + // PrincipalID - READ-ONLY; The id of the service principal object associated with the created identity. + PrincipalID *uuid.UUID `json:"principalId,omitempty"` + // ClientID - READ-ONLY; The id of the app associated with the identity. This is a random generated UUID by MSI. + ClientID *uuid.UUID `json:"clientId,omitempty"` +} + +// MarshalJSON is the custom marshaler for UserAssignedIdentityProperties. +func (uaip UserAssignedIdentityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} diff --git a/services/preview/msi/mgmt/2021-09-30-preview/msi/msiapi/interfaces.go b/services/preview/msi/mgmt/2021-09-30-preview/msi/msiapi/interfaces.go new file mode 100644 index 000000000000..475715b3a7ed --- /dev/null +++ b/services/preview/msi/mgmt/2021-09-30-preview/msi/msiapi/interfaces.go @@ -0,0 +1,44 @@ +package msiapi + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2021-09-30-preview/msi" + "github.com/Azure/go-autorest/autorest" +) + +// SystemAssignedIdentitiesClientAPI contains the set of methods on the SystemAssignedIdentitiesClient type. +type SystemAssignedIdentitiesClientAPI interface { + GetByScope(ctx context.Context, scope string) (result msi.SystemAssignedIdentity, err error) +} + +var _ SystemAssignedIdentitiesClientAPI = (*msi.SystemAssignedIdentitiesClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result msi.OperationListResultPage, err error) + ListComplete(ctx context.Context) (result msi.OperationListResultIterator, err error) +} + +var _ OperationsClientAPI = (*msi.OperationsClient)(nil) + +// UserAssignedIdentitiesClientAPI contains the set of methods on the UserAssignedIdentitiesClient type. +type UserAssignedIdentitiesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters msi.Identity) (result msi.Identity, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string) (result msi.Identity, err error) + ListAssociatedResources(ctx context.Context, resourceGroupName string, resourceName string, filter string, orderby string, top *int32, skip *int32, skiptoken string) (result msi.AssociatedResourcesListResultPage, err error) + ListAssociatedResourcesComplete(ctx context.Context, resourceGroupName string, resourceName string, filter string, orderby string, top *int32, skip *int32, skiptoken string) (result msi.AssociatedResourcesListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result msi.UserAssignedIdentitiesListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result msi.UserAssignedIdentitiesListResultIterator, err error) + ListBySubscription(ctx context.Context) (result msi.UserAssignedIdentitiesListResultPage, err error) + ListBySubscriptionComplete(ctx context.Context) (result msi.UserAssignedIdentitiesListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, parameters msi.IdentityUpdate) (result msi.Identity, err error) +} + +var _ UserAssignedIdentitiesClientAPI = (*msi.UserAssignedIdentitiesClient)(nil) diff --git a/services/preview/msi/mgmt/2021-09-30-preview/msi/operations.go b/services/preview/msi/mgmt/2021-09-30-preview/msi/operations.go new file mode 100644 index 000000000000..739e0fe1524b --- /dev/null +++ b/services/preview/msi/mgmt/2021-09-30-preview/msi/operations.go @@ -0,0 +1,140 @@ +package msi + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the the Managed Service Identity Client. +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists available operations for the Microsoft.ManagedIdentity provider +func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.olr.Response.Response != nil { + sc = result.olr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.olr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "msi.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.olr.hasNextLink() && result.olr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-09-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.ManagedIdentity/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.operationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "msi.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "msi.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/preview/msi/mgmt/2021-09-30-preview/msi/systemassignedidentities.go b/services/preview/msi/mgmt/2021-09-30-preview/msi/systemassignedidentities.go new file mode 100644 index 000000000000..371b86088631 --- /dev/null +++ b/services/preview/msi/mgmt/2021-09-30-preview/msi/systemassignedidentities.go @@ -0,0 +1,105 @@ +package msi + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SystemAssignedIdentitiesClient is the the Managed Service Identity Client. +type SystemAssignedIdentitiesClient struct { + BaseClient +} + +// NewSystemAssignedIdentitiesClient creates an instance of the SystemAssignedIdentitiesClient client. +func NewSystemAssignedIdentitiesClient(subscriptionID string) SystemAssignedIdentitiesClient { + return NewSystemAssignedIdentitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSystemAssignedIdentitiesClientWithBaseURI creates an instance of the SystemAssignedIdentitiesClient client using +// a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewSystemAssignedIdentitiesClientWithBaseURI(baseURI string, subscriptionID string) SystemAssignedIdentitiesClient { + return SystemAssignedIdentitiesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GetByScope gets the systemAssignedIdentity available under the specified RP scope. +// Parameters: +// scope - the resource provider scope of the resource. Parent resource being extended by Managed Identities. +func (client SystemAssignedIdentitiesClient) GetByScope(ctx context.Context, scope string) (result SystemAssignedIdentity, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SystemAssignedIdentitiesClient.GetByScope") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetByScopePreparer(ctx, scope) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.SystemAssignedIdentitiesClient", "GetByScope", nil, "Failure preparing request") + return + } + + resp, err := client.GetByScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "msi.SystemAssignedIdentitiesClient", "GetByScope", resp, "Failure sending request") + return + } + + result, err = client.GetByScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.SystemAssignedIdentitiesClient", "GetByScope", resp, "Failure responding to request") + return + } + + return +} + +// GetByScopePreparer prepares the GetByScope request. +func (client SystemAssignedIdentitiesClient) GetByScopePreparer(ctx context.Context, scope string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scope": scope, + } + + const APIVersion = "2021-09-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.ManagedIdentity/identities/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetByScopeSender sends the GetByScope request. The method will close the +// http.Response Body if it receives an error. +func (client SystemAssignedIdentitiesClient) GetByScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetByScopeResponder handles the response to the GetByScope request. The method always +// closes the http.Response Body. +func (client SystemAssignedIdentitiesClient) GetByScopeResponder(resp *http.Response) (result SystemAssignedIdentity, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/msi/mgmt/2021-09-30-preview/msi/userassignedidentities.go b/services/preview/msi/mgmt/2021-09-30-preview/msi/userassignedidentities.go new file mode 100644 index 000000000000..f8c4573c160a --- /dev/null +++ b/services/preview/msi/mgmt/2021-09-30-preview/msi/userassignedidentities.go @@ -0,0 +1,723 @@ +package msi + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// UserAssignedIdentitiesClient is the the Managed Service Identity Client. +type UserAssignedIdentitiesClient struct { + BaseClient +} + +// NewUserAssignedIdentitiesClient creates an instance of the UserAssignedIdentitiesClient client. +func NewUserAssignedIdentitiesClient(subscriptionID string) UserAssignedIdentitiesClient { + return NewUserAssignedIdentitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewUserAssignedIdentitiesClientWithBaseURI creates an instance of the UserAssignedIdentitiesClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewUserAssignedIdentitiesClientWithBaseURI(baseURI string, subscriptionID string) UserAssignedIdentitiesClient { + return UserAssignedIdentitiesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update an identity in the specified subscription and resource group. +// Parameters: +// resourceGroupName - the name of the Resource Group to which the identity belongs. +// resourceName - the name of the identity resource. +// parameters - parameters to create or update the identity +func (client UserAssignedIdentitiesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters Identity) (result Identity, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UserAssignedIdentitiesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client UserAssignedIdentitiesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters Identity) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.UserAssignedIdentityProperties = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client UserAssignedIdentitiesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client UserAssignedIdentitiesClient) CreateOrUpdateResponder(resp *http.Response) (result Identity, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the identity. +// Parameters: +// resourceGroupName - the name of the Resource Group to which the identity belongs. +// resourceName - the name of the identity resource. +func (client UserAssignedIdentitiesClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UserAssignedIdentitiesClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client UserAssignedIdentitiesClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client UserAssignedIdentitiesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client UserAssignedIdentitiesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the identity. +// Parameters: +// resourceGroupName - the name of the Resource Group to which the identity belongs. +// resourceName - the name of the identity resource. +func (client UserAssignedIdentitiesClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result Identity, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UserAssignedIdentitiesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client UserAssignedIdentitiesClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client UserAssignedIdentitiesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client UserAssignedIdentitiesClient) GetResponder(resp *http.Response) (result Identity, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAssociatedResources lists the associated resources for this identity. +// Parameters: +// resourceGroupName - the name of the Resource Group to which the identity belongs. +// resourceName - the name of the identity resource. +// filter - oData filter expression to apply to the query. +// orderby - oData orderBy expression to apply to the query. +// top - number of records to return. +// skip - number of records to skip. +// skiptoken - a skip token is used to continue retrieving items after an operation returns a partial result. +// If a previous response contains a nextLink element, the value of the nextLink element will include a +// skipToken parameter that specifies a starting point to use for subsequent calls. +func (client UserAssignedIdentitiesClient) ListAssociatedResources(ctx context.Context, resourceGroupName string, resourceName string, filter string, orderby string, top *int32, skip *int32, skiptoken string) (result AssociatedResourcesListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UserAssignedIdentitiesClient.ListAssociatedResources") + defer func() { + sc := -1 + if result.arlr.Response.Response != nil { + sc = result.arlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil { + return result, validation.NewError("msi.UserAssignedIdentitiesClient", "ListAssociatedResources", err.Error()) + } + + result.fn = client.listAssociatedResourcesNextResults + req, err := client.ListAssociatedResourcesPreparer(ctx, resourceGroupName, resourceName, filter, orderby, top, skip, skiptoken) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "ListAssociatedResources", nil, "Failure preparing request") + return + } + + resp, err := client.ListAssociatedResourcesSender(req) + if err != nil { + result.arlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "ListAssociatedResources", resp, "Failure sending request") + return + } + + result.arlr, err = client.ListAssociatedResourcesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "ListAssociatedResources", resp, "Failure responding to request") + return + } + if result.arlr.hasNextLink() && result.arlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAssociatedResourcesPreparer prepares the ListAssociatedResources request. +func (client UserAssignedIdentitiesClient) ListAssociatedResourcesPreparer(ctx context.Context, resourceGroupName string, resourceName string, filter string, orderby string, top *int32, skip *int32, skiptoken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + if len(skiptoken) > 0 { + queryParameters["$skiptoken"] = autorest.Encode("query", skiptoken) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}/listAssociatedResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAssociatedResourcesSender sends the ListAssociatedResources request. The method will close the +// http.Response Body if it receives an error. +func (client UserAssignedIdentitiesClient) ListAssociatedResourcesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAssociatedResourcesResponder handles the response to the ListAssociatedResources request. The method always +// closes the http.Response Body. +func (client UserAssignedIdentitiesClient) ListAssociatedResourcesResponder(resp *http.Response) (result AssociatedResourcesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAssociatedResourcesNextResults retrieves the next set of results, if any. +func (client UserAssignedIdentitiesClient) listAssociatedResourcesNextResults(ctx context.Context, lastResults AssociatedResourcesListResult) (result AssociatedResourcesListResult, err error) { + req, err := lastResults.associatedResourcesListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "listAssociatedResourcesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAssociatedResourcesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "listAssociatedResourcesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAssociatedResourcesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "listAssociatedResourcesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAssociatedResourcesComplete enumerates all values, automatically crossing page boundaries as required. +func (client UserAssignedIdentitiesClient) ListAssociatedResourcesComplete(ctx context.Context, resourceGroupName string, resourceName string, filter string, orderby string, top *int32, skip *int32, skiptoken string) (result AssociatedResourcesListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UserAssignedIdentitiesClient.ListAssociatedResources") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAssociatedResources(ctx, resourceGroupName, resourceName, filter, orderby, top, skip, skiptoken) + return +} + +// ListByResourceGroup lists all the userAssignedIdentities available under the specified ResourceGroup. +// Parameters: +// resourceGroupName - the name of the Resource Group to which the identity belongs. +func (client UserAssignedIdentitiesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result UserAssignedIdentitiesListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UserAssignedIdentitiesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.uailr.Response.Response != nil { + sc = result.uailr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.uailr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.uailr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.uailr.hasNextLink() && result.uailr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client UserAssignedIdentitiesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client UserAssignedIdentitiesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client UserAssignedIdentitiesClient) ListByResourceGroupResponder(resp *http.Response) (result UserAssignedIdentitiesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client UserAssignedIdentitiesClient) listByResourceGroupNextResults(ctx context.Context, lastResults UserAssignedIdentitiesListResult) (result UserAssignedIdentitiesListResult, err error) { + req, err := lastResults.userAssignedIdentitiesListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client UserAssignedIdentitiesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result UserAssignedIdentitiesListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UserAssignedIdentitiesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListBySubscription lists all the userAssignedIdentities available under the specified subscription. +func (client UserAssignedIdentitiesClient) ListBySubscription(ctx context.Context) (result UserAssignedIdentitiesListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UserAssignedIdentitiesClient.ListBySubscription") + defer func() { + sc := -1 + if result.uailr.Response.Response != nil { + sc = result.uailr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.uailr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.uailr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.uailr.hasNextLink() && result.uailr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client UserAssignedIdentitiesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ManagedIdentity/userAssignedIdentities", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client UserAssignedIdentitiesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client UserAssignedIdentitiesClient) ListBySubscriptionResponder(resp *http.Response) (result UserAssignedIdentitiesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client UserAssignedIdentitiesClient) listBySubscriptionNextResults(ctx context.Context, lastResults UserAssignedIdentitiesListResult) (result UserAssignedIdentitiesListResult, err error) { + req, err := lastResults.userAssignedIdentitiesListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client UserAssignedIdentitiesClient) ListBySubscriptionComplete(ctx context.Context) (result UserAssignedIdentitiesListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UserAssignedIdentitiesClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx) + return +} + +// Update update an identity in the specified subscription and resource group. +// Parameters: +// resourceGroupName - the name of the Resource Group to which the identity belongs. +// resourceName - the name of the identity resource. +// parameters - parameters to update the identity +func (client UserAssignedIdentitiesClient) Update(ctx context.Context, resourceGroupName string, resourceName string, parameters IdentityUpdate) (result Identity, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UserAssignedIdentitiesClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "msi.UserAssignedIdentitiesClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client UserAssignedIdentitiesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters IdentityUpdate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.UserAssignedIdentityProperties = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client UserAssignedIdentitiesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client UserAssignedIdentitiesClient) UpdateResponder(resp *http.Response) (result Identity, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/msi/mgmt/2021-09-30-preview/msi/version.go b/services/preview/msi/mgmt/2021-09-30-preview/msi/version.go new file mode 100644 index 000000000000..6fe96b0d7a91 --- /dev/null +++ b/services/preview/msi/mgmt/2021-09-30-preview/msi/version.go @@ -0,0 +1,19 @@ +package msi + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights 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. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " msi/2021-09-30-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/CHANGELOG.md b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/CHANGELOG.md new file mode 100644 index 000000000000..52911e4cc5e4 --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/CHANGELOG.md @@ -0,0 +1,2 @@ +# Change History + diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/_meta.json b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/_meta.json new file mode 100644 index 000000000000..df92701122e1 --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "162460648e39b3cd20ef3d302008add138e90223", + "readme": "/_/azure-rest-api-specs/specification/securityinsights/resource-manager/readme.md", + "tag": "package-preview-2022-01", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-preview-2022-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/securityinsights/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" + } +} \ No newline at end of file diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/actions.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/actions.go new file mode 100644 index 000000000000..ba0bbe337e0f --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/actions.go @@ -0,0 +1,445 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ActionsClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider +type ActionsClient struct { + BaseClient +} + +// NewActionsClient creates an instance of the ActionsClient client. +func NewActionsClient(subscriptionID string) ActionsClient { + return NewActionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewActionsClientWithBaseURI creates an instance of the ActionsClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewActionsClientWithBaseURI(baseURI string, subscriptionID string) ActionsClient { + return ActionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the action of alert rule. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// ruleID - alert rule ID +// actionID - action ID +// action - the action +func (client ActionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, ruleID string, actionID string, action ActionRequest) (result ActionResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ActionsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: action, + Constraints: []validation.Constraint{{Target: "action.ActionRequestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "action.ActionRequestProperties.TriggerURI", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("securityinsight.ActionsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, ruleID, actionID, action) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ActionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.ActionsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ActionsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ActionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, ruleID string, actionID string, action ActionRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "actionId": autorest.Encode("path", actionID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleId": autorest.Encode("path", ruleID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}", pathParameters), + autorest.WithJSON(action), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ActionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ActionsClient) CreateOrUpdateResponder(resp *http.Response) (result ActionResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the action of alert rule. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// ruleID - alert rule ID +// actionID - action ID +func (client ActionsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, ruleID string, actionID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ActionsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.ActionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, ruleID, actionID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ActionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "securityinsight.ActionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ActionsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ActionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, ruleID string, actionID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "actionId": autorest.Encode("path", actionID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleId": autorest.Encode("path", ruleID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ActionsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ActionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the action of alert rule. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// ruleID - alert rule ID +// actionID - action ID +func (client ActionsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, ruleID string, actionID string) (result ActionResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ActionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.ActionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, ruleID, actionID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ActionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.ActionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ActionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ActionsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, ruleID string, actionID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "actionId": autorest.Encode("path", actionID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleId": autorest.Encode("path", ruleID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ActionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ActionsClient) GetResponder(resp *http.Response) (result ActionResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAlertRule gets all actions of alert rule. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// ruleID - alert rule ID +func (client ActionsClient) ListByAlertRule(ctx context.Context, resourceGroupName string, workspaceName string, ruleID string) (result ActionsListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ActionsClient.ListByAlertRule") + defer func() { + sc := -1 + if result.al.Response.Response != nil { + sc = result.al.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.ActionsClient", "ListByAlertRule", err.Error()) + } + + result.fn = client.listByAlertRuleNextResults + req, err := client.ListByAlertRulePreparer(ctx, resourceGroupName, workspaceName, ruleID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ActionsClient", "ListByAlertRule", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAlertRuleSender(req) + if err != nil { + result.al.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.ActionsClient", "ListByAlertRule", resp, "Failure sending request") + return + } + + result.al, err = client.ListByAlertRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ActionsClient", "ListByAlertRule", resp, "Failure responding to request") + return + } + if result.al.hasNextLink() && result.al.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByAlertRulePreparer prepares the ListByAlertRule request. +func (client ActionsClient) ListByAlertRulePreparer(ctx context.Context, resourceGroupName string, workspaceName string, ruleID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleId": autorest.Encode("path", ruleID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByAlertRuleSender sends the ListByAlertRule request. The method will close the +// http.Response Body if it receives an error. +func (client ActionsClient) ListByAlertRuleSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByAlertRuleResponder handles the response to the ListByAlertRule request. The method always +// closes the http.Response Body. +func (client ActionsClient) ListByAlertRuleResponder(resp *http.Response) (result ActionsList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByAlertRuleNextResults retrieves the next set of results, if any. +func (client ActionsClient) listByAlertRuleNextResults(ctx context.Context, lastResults ActionsList) (result ActionsList, err error) { + req, err := lastResults.actionsListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "securityinsight.ActionsClient", "listByAlertRuleNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByAlertRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "securityinsight.ActionsClient", "listByAlertRuleNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByAlertRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ActionsClient", "listByAlertRuleNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByAlertRuleComplete enumerates all values, automatically crossing page boundaries as required. +func (client ActionsClient) ListByAlertRuleComplete(ctx context.Context, resourceGroupName string, workspaceName string, ruleID string) (result ActionsListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ActionsClient.ListByAlertRule") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByAlertRule(ctx, resourceGroupName, workspaceName, ruleID) + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/alertrules.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/alertrules.go new file mode 100644 index 000000000000..811d063bb71a --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/alertrules.go @@ -0,0 +1,434 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AlertRulesClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider +type AlertRulesClient struct { + BaseClient +} + +// NewAlertRulesClient creates an instance of the AlertRulesClient client. +func NewAlertRulesClient(subscriptionID string) AlertRulesClient { + return NewAlertRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAlertRulesClientWithBaseURI creates an instance of the AlertRulesClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAlertRulesClientWithBaseURI(baseURI string, subscriptionID string) AlertRulesClient { + return AlertRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the alert rule. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// ruleID - alert rule ID +// alertRule - the alert rule +func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, ruleID string, alertRule BasicAlertRule) (result AlertRuleModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.AlertRulesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, ruleID, alertRule) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.AlertRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.AlertRulesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.AlertRulesClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AlertRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, ruleID string, alertRule BasicAlertRule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleId": autorest.Encode("path", ruleID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}", pathParameters), + autorest.WithJSON(alertRule), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AlertRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AlertRulesClient) CreateOrUpdateResponder(resp *http.Response) (result AlertRuleModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the alert rule. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// ruleID - alert rule ID +func (client AlertRulesClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, ruleID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.AlertRulesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, ruleID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.AlertRulesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "securityinsight.AlertRulesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.AlertRulesClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AlertRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, ruleID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleId": autorest.Encode("path", ruleID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AlertRulesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AlertRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the alert rule. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// ruleID - alert rule ID +func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, ruleID string) (result AlertRuleModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.AlertRulesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, ruleID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.AlertRulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.AlertRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.AlertRulesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AlertRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, ruleID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleId": autorest.Encode("path", ruleID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AlertRulesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AlertRulesClient) GetResponder(resp *http.Response) (result AlertRuleModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all alert rules. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +func (client AlertRulesClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result AlertRulesListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.List") + defer func() { + sc := -1 + if result.arl.Response.Response != nil { + sc = result.arl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.AlertRulesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.AlertRulesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.arl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.AlertRulesClient", "List", resp, "Failure sending request") + return + } + + result.arl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.AlertRulesClient", "List", resp, "Failure responding to request") + return + } + if result.arl.hasNextLink() && result.arl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AlertRulesClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AlertRulesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AlertRulesClient) ListResponder(resp *http.Response) (result AlertRulesList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AlertRulesClient) listNextResults(ctx context.Context, lastResults AlertRulesList) (result AlertRulesList, err error) { + req, err := lastResults.alertRulesListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "securityinsight.AlertRulesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "securityinsight.AlertRulesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.AlertRulesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AlertRulesClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result AlertRulesListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName) + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/alertruletemplates.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/alertruletemplates.go new file mode 100644 index 000000000000..c3b137492fbc --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/alertruletemplates.go @@ -0,0 +1,253 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AlertRuleTemplatesClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider +type AlertRuleTemplatesClient struct { + BaseClient +} + +// NewAlertRuleTemplatesClient creates an instance of the AlertRuleTemplatesClient client. +func NewAlertRuleTemplatesClient(subscriptionID string) AlertRuleTemplatesClient { + return NewAlertRuleTemplatesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAlertRuleTemplatesClientWithBaseURI creates an instance of the AlertRuleTemplatesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewAlertRuleTemplatesClientWithBaseURI(baseURI string, subscriptionID string) AlertRuleTemplatesClient { + return AlertRuleTemplatesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets the alert rule template. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// alertRuleTemplateID - alert rule template ID +func (client AlertRuleTemplatesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, alertRuleTemplateID string) (result AlertRuleTemplateModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleTemplatesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.AlertRuleTemplatesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, alertRuleTemplateID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.AlertRuleTemplatesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.AlertRuleTemplatesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.AlertRuleTemplatesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AlertRuleTemplatesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, alertRuleTemplateID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "alertRuleTemplateId": autorest.Encode("path", alertRuleTemplateID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates/{alertRuleTemplateId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AlertRuleTemplatesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AlertRuleTemplatesClient) GetResponder(resp *http.Response) (result AlertRuleTemplateModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all alert rule templates. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +func (client AlertRuleTemplatesClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result AlertRuleTemplatesListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleTemplatesClient.List") + defer func() { + sc := -1 + if result.artl.Response.Response != nil { + sc = result.artl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.AlertRuleTemplatesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.AlertRuleTemplatesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.artl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.AlertRuleTemplatesClient", "List", resp, "Failure sending request") + return + } + + result.artl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.AlertRuleTemplatesClient", "List", resp, "Failure responding to request") + return + } + if result.artl.hasNextLink() && result.artl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AlertRuleTemplatesClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AlertRuleTemplatesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AlertRuleTemplatesClient) ListResponder(resp *http.Response) (result AlertRuleTemplatesList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AlertRuleTemplatesClient) listNextResults(ctx context.Context, lastResults AlertRuleTemplatesList) (result AlertRuleTemplatesList, err error) { + req, err := lastResults.alertRuleTemplatesListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "securityinsight.AlertRuleTemplatesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "securityinsight.AlertRuleTemplatesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.AlertRuleTemplatesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AlertRuleTemplatesClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result AlertRuleTemplatesListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleTemplatesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName) + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/automationrules.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/automationrules.go new file mode 100644 index 000000000000..a6acf899bcbe --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/automationrules.go @@ -0,0 +1,458 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AutomationRulesClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider +type AutomationRulesClient struct { + BaseClient +} + +// NewAutomationRulesClient creates an instance of the AutomationRulesClient client. +func NewAutomationRulesClient(subscriptionID string) AutomationRulesClient { + return NewAutomationRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAutomationRulesClientWithBaseURI creates an instance of the AutomationRulesClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAutomationRulesClientWithBaseURI(baseURI string, subscriptionID string) AutomationRulesClient { + return AutomationRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the automation rule. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// automationRuleID - automation rule ID +// automationRuleToUpsert - the automation rule +func (client AutomationRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, automationRuleID string, automationRuleToUpsert *AutomationRule) (result AutomationRule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationRulesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: automationRuleToUpsert, + Constraints: []validation.Constraint{{Target: "automationRuleToUpsert", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "automationRuleToUpsert.AutomationRuleProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "automationRuleToUpsert.AutomationRuleProperties.DisplayName", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "automationRuleToUpsert.AutomationRuleProperties.DisplayName", Name: validation.MaxLength, Rule: 500, Chain: nil}}}, + {Target: "automationRuleToUpsert.AutomationRuleProperties.Order", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "automationRuleToUpsert.AutomationRuleProperties.Order", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, + {Target: "automationRuleToUpsert.AutomationRuleProperties.Order", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}, + {Target: "automationRuleToUpsert.AutomationRuleProperties.TriggeringLogic", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "automationRuleToUpsert.AutomationRuleProperties.TriggeringLogic.IsEnabled", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "automationRuleToUpsert.AutomationRuleProperties.TriggeringLogic.TriggersOn", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "automationRuleToUpsert.AutomationRuleProperties.TriggeringLogic.TriggersWhen", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "automationRuleToUpsert.AutomationRuleProperties.TriggeringLogic.Conditions", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "automationRuleToUpsert.AutomationRuleProperties.TriggeringLogic.Conditions", Name: validation.MaxItems, Rule: 50, Chain: nil}}}, + }}, + {Target: "automationRuleToUpsert.AutomationRuleProperties.Actions", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "automationRuleToUpsert.AutomationRuleProperties.Actions", Name: validation.MaxItems, Rule: 20, Chain: nil}}}, + }}, + }}}}}); err != nil { + return result, validation.NewError("securityinsight.AutomationRulesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, automationRuleID, automationRuleToUpsert) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.AutomationRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.AutomationRulesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.AutomationRulesClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AutomationRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, automationRuleID string, automationRuleToUpsert *AutomationRule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationRuleId": autorest.Encode("path", automationRuleID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules/{automationRuleId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if automationRuleToUpsert != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(automationRuleToUpsert)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AutomationRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AutomationRulesClient) CreateOrUpdateResponder(resp *http.Response) (result AutomationRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the automation rule. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// automationRuleID - automation rule ID +func (client AutomationRulesClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, automationRuleID string) (result SetObject, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationRulesClient.Delete") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.AutomationRulesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, automationRuleID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.AutomationRulesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.AutomationRulesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.AutomationRulesClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AutomationRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, automationRuleID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationRuleId": autorest.Encode("path", automationRuleID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules/{automationRuleId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AutomationRulesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AutomationRulesClient) DeleteResponder(resp *http.Response) (result SetObject, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets the automation rule. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// automationRuleID - automation rule ID +func (client AutomationRulesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, automationRuleID string) (result AutomationRule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationRulesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.AutomationRulesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, automationRuleID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.AutomationRulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.AutomationRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.AutomationRulesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AutomationRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, automationRuleID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationRuleId": autorest.Encode("path", automationRuleID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules/{automationRuleId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AutomationRulesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AutomationRulesClient) GetResponder(resp *http.Response) (result AutomationRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all automation rules. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +func (client AutomationRulesClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result AutomationRulesListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationRulesClient.List") + defer func() { + sc := -1 + if result.arl.Response.Response != nil { + sc = result.arl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.AutomationRulesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.AutomationRulesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.arl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.AutomationRulesClient", "List", resp, "Failure sending request") + return + } + + result.arl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.AutomationRulesClient", "List", resp, "Failure responding to request") + return + } + if result.arl.hasNextLink() && result.arl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AutomationRulesClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AutomationRulesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AutomationRulesClient) ListResponder(resp *http.Response) (result AutomationRulesList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AutomationRulesClient) listNextResults(ctx context.Context, lastResults AutomationRulesList) (result AutomationRulesList, err error) { + req, err := lastResults.automationRulesListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "securityinsight.AutomationRulesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "securityinsight.AutomationRulesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.AutomationRulesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AutomationRulesClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result AutomationRulesListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationRulesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName) + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/bookmark.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/bookmark.go new file mode 100644 index 000000000000..0dd4aaa6c1b4 --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/bookmark.go @@ -0,0 +1,125 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// BookmarkClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider +type BookmarkClient struct { + BaseClient +} + +// NewBookmarkClient creates an instance of the BookmarkClient client. +func NewBookmarkClient(subscriptionID string) BookmarkClient { + return NewBookmarkClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBookmarkClientWithBaseURI creates an instance of the BookmarkClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewBookmarkClientWithBaseURI(baseURI string, subscriptionID string) BookmarkClient { + return BookmarkClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Expand expand an bookmark +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// bookmarkID - bookmark ID +// parameters - the parameters required to execute an expand operation on the given bookmark. +func (client BookmarkClient) Expand(ctx context.Context, resourceGroupName string, workspaceName string, bookmarkID string, parameters BookmarkExpandParameters) (result BookmarkExpandResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BookmarkClient.Expand") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.BookmarkClient", "Expand", err.Error()) + } + + req, err := client.ExpandPreparer(ctx, resourceGroupName, workspaceName, bookmarkID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.BookmarkClient", "Expand", nil, "Failure preparing request") + return + } + + resp, err := client.ExpandSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.BookmarkClient", "Expand", resp, "Failure sending request") + return + } + + result, err = client.ExpandResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.BookmarkClient", "Expand", resp, "Failure responding to request") + return + } + + return +} + +// ExpandPreparer prepares the Expand request. +func (client BookmarkClient) ExpandPreparer(ctx context.Context, resourceGroupName string, workspaceName string, bookmarkID string, parameters BookmarkExpandParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "bookmarkId": autorest.Encode("path", bookmarkID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/expand", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ExpandSender sends the Expand request. The method will close the +// http.Response Body if it receives an error. +func (client BookmarkClient) ExpandSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ExpandResponder handles the response to the Expand request. The method always +// closes the http.Response Body. +func (client BookmarkClient) ExpandResponder(resp *http.Response) (result BookmarkExpandResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/bookmarkrelations.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/bookmarkrelations.go new file mode 100644 index 000000000000..04c697d2f7bb --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/bookmarkrelations.go @@ -0,0 +1,464 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// BookmarkRelationsClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider +type BookmarkRelationsClient struct { + BaseClient +} + +// NewBookmarkRelationsClient creates an instance of the BookmarkRelationsClient client. +func NewBookmarkRelationsClient(subscriptionID string) BookmarkRelationsClient { + return NewBookmarkRelationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBookmarkRelationsClientWithBaseURI creates an instance of the BookmarkRelationsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewBookmarkRelationsClientWithBaseURI(baseURI string, subscriptionID string) BookmarkRelationsClient { + return BookmarkRelationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates the bookmark relation. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// bookmarkID - bookmark ID +// relationName - relation Name +// relation - the relation model +func (client BookmarkRelationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, bookmarkID string, relationName string, relation Relation) (result Relation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BookmarkRelationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: relation, + Constraints: []validation.Constraint{{Target: "relation.RelationProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "relation.RelationProperties.RelatedResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("securityinsight.BookmarkRelationsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, bookmarkID, relationName, relation) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.BookmarkRelationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.BookmarkRelationsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.BookmarkRelationsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client BookmarkRelationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, bookmarkID string, relationName string, relation Relation) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "bookmarkId": autorest.Encode("path", bookmarkID), + "relationName": autorest.Encode("path", relationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations/{relationName}", pathParameters), + autorest.WithJSON(relation), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client BookmarkRelationsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client BookmarkRelationsClient) CreateOrUpdateResponder(resp *http.Response) (result Relation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the bookmark relation. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// bookmarkID - bookmark ID +// relationName - relation Name +func (client BookmarkRelationsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, bookmarkID string, relationName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BookmarkRelationsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.BookmarkRelationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, bookmarkID, relationName) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.BookmarkRelationsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "securityinsight.BookmarkRelationsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.BookmarkRelationsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client BookmarkRelationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, bookmarkID string, relationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "bookmarkId": autorest.Encode("path", bookmarkID), + "relationName": autorest.Encode("path", relationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations/{relationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client BookmarkRelationsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client BookmarkRelationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a bookmark relation. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// bookmarkID - bookmark ID +// relationName - relation Name +func (client BookmarkRelationsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, bookmarkID string, relationName string) (result Relation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BookmarkRelationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.BookmarkRelationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, bookmarkID, relationName) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.BookmarkRelationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.BookmarkRelationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.BookmarkRelationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client BookmarkRelationsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, bookmarkID string, relationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "bookmarkId": autorest.Encode("path", bookmarkID), + "relationName": autorest.Encode("path", relationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations/{relationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client BookmarkRelationsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client BookmarkRelationsClient) GetResponder(resp *http.Response) (result Relation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all bookmark relations. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// bookmarkID - bookmark ID +// filter - filters the results, based on a Boolean condition. Optional. +// orderby - sorts the results. Optional. +// top - returns only the first n results. Optional. +// skipToken - skiptoken is only used if a previous operation returned a partial result. If a previous response +// contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that +// specifies a starting point to use for subsequent calls. Optional. +func (client BookmarkRelationsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, bookmarkID string, filter string, orderby string, top *int32, skipToken string) (result RelationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BookmarkRelationsClient.List") + defer func() { + sc := -1 + if result.rl.Response.Response != nil { + sc = result.rl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.BookmarkRelationsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, bookmarkID, filter, orderby, top, skipToken) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.BookmarkRelationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.BookmarkRelationsClient", "List", resp, "Failure sending request") + return + } + + result.rl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.BookmarkRelationsClient", "List", resp, "Failure responding to request") + return + } + if result.rl.hasNextLink() && result.rl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client BookmarkRelationsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, bookmarkID string, filter string, orderby string, top *int32, skipToken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "bookmarkId": autorest.Encode("path", bookmarkID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(skipToken) > 0 { + queryParameters["$skipToken"] = autorest.Encode("query", skipToken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client BookmarkRelationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client BookmarkRelationsClient) ListResponder(resp *http.Response) (result RelationList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client BookmarkRelationsClient) listNextResults(ctx context.Context, lastResults RelationList) (result RelationList, err error) { + req, err := lastResults.relationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "securityinsight.BookmarkRelationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "securityinsight.BookmarkRelationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.BookmarkRelationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client BookmarkRelationsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, bookmarkID string, filter string, orderby string, top *int32, skipToken string) (result RelationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BookmarkRelationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName, bookmarkID, filter, orderby, top, skipToken) + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/bookmarks.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/bookmarks.go new file mode 100644 index 000000000000..c5fd52a771e5 --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/bookmarks.go @@ -0,0 +1,439 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// BookmarksClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider +type BookmarksClient struct { + BaseClient +} + +// NewBookmarksClient creates an instance of the BookmarksClient client. +func NewBookmarksClient(subscriptionID string) BookmarksClient { + return NewBookmarksClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBookmarksClientWithBaseURI creates an instance of the BookmarksClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewBookmarksClientWithBaseURI(baseURI string, subscriptionID string) BookmarksClient { + return BookmarksClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the bookmark. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// bookmarkID - bookmark ID +// bookmark - the bookmark +func (client BookmarksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, bookmarkID string, bookmark Bookmark) (result Bookmark, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BookmarksClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: bookmark, + Constraints: []validation.Constraint{{Target: "bookmark.BookmarkProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "bookmark.BookmarkProperties.DisplayName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "bookmark.BookmarkProperties.Query", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("securityinsight.BookmarksClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, bookmarkID, bookmark) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.BookmarksClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.BookmarksClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.BookmarksClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client BookmarksClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, bookmarkID string, bookmark Bookmark) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "bookmarkId": autorest.Encode("path", bookmarkID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}", pathParameters), + autorest.WithJSON(bookmark), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client BookmarksClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client BookmarksClient) CreateOrUpdateResponder(resp *http.Response) (result Bookmark, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the bookmark. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// bookmarkID - bookmark ID +func (client BookmarksClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, bookmarkID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BookmarksClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.BookmarksClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, bookmarkID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.BookmarksClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "securityinsight.BookmarksClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.BookmarksClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client BookmarksClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, bookmarkID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "bookmarkId": autorest.Encode("path", bookmarkID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client BookmarksClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client BookmarksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a bookmark. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// bookmarkID - bookmark ID +func (client BookmarksClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, bookmarkID string) (result Bookmark, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BookmarksClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.BookmarksClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, bookmarkID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.BookmarksClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.BookmarksClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.BookmarksClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client BookmarksClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, bookmarkID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "bookmarkId": autorest.Encode("path", bookmarkID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client BookmarksClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client BookmarksClient) GetResponder(resp *http.Response) (result Bookmark, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all bookmarks. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +func (client BookmarksClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result BookmarkListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BookmarksClient.List") + defer func() { + sc := -1 + if result.bl.Response.Response != nil { + sc = result.bl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.BookmarksClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.BookmarksClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.bl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.BookmarksClient", "List", resp, "Failure sending request") + return + } + + result.bl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.BookmarksClient", "List", resp, "Failure responding to request") + return + } + if result.bl.hasNextLink() && result.bl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client BookmarksClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client BookmarksClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client BookmarksClient) ListResponder(resp *http.Response) (result BookmarkList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client BookmarksClient) listNextResults(ctx context.Context, lastResults BookmarkList) (result BookmarkList, err error) { + req, err := lastResults.bookmarkListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "securityinsight.BookmarksClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "securityinsight.BookmarksClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.BookmarksClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client BookmarksClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result BookmarkListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BookmarksClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName) + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/client.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/client.go new file mode 100644 index 000000000000..edaa951ba27e --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/client.go @@ -0,0 +1,41 @@ +// Package securityinsight implements the Azure ARM Securityinsight service API version 2022-01-01-preview. +// +// API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Securityinsight + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Securityinsight. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/dataconnectors.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/dataconnectors.go new file mode 100644 index 000000000000..f5e932511016 --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/dataconnectors.go @@ -0,0 +1,615 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DataConnectorsClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider +type DataConnectorsClient struct { + BaseClient +} + +// NewDataConnectorsClient creates an instance of the DataConnectorsClient client. +func NewDataConnectorsClient(subscriptionID string) DataConnectorsClient { + return NewDataConnectorsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDataConnectorsClientWithBaseURI creates an instance of the DataConnectorsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewDataConnectorsClientWithBaseURI(baseURI string, subscriptionID string) DataConnectorsClient { + return DataConnectorsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Connect connects a data connector. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// dataConnectorID - connector ID +// connectBody - the data connector +func (client DataConnectorsClient) Connect(ctx context.Context, resourceGroupName string, workspaceName string, dataConnectorID string, connectBody DataConnectorConnectBody) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataConnectorsClient.Connect") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.DataConnectorsClient", "Connect", err.Error()) + } + + req, err := client.ConnectPreparer(ctx, resourceGroupName, workspaceName, dataConnectorID, connectBody) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.DataConnectorsClient", "Connect", nil, "Failure preparing request") + return + } + + resp, err := client.ConnectSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "securityinsight.DataConnectorsClient", "Connect", resp, "Failure sending request") + return + } + + result, err = client.ConnectResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.DataConnectorsClient", "Connect", resp, "Failure responding to request") + return + } + + return +} + +// ConnectPreparer prepares the Connect request. +func (client DataConnectorsClient) ConnectPreparer(ctx context.Context, resourceGroupName string, workspaceName string, dataConnectorID string, connectBody DataConnectorConnectBody) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataConnectorId": autorest.Encode("path", dataConnectorID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}/connect", pathParameters), + autorest.WithJSON(connectBody), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ConnectSender sends the Connect request. The method will close the +// http.Response Body if it receives an error. +func (client DataConnectorsClient) ConnectSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ConnectResponder handles the response to the Connect request. The method always +// closes the http.Response Body. +func (client DataConnectorsClient) ConnectResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdate creates or updates the data connector. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// dataConnectorID - connector ID +// dataConnector - the data connector +func (client DataConnectorsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, dataConnectorID string, dataConnector BasicDataConnector) (result DataConnectorModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataConnectorsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.DataConnectorsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, dataConnectorID, dataConnector) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.DataConnectorsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.DataConnectorsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.DataConnectorsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DataConnectorsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, dataConnectorID string, dataConnector BasicDataConnector) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataConnectorId": autorest.Encode("path", dataConnectorID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}", pathParameters), + autorest.WithJSON(dataConnector), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DataConnectorsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DataConnectorsClient) CreateOrUpdateResponder(resp *http.Response) (result DataConnectorModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the data connector. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// dataConnectorID - connector ID +func (client DataConnectorsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, dataConnectorID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataConnectorsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.DataConnectorsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, dataConnectorID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.DataConnectorsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "securityinsight.DataConnectorsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.DataConnectorsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DataConnectorsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, dataConnectorID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataConnectorId": autorest.Encode("path", dataConnectorID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DataConnectorsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DataConnectorsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Disconnect disconnect a data connector. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// dataConnectorID - connector ID +func (client DataConnectorsClient) Disconnect(ctx context.Context, resourceGroupName string, workspaceName string, dataConnectorID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataConnectorsClient.Disconnect") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.DataConnectorsClient", "Disconnect", err.Error()) + } + + req, err := client.DisconnectPreparer(ctx, resourceGroupName, workspaceName, dataConnectorID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.DataConnectorsClient", "Disconnect", nil, "Failure preparing request") + return + } + + resp, err := client.DisconnectSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "securityinsight.DataConnectorsClient", "Disconnect", resp, "Failure sending request") + return + } + + result, err = client.DisconnectResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.DataConnectorsClient", "Disconnect", resp, "Failure responding to request") + return + } + + return +} + +// DisconnectPreparer prepares the Disconnect request. +func (client DataConnectorsClient) DisconnectPreparer(ctx context.Context, resourceGroupName string, workspaceName string, dataConnectorID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataConnectorId": autorest.Encode("path", dataConnectorID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}/disconnect", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DisconnectSender sends the Disconnect request. The method will close the +// http.Response Body if it receives an error. +func (client DataConnectorsClient) DisconnectSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DisconnectResponder handles the response to the Disconnect request. The method always +// closes the http.Response Body. +func (client DataConnectorsClient) DisconnectResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a data connector. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// dataConnectorID - connector ID +func (client DataConnectorsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, dataConnectorID string) (result DataConnectorModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataConnectorsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.DataConnectorsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, dataConnectorID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.DataConnectorsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.DataConnectorsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.DataConnectorsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client DataConnectorsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, dataConnectorID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataConnectorId": autorest.Encode("path", dataConnectorID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DataConnectorsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DataConnectorsClient) GetResponder(resp *http.Response) (result DataConnectorModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all data connectors. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +func (client DataConnectorsClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result DataConnectorListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataConnectorsClient.List") + defer func() { + sc := -1 + if result.dcl.Response.Response != nil { + sc = result.dcl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.DataConnectorsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.DataConnectorsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.dcl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.DataConnectorsClient", "List", resp, "Failure sending request") + return + } + + result.dcl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.DataConnectorsClient", "List", resp, "Failure responding to request") + return + } + if result.dcl.hasNextLink() && result.dcl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client DataConnectorsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DataConnectorsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DataConnectorsClient) ListResponder(resp *http.Response) (result DataConnectorList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client DataConnectorsClient) listNextResults(ctx context.Context, lastResults DataConnectorList) (result DataConnectorList, err error) { + req, err := lastResults.dataConnectorListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "securityinsight.DataConnectorsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "securityinsight.DataConnectorsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.DataConnectorsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client DataConnectorsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result DataConnectorListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataConnectorsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName) + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/dataconnectorscheckrequirements.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/dataconnectorscheckrequirements.go new file mode 100644 index 000000000000..6550458d1f65 --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/dataconnectorscheckrequirements.go @@ -0,0 +1,125 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DataConnectorsCheckRequirementsClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) +// resource provider +type DataConnectorsCheckRequirementsClient struct { + BaseClient +} + +// NewDataConnectorsCheckRequirementsClient creates an instance of the DataConnectorsCheckRequirementsClient client. +func NewDataConnectorsCheckRequirementsClient(subscriptionID string) DataConnectorsCheckRequirementsClient { + return NewDataConnectorsCheckRequirementsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDataConnectorsCheckRequirementsClientWithBaseURI creates an instance of the DataConnectorsCheckRequirementsClient +// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI +// (sovereign clouds, Azure stack). +func NewDataConnectorsCheckRequirementsClientWithBaseURI(baseURI string, subscriptionID string) DataConnectorsCheckRequirementsClient { + return DataConnectorsCheckRequirementsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Post get requirements state for a data connector type. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// dataConnectorsCheckRequirements - the parameters for requirements check message +func (client DataConnectorsCheckRequirementsClient) Post(ctx context.Context, resourceGroupName string, workspaceName string, dataConnectorsCheckRequirements BasicDataConnectorsCheckRequirements) (result DataConnectorRequirementsState, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataConnectorsCheckRequirementsClient.Post") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.DataConnectorsCheckRequirementsClient", "Post", err.Error()) + } + + req, err := client.PostPreparer(ctx, resourceGroupName, workspaceName, dataConnectorsCheckRequirements) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.DataConnectorsCheckRequirementsClient", "Post", nil, "Failure preparing request") + return + } + + resp, err := client.PostSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.DataConnectorsCheckRequirementsClient", "Post", resp, "Failure sending request") + return + } + + result, err = client.PostResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.DataConnectorsCheckRequirementsClient", "Post", resp, "Failure responding to request") + return + } + + return +} + +// PostPreparer prepares the Post request. +func (client DataConnectorsCheckRequirementsClient) PostPreparer(ctx context.Context, resourceGroupName string, workspaceName string, dataConnectorsCheckRequirements BasicDataConnectorsCheckRequirements) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectorsCheckRequirements", pathParameters), + autorest.WithJSON(dataConnectorsCheckRequirements), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PostSender sends the Post request. The method will close the +// http.Response Body if it receives an error. +func (client DataConnectorsCheckRequirementsClient) PostSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// PostResponder handles the response to the Post request. The method always +// closes the http.Response Body. +func (client DataConnectorsCheckRequirementsClient) PostResponder(resp *http.Response) (result DataConnectorRequirementsState, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/domainwhois.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/domainwhois.go new file mode 100644 index 000000000000..7353701f4750 --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/domainwhois.go @@ -0,0 +1,117 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DomainWhoisClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider +type DomainWhoisClient struct { + BaseClient +} + +// NewDomainWhoisClient creates an instance of the DomainWhoisClient client. +func NewDomainWhoisClient(subscriptionID string) DomainWhoisClient { + return NewDomainWhoisClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDomainWhoisClientWithBaseURI creates an instance of the DomainWhoisClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewDomainWhoisClientWithBaseURI(baseURI string, subscriptionID string) DomainWhoisClient { + return DomainWhoisClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get whois information for a single domain name +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// domain - domain name to be enriched +func (client DomainWhoisClient) Get(ctx context.Context, resourceGroupName string, domain string) (result EnrichmentDomainWhois, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainWhoisClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.DomainWhoisClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, domain) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.DomainWhoisClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.DomainWhoisClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.DomainWhoisClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client DomainWhoisClient) GetPreparer(ctx context.Context, resourceGroupName string, domain string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "domain": autorest.Encode("query", domain), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityInsights/enrichment/domain/whois/", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DomainWhoisClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DomainWhoisClient) GetResponder(resp *http.Response) (result EnrichmentDomainWhois, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/entities.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/entities.go new file mode 100644 index 000000000000..89c5c9a4726b --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/entities.go @@ -0,0 +1,532 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// EntitiesClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider +type EntitiesClient struct { + BaseClient +} + +// NewEntitiesClient creates an instance of the EntitiesClient client. +func NewEntitiesClient(subscriptionID string) EntitiesClient { + return NewEntitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEntitiesClientWithBaseURI creates an instance of the EntitiesClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewEntitiesClientWithBaseURI(baseURI string, subscriptionID string) EntitiesClient { + return EntitiesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Expand expands an entity. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// entityID - entity ID +// parameters - the parameters required to execute an expand operation on the given entity. +func (client EntitiesClient) Expand(ctx context.Context, resourceGroupName string, workspaceName string, entityID string, parameters EntityExpandParameters) (result EntityExpandResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EntitiesClient.Expand") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.EntitiesClient", "Expand", err.Error()) + } + + req, err := client.ExpandPreparer(ctx, resourceGroupName, workspaceName, entityID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntitiesClient", "Expand", nil, "Failure preparing request") + return + } + + resp, err := client.ExpandSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.EntitiesClient", "Expand", resp, "Failure sending request") + return + } + + result, err = client.ExpandResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntitiesClient", "Expand", resp, "Failure responding to request") + return + } + + return +} + +// ExpandPreparer prepares the Expand request. +func (client EntitiesClient) ExpandPreparer(ctx context.Context, resourceGroupName string, workspaceName string, entityID string, parameters EntityExpandParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityId": autorest.Encode("path", entityID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/expand", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ExpandSender sends the Expand request. The method will close the +// http.Response Body if it receives an error. +func (client EntitiesClient) ExpandSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ExpandResponder handles the response to the Expand request. The method always +// closes the http.Response Body. +func (client EntitiesClient) ExpandResponder(resp *http.Response) (result EntityExpandResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets an entity. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// entityID - entity ID +func (client EntitiesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, entityID string) (result EntityModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EntitiesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.EntitiesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, entityID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntitiesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.EntitiesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntitiesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client EntitiesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, entityID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityId": autorest.Encode("path", entityID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client EntitiesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client EntitiesClient) GetResponder(resp *http.Response) (result EntityModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetInsights execute Insights for an entity. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// entityID - entity ID +// parameters - the parameters required to execute insights on the given entity. +func (client EntitiesClient) GetInsights(ctx context.Context, resourceGroupName string, workspaceName string, entityID string, parameters EntityGetInsightsParameters) (result EntityGetInsightsResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EntitiesClient.GetInsights") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.StartTime", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.EndTime", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.EntitiesClient", "GetInsights", err.Error()) + } + + req, err := client.GetInsightsPreparer(ctx, resourceGroupName, workspaceName, entityID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntitiesClient", "GetInsights", nil, "Failure preparing request") + return + } + + resp, err := client.GetInsightsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.EntitiesClient", "GetInsights", resp, "Failure sending request") + return + } + + result, err = client.GetInsightsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntitiesClient", "GetInsights", resp, "Failure responding to request") + return + } + + return +} + +// GetInsightsPreparer prepares the GetInsights request. +func (client EntitiesClient) GetInsightsPreparer(ctx context.Context, resourceGroupName string, workspaceName string, entityID string, parameters EntityGetInsightsParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityId": autorest.Encode("path", entityID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/getInsights", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetInsightsSender sends the GetInsights request. The method will close the +// http.Response Body if it receives an error. +func (client EntitiesClient) GetInsightsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetInsightsResponder handles the response to the GetInsights request. The method always +// closes the http.Response Body. +func (client EntitiesClient) GetInsightsResponder(resp *http.Response) (result EntityGetInsightsResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all entities. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +func (client EntitiesClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result EntityListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EntitiesClient.List") + defer func() { + sc := -1 + if result.el.Response.Response != nil { + sc = result.el.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.EntitiesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntitiesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.el.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.EntitiesClient", "List", resp, "Failure sending request") + return + } + + result.el, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntitiesClient", "List", resp, "Failure responding to request") + return + } + if result.el.hasNextLink() && result.el.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client EntitiesClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client EntitiesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client EntitiesClient) ListResponder(resp *http.Response) (result EntityList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client EntitiesClient) listNextResults(ctx context.Context, lastResults EntityList) (result EntityList, err error) { + req, err := lastResults.entityListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "securityinsight.EntitiesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "securityinsight.EntitiesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntitiesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client EntitiesClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result EntityListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EntitiesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName) + return +} + +// Queries get Insights and Activities for an entity. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// entityID - entity ID +func (client EntitiesClient) Queries(ctx context.Context, resourceGroupName string, workspaceName string, entityID string) (result GetQueriesResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EntitiesClient.Queries") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.EntitiesClient", "Queries", err.Error()) + } + + req, err := client.QueriesPreparer(ctx, resourceGroupName, workspaceName, entityID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntitiesClient", "Queries", nil, "Failure preparing request") + return + } + + resp, err := client.QueriesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.EntitiesClient", "Queries", resp, "Failure sending request") + return + } + + result, err = client.QueriesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntitiesClient", "Queries", resp, "Failure responding to request") + return + } + + return +} + +// QueriesPreparer prepares the Queries request. +func (client EntitiesClient) QueriesPreparer(ctx context.Context, resourceGroupName string, workspaceName string, entityID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityId": autorest.Encode("path", entityID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "kind": autorest.Encode("query", "Insight"), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/queries", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// QueriesSender sends the Queries request. The method will close the +// http.Response Body if it receives an error. +func (client EntitiesClient) QueriesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// QueriesResponder handles the response to the Queries request. The method always +// closes the http.Response Body. +func (client EntitiesClient) QueriesResponder(resp *http.Response) (result GetQueriesResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/entitiesgettimeline.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/entitiesgettimeline.go new file mode 100644 index 000000000000..7bf337727df4 --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/entitiesgettimeline.go @@ -0,0 +1,129 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// EntitiesGetTimelineClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider +type EntitiesGetTimelineClient struct { + BaseClient +} + +// NewEntitiesGetTimelineClient creates an instance of the EntitiesGetTimelineClient client. +func NewEntitiesGetTimelineClient(subscriptionID string) EntitiesGetTimelineClient { + return NewEntitiesGetTimelineClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEntitiesGetTimelineClientWithBaseURI creates an instance of the EntitiesGetTimelineClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewEntitiesGetTimelineClientWithBaseURI(baseURI string, subscriptionID string) EntitiesGetTimelineClient { + return EntitiesGetTimelineClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List timeline for an entity. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// entityID - entity ID +// parameters - the parameters required to execute an timeline operation on the given entity. +func (client EntitiesGetTimelineClient) List(ctx context.Context, resourceGroupName string, workspaceName string, entityID string, parameters EntityTimelineParameters) (result EntityTimelineResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EntitiesGetTimelineClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.StartTime", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.EndTime", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.EntitiesGetTimelineClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, entityID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntitiesGetTimelineClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.EntitiesGetTimelineClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntitiesGetTimelineClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client EntitiesGetTimelineClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, entityID string, parameters EntityTimelineParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityId": autorest.Encode("path", entityID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/getTimeline", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client EntitiesGetTimelineClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client EntitiesGetTimelineClient) ListResponder(resp *http.Response) (result EntityTimelineResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/entitiesrelations.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/entitiesrelations.go new file mode 100644 index 000000000000..e2b8891cc47d --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/entitiesrelations.go @@ -0,0 +1,183 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// EntitiesRelationsClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider +type EntitiesRelationsClient struct { + BaseClient +} + +// NewEntitiesRelationsClient creates an instance of the EntitiesRelationsClient client. +func NewEntitiesRelationsClient(subscriptionID string) EntitiesRelationsClient { + return NewEntitiesRelationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEntitiesRelationsClientWithBaseURI creates an instance of the EntitiesRelationsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewEntitiesRelationsClientWithBaseURI(baseURI string, subscriptionID string) EntitiesRelationsClient { + return EntitiesRelationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets all relations of an entity. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// entityID - entity ID +// filter - filters the results, based on a Boolean condition. Optional. +// orderby - sorts the results. Optional. +// top - returns only the first n results. Optional. +// skipToken - skiptoken is only used if a previous operation returned a partial result. If a previous response +// contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that +// specifies a starting point to use for subsequent calls. Optional. +func (client EntitiesRelationsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, entityID string, filter string, orderby string, top *int32, skipToken string) (result RelationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EntitiesRelationsClient.List") + defer func() { + sc := -1 + if result.rl.Response.Response != nil { + sc = result.rl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.EntitiesRelationsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, entityID, filter, orderby, top, skipToken) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntitiesRelationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.EntitiesRelationsClient", "List", resp, "Failure sending request") + return + } + + result.rl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntitiesRelationsClient", "List", resp, "Failure responding to request") + return + } + if result.rl.hasNextLink() && result.rl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client EntitiesRelationsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, entityID string, filter string, orderby string, top *int32, skipToken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityId": autorest.Encode("path", entityID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(skipToken) > 0 { + queryParameters["$skipToken"] = autorest.Encode("query", skipToken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/relations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client EntitiesRelationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client EntitiesRelationsClient) ListResponder(resp *http.Response) (result RelationList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client EntitiesRelationsClient) listNextResults(ctx context.Context, lastResults RelationList) (result RelationList, err error) { + req, err := lastResults.relationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "securityinsight.EntitiesRelationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "securityinsight.EntitiesRelationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntitiesRelationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client EntitiesRelationsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, entityID string, filter string, orderby string, top *int32, skipToken string) (result RelationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EntitiesRelationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName, entityID, filter, orderby, top, skipToken) + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/entityqueries.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/entityqueries.go new file mode 100644 index 000000000000..e14d1b9cb016 --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/entityqueries.go @@ -0,0 +1,438 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// EntityQueriesClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider +type EntityQueriesClient struct { + BaseClient +} + +// NewEntityQueriesClient creates an instance of the EntityQueriesClient client. +func NewEntityQueriesClient(subscriptionID string) EntityQueriesClient { + return NewEntityQueriesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEntityQueriesClientWithBaseURI creates an instance of the EntityQueriesClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewEntityQueriesClientWithBaseURI(baseURI string, subscriptionID string) EntityQueriesClient { + return EntityQueriesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the entity query. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// entityQueryID - entity query ID +// entityQuery - the entity query we want to create or update +func (client EntityQueriesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, entityQueryID string, entityQuery BasicCustomEntityQuery) (result EntityQueryModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EntityQueriesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.EntityQueriesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, entityQueryID, entityQuery) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntityQueriesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.EntityQueriesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntityQueriesClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client EntityQueriesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, entityQueryID string, entityQuery BasicCustomEntityQuery) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityQueryId": autorest.Encode("path", entityQueryID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries/{entityQueryId}", pathParameters), + autorest.WithJSON(entityQuery), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client EntityQueriesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client EntityQueriesClient) CreateOrUpdateResponder(resp *http.Response) (result EntityQueryModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the entity query. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// entityQueryID - entity query ID +func (client EntityQueriesClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, entityQueryID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EntityQueriesClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.EntityQueriesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, entityQueryID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntityQueriesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "securityinsight.EntityQueriesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntityQueriesClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client EntityQueriesClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, entityQueryID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityQueryId": autorest.Encode("path", entityQueryID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries/{entityQueryId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client EntityQueriesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client EntityQueriesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an entity query. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// entityQueryID - entity query ID +func (client EntityQueriesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, entityQueryID string) (result EntityQueryModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EntityQueriesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.EntityQueriesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, entityQueryID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntityQueriesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.EntityQueriesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntityQueriesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client EntityQueriesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, entityQueryID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityQueryId": autorest.Encode("path", entityQueryID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries/{entityQueryId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client EntityQueriesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client EntityQueriesClient) GetResponder(resp *http.Response) (result EntityQueryModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all entity queries. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// kind - the entity query kind we want to fetch +func (client EntityQueriesClient) List(ctx context.Context, resourceGroupName string, workspaceName string, kind string) (result EntityQueryListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EntityQueriesClient.List") + defer func() { + sc := -1 + if result.eql.Response.Response != nil { + sc = result.eql.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.EntityQueriesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, kind) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntityQueriesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.eql.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.EntityQueriesClient", "List", resp, "Failure sending request") + return + } + + result.eql, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntityQueriesClient", "List", resp, "Failure responding to request") + return + } + if result.eql.hasNextLink() && result.eql.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client EntityQueriesClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, kind string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(string(kind)) > 0 { + queryParameters["kind"] = autorest.Encode("query", kind) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client EntityQueriesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client EntityQueriesClient) ListResponder(resp *http.Response) (result EntityQueryList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client EntityQueriesClient) listNextResults(ctx context.Context, lastResults EntityQueryList) (result EntityQueryList, err error) { + req, err := lastResults.entityQueryListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "securityinsight.EntityQueriesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "securityinsight.EntityQueriesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntityQueriesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client EntityQueriesClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, kind string) (result EntityQueryListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EntityQueriesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName, kind) + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/entityquerytemplates.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/entityquerytemplates.go new file mode 100644 index 000000000000..801759b44361 --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/entityquerytemplates.go @@ -0,0 +1,258 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// EntityQueryTemplatesClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) resource +// provider +type EntityQueryTemplatesClient struct { + BaseClient +} + +// NewEntityQueryTemplatesClient creates an instance of the EntityQueryTemplatesClient client. +func NewEntityQueryTemplatesClient(subscriptionID string) EntityQueryTemplatesClient { + return NewEntityQueryTemplatesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEntityQueryTemplatesClientWithBaseURI creates an instance of the EntityQueryTemplatesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewEntityQueryTemplatesClientWithBaseURI(baseURI string, subscriptionID string) EntityQueryTemplatesClient { + return EntityQueryTemplatesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets an entity query. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// entityQueryTemplateID - entity query template ID +func (client EntityQueryTemplatesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, entityQueryTemplateID string) (result EntityQueryTemplateModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EntityQueryTemplatesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.EntityQueryTemplatesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, entityQueryTemplateID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntityQueryTemplatesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.EntityQueryTemplatesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntityQueryTemplatesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client EntityQueryTemplatesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, entityQueryTemplateID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityQueryTemplateId": autorest.Encode("path", entityQueryTemplateID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueryTemplates/{entityQueryTemplateId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client EntityQueryTemplatesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client EntityQueryTemplatesClient) GetResponder(resp *http.Response) (result EntityQueryTemplateModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all entity query templates. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// kind - the entity template query kind we want to fetch +func (client EntityQueryTemplatesClient) List(ctx context.Context, resourceGroupName string, workspaceName string, kind string) (result EntityQueryTemplateListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EntityQueryTemplatesClient.List") + defer func() { + sc := -1 + if result.eqtl.Response.Response != nil { + sc = result.eqtl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.EntityQueryTemplatesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, kind) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntityQueryTemplatesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.eqtl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.EntityQueryTemplatesClient", "List", resp, "Failure sending request") + return + } + + result.eqtl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntityQueryTemplatesClient", "List", resp, "Failure responding to request") + return + } + if result.eqtl.hasNextLink() && result.eqtl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client EntityQueryTemplatesClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, kind string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(string(kind)) > 0 { + queryParameters["kind"] = autorest.Encode("query", kind) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueryTemplates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client EntityQueryTemplatesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client EntityQueryTemplatesClient) ListResponder(resp *http.Response) (result EntityQueryTemplateList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client EntityQueryTemplatesClient) listNextResults(ctx context.Context, lastResults EntityQueryTemplateList) (result EntityQueryTemplateList, err error) { + req, err := lastResults.entityQueryTemplateListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "securityinsight.EntityQueryTemplatesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "securityinsight.EntityQueryTemplatesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntityQueryTemplatesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client EntityQueryTemplatesClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, kind string) (result EntityQueryTemplateListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EntityQueryTemplatesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName, kind) + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/entityrelations.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/entityrelations.go new file mode 100644 index 000000000000..730e2fa4078b --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/entityrelations.go @@ -0,0 +1,124 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// EntityRelationsClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider +type EntityRelationsClient struct { + BaseClient +} + +// NewEntityRelationsClient creates an instance of the EntityRelationsClient client. +func NewEntityRelationsClient(subscriptionID string) EntityRelationsClient { + return NewEntityRelationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEntityRelationsClientWithBaseURI creates an instance of the EntityRelationsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewEntityRelationsClientWithBaseURI(baseURI string, subscriptionID string) EntityRelationsClient { + return EntityRelationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GetRelation gets an entity relation. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// entityID - entity ID +// relationName - relation Name +func (client EntityRelationsClient) GetRelation(ctx context.Context, resourceGroupName string, workspaceName string, entityID string, relationName string) (result Relation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EntityRelationsClient.GetRelation") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.EntityRelationsClient", "GetRelation", err.Error()) + } + + req, err := client.GetRelationPreparer(ctx, resourceGroupName, workspaceName, entityID, relationName) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntityRelationsClient", "GetRelation", nil, "Failure preparing request") + return + } + + resp, err := client.GetRelationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.EntityRelationsClient", "GetRelation", resp, "Failure sending request") + return + } + + result, err = client.GetRelationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.EntityRelationsClient", "GetRelation", resp, "Failure responding to request") + return + } + + return +} + +// GetRelationPreparer prepares the GetRelation request. +func (client EntityRelationsClient) GetRelationPreparer(ctx context.Context, resourceGroupName string, workspaceName string, entityID string, relationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityId": autorest.Encode("path", entityID), + "relationName": autorest.Encode("path", relationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/relations/{relationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetRelationSender sends the GetRelation request. The method will close the +// http.Response Body if it receives an error. +func (client EntityRelationsClient) GetRelationSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetRelationResponder handles the response to the GetRelation request. The method always +// closes the http.Response Body. +func (client EntityRelationsClient) GetRelationResponder(resp *http.Response) (result Relation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/enums.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/enums.go new file mode 100644 index 000000000000..1e78a023bb32 --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/enums.go @@ -0,0 +1,1934 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +// ActionType enumerates the values for action type. +type ActionType string + +const ( + // ActionTypeModifyProperties Modify an object's properties + ActionTypeModifyProperties ActionType = "ModifyProperties" + // ActionTypeRunPlaybook Run a playbook on an object + ActionTypeRunPlaybook ActionType = "RunPlaybook" +) + +// PossibleActionTypeValues returns an array of possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ActionTypeModifyProperties, ActionTypeRunPlaybook} +} + +// ActionTypeBasicAutomationRuleAction enumerates the values for action type basic automation rule action. +type ActionTypeBasicAutomationRuleAction string + +const ( + // ActionTypeBasicAutomationRuleActionActionTypeAutomationRuleAction ... + ActionTypeBasicAutomationRuleActionActionTypeAutomationRuleAction ActionTypeBasicAutomationRuleAction = "AutomationRuleAction" + // ActionTypeBasicAutomationRuleActionActionTypeModifyProperties ... + ActionTypeBasicAutomationRuleActionActionTypeModifyProperties ActionTypeBasicAutomationRuleAction = "ModifyProperties" + // ActionTypeBasicAutomationRuleActionActionTypeRunPlaybook ... + ActionTypeBasicAutomationRuleActionActionTypeRunPlaybook ActionTypeBasicAutomationRuleAction = "RunPlaybook" +) + +// PossibleActionTypeBasicAutomationRuleActionValues returns an array of possible values for the ActionTypeBasicAutomationRuleAction const type. +func PossibleActionTypeBasicAutomationRuleActionValues() []ActionTypeBasicAutomationRuleAction { + return []ActionTypeBasicAutomationRuleAction{ActionTypeBasicAutomationRuleActionActionTypeAutomationRuleAction, ActionTypeBasicAutomationRuleActionActionTypeModifyProperties, ActionTypeBasicAutomationRuleActionActionTypeRunPlaybook} +} + +// AlertDetail enumerates the values for alert detail. +type AlertDetail string + +const ( + // AlertDetailDisplayName Alert display name + AlertDetailDisplayName AlertDetail = "DisplayName" + // AlertDetailSeverity Alert severity + AlertDetailSeverity AlertDetail = "Severity" +) + +// PossibleAlertDetailValues returns an array of possible values for the AlertDetail const type. +func PossibleAlertDetailValues() []AlertDetail { + return []AlertDetail{AlertDetailDisplayName, AlertDetailSeverity} +} + +// AlertRuleKind enumerates the values for alert rule kind. +type AlertRuleKind string + +const ( + // AlertRuleKindFusion ... + AlertRuleKindFusion AlertRuleKind = "Fusion" + // AlertRuleKindMicrosoftSecurityIncidentCreation ... + AlertRuleKindMicrosoftSecurityIncidentCreation AlertRuleKind = "MicrosoftSecurityIncidentCreation" + // AlertRuleKindMLBehaviorAnalytics ... + AlertRuleKindMLBehaviorAnalytics AlertRuleKind = "MLBehaviorAnalytics" + // AlertRuleKindNRT ... + AlertRuleKindNRT AlertRuleKind = "NRT" + // AlertRuleKindScheduled ... + AlertRuleKindScheduled AlertRuleKind = "Scheduled" + // AlertRuleKindThreatIntelligence ... + AlertRuleKindThreatIntelligence AlertRuleKind = "ThreatIntelligence" +) + +// PossibleAlertRuleKindValues returns an array of possible values for the AlertRuleKind const type. +func PossibleAlertRuleKindValues() []AlertRuleKind { + return []AlertRuleKind{AlertRuleKindFusion, AlertRuleKindMicrosoftSecurityIncidentCreation, AlertRuleKindMLBehaviorAnalytics, AlertRuleKindNRT, AlertRuleKindScheduled, AlertRuleKindThreatIntelligence} +} + +// AlertSeverity enumerates the values for alert severity. +type AlertSeverity string + +const ( + // AlertSeverityHigh High severity + AlertSeverityHigh AlertSeverity = "High" + // AlertSeverityInformational Informational severity + AlertSeverityInformational AlertSeverity = "Informational" + // AlertSeverityLow Low severity + AlertSeverityLow AlertSeverity = "Low" + // AlertSeverityMedium Medium severity + AlertSeverityMedium AlertSeverity = "Medium" +) + +// PossibleAlertSeverityValues returns an array of possible values for the AlertSeverity const type. +func PossibleAlertSeverityValues() []AlertSeverity { + return []AlertSeverity{AlertSeverityHigh, AlertSeverityInformational, AlertSeverityLow, AlertSeverityMedium} +} + +// AlertStatus enumerates the values for alert status. +type AlertStatus string + +const ( + // AlertStatusDismissed Alert dismissed as false positive + AlertStatusDismissed AlertStatus = "Dismissed" + // AlertStatusInProgress Alert is being handled + AlertStatusInProgress AlertStatus = "InProgress" + // AlertStatusNew New alert + AlertStatusNew AlertStatus = "New" + // AlertStatusResolved Alert closed after handling + AlertStatusResolved AlertStatus = "Resolved" + // AlertStatusUnknown Unknown value + AlertStatusUnknown AlertStatus = "Unknown" +) + +// PossibleAlertStatusValues returns an array of possible values for the AlertStatus const type. +func PossibleAlertStatusValues() []AlertStatus { + return []AlertStatus{AlertStatusDismissed, AlertStatusInProgress, AlertStatusNew, AlertStatusResolved, AlertStatusUnknown} +} + +// AntispamMailDirection enumerates the values for antispam mail direction. +type AntispamMailDirection string + +const ( + // AntispamMailDirectionInbound Inbound + AntispamMailDirectionInbound AntispamMailDirection = "Inbound" + // AntispamMailDirectionIntraorg Intraorg + AntispamMailDirectionIntraorg AntispamMailDirection = "Intraorg" + // AntispamMailDirectionOutbound Outbound + AntispamMailDirectionOutbound AntispamMailDirection = "Outbound" + // AntispamMailDirectionUnknown Unknown + AntispamMailDirectionUnknown AntispamMailDirection = "Unknown" +) + +// PossibleAntispamMailDirectionValues returns an array of possible values for the AntispamMailDirection const type. +func PossibleAntispamMailDirectionValues() []AntispamMailDirection { + return []AntispamMailDirection{AntispamMailDirectionInbound, AntispamMailDirectionIntraorg, AntispamMailDirectionOutbound, AntispamMailDirectionUnknown} +} + +// AttackTactic enumerates the values for attack tactic. +type AttackTactic string + +const ( + // AttackTacticCollection ... + AttackTacticCollection AttackTactic = "Collection" + // AttackTacticCommandAndControl ... + AttackTacticCommandAndControl AttackTactic = "CommandAndControl" + // AttackTacticCredentialAccess ... + AttackTacticCredentialAccess AttackTactic = "CredentialAccess" + // AttackTacticDefenseEvasion ... + AttackTacticDefenseEvasion AttackTactic = "DefenseEvasion" + // AttackTacticDiscovery ... + AttackTacticDiscovery AttackTactic = "Discovery" + // AttackTacticExecution ... + AttackTacticExecution AttackTactic = "Execution" + // AttackTacticExfiltration ... + AttackTacticExfiltration AttackTactic = "Exfiltration" + // AttackTacticImpact ... + AttackTacticImpact AttackTactic = "Impact" + // AttackTacticImpairProcessControl ... + AttackTacticImpairProcessControl AttackTactic = "ImpairProcessControl" + // AttackTacticInhibitResponseFunction ... + AttackTacticInhibitResponseFunction AttackTactic = "InhibitResponseFunction" + // AttackTacticInitialAccess ... + AttackTacticInitialAccess AttackTactic = "InitialAccess" + // AttackTacticLateralMovement ... + AttackTacticLateralMovement AttackTactic = "LateralMovement" + // AttackTacticPersistence ... + AttackTacticPersistence AttackTactic = "Persistence" + // AttackTacticPreAttack ... + AttackTacticPreAttack AttackTactic = "PreAttack" + // AttackTacticPrivilegeEscalation ... + AttackTacticPrivilegeEscalation AttackTactic = "PrivilegeEscalation" + // AttackTacticReconnaissance ... + AttackTacticReconnaissance AttackTactic = "Reconnaissance" + // AttackTacticResourceDevelopment ... + AttackTacticResourceDevelopment AttackTactic = "ResourceDevelopment" +) + +// PossibleAttackTacticValues returns an array of possible values for the AttackTactic const type. +func PossibleAttackTacticValues() []AttackTactic { + return []AttackTactic{AttackTacticCollection, AttackTacticCommandAndControl, AttackTacticCredentialAccess, AttackTacticDefenseEvasion, AttackTacticDiscovery, AttackTacticExecution, AttackTacticExfiltration, AttackTacticImpact, AttackTacticImpairProcessControl, AttackTacticInhibitResponseFunction, AttackTacticInitialAccess, AttackTacticLateralMovement, AttackTacticPersistence, AttackTacticPreAttack, AttackTacticPrivilegeEscalation, AttackTacticReconnaissance, AttackTacticResourceDevelopment} +} + +// AutomationRulePropertyConditionSupportedOperator enumerates the values for automation rule property +// condition supported operator. +type AutomationRulePropertyConditionSupportedOperator string + +const ( + // AutomationRulePropertyConditionSupportedOperatorContains Evaluates if the property contains at least one + // of the condition values + AutomationRulePropertyConditionSupportedOperatorContains AutomationRulePropertyConditionSupportedOperator = "Contains" + // AutomationRulePropertyConditionSupportedOperatorEndsWith Evaluates if the property ends with any of the + // condition values + AutomationRulePropertyConditionSupportedOperatorEndsWith AutomationRulePropertyConditionSupportedOperator = "EndsWith" + // AutomationRulePropertyConditionSupportedOperatorEquals Evaluates if the property equals at least one of + // the condition values + AutomationRulePropertyConditionSupportedOperatorEquals AutomationRulePropertyConditionSupportedOperator = "Equals" + // AutomationRulePropertyConditionSupportedOperatorNotContains Evaluates if the property does not contain + // any of the condition values + AutomationRulePropertyConditionSupportedOperatorNotContains AutomationRulePropertyConditionSupportedOperator = "NotContains" + // AutomationRulePropertyConditionSupportedOperatorNotEndsWith Evaluates if the property does not end with + // any of the condition values + AutomationRulePropertyConditionSupportedOperatorNotEndsWith AutomationRulePropertyConditionSupportedOperator = "NotEndsWith" + // AutomationRulePropertyConditionSupportedOperatorNotEquals Evaluates if the property does not equal any + // of the condition values + AutomationRulePropertyConditionSupportedOperatorNotEquals AutomationRulePropertyConditionSupportedOperator = "NotEquals" + // AutomationRulePropertyConditionSupportedOperatorNotStartsWith Evaluates if the property does not start + // with any of the condition values + AutomationRulePropertyConditionSupportedOperatorNotStartsWith AutomationRulePropertyConditionSupportedOperator = "NotStartsWith" + // AutomationRulePropertyConditionSupportedOperatorStartsWith Evaluates if the property starts with any of + // the condition values + AutomationRulePropertyConditionSupportedOperatorStartsWith AutomationRulePropertyConditionSupportedOperator = "StartsWith" +) + +// PossibleAutomationRulePropertyConditionSupportedOperatorValues returns an array of possible values for the AutomationRulePropertyConditionSupportedOperator const type. +func PossibleAutomationRulePropertyConditionSupportedOperatorValues() []AutomationRulePropertyConditionSupportedOperator { + return []AutomationRulePropertyConditionSupportedOperator{AutomationRulePropertyConditionSupportedOperatorContains, AutomationRulePropertyConditionSupportedOperatorEndsWith, AutomationRulePropertyConditionSupportedOperatorEquals, AutomationRulePropertyConditionSupportedOperatorNotContains, AutomationRulePropertyConditionSupportedOperatorNotEndsWith, AutomationRulePropertyConditionSupportedOperatorNotEquals, AutomationRulePropertyConditionSupportedOperatorNotStartsWith, AutomationRulePropertyConditionSupportedOperatorStartsWith} +} + +// AutomationRulePropertyConditionSupportedProperty enumerates the values for automation rule property +// condition supported property. +type AutomationRulePropertyConditionSupportedProperty string + +const ( + // AutomationRulePropertyConditionSupportedPropertyAccountAadTenantID The account Azure Active Directory + // tenant id + AutomationRulePropertyConditionSupportedPropertyAccountAadTenantID AutomationRulePropertyConditionSupportedProperty = "AccountAadTenantId" + // AutomationRulePropertyConditionSupportedPropertyAccountAadUserID The account Azure Active Directory user + // id + AutomationRulePropertyConditionSupportedPropertyAccountAadUserID AutomationRulePropertyConditionSupportedProperty = "AccountAadUserId" + // AutomationRulePropertyConditionSupportedPropertyAccountName The account name + AutomationRulePropertyConditionSupportedPropertyAccountName AutomationRulePropertyConditionSupportedProperty = "AccountName" + // AutomationRulePropertyConditionSupportedPropertyAccountNTDomain The account NetBIOS domain name + AutomationRulePropertyConditionSupportedPropertyAccountNTDomain AutomationRulePropertyConditionSupportedProperty = "AccountNTDomain" + // AutomationRulePropertyConditionSupportedPropertyAccountObjectGUID The account unique identifier + AutomationRulePropertyConditionSupportedPropertyAccountObjectGUID AutomationRulePropertyConditionSupportedProperty = "AccountObjectGuid" + // AutomationRulePropertyConditionSupportedPropertyAccountPUID The account Azure Active Directory Passport + // User ID + AutomationRulePropertyConditionSupportedPropertyAccountPUID AutomationRulePropertyConditionSupportedProperty = "AccountPUID" + // AutomationRulePropertyConditionSupportedPropertyAccountSid The account security identifier + AutomationRulePropertyConditionSupportedPropertyAccountSid AutomationRulePropertyConditionSupportedProperty = "AccountSid" + // AutomationRulePropertyConditionSupportedPropertyAccountUPNSuffix The account user principal name suffix + AutomationRulePropertyConditionSupportedPropertyAccountUPNSuffix AutomationRulePropertyConditionSupportedProperty = "AccountUPNSuffix" + // AutomationRulePropertyConditionSupportedPropertyAlertProductNames The name of the product of the alert + AutomationRulePropertyConditionSupportedPropertyAlertProductNames AutomationRulePropertyConditionSupportedProperty = "AlertProductNames" + // AutomationRulePropertyConditionSupportedPropertyAzureResourceResourceID The Azure resource id + AutomationRulePropertyConditionSupportedPropertyAzureResourceResourceID AutomationRulePropertyConditionSupportedProperty = "AzureResourceResourceId" + // AutomationRulePropertyConditionSupportedPropertyAzureResourceSubscriptionID The Azure resource + // subscription id + AutomationRulePropertyConditionSupportedPropertyAzureResourceSubscriptionID AutomationRulePropertyConditionSupportedProperty = "AzureResourceSubscriptionId" + // AutomationRulePropertyConditionSupportedPropertyCloudApplicationAppID The cloud application identifier + AutomationRulePropertyConditionSupportedPropertyCloudApplicationAppID AutomationRulePropertyConditionSupportedProperty = "CloudApplicationAppId" + // AutomationRulePropertyConditionSupportedPropertyCloudApplicationAppName The cloud application name + AutomationRulePropertyConditionSupportedPropertyCloudApplicationAppName AutomationRulePropertyConditionSupportedProperty = "CloudApplicationAppName" + // AutomationRulePropertyConditionSupportedPropertyDNSDomainName The dns record domain name + AutomationRulePropertyConditionSupportedPropertyDNSDomainName AutomationRulePropertyConditionSupportedProperty = "DNSDomainName" + // AutomationRulePropertyConditionSupportedPropertyFileDirectory The file directory full path + AutomationRulePropertyConditionSupportedPropertyFileDirectory AutomationRulePropertyConditionSupportedProperty = "FileDirectory" + // AutomationRulePropertyConditionSupportedPropertyFileHashValue The file hash value + AutomationRulePropertyConditionSupportedPropertyFileHashValue AutomationRulePropertyConditionSupportedProperty = "FileHashValue" + // AutomationRulePropertyConditionSupportedPropertyFileName The file name without path + AutomationRulePropertyConditionSupportedPropertyFileName AutomationRulePropertyConditionSupportedProperty = "FileName" + // AutomationRulePropertyConditionSupportedPropertyHostAzureID The host Azure resource id + AutomationRulePropertyConditionSupportedPropertyHostAzureID AutomationRulePropertyConditionSupportedProperty = "HostAzureID" + // AutomationRulePropertyConditionSupportedPropertyHostName The host name without domain + AutomationRulePropertyConditionSupportedPropertyHostName AutomationRulePropertyConditionSupportedProperty = "HostName" + // AutomationRulePropertyConditionSupportedPropertyHostNetBiosName The host NetBIOS name + AutomationRulePropertyConditionSupportedPropertyHostNetBiosName AutomationRulePropertyConditionSupportedProperty = "HostNetBiosName" + // AutomationRulePropertyConditionSupportedPropertyHostNTDomain The host NT domain + AutomationRulePropertyConditionSupportedPropertyHostNTDomain AutomationRulePropertyConditionSupportedProperty = "HostNTDomain" + // AutomationRulePropertyConditionSupportedPropertyHostOSVersion The host operating system + AutomationRulePropertyConditionSupportedPropertyHostOSVersion AutomationRulePropertyConditionSupportedProperty = "HostOSVersion" + // AutomationRulePropertyConditionSupportedPropertyIncidentDescription The description of the incident + AutomationRulePropertyConditionSupportedPropertyIncidentDescription AutomationRulePropertyConditionSupportedProperty = "IncidentDescription" + // AutomationRulePropertyConditionSupportedPropertyIncidentLabel The labels of the incident + AutomationRulePropertyConditionSupportedPropertyIncidentLabel AutomationRulePropertyConditionSupportedProperty = "IncidentLabel" + // AutomationRulePropertyConditionSupportedPropertyIncidentProviderName The provider name of the incident + AutomationRulePropertyConditionSupportedPropertyIncidentProviderName AutomationRulePropertyConditionSupportedProperty = "IncidentProviderName" + // AutomationRulePropertyConditionSupportedPropertyIncidentRelatedAnalyticRuleIds The related Analytic rule + // ids of the incident + AutomationRulePropertyConditionSupportedPropertyIncidentRelatedAnalyticRuleIds AutomationRulePropertyConditionSupportedProperty = "IncidentRelatedAnalyticRuleIds" + // AutomationRulePropertyConditionSupportedPropertyIncidentSeverity The severity of the incident + AutomationRulePropertyConditionSupportedPropertyIncidentSeverity AutomationRulePropertyConditionSupportedProperty = "IncidentSeverity" + // AutomationRulePropertyConditionSupportedPropertyIncidentStatus The status of the incident + AutomationRulePropertyConditionSupportedPropertyIncidentStatus AutomationRulePropertyConditionSupportedProperty = "IncidentStatus" + // AutomationRulePropertyConditionSupportedPropertyIncidentTactics The tactics of the incident + AutomationRulePropertyConditionSupportedPropertyIncidentTactics AutomationRulePropertyConditionSupportedProperty = "IncidentTactics" + // AutomationRulePropertyConditionSupportedPropertyIncidentTitle The title of the incident + AutomationRulePropertyConditionSupportedPropertyIncidentTitle AutomationRulePropertyConditionSupportedProperty = "IncidentTitle" + // AutomationRulePropertyConditionSupportedPropertyIoTDeviceID "The IoT device id + AutomationRulePropertyConditionSupportedPropertyIoTDeviceID AutomationRulePropertyConditionSupportedProperty = "IoTDeviceId" + // AutomationRulePropertyConditionSupportedPropertyIoTDeviceModel The IoT device model + AutomationRulePropertyConditionSupportedPropertyIoTDeviceModel AutomationRulePropertyConditionSupportedProperty = "IoTDeviceModel" + // AutomationRulePropertyConditionSupportedPropertyIoTDeviceName The IoT device name + AutomationRulePropertyConditionSupportedPropertyIoTDeviceName AutomationRulePropertyConditionSupportedProperty = "IoTDeviceName" + // AutomationRulePropertyConditionSupportedPropertyIoTDeviceOperatingSystem The IoT device operating system + AutomationRulePropertyConditionSupportedPropertyIoTDeviceOperatingSystem AutomationRulePropertyConditionSupportedProperty = "IoTDeviceOperatingSystem" + // AutomationRulePropertyConditionSupportedPropertyIoTDeviceType The IoT device type + AutomationRulePropertyConditionSupportedPropertyIoTDeviceType AutomationRulePropertyConditionSupportedProperty = "IoTDeviceType" + // AutomationRulePropertyConditionSupportedPropertyIoTDeviceVendor The IoT device vendor + AutomationRulePropertyConditionSupportedPropertyIoTDeviceVendor AutomationRulePropertyConditionSupportedProperty = "IoTDeviceVendor" + // AutomationRulePropertyConditionSupportedPropertyIPAddress The IP address + AutomationRulePropertyConditionSupportedPropertyIPAddress AutomationRulePropertyConditionSupportedProperty = "IPAddress" + // AutomationRulePropertyConditionSupportedPropertyMailboxDisplayName The mailbox display name + AutomationRulePropertyConditionSupportedPropertyMailboxDisplayName AutomationRulePropertyConditionSupportedProperty = "MailboxDisplayName" + // AutomationRulePropertyConditionSupportedPropertyMailboxPrimaryAddress The mailbox primary address + AutomationRulePropertyConditionSupportedPropertyMailboxPrimaryAddress AutomationRulePropertyConditionSupportedProperty = "MailboxPrimaryAddress" + // AutomationRulePropertyConditionSupportedPropertyMailboxUPN The mailbox user principal name + AutomationRulePropertyConditionSupportedPropertyMailboxUPN AutomationRulePropertyConditionSupportedProperty = "MailboxUPN" + // AutomationRulePropertyConditionSupportedPropertyMailMessageDeliveryAction The mail message delivery + // action + AutomationRulePropertyConditionSupportedPropertyMailMessageDeliveryAction AutomationRulePropertyConditionSupportedProperty = "MailMessageDeliveryAction" + // AutomationRulePropertyConditionSupportedPropertyMailMessageDeliveryLocation The mail message delivery + // location + AutomationRulePropertyConditionSupportedPropertyMailMessageDeliveryLocation AutomationRulePropertyConditionSupportedProperty = "MailMessageDeliveryLocation" + // AutomationRulePropertyConditionSupportedPropertyMailMessageP1Sender The mail message P1 sender + AutomationRulePropertyConditionSupportedPropertyMailMessageP1Sender AutomationRulePropertyConditionSupportedProperty = "MailMessageP1Sender" + // AutomationRulePropertyConditionSupportedPropertyMailMessageP2Sender The mail message P2 sender + AutomationRulePropertyConditionSupportedPropertyMailMessageP2Sender AutomationRulePropertyConditionSupportedProperty = "MailMessageP2Sender" + // AutomationRulePropertyConditionSupportedPropertyMailMessageRecipient The mail message recipient + AutomationRulePropertyConditionSupportedPropertyMailMessageRecipient AutomationRulePropertyConditionSupportedProperty = "MailMessageRecipient" + // AutomationRulePropertyConditionSupportedPropertyMailMessageSenderIP The mail message sender IP address + AutomationRulePropertyConditionSupportedPropertyMailMessageSenderIP AutomationRulePropertyConditionSupportedProperty = "MailMessageSenderIP" + // AutomationRulePropertyConditionSupportedPropertyMailMessageSubject The mail message subject + AutomationRulePropertyConditionSupportedPropertyMailMessageSubject AutomationRulePropertyConditionSupportedProperty = "MailMessageSubject" + // AutomationRulePropertyConditionSupportedPropertyMalwareCategory The malware category + AutomationRulePropertyConditionSupportedPropertyMalwareCategory AutomationRulePropertyConditionSupportedProperty = "MalwareCategory" + // AutomationRulePropertyConditionSupportedPropertyMalwareName The malware name + AutomationRulePropertyConditionSupportedPropertyMalwareName AutomationRulePropertyConditionSupportedProperty = "MalwareName" + // AutomationRulePropertyConditionSupportedPropertyProcessCommandLine The process execution command line + AutomationRulePropertyConditionSupportedPropertyProcessCommandLine AutomationRulePropertyConditionSupportedProperty = "ProcessCommandLine" + // AutomationRulePropertyConditionSupportedPropertyProcessID The process id + AutomationRulePropertyConditionSupportedPropertyProcessID AutomationRulePropertyConditionSupportedProperty = "ProcessId" + // AutomationRulePropertyConditionSupportedPropertyRegistryKey The registry key path + AutomationRulePropertyConditionSupportedPropertyRegistryKey AutomationRulePropertyConditionSupportedProperty = "RegistryKey" + // AutomationRulePropertyConditionSupportedPropertyRegistryValueData The registry key value in string + // formatted representation + AutomationRulePropertyConditionSupportedPropertyRegistryValueData AutomationRulePropertyConditionSupportedProperty = "RegistryValueData" + // AutomationRulePropertyConditionSupportedPropertyURL The url + AutomationRulePropertyConditionSupportedPropertyURL AutomationRulePropertyConditionSupportedProperty = "Url" +) + +// PossibleAutomationRulePropertyConditionSupportedPropertyValues returns an array of possible values for the AutomationRulePropertyConditionSupportedProperty const type. +func PossibleAutomationRulePropertyConditionSupportedPropertyValues() []AutomationRulePropertyConditionSupportedProperty { + return []AutomationRulePropertyConditionSupportedProperty{AutomationRulePropertyConditionSupportedPropertyAccountAadTenantID, AutomationRulePropertyConditionSupportedPropertyAccountAadUserID, AutomationRulePropertyConditionSupportedPropertyAccountName, AutomationRulePropertyConditionSupportedPropertyAccountNTDomain, AutomationRulePropertyConditionSupportedPropertyAccountObjectGUID, AutomationRulePropertyConditionSupportedPropertyAccountPUID, AutomationRulePropertyConditionSupportedPropertyAccountSid, AutomationRulePropertyConditionSupportedPropertyAccountUPNSuffix, AutomationRulePropertyConditionSupportedPropertyAlertProductNames, AutomationRulePropertyConditionSupportedPropertyAzureResourceResourceID, AutomationRulePropertyConditionSupportedPropertyAzureResourceSubscriptionID, AutomationRulePropertyConditionSupportedPropertyCloudApplicationAppID, AutomationRulePropertyConditionSupportedPropertyCloudApplicationAppName, AutomationRulePropertyConditionSupportedPropertyDNSDomainName, AutomationRulePropertyConditionSupportedPropertyFileDirectory, AutomationRulePropertyConditionSupportedPropertyFileHashValue, AutomationRulePropertyConditionSupportedPropertyFileName, AutomationRulePropertyConditionSupportedPropertyHostAzureID, AutomationRulePropertyConditionSupportedPropertyHostName, AutomationRulePropertyConditionSupportedPropertyHostNetBiosName, AutomationRulePropertyConditionSupportedPropertyHostNTDomain, AutomationRulePropertyConditionSupportedPropertyHostOSVersion, AutomationRulePropertyConditionSupportedPropertyIncidentDescription, AutomationRulePropertyConditionSupportedPropertyIncidentLabel, AutomationRulePropertyConditionSupportedPropertyIncidentProviderName, AutomationRulePropertyConditionSupportedPropertyIncidentRelatedAnalyticRuleIds, AutomationRulePropertyConditionSupportedPropertyIncidentSeverity, AutomationRulePropertyConditionSupportedPropertyIncidentStatus, AutomationRulePropertyConditionSupportedPropertyIncidentTactics, AutomationRulePropertyConditionSupportedPropertyIncidentTitle, AutomationRulePropertyConditionSupportedPropertyIoTDeviceID, AutomationRulePropertyConditionSupportedPropertyIoTDeviceModel, AutomationRulePropertyConditionSupportedPropertyIoTDeviceName, AutomationRulePropertyConditionSupportedPropertyIoTDeviceOperatingSystem, AutomationRulePropertyConditionSupportedPropertyIoTDeviceType, AutomationRulePropertyConditionSupportedPropertyIoTDeviceVendor, AutomationRulePropertyConditionSupportedPropertyIPAddress, AutomationRulePropertyConditionSupportedPropertyMailboxDisplayName, AutomationRulePropertyConditionSupportedPropertyMailboxPrimaryAddress, AutomationRulePropertyConditionSupportedPropertyMailboxUPN, AutomationRulePropertyConditionSupportedPropertyMailMessageDeliveryAction, AutomationRulePropertyConditionSupportedPropertyMailMessageDeliveryLocation, AutomationRulePropertyConditionSupportedPropertyMailMessageP1Sender, AutomationRulePropertyConditionSupportedPropertyMailMessageP2Sender, AutomationRulePropertyConditionSupportedPropertyMailMessageRecipient, AutomationRulePropertyConditionSupportedPropertyMailMessageSenderIP, AutomationRulePropertyConditionSupportedPropertyMailMessageSubject, AutomationRulePropertyConditionSupportedPropertyMalwareCategory, AutomationRulePropertyConditionSupportedPropertyMalwareName, AutomationRulePropertyConditionSupportedPropertyProcessCommandLine, AutomationRulePropertyConditionSupportedPropertyProcessID, AutomationRulePropertyConditionSupportedPropertyRegistryKey, AutomationRulePropertyConditionSupportedPropertyRegistryValueData, AutomationRulePropertyConditionSupportedPropertyURL} +} + +// ConditionType enumerates the values for condition type. +type ConditionType string + +const ( + // ConditionTypeProperty Evaluate an object property value + ConditionTypeProperty ConditionType = "Property" +) + +// PossibleConditionTypeValues returns an array of possible values for the ConditionType const type. +func PossibleConditionTypeValues() []ConditionType { + return []ConditionType{ConditionTypeProperty} +} + +// ConditionTypeBasicAutomationRuleCondition enumerates the values for condition type basic automation rule +// condition. +type ConditionTypeBasicAutomationRuleCondition string + +const ( + // ConditionTypeBasicAutomationRuleConditionConditionTypeAutomationRuleCondition ... + ConditionTypeBasicAutomationRuleConditionConditionTypeAutomationRuleCondition ConditionTypeBasicAutomationRuleCondition = "AutomationRuleCondition" + // ConditionTypeBasicAutomationRuleConditionConditionTypeProperty ... + ConditionTypeBasicAutomationRuleConditionConditionTypeProperty ConditionTypeBasicAutomationRuleCondition = "Property" +) + +// PossibleConditionTypeBasicAutomationRuleConditionValues returns an array of possible values for the ConditionTypeBasicAutomationRuleCondition const type. +func PossibleConditionTypeBasicAutomationRuleConditionValues() []ConditionTypeBasicAutomationRuleCondition { + return []ConditionTypeBasicAutomationRuleCondition{ConditionTypeBasicAutomationRuleConditionConditionTypeAutomationRuleCondition, ConditionTypeBasicAutomationRuleConditionConditionTypeProperty} +} + +// ConfidenceLevel enumerates the values for confidence level. +type ConfidenceLevel string + +const ( + // ConfidenceLevelHigh High confidence that the alert is true positive malicious + ConfidenceLevelHigh ConfidenceLevel = "High" + // ConfidenceLevelLow Low confidence, meaning we have some doubts this is indeed malicious or part of an + // attack + ConfidenceLevelLow ConfidenceLevel = "Low" + // ConfidenceLevelUnknown Unknown confidence, the is the default value + ConfidenceLevelUnknown ConfidenceLevel = "Unknown" +) + +// PossibleConfidenceLevelValues returns an array of possible values for the ConfidenceLevel const type. +func PossibleConfidenceLevelValues() []ConfidenceLevel { + return []ConfidenceLevel{ConfidenceLevelHigh, ConfidenceLevelLow, ConfidenceLevelUnknown} +} + +// ConfidenceScoreStatus enumerates the values for confidence score status. +type ConfidenceScoreStatus string + +const ( + // ConfidenceScoreStatusFinal Final score was calculated and available + ConfidenceScoreStatusFinal ConfidenceScoreStatus = "Final" + // ConfidenceScoreStatusInProcess No score was set yet and calculation is in progress + ConfidenceScoreStatusInProcess ConfidenceScoreStatus = "InProcess" + // ConfidenceScoreStatusNotApplicable Score will not be calculated for this alert as it is not supported by + // virtual analyst + ConfidenceScoreStatusNotApplicable ConfidenceScoreStatus = "NotApplicable" + // ConfidenceScoreStatusNotFinal Score is calculated and shown as part of the alert, but may be updated + // again at a later time following the processing of additional data + ConfidenceScoreStatusNotFinal ConfidenceScoreStatus = "NotFinal" +) + +// PossibleConfidenceScoreStatusValues returns an array of possible values for the ConfidenceScoreStatus const type. +func PossibleConfidenceScoreStatusValues() []ConfidenceScoreStatus { + return []ConfidenceScoreStatus{ConfidenceScoreStatusFinal, ConfidenceScoreStatusInProcess, ConfidenceScoreStatusNotApplicable, ConfidenceScoreStatusNotFinal} +} + +// ConnectAuthKind enumerates the values for connect auth kind. +type ConnectAuthKind string + +const ( + // ConnectAuthKindAPIKey ... + ConnectAuthKindAPIKey ConnectAuthKind = "APIKey" + // ConnectAuthKindBasic ... + ConnectAuthKindBasic ConnectAuthKind = "Basic" + // ConnectAuthKindOAuth2 ... + ConnectAuthKindOAuth2 ConnectAuthKind = "OAuth2" +) + +// PossibleConnectAuthKindValues returns an array of possible values for the ConnectAuthKind const type. +func PossibleConnectAuthKindValues() []ConnectAuthKind { + return []ConnectAuthKind{ConnectAuthKindAPIKey, ConnectAuthKindBasic, ConnectAuthKindOAuth2} +} + +// ConnectivityType enumerates the values for connectivity type. +type ConnectivityType string + +const ( + // ConnectivityTypeIsConnectedQuery ... + ConnectivityTypeIsConnectedQuery ConnectivityType = "IsConnectedQuery" +) + +// PossibleConnectivityTypeValues returns an array of possible values for the ConnectivityType const type. +func PossibleConnectivityTypeValues() []ConnectivityType { + return []ConnectivityType{ConnectivityTypeIsConnectedQuery} +} + +// ContentType enumerates the values for content type. +type ContentType string + +const ( + // ContentTypeAnalyticRule ... + ContentTypeAnalyticRule ContentType = "AnalyticRule" + // ContentTypeWorkbook ... + ContentTypeWorkbook ContentType = "Workbook" +) + +// PossibleContentTypeValues returns an array of possible values for the ContentType const type. +func PossibleContentTypeValues() []ContentType { + return []ContentType{ContentTypeAnalyticRule, ContentTypeWorkbook} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // CreatedByTypeApplication ... + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey ... + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity ... + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + // CreatedByTypeUser ... + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} +} + +// CustomEntityQueryKind enumerates the values for custom entity query kind. +type CustomEntityQueryKind string + +const ( + // CustomEntityQueryKindActivity ... + CustomEntityQueryKindActivity CustomEntityQueryKind = "Activity" +) + +// PossibleCustomEntityQueryKindValues returns an array of possible values for the CustomEntityQueryKind const type. +func PossibleCustomEntityQueryKindValues() []CustomEntityQueryKind { + return []CustomEntityQueryKind{CustomEntityQueryKindActivity} +} + +// DataConnectorAuthorizationState enumerates the values for data connector authorization state. +type DataConnectorAuthorizationState string + +const ( + // DataConnectorAuthorizationStateInvalid ... + DataConnectorAuthorizationStateInvalid DataConnectorAuthorizationState = "Invalid" + // DataConnectorAuthorizationStateValid ... + DataConnectorAuthorizationStateValid DataConnectorAuthorizationState = "Valid" +) + +// PossibleDataConnectorAuthorizationStateValues returns an array of possible values for the DataConnectorAuthorizationState const type. +func PossibleDataConnectorAuthorizationStateValues() []DataConnectorAuthorizationState { + return []DataConnectorAuthorizationState{DataConnectorAuthorizationStateInvalid, DataConnectorAuthorizationStateValid} +} + +// DataConnectorKind enumerates the values for data connector kind. +type DataConnectorKind string + +const ( + // DataConnectorKindAmazonWebServicesCloudTrail ... + DataConnectorKindAmazonWebServicesCloudTrail DataConnectorKind = "AmazonWebServicesCloudTrail" + // DataConnectorKindAmazonWebServicesS3 ... + DataConnectorKindAmazonWebServicesS3 DataConnectorKind = "AmazonWebServicesS3" + // DataConnectorKindAPIPolling ... + DataConnectorKindAPIPolling DataConnectorKind = "APIPolling" + // DataConnectorKindAzureActiveDirectory ... + DataConnectorKindAzureActiveDirectory DataConnectorKind = "AzureActiveDirectory" + // DataConnectorKindAzureAdvancedThreatProtection ... + DataConnectorKindAzureAdvancedThreatProtection DataConnectorKind = "AzureAdvancedThreatProtection" + // DataConnectorKindAzureSecurityCenter ... + DataConnectorKindAzureSecurityCenter DataConnectorKind = "AzureSecurityCenter" + // DataConnectorKindDynamics365 ... + DataConnectorKindDynamics365 DataConnectorKind = "Dynamics365" + // DataConnectorKindGenericUI ... + DataConnectorKindGenericUI DataConnectorKind = "GenericUI" + // DataConnectorKindIOT ... + DataConnectorKindIOT DataConnectorKind = "IOT" + // DataConnectorKindMicrosoftCloudAppSecurity ... + DataConnectorKindMicrosoftCloudAppSecurity DataConnectorKind = "MicrosoftCloudAppSecurity" + // DataConnectorKindMicrosoftDefenderAdvancedThreatProtection ... + DataConnectorKindMicrosoftDefenderAdvancedThreatProtection DataConnectorKind = "MicrosoftDefenderAdvancedThreatProtection" + // DataConnectorKindMicrosoftThreatIntelligence ... + DataConnectorKindMicrosoftThreatIntelligence DataConnectorKind = "MicrosoftThreatIntelligence" + // DataConnectorKindMicrosoftThreatProtection ... + DataConnectorKindMicrosoftThreatProtection DataConnectorKind = "MicrosoftThreatProtection" + // DataConnectorKindOffice365 ... + DataConnectorKindOffice365 DataConnectorKind = "Office365" + // DataConnectorKindOffice365Project ... + DataConnectorKindOffice365Project DataConnectorKind = "Office365Project" + // DataConnectorKindOfficeATP ... + DataConnectorKindOfficeATP DataConnectorKind = "OfficeATP" + // DataConnectorKindOfficeIRM ... + DataConnectorKindOfficeIRM DataConnectorKind = "OfficeIRM" + // DataConnectorKindOfficePowerBI ... + DataConnectorKindOfficePowerBI DataConnectorKind = "OfficePowerBI" + // DataConnectorKindThreatIntelligence ... + DataConnectorKindThreatIntelligence DataConnectorKind = "ThreatIntelligence" + // DataConnectorKindThreatIntelligenceTaxii ... + DataConnectorKindThreatIntelligenceTaxii DataConnectorKind = "ThreatIntelligenceTaxii" +) + +// PossibleDataConnectorKindValues returns an array of possible values for the DataConnectorKind const type. +func PossibleDataConnectorKindValues() []DataConnectorKind { + return []DataConnectorKind{DataConnectorKindAmazonWebServicesCloudTrail, DataConnectorKindAmazonWebServicesS3, DataConnectorKindAPIPolling, DataConnectorKindAzureActiveDirectory, DataConnectorKindAzureAdvancedThreatProtection, DataConnectorKindAzureSecurityCenter, DataConnectorKindDynamics365, DataConnectorKindGenericUI, DataConnectorKindIOT, DataConnectorKindMicrosoftCloudAppSecurity, DataConnectorKindMicrosoftDefenderAdvancedThreatProtection, DataConnectorKindMicrosoftThreatIntelligence, DataConnectorKindMicrosoftThreatProtection, DataConnectorKindOffice365, DataConnectorKindOffice365Project, DataConnectorKindOfficeATP, DataConnectorKindOfficeIRM, DataConnectorKindOfficePowerBI, DataConnectorKindThreatIntelligence, DataConnectorKindThreatIntelligenceTaxii} +} + +// DataConnectorLicenseState enumerates the values for data connector license state. +type DataConnectorLicenseState string + +const ( + // DataConnectorLicenseStateInvalid ... + DataConnectorLicenseStateInvalid DataConnectorLicenseState = "Invalid" + // DataConnectorLicenseStateUnknown ... + DataConnectorLicenseStateUnknown DataConnectorLicenseState = "Unknown" + // DataConnectorLicenseStateValid ... + DataConnectorLicenseStateValid DataConnectorLicenseState = "Valid" +) + +// PossibleDataConnectorLicenseStateValues returns an array of possible values for the DataConnectorLicenseState const type. +func PossibleDataConnectorLicenseStateValues() []DataConnectorLicenseState { + return []DataConnectorLicenseState{DataConnectorLicenseStateInvalid, DataConnectorLicenseStateUnknown, DataConnectorLicenseStateValid} +} + +// DataTypeState enumerates the values for data type state. +type DataTypeState string + +const ( + // DataTypeStateDisabled ... + DataTypeStateDisabled DataTypeState = "Disabled" + // DataTypeStateEnabled ... + DataTypeStateEnabled DataTypeState = "Enabled" +) + +// PossibleDataTypeStateValues returns an array of possible values for the DataTypeState const type. +func PossibleDataTypeStateValues() []DataTypeState { + return []DataTypeState{DataTypeStateDisabled, DataTypeStateEnabled} +} + +// DeliveryAction enumerates the values for delivery action. +type DeliveryAction string + +const ( + // DeliveryActionBlocked Blocked + DeliveryActionBlocked DeliveryAction = "Blocked" + // DeliveryActionDelivered Delivered + DeliveryActionDelivered DeliveryAction = "Delivered" + // DeliveryActionDeliveredAsSpam DeliveredAsSpam + DeliveryActionDeliveredAsSpam DeliveryAction = "DeliveredAsSpam" + // DeliveryActionReplaced Replaced + DeliveryActionReplaced DeliveryAction = "Replaced" + // DeliveryActionUnknown Unknown + DeliveryActionUnknown DeliveryAction = "Unknown" +) + +// PossibleDeliveryActionValues returns an array of possible values for the DeliveryAction const type. +func PossibleDeliveryActionValues() []DeliveryAction { + return []DeliveryAction{DeliveryActionBlocked, DeliveryActionDelivered, DeliveryActionDeliveredAsSpam, DeliveryActionReplaced, DeliveryActionUnknown} +} + +// DeliveryLocation enumerates the values for delivery location. +type DeliveryLocation string + +const ( + // DeliveryLocationDeletedFolder DeletedFolder + DeliveryLocationDeletedFolder DeliveryLocation = "DeletedFolder" + // DeliveryLocationDropped Dropped + DeliveryLocationDropped DeliveryLocation = "Dropped" + // DeliveryLocationExternal External + DeliveryLocationExternal DeliveryLocation = "External" + // DeliveryLocationFailed Failed + DeliveryLocationFailed DeliveryLocation = "Failed" + // DeliveryLocationForwarded Forwarded + DeliveryLocationForwarded DeliveryLocation = "Forwarded" + // DeliveryLocationInbox Inbox + DeliveryLocationInbox DeliveryLocation = "Inbox" + // DeliveryLocationJunkFolder JunkFolder + DeliveryLocationJunkFolder DeliveryLocation = "JunkFolder" + // DeliveryLocationQuarantine Quarantine + DeliveryLocationQuarantine DeliveryLocation = "Quarantine" + // DeliveryLocationUnknown Unknown + DeliveryLocationUnknown DeliveryLocation = "Unknown" +) + +// PossibleDeliveryLocationValues returns an array of possible values for the DeliveryLocation const type. +func PossibleDeliveryLocationValues() []DeliveryLocation { + return []DeliveryLocation{DeliveryLocationDeletedFolder, DeliveryLocationDropped, DeliveryLocationExternal, DeliveryLocationFailed, DeliveryLocationForwarded, DeliveryLocationInbox, DeliveryLocationJunkFolder, DeliveryLocationQuarantine, DeliveryLocationUnknown} +} + +// DeploymentFetchStatus enumerates the values for deployment fetch status. +type DeploymentFetchStatus string + +const ( + // DeploymentFetchStatusNotFound ... + DeploymentFetchStatusNotFound DeploymentFetchStatus = "NotFound" + // DeploymentFetchStatusSuccess ... + DeploymentFetchStatusSuccess DeploymentFetchStatus = "Success" + // DeploymentFetchStatusUnauthorized ... + DeploymentFetchStatusUnauthorized DeploymentFetchStatus = "Unauthorized" +) + +// PossibleDeploymentFetchStatusValues returns an array of possible values for the DeploymentFetchStatus const type. +func PossibleDeploymentFetchStatusValues() []DeploymentFetchStatus { + return []DeploymentFetchStatus{DeploymentFetchStatusNotFound, DeploymentFetchStatusSuccess, DeploymentFetchStatusUnauthorized} +} + +// DeploymentResult enumerates the values for deployment result. +type DeploymentResult string + +const ( + // DeploymentResultCanceled ... + DeploymentResultCanceled DeploymentResult = "Canceled" + // DeploymentResultFailed ... + DeploymentResultFailed DeploymentResult = "Failed" + // DeploymentResultSuccess ... + DeploymentResultSuccess DeploymentResult = "Success" +) + +// PossibleDeploymentResultValues returns an array of possible values for the DeploymentResult const type. +func PossibleDeploymentResultValues() []DeploymentResult { + return []DeploymentResult{DeploymentResultCanceled, DeploymentResultFailed, DeploymentResultSuccess} +} + +// DeploymentState enumerates the values for deployment state. +type DeploymentState string + +const ( + // DeploymentStateCanceling ... + DeploymentStateCanceling DeploymentState = "Canceling" + // DeploymentStateCompleted ... + DeploymentStateCompleted DeploymentState = "Completed" + // DeploymentStateInProgress ... + DeploymentStateInProgress DeploymentState = "In_Progress" + // DeploymentStateQueued ... + DeploymentStateQueued DeploymentState = "Queued" +) + +// PossibleDeploymentStateValues returns an array of possible values for the DeploymentState const type. +func PossibleDeploymentStateValues() []DeploymentState { + return []DeploymentState{DeploymentStateCanceling, DeploymentStateCompleted, DeploymentStateInProgress, DeploymentStateQueued} +} + +// ElevationToken enumerates the values for elevation token. +type ElevationToken string + +const ( + // ElevationTokenDefault Default elevation token + ElevationTokenDefault ElevationToken = "Default" + // ElevationTokenFull Full elevation token + ElevationTokenFull ElevationToken = "Full" + // ElevationTokenLimited Limited elevation token + ElevationTokenLimited ElevationToken = "Limited" +) + +// PossibleElevationTokenValues returns an array of possible values for the ElevationToken const type. +func PossibleElevationTokenValues() []ElevationToken { + return []ElevationToken{ElevationTokenDefault, ElevationTokenFull, ElevationTokenLimited} +} + +// EntityKind enumerates the values for entity kind. +type EntityKind string + +const ( + // EntityKindAccount Entity represents account in the system. + EntityKindAccount EntityKind = "Account" + // EntityKindAzureResource Entity represents azure resource in the system. + EntityKindAzureResource EntityKind = "AzureResource" + // EntityKindBookmark Entity represents bookmark in the system. + EntityKindBookmark EntityKind = "Bookmark" + // EntityKindCloudApplication Entity represents cloud application in the system. + EntityKindCloudApplication EntityKind = "CloudApplication" + // EntityKindDNSResolution Entity represents dns resolution in the system. + EntityKindDNSResolution EntityKind = "DnsResolution" + // EntityKindFile Entity represents file in the system. + EntityKindFile EntityKind = "File" + // EntityKindFileHash Entity represents file hash in the system. + EntityKindFileHash EntityKind = "FileHash" + // EntityKindHost Entity represents host in the system. + EntityKindHost EntityKind = "Host" + // EntityKindIoTDevice Entity represents IoT device in the system. + EntityKindIoTDevice EntityKind = "IoTDevice" + // EntityKindIP Entity represents ip in the system. + EntityKindIP EntityKind = "Ip" + // EntityKindMailbox Entity represents mailbox in the system. + EntityKindMailbox EntityKind = "Mailbox" + // EntityKindMailCluster Entity represents mail cluster in the system. + EntityKindMailCluster EntityKind = "MailCluster" + // EntityKindMailMessage Entity represents mail message in the system. + EntityKindMailMessage EntityKind = "MailMessage" + // EntityKindMalware Entity represents malware in the system. + EntityKindMalware EntityKind = "Malware" + // EntityKindProcess Entity represents process in the system. + EntityKindProcess EntityKind = "Process" + // EntityKindRegistryKey Entity represents registry key in the system. + EntityKindRegistryKey EntityKind = "RegistryKey" + // EntityKindRegistryValue Entity represents registry value in the system. + EntityKindRegistryValue EntityKind = "RegistryValue" + // EntityKindSecurityAlert Entity represents security alert in the system. + EntityKindSecurityAlert EntityKind = "SecurityAlert" + // EntityKindSecurityGroup Entity represents security group in the system. + EntityKindSecurityGroup EntityKind = "SecurityGroup" + // EntityKindSubmissionMail Entity represents submission mail in the system. + EntityKindSubmissionMail EntityKind = "SubmissionMail" + // EntityKindURL Entity represents url in the system. + EntityKindURL EntityKind = "Url" +) + +// PossibleEntityKindValues returns an array of possible values for the EntityKind const type. +func PossibleEntityKindValues() []EntityKind { + return []EntityKind{EntityKindAccount, EntityKindAzureResource, EntityKindBookmark, EntityKindCloudApplication, EntityKindDNSResolution, EntityKindFile, EntityKindFileHash, EntityKindHost, EntityKindIoTDevice, EntityKindIP, EntityKindMailbox, EntityKindMailCluster, EntityKindMailMessage, EntityKindMalware, EntityKindProcess, EntityKindRegistryKey, EntityKindRegistryValue, EntityKindSecurityAlert, EntityKindSecurityGroup, EntityKindSubmissionMail, EntityKindURL} +} + +// EntityMappingType enumerates the values for entity mapping type. +type EntityMappingType string + +const ( + // EntityMappingTypeAccount User account entity type + EntityMappingTypeAccount EntityMappingType = "Account" + // EntityMappingTypeAzureResource Azure resource entity type + EntityMappingTypeAzureResource EntityMappingType = "AzureResource" + // EntityMappingTypeCloudApplication Cloud app entity type + EntityMappingTypeCloudApplication EntityMappingType = "CloudApplication" + // EntityMappingTypeDNS DNS entity type + EntityMappingTypeDNS EntityMappingType = "DNS" + // EntityMappingTypeFile System file entity type + EntityMappingTypeFile EntityMappingType = "File" + // EntityMappingTypeFileHash File-hash entity type + EntityMappingTypeFileHash EntityMappingType = "FileHash" + // EntityMappingTypeHost Host entity type + EntityMappingTypeHost EntityMappingType = "Host" + // EntityMappingTypeIP IP address entity type + EntityMappingTypeIP EntityMappingType = "IP" + // EntityMappingTypeMailbox Mailbox entity type + EntityMappingTypeMailbox EntityMappingType = "Mailbox" + // EntityMappingTypeMailCluster Mail cluster entity type + EntityMappingTypeMailCluster EntityMappingType = "MailCluster" + // EntityMappingTypeMailMessage Mail message entity type + EntityMappingTypeMailMessage EntityMappingType = "MailMessage" + // EntityMappingTypeMalware Malware entity type + EntityMappingTypeMalware EntityMappingType = "Malware" + // EntityMappingTypeProcess Process entity type + EntityMappingTypeProcess EntityMappingType = "Process" + // EntityMappingTypeRegistryKey Registry key entity type + EntityMappingTypeRegistryKey EntityMappingType = "RegistryKey" + // EntityMappingTypeRegistryValue Registry value entity type + EntityMappingTypeRegistryValue EntityMappingType = "RegistryValue" + // EntityMappingTypeSecurityGroup Security group entity type + EntityMappingTypeSecurityGroup EntityMappingType = "SecurityGroup" + // EntityMappingTypeSubmissionMail Submission mail entity type + EntityMappingTypeSubmissionMail EntityMappingType = "SubmissionMail" + // EntityMappingTypeURL URL entity type + EntityMappingTypeURL EntityMappingType = "URL" +) + +// PossibleEntityMappingTypeValues returns an array of possible values for the EntityMappingType const type. +func PossibleEntityMappingTypeValues() []EntityMappingType { + return []EntityMappingType{EntityMappingTypeAccount, EntityMappingTypeAzureResource, EntityMappingTypeCloudApplication, EntityMappingTypeDNS, EntityMappingTypeFile, EntityMappingTypeFileHash, EntityMappingTypeHost, EntityMappingTypeIP, EntityMappingTypeMailbox, EntityMappingTypeMailCluster, EntityMappingTypeMailMessage, EntityMappingTypeMalware, EntityMappingTypeProcess, EntityMappingTypeRegistryKey, EntityMappingTypeRegistryValue, EntityMappingTypeSecurityGroup, EntityMappingTypeSubmissionMail, EntityMappingTypeURL} +} + +// EntityQueryKind enumerates the values for entity query kind. +type EntityQueryKind string + +const ( + // EntityQueryKindActivity ... + EntityQueryKindActivity EntityQueryKind = "Activity" + // EntityQueryKindExpansion ... + EntityQueryKindExpansion EntityQueryKind = "Expansion" + // EntityQueryKindInsight ... + EntityQueryKindInsight EntityQueryKind = "Insight" +) + +// PossibleEntityQueryKindValues returns an array of possible values for the EntityQueryKind const type. +func PossibleEntityQueryKindValues() []EntityQueryKind { + return []EntityQueryKind{EntityQueryKindActivity, EntityQueryKindExpansion, EntityQueryKindInsight} +} + +// EntityQueryTemplateKind enumerates the values for entity query template kind. +type EntityQueryTemplateKind string + +const ( + // EntityQueryTemplateKindActivity ... + EntityQueryTemplateKindActivity EntityQueryTemplateKind = "Activity" +) + +// PossibleEntityQueryTemplateKindValues returns an array of possible values for the EntityQueryTemplateKind const type. +func PossibleEntityQueryTemplateKindValues() []EntityQueryTemplateKind { + return []EntityQueryTemplateKind{EntityQueryTemplateKindActivity} +} + +// EntityTimelineKind enumerates the values for entity timeline kind. +type EntityTimelineKind string + +const ( + // EntityTimelineKindActivity activity + EntityTimelineKindActivity EntityTimelineKind = "Activity" + // EntityTimelineKindBookmark bookmarks + EntityTimelineKindBookmark EntityTimelineKind = "Bookmark" + // EntityTimelineKindSecurityAlert security alerts + EntityTimelineKindSecurityAlert EntityTimelineKind = "SecurityAlert" +) + +// PossibleEntityTimelineKindValues returns an array of possible values for the EntityTimelineKind const type. +func PossibleEntityTimelineKindValues() []EntityTimelineKind { + return []EntityTimelineKind{EntityTimelineKindActivity, EntityTimelineKindBookmark, EntityTimelineKindSecurityAlert} +} + +// EntityType enumerates the values for entity type. +type EntityType string + +const ( + // EntityTypeAccount Entity represents account in the system. + EntityTypeAccount EntityType = "Account" + // EntityTypeAzureResource Entity represents azure resource in the system. + EntityTypeAzureResource EntityType = "AzureResource" + // EntityTypeCloudApplication Entity represents cloud application in the system. + EntityTypeCloudApplication EntityType = "CloudApplication" + // EntityTypeDNS Entity represents dns in the system. + EntityTypeDNS EntityType = "DNS" + // EntityTypeFile Entity represents file in the system. + EntityTypeFile EntityType = "File" + // EntityTypeFileHash Entity represents file hash in the system. + EntityTypeFileHash EntityType = "FileHash" + // EntityTypeHost Entity represents host in the system. + EntityTypeHost EntityType = "Host" + // EntityTypeHuntingBookmark Entity represents HuntingBookmark in the system. + EntityTypeHuntingBookmark EntityType = "HuntingBookmark" + // EntityTypeIoTDevice Entity represents IoT device in the system. + EntityTypeIoTDevice EntityType = "IoTDevice" + // EntityTypeIP Entity represents ip in the system. + EntityTypeIP EntityType = "IP" + // EntityTypeMailbox Entity represents mailbox in the system. + EntityTypeMailbox EntityType = "Mailbox" + // EntityTypeMailCluster Entity represents mail cluster in the system. + EntityTypeMailCluster EntityType = "MailCluster" + // EntityTypeMailMessage Entity represents mail message in the system. + EntityTypeMailMessage EntityType = "MailMessage" + // EntityTypeMalware Entity represents malware in the system. + EntityTypeMalware EntityType = "Malware" + // EntityTypeProcess Entity represents process in the system. + EntityTypeProcess EntityType = "Process" + // EntityTypeRegistryKey Entity represents registry key in the system. + EntityTypeRegistryKey EntityType = "RegistryKey" + // EntityTypeRegistryValue Entity represents registry value in the system. + EntityTypeRegistryValue EntityType = "RegistryValue" + // EntityTypeSecurityAlert Entity represents security alert in the system. + EntityTypeSecurityAlert EntityType = "SecurityAlert" + // EntityTypeSecurityGroup Entity represents security group in the system. + EntityTypeSecurityGroup EntityType = "SecurityGroup" + // EntityTypeSubmissionMail Entity represents submission mail in the system. + EntityTypeSubmissionMail EntityType = "SubmissionMail" + // EntityTypeURL Entity represents url in the system. + EntityTypeURL EntityType = "URL" +) + +// PossibleEntityTypeValues returns an array of possible values for the EntityType const type. +func PossibleEntityTypeValues() []EntityType { + return []EntityType{EntityTypeAccount, EntityTypeAzureResource, EntityTypeCloudApplication, EntityTypeDNS, EntityTypeFile, EntityTypeFileHash, EntityTypeHost, EntityTypeHuntingBookmark, EntityTypeIoTDevice, EntityTypeIP, EntityTypeMailbox, EntityTypeMailCluster, EntityTypeMailMessage, EntityTypeMalware, EntityTypeProcess, EntityTypeRegistryKey, EntityTypeRegistryValue, EntityTypeSecurityAlert, EntityTypeSecurityGroup, EntityTypeSubmissionMail, EntityTypeURL} +} + +// EventGroupingAggregationKind enumerates the values for event grouping aggregation kind. +type EventGroupingAggregationKind string + +const ( + // EventGroupingAggregationKindAlertPerResult ... + EventGroupingAggregationKindAlertPerResult EventGroupingAggregationKind = "AlertPerResult" + // EventGroupingAggregationKindSingleAlert ... + EventGroupingAggregationKindSingleAlert EventGroupingAggregationKind = "SingleAlert" +) + +// PossibleEventGroupingAggregationKindValues returns an array of possible values for the EventGroupingAggregationKind const type. +func PossibleEventGroupingAggregationKindValues() []EventGroupingAggregationKind { + return []EventGroupingAggregationKind{EventGroupingAggregationKindAlertPerResult, EventGroupingAggregationKindSingleAlert} +} + +// FileHashAlgorithm enumerates the values for file hash algorithm. +type FileHashAlgorithm string + +const ( + // FileHashAlgorithmMD5 MD5 hash type + FileHashAlgorithmMD5 FileHashAlgorithm = "MD5" + // FileHashAlgorithmSHA1 SHA1 hash type + FileHashAlgorithmSHA1 FileHashAlgorithm = "SHA1" + // FileHashAlgorithmSHA256 SHA256 hash type + FileHashAlgorithmSHA256 FileHashAlgorithm = "SHA256" + // FileHashAlgorithmSHA256AC SHA256 Authenticode hash type + FileHashAlgorithmSHA256AC FileHashAlgorithm = "SHA256AC" + // FileHashAlgorithmUnknown Unknown hash algorithm + FileHashAlgorithmUnknown FileHashAlgorithm = "Unknown" +) + +// PossibleFileHashAlgorithmValues returns an array of possible values for the FileHashAlgorithm const type. +func PossibleFileHashAlgorithmValues() []FileHashAlgorithm { + return []FileHashAlgorithm{FileHashAlgorithmMD5, FileHashAlgorithmSHA1, FileHashAlgorithmSHA256, FileHashAlgorithmSHA256AC, FileHashAlgorithmUnknown} +} + +// IncidentClassification enumerates the values for incident classification. +type IncidentClassification string + +const ( + // IncidentClassificationBenignPositive Incident was benign positive + IncidentClassificationBenignPositive IncidentClassification = "BenignPositive" + // IncidentClassificationFalsePositive Incident was false positive + IncidentClassificationFalsePositive IncidentClassification = "FalsePositive" + // IncidentClassificationTruePositive Incident was true positive + IncidentClassificationTruePositive IncidentClassification = "TruePositive" + // IncidentClassificationUndetermined Incident classification was undetermined + IncidentClassificationUndetermined IncidentClassification = "Undetermined" +) + +// PossibleIncidentClassificationValues returns an array of possible values for the IncidentClassification const type. +func PossibleIncidentClassificationValues() []IncidentClassification { + return []IncidentClassification{IncidentClassificationBenignPositive, IncidentClassificationFalsePositive, IncidentClassificationTruePositive, IncidentClassificationUndetermined} +} + +// IncidentClassificationReason enumerates the values for incident classification reason. +type IncidentClassificationReason string + +const ( + // IncidentClassificationReasonInaccurateData Classification reason was inaccurate data + IncidentClassificationReasonInaccurateData IncidentClassificationReason = "InaccurateData" + // IncidentClassificationReasonIncorrectAlertLogic Classification reason was incorrect alert logic + IncidentClassificationReasonIncorrectAlertLogic IncidentClassificationReason = "IncorrectAlertLogic" + // IncidentClassificationReasonSuspiciousActivity Classification reason was suspicious activity + IncidentClassificationReasonSuspiciousActivity IncidentClassificationReason = "SuspiciousActivity" + // IncidentClassificationReasonSuspiciousButExpected Classification reason was suspicious but expected + IncidentClassificationReasonSuspiciousButExpected IncidentClassificationReason = "SuspiciousButExpected" +) + +// PossibleIncidentClassificationReasonValues returns an array of possible values for the IncidentClassificationReason const type. +func PossibleIncidentClassificationReasonValues() []IncidentClassificationReason { + return []IncidentClassificationReason{IncidentClassificationReasonInaccurateData, IncidentClassificationReasonIncorrectAlertLogic, IncidentClassificationReasonSuspiciousActivity, IncidentClassificationReasonSuspiciousButExpected} +} + +// IncidentLabelType enumerates the values for incident label type. +type IncidentLabelType string + +const ( + // IncidentLabelTypeAutoAssigned Label automatically created by the system + IncidentLabelTypeAutoAssigned IncidentLabelType = "AutoAssigned" + // IncidentLabelTypeUser Label manually created by a user + IncidentLabelTypeUser IncidentLabelType = "User" +) + +// PossibleIncidentLabelTypeValues returns an array of possible values for the IncidentLabelType const type. +func PossibleIncidentLabelTypeValues() []IncidentLabelType { + return []IncidentLabelType{IncidentLabelTypeAutoAssigned, IncidentLabelTypeUser} +} + +// IncidentSeverity enumerates the values for incident severity. +type IncidentSeverity string + +const ( + // IncidentSeverityHigh High severity + IncidentSeverityHigh IncidentSeverity = "High" + // IncidentSeverityInformational Informational severity + IncidentSeverityInformational IncidentSeverity = "Informational" + // IncidentSeverityLow Low severity + IncidentSeverityLow IncidentSeverity = "Low" + // IncidentSeverityMedium Medium severity + IncidentSeverityMedium IncidentSeverity = "Medium" +) + +// PossibleIncidentSeverityValues returns an array of possible values for the IncidentSeverity const type. +func PossibleIncidentSeverityValues() []IncidentSeverity { + return []IncidentSeverity{IncidentSeverityHigh, IncidentSeverityInformational, IncidentSeverityLow, IncidentSeverityMedium} +} + +// IncidentStatus enumerates the values for incident status. +type IncidentStatus string + +const ( + // IncidentStatusActive An active incident which is being handled + IncidentStatusActive IncidentStatus = "Active" + // IncidentStatusClosed A non-active incident + IncidentStatusClosed IncidentStatus = "Closed" + // IncidentStatusNew An active incident which isn't being handled currently + IncidentStatusNew IncidentStatus = "New" +) + +// PossibleIncidentStatusValues returns an array of possible values for the IncidentStatus const type. +func PossibleIncidentStatusValues() []IncidentStatus { + return []IncidentStatus{IncidentStatusActive, IncidentStatusClosed, IncidentStatusNew} +} + +// KillChainIntent enumerates the values for kill chain intent. +type KillChainIntent string + +const ( + // KillChainIntentCollection Collection consists of techniques used to identify and gather information, + // such as sensitive files, from a target network prior to exfiltration. This category also covers + // locations on a system or network where the adversary may look for information to exfiltrate. + KillChainIntentCollection KillChainIntent = "Collection" + // KillChainIntentCommandAndControl The command and control tactic represents how adversaries communicate + // with systems under their control within a target network. + KillChainIntentCommandAndControl KillChainIntent = "CommandAndControl" + // KillChainIntentCredentialAccess Credential access represents techniques resulting in access to or + // control over system, domain, or service credentials that are used within an enterprise environment. + // Adversaries will likely attempt to obtain legitimate credentials from users or administrator accounts + // (local system administrator or domain users with administrator access) to use within the network. With + // sufficient access within a network, an adversary can create accounts for later use within the + // environment. + KillChainIntentCredentialAccess KillChainIntent = "CredentialAccess" + // KillChainIntentDefenseEvasion Defense evasion consists of techniques an adversary may use to evade + // detection or avoid other defenses. Sometimes these actions are the same as or variations of techniques + // in other categories that have the added benefit of subverting a particular defense or mitigation. + KillChainIntentDefenseEvasion KillChainIntent = "DefenseEvasion" + // KillChainIntentDiscovery Discovery consists of techniques that allow the adversary to gain knowledge + // about the system and internal network. When adversaries gain access to a new system, they must orient + // themselves to what they now have control of and what benefits operating from that system give to their + // current objective or overall goals during the intrusion. The operating system provides many native tools + // that aid in this post-compromise information-gathering phase. + KillChainIntentDiscovery KillChainIntent = "Discovery" + // KillChainIntentExecution The execution tactic represents techniques that result in execution of + // adversary-controlled code on a local or remote system. This tactic is often used in conjunction with + // lateral movement to expand access to remote systems on a network. + KillChainIntentExecution KillChainIntent = "Execution" + // KillChainIntentExfiltration Exfiltration refers to techniques and attributes that result or aid in the + // adversary removing files and information from a target network. This category also covers locations on a + // system or network where the adversary may look for information to exfiltrate. + KillChainIntentExfiltration KillChainIntent = "Exfiltration" + // KillChainIntentExploitation Exploitation is the stage where an attacker manage to get foothold on the + // attacked resource. This stage is applicable not only for compute hosts, but also for resources such as + // user accounts, certificates etc. Adversaries will often be able to control the resource after this + // stage. + KillChainIntentExploitation KillChainIntent = "Exploitation" + // KillChainIntentImpact The impact intent primary objective is to directly reduce the availability or + // integrity of a system, service, or network; including manipulation of data to impact a business or + // operational process. This would often refer to techniques such as ransom-ware, defacement, data + // manipulation and others. + KillChainIntentImpact KillChainIntent = "Impact" + // KillChainIntentLateralMovement 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. The lateral movement techniques could allow an adversary to gather information + // from a system without needing additional tools, such as a remote access tool. An adversary can use + // lateral movement for many purposes, including remote Execution of tools, pivoting to additional systems, + // access to specific information or files, access to additional credentials, or to cause an effect. + KillChainIntentLateralMovement KillChainIntent = "LateralMovement" + // KillChainIntentPersistence Persistence is any access, action, or configuration change to a system that + // gives an adversary a persistent presence on that system. Adversaries will often need to maintain access + // to systems through interruptions such as system restarts, loss of credentials, or other failures that + // would require a remote access tool to restart or alternate backdoor for them to regain access. + KillChainIntentPersistence KillChainIntent = "Persistence" + // KillChainIntentPrivilegeEscalation Privilege escalation is the result of actions that allow an adversary + // to obtain a higher level of permissions on a system or network. Certain tools or actions require a + // higher level of privilege to work and are likely necessary at many points throughout an operation. User + // accounts with permissions to access specific systems or perform specific functions necessary for + // adversaries to achieve their objective may also be considered an escalation of privilege. + KillChainIntentPrivilegeEscalation KillChainIntent = "PrivilegeEscalation" + // KillChainIntentProbing Probing could be 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 in + // attempt to scan the target system and find a way in. + KillChainIntentProbing KillChainIntent = "Probing" + // KillChainIntentUnknown The default value. + KillChainIntentUnknown KillChainIntent = "Unknown" +) + +// PossibleKillChainIntentValues returns an array of possible values for the KillChainIntent const type. +func PossibleKillChainIntentValues() []KillChainIntent { + return []KillChainIntent{KillChainIntentCollection, KillChainIntentCommandAndControl, KillChainIntentCredentialAccess, KillChainIntentDefenseEvasion, KillChainIntentDiscovery, KillChainIntentExecution, KillChainIntentExfiltration, KillChainIntentExploitation, KillChainIntentImpact, KillChainIntentLateralMovement, KillChainIntentPersistence, KillChainIntentPrivilegeEscalation, KillChainIntentProbing, KillChainIntentUnknown} +} + +// Kind enumerates the values for kind. +type Kind string + +const ( + // KindAnalyticsRule ... + KindAnalyticsRule Kind = "AnalyticsRule" + // KindAnalyticsRuleTemplate ... + KindAnalyticsRuleTemplate Kind = "AnalyticsRuleTemplate" + // KindAutomationRule ... + KindAutomationRule Kind = "AutomationRule" + // KindAzureFunction ... + KindAzureFunction Kind = "AzureFunction" + // KindDataConnector ... + KindDataConnector Kind = "DataConnector" + // KindDataType ... + KindDataType Kind = "DataType" + // KindHuntingQuery ... + KindHuntingQuery Kind = "HuntingQuery" + // KindInvestigationQuery ... + KindInvestigationQuery Kind = "InvestigationQuery" + // KindLogicAppsCustomConnector ... + KindLogicAppsCustomConnector Kind = "LogicAppsCustomConnector" + // KindParser ... + KindParser Kind = "Parser" + // KindPlaybook ... + KindPlaybook Kind = "Playbook" + // KindPlaybookTemplate ... + KindPlaybookTemplate Kind = "PlaybookTemplate" + // KindSolution ... + KindSolution Kind = "Solution" + // KindWatchlist ... + KindWatchlist Kind = "Watchlist" + // KindWatchlistTemplate ... + KindWatchlistTemplate Kind = "WatchlistTemplate" + // KindWorkbook ... + KindWorkbook Kind = "Workbook" + // KindWorkbookTemplate ... + KindWorkbookTemplate Kind = "WorkbookTemplate" +) + +// PossibleKindValues returns an array of possible values for the Kind const type. +func PossibleKindValues() []Kind { + return []Kind{KindAnalyticsRule, KindAnalyticsRuleTemplate, KindAutomationRule, KindAzureFunction, KindDataConnector, KindDataType, KindHuntingQuery, KindInvestigationQuery, KindLogicAppsCustomConnector, KindParser, KindPlaybook, KindPlaybookTemplate, KindSolution, KindWatchlist, KindWatchlistTemplate, KindWorkbook, KindWorkbookTemplate} +} + +// KindBasicAlertRule enumerates the values for kind basic alert rule. +type KindBasicAlertRule string + +const ( + // KindBasicAlertRuleKindAlertRule ... + KindBasicAlertRuleKindAlertRule KindBasicAlertRule = "AlertRule" + // KindBasicAlertRuleKindFusion ... + KindBasicAlertRuleKindFusion KindBasicAlertRule = "Fusion" + // KindBasicAlertRuleKindMicrosoftSecurityIncidentCreation ... + KindBasicAlertRuleKindMicrosoftSecurityIncidentCreation KindBasicAlertRule = "MicrosoftSecurityIncidentCreation" + // KindBasicAlertRuleKindMLBehaviorAnalytics ... + KindBasicAlertRuleKindMLBehaviorAnalytics KindBasicAlertRule = "MLBehaviorAnalytics" + // KindBasicAlertRuleKindNRT ... + KindBasicAlertRuleKindNRT KindBasicAlertRule = "NRT" + // KindBasicAlertRuleKindScheduled ... + KindBasicAlertRuleKindScheduled KindBasicAlertRule = "Scheduled" + // KindBasicAlertRuleKindThreatIntelligence ... + KindBasicAlertRuleKindThreatIntelligence KindBasicAlertRule = "ThreatIntelligence" +) + +// PossibleKindBasicAlertRuleValues returns an array of possible values for the KindBasicAlertRule const type. +func PossibleKindBasicAlertRuleValues() []KindBasicAlertRule { + return []KindBasicAlertRule{KindBasicAlertRuleKindAlertRule, KindBasicAlertRuleKindFusion, KindBasicAlertRuleKindMicrosoftSecurityIncidentCreation, KindBasicAlertRuleKindMLBehaviorAnalytics, KindBasicAlertRuleKindNRT, KindBasicAlertRuleKindScheduled, KindBasicAlertRuleKindThreatIntelligence} +} + +// KindBasicAlertRuleTemplate enumerates the values for kind basic alert rule template. +type KindBasicAlertRuleTemplate string + +const ( + // KindBasicAlertRuleTemplateKindAlertRuleTemplate ... + KindBasicAlertRuleTemplateKindAlertRuleTemplate KindBasicAlertRuleTemplate = "AlertRuleTemplate" + // KindBasicAlertRuleTemplateKindFusion ... + KindBasicAlertRuleTemplateKindFusion KindBasicAlertRuleTemplate = "Fusion" + // KindBasicAlertRuleTemplateKindMicrosoftSecurityIncidentCreation ... + KindBasicAlertRuleTemplateKindMicrosoftSecurityIncidentCreation KindBasicAlertRuleTemplate = "MicrosoftSecurityIncidentCreation" + // KindBasicAlertRuleTemplateKindMLBehaviorAnalytics ... + KindBasicAlertRuleTemplateKindMLBehaviorAnalytics KindBasicAlertRuleTemplate = "MLBehaviorAnalytics" + // KindBasicAlertRuleTemplateKindNRT ... + KindBasicAlertRuleTemplateKindNRT KindBasicAlertRuleTemplate = "NRT" + // KindBasicAlertRuleTemplateKindScheduled ... + KindBasicAlertRuleTemplateKindScheduled KindBasicAlertRuleTemplate = "Scheduled" + // KindBasicAlertRuleTemplateKindThreatIntelligence ... + KindBasicAlertRuleTemplateKindThreatIntelligence KindBasicAlertRuleTemplate = "ThreatIntelligence" +) + +// PossibleKindBasicAlertRuleTemplateValues returns an array of possible values for the KindBasicAlertRuleTemplate const type. +func PossibleKindBasicAlertRuleTemplateValues() []KindBasicAlertRuleTemplate { + return []KindBasicAlertRuleTemplate{KindBasicAlertRuleTemplateKindAlertRuleTemplate, KindBasicAlertRuleTemplateKindFusion, KindBasicAlertRuleTemplateKindMicrosoftSecurityIncidentCreation, KindBasicAlertRuleTemplateKindMLBehaviorAnalytics, KindBasicAlertRuleTemplateKindNRT, KindBasicAlertRuleTemplateKindScheduled, KindBasicAlertRuleTemplateKindThreatIntelligence} +} + +// KindBasicCustomEntityQuery enumerates the values for kind basic custom entity query. +type KindBasicCustomEntityQuery string + +const ( + // KindBasicCustomEntityQueryKindActivity ... + KindBasicCustomEntityQueryKindActivity KindBasicCustomEntityQuery = "Activity" + // KindBasicCustomEntityQueryKindCustomEntityQuery ... + KindBasicCustomEntityQueryKindCustomEntityQuery KindBasicCustomEntityQuery = "CustomEntityQuery" +) + +// PossibleKindBasicCustomEntityQueryValues returns an array of possible values for the KindBasicCustomEntityQuery const type. +func PossibleKindBasicCustomEntityQueryValues() []KindBasicCustomEntityQuery { + return []KindBasicCustomEntityQuery{KindBasicCustomEntityQueryKindActivity, KindBasicCustomEntityQueryKindCustomEntityQuery} +} + +// KindBasicDataConnector enumerates the values for kind basic data connector. +type KindBasicDataConnector string + +const ( + // KindBasicDataConnectorKindAmazonWebServicesCloudTrail ... + KindBasicDataConnectorKindAmazonWebServicesCloudTrail KindBasicDataConnector = "AmazonWebServicesCloudTrail" + // KindBasicDataConnectorKindAmazonWebServicesS3 ... + KindBasicDataConnectorKindAmazonWebServicesS3 KindBasicDataConnector = "AmazonWebServicesS3" + // KindBasicDataConnectorKindAPIPolling ... + KindBasicDataConnectorKindAPIPolling KindBasicDataConnector = "APIPolling" + // KindBasicDataConnectorKindAzureActiveDirectory ... + KindBasicDataConnectorKindAzureActiveDirectory KindBasicDataConnector = "AzureActiveDirectory" + // KindBasicDataConnectorKindAzureAdvancedThreatProtection ... + KindBasicDataConnectorKindAzureAdvancedThreatProtection KindBasicDataConnector = "AzureAdvancedThreatProtection" + // KindBasicDataConnectorKindAzureSecurityCenter ... + KindBasicDataConnectorKindAzureSecurityCenter KindBasicDataConnector = "AzureSecurityCenter" + // KindBasicDataConnectorKindDataConnector ... + KindBasicDataConnectorKindDataConnector KindBasicDataConnector = "DataConnector" + // KindBasicDataConnectorKindDynamics365 ... + KindBasicDataConnectorKindDynamics365 KindBasicDataConnector = "Dynamics365" + // KindBasicDataConnectorKindGenericUI ... + KindBasicDataConnectorKindGenericUI KindBasicDataConnector = "GenericUI" + // KindBasicDataConnectorKindIOT ... + KindBasicDataConnectorKindIOT KindBasicDataConnector = "IOT" + // KindBasicDataConnectorKindMicrosoftCloudAppSecurity ... + KindBasicDataConnectorKindMicrosoftCloudAppSecurity KindBasicDataConnector = "MicrosoftCloudAppSecurity" + // KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection ... + KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection KindBasicDataConnector = "MicrosoftDefenderAdvancedThreatProtection" + // KindBasicDataConnectorKindMicrosoftThreatIntelligence ... + KindBasicDataConnectorKindMicrosoftThreatIntelligence KindBasicDataConnector = "MicrosoftThreatIntelligence" + // KindBasicDataConnectorKindMicrosoftThreatProtection ... + KindBasicDataConnectorKindMicrosoftThreatProtection KindBasicDataConnector = "MicrosoftThreatProtection" + // KindBasicDataConnectorKindOffice365 ... + KindBasicDataConnectorKindOffice365 KindBasicDataConnector = "Office365" + // KindBasicDataConnectorKindOffice365Project ... + KindBasicDataConnectorKindOffice365Project KindBasicDataConnector = "Office365Project" + // KindBasicDataConnectorKindOfficeATP ... + KindBasicDataConnectorKindOfficeATP KindBasicDataConnector = "OfficeATP" + // KindBasicDataConnectorKindOfficeIRM ... + KindBasicDataConnectorKindOfficeIRM KindBasicDataConnector = "OfficeIRM" + // KindBasicDataConnectorKindOfficePowerBI ... + KindBasicDataConnectorKindOfficePowerBI KindBasicDataConnector = "OfficePowerBI" + // KindBasicDataConnectorKindThreatIntelligence ... + KindBasicDataConnectorKindThreatIntelligence KindBasicDataConnector = "ThreatIntelligence" + // KindBasicDataConnectorKindThreatIntelligenceTaxii ... + KindBasicDataConnectorKindThreatIntelligenceTaxii KindBasicDataConnector = "ThreatIntelligenceTaxii" +) + +// PossibleKindBasicDataConnectorValues returns an array of possible values for the KindBasicDataConnector const type. +func PossibleKindBasicDataConnectorValues() []KindBasicDataConnector { + return []KindBasicDataConnector{KindBasicDataConnectorKindAmazonWebServicesCloudTrail, KindBasicDataConnectorKindAmazonWebServicesS3, KindBasicDataConnectorKindAPIPolling, KindBasicDataConnectorKindAzureActiveDirectory, KindBasicDataConnectorKindAzureAdvancedThreatProtection, KindBasicDataConnectorKindAzureSecurityCenter, KindBasicDataConnectorKindDataConnector, KindBasicDataConnectorKindDynamics365, KindBasicDataConnectorKindGenericUI, KindBasicDataConnectorKindIOT, KindBasicDataConnectorKindMicrosoftCloudAppSecurity, KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection, KindBasicDataConnectorKindMicrosoftThreatIntelligence, KindBasicDataConnectorKindMicrosoftThreatProtection, KindBasicDataConnectorKindOffice365, KindBasicDataConnectorKindOffice365Project, KindBasicDataConnectorKindOfficeATP, KindBasicDataConnectorKindOfficeIRM, KindBasicDataConnectorKindOfficePowerBI, KindBasicDataConnectorKindThreatIntelligence, KindBasicDataConnectorKindThreatIntelligenceTaxii} +} + +// KindBasicDataConnectorsCheckRequirements enumerates the values for kind basic data connectors check +// requirements. +type KindBasicDataConnectorsCheckRequirements string + +const ( + // KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesCloudTrail ... + KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesCloudTrail KindBasicDataConnectorsCheckRequirements = "AmazonWebServicesCloudTrail" + // KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesS3 ... + KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesS3 KindBasicDataConnectorsCheckRequirements = "AmazonWebServicesS3" + // KindBasicDataConnectorsCheckRequirementsKindAzureActiveDirectory ... + KindBasicDataConnectorsCheckRequirementsKindAzureActiveDirectory KindBasicDataConnectorsCheckRequirements = "AzureActiveDirectory" + // KindBasicDataConnectorsCheckRequirementsKindAzureAdvancedThreatProtection ... + KindBasicDataConnectorsCheckRequirementsKindAzureAdvancedThreatProtection KindBasicDataConnectorsCheckRequirements = "AzureAdvancedThreatProtection" + // KindBasicDataConnectorsCheckRequirementsKindAzureSecurityCenter ... + KindBasicDataConnectorsCheckRequirementsKindAzureSecurityCenter KindBasicDataConnectorsCheckRequirements = "AzureSecurityCenter" + // KindBasicDataConnectorsCheckRequirementsKindDataConnectorsCheckRequirements ... + KindBasicDataConnectorsCheckRequirementsKindDataConnectorsCheckRequirements KindBasicDataConnectorsCheckRequirements = "DataConnectorsCheckRequirements" + // KindBasicDataConnectorsCheckRequirementsKindDynamics365 ... + KindBasicDataConnectorsCheckRequirementsKindDynamics365 KindBasicDataConnectorsCheckRequirements = "Dynamics365" + // KindBasicDataConnectorsCheckRequirementsKindIOT ... + KindBasicDataConnectorsCheckRequirementsKindIOT KindBasicDataConnectorsCheckRequirements = "IOT" + // KindBasicDataConnectorsCheckRequirementsKindMicrosoftCloudAppSecurity ... + KindBasicDataConnectorsCheckRequirementsKindMicrosoftCloudAppSecurity KindBasicDataConnectorsCheckRequirements = "MicrosoftCloudAppSecurity" + // KindBasicDataConnectorsCheckRequirementsKindMicrosoftDefenderAdvancedThreatProtection ... + KindBasicDataConnectorsCheckRequirementsKindMicrosoftDefenderAdvancedThreatProtection KindBasicDataConnectorsCheckRequirements = "MicrosoftDefenderAdvancedThreatProtection" + // KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatIntelligence ... + KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatIntelligence KindBasicDataConnectorsCheckRequirements = "MicrosoftThreatIntelligence" + // KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatProtection ... + KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatProtection KindBasicDataConnectorsCheckRequirements = "MicrosoftThreatProtection" + // KindBasicDataConnectorsCheckRequirementsKindOffice365Project ... + KindBasicDataConnectorsCheckRequirementsKindOffice365Project KindBasicDataConnectorsCheckRequirements = "Office365Project" + // KindBasicDataConnectorsCheckRequirementsKindOfficeATP ... + KindBasicDataConnectorsCheckRequirementsKindOfficeATP KindBasicDataConnectorsCheckRequirements = "OfficeATP" + // KindBasicDataConnectorsCheckRequirementsKindOfficeIRM ... + KindBasicDataConnectorsCheckRequirementsKindOfficeIRM KindBasicDataConnectorsCheckRequirements = "OfficeIRM" + // KindBasicDataConnectorsCheckRequirementsKindOfficePowerBI ... + KindBasicDataConnectorsCheckRequirementsKindOfficePowerBI KindBasicDataConnectorsCheckRequirements = "OfficePowerBI" + // KindBasicDataConnectorsCheckRequirementsKindThreatIntelligence ... + KindBasicDataConnectorsCheckRequirementsKindThreatIntelligence KindBasicDataConnectorsCheckRequirements = "ThreatIntelligence" + // KindBasicDataConnectorsCheckRequirementsKindThreatIntelligenceTaxii ... + KindBasicDataConnectorsCheckRequirementsKindThreatIntelligenceTaxii KindBasicDataConnectorsCheckRequirements = "ThreatIntelligenceTaxii" +) + +// PossibleKindBasicDataConnectorsCheckRequirementsValues returns an array of possible values for the KindBasicDataConnectorsCheckRequirements const type. +func PossibleKindBasicDataConnectorsCheckRequirementsValues() []KindBasicDataConnectorsCheckRequirements { + return []KindBasicDataConnectorsCheckRequirements{KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesCloudTrail, KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesS3, KindBasicDataConnectorsCheckRequirementsKindAzureActiveDirectory, KindBasicDataConnectorsCheckRequirementsKindAzureAdvancedThreatProtection, KindBasicDataConnectorsCheckRequirementsKindAzureSecurityCenter, KindBasicDataConnectorsCheckRequirementsKindDataConnectorsCheckRequirements, KindBasicDataConnectorsCheckRequirementsKindDynamics365, KindBasicDataConnectorsCheckRequirementsKindIOT, KindBasicDataConnectorsCheckRequirementsKindMicrosoftCloudAppSecurity, KindBasicDataConnectorsCheckRequirementsKindMicrosoftDefenderAdvancedThreatProtection, KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatIntelligence, KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatProtection, KindBasicDataConnectorsCheckRequirementsKindOffice365Project, KindBasicDataConnectorsCheckRequirementsKindOfficeATP, KindBasicDataConnectorsCheckRequirementsKindOfficeIRM, KindBasicDataConnectorsCheckRequirementsKindOfficePowerBI, KindBasicDataConnectorsCheckRequirementsKindThreatIntelligence, KindBasicDataConnectorsCheckRequirementsKindThreatIntelligenceTaxii} +} + +// KindBasicEntity enumerates the values for kind basic entity. +type KindBasicEntity string + +const ( + // KindBasicEntityKindAccount ... + KindBasicEntityKindAccount KindBasicEntity = "Account" + // KindBasicEntityKindAzureResource ... + KindBasicEntityKindAzureResource KindBasicEntity = "AzureResource" + // KindBasicEntityKindBookmark ... + KindBasicEntityKindBookmark KindBasicEntity = "Bookmark" + // KindBasicEntityKindCloudApplication ... + KindBasicEntityKindCloudApplication KindBasicEntity = "CloudApplication" + // KindBasicEntityKindDNSResolution ... + KindBasicEntityKindDNSResolution KindBasicEntity = "DnsResolution" + // KindBasicEntityKindEntity ... + KindBasicEntityKindEntity KindBasicEntity = "Entity" + // KindBasicEntityKindFile ... + KindBasicEntityKindFile KindBasicEntity = "File" + // KindBasicEntityKindFileHash ... + KindBasicEntityKindFileHash KindBasicEntity = "FileHash" + // KindBasicEntityKindHost ... + KindBasicEntityKindHost KindBasicEntity = "Host" + // KindBasicEntityKindIoTDevice ... + KindBasicEntityKindIoTDevice KindBasicEntity = "IoTDevice" + // KindBasicEntityKindIP ... + KindBasicEntityKindIP KindBasicEntity = "Ip" + // KindBasicEntityKindMailbox ... + KindBasicEntityKindMailbox KindBasicEntity = "Mailbox" + // KindBasicEntityKindMailCluster ... + KindBasicEntityKindMailCluster KindBasicEntity = "MailCluster" + // KindBasicEntityKindMailMessage ... + KindBasicEntityKindMailMessage KindBasicEntity = "MailMessage" + // KindBasicEntityKindMalware ... + KindBasicEntityKindMalware KindBasicEntity = "Malware" + // KindBasicEntityKindProcess ... + KindBasicEntityKindProcess KindBasicEntity = "Process" + // KindBasicEntityKindRegistryKey ... + KindBasicEntityKindRegistryKey KindBasicEntity = "RegistryKey" + // KindBasicEntityKindRegistryValue ... + KindBasicEntityKindRegistryValue KindBasicEntity = "RegistryValue" + // KindBasicEntityKindSecurityAlert ... + KindBasicEntityKindSecurityAlert KindBasicEntity = "SecurityAlert" + // KindBasicEntityKindSecurityGroup ... + KindBasicEntityKindSecurityGroup KindBasicEntity = "SecurityGroup" + // KindBasicEntityKindSubmissionMail ... + KindBasicEntityKindSubmissionMail KindBasicEntity = "SubmissionMail" + // KindBasicEntityKindURL ... + KindBasicEntityKindURL KindBasicEntity = "Url" +) + +// PossibleKindBasicEntityValues returns an array of possible values for the KindBasicEntity const type. +func PossibleKindBasicEntityValues() []KindBasicEntity { + return []KindBasicEntity{KindBasicEntityKindAccount, KindBasicEntityKindAzureResource, KindBasicEntityKindBookmark, KindBasicEntityKindCloudApplication, KindBasicEntityKindDNSResolution, KindBasicEntityKindEntity, KindBasicEntityKindFile, KindBasicEntityKindFileHash, KindBasicEntityKindHost, KindBasicEntityKindIoTDevice, KindBasicEntityKindIP, KindBasicEntityKindMailbox, KindBasicEntityKindMailCluster, KindBasicEntityKindMailMessage, KindBasicEntityKindMalware, KindBasicEntityKindProcess, KindBasicEntityKindRegistryKey, KindBasicEntityKindRegistryValue, KindBasicEntityKindSecurityAlert, KindBasicEntityKindSecurityGroup, KindBasicEntityKindSubmissionMail, KindBasicEntityKindURL} +} + +// KindBasicEntityQuery enumerates the values for kind basic entity query. +type KindBasicEntityQuery string + +const ( + // KindBasicEntityQueryKindActivity ... + KindBasicEntityQueryKindActivity KindBasicEntityQuery = "Activity" + // KindBasicEntityQueryKindEntityQuery ... + KindBasicEntityQueryKindEntityQuery KindBasicEntityQuery = "EntityQuery" + // KindBasicEntityQueryKindExpansion ... + KindBasicEntityQueryKindExpansion KindBasicEntityQuery = "Expansion" +) + +// PossibleKindBasicEntityQueryValues returns an array of possible values for the KindBasicEntityQuery const type. +func PossibleKindBasicEntityQueryValues() []KindBasicEntityQuery { + return []KindBasicEntityQuery{KindBasicEntityQueryKindActivity, KindBasicEntityQueryKindEntityQuery, KindBasicEntityQueryKindExpansion} +} + +// KindBasicEntityQueryItem enumerates the values for kind basic entity query item. +type KindBasicEntityQueryItem string + +const ( + // KindBasicEntityQueryItemKindEntityQueryItem ... + KindBasicEntityQueryItemKindEntityQueryItem KindBasicEntityQueryItem = "EntityQueryItem" + // KindBasicEntityQueryItemKindInsight ... + KindBasicEntityQueryItemKindInsight KindBasicEntityQueryItem = "Insight" +) + +// PossibleKindBasicEntityQueryItemValues returns an array of possible values for the KindBasicEntityQueryItem const type. +func PossibleKindBasicEntityQueryItemValues() []KindBasicEntityQueryItem { + return []KindBasicEntityQueryItem{KindBasicEntityQueryItemKindEntityQueryItem, KindBasicEntityQueryItemKindInsight} +} + +// KindBasicEntityQueryTemplate enumerates the values for kind basic entity query template. +type KindBasicEntityQueryTemplate string + +const ( + // KindBasicEntityQueryTemplateKindActivity ... + KindBasicEntityQueryTemplateKindActivity KindBasicEntityQueryTemplate = "Activity" + // KindBasicEntityQueryTemplateKindEntityQueryTemplate ... + KindBasicEntityQueryTemplateKindEntityQueryTemplate KindBasicEntityQueryTemplate = "EntityQueryTemplate" +) + +// PossibleKindBasicEntityQueryTemplateValues returns an array of possible values for the KindBasicEntityQueryTemplate const type. +func PossibleKindBasicEntityQueryTemplateValues() []KindBasicEntityQueryTemplate { + return []KindBasicEntityQueryTemplate{KindBasicEntityQueryTemplateKindActivity, KindBasicEntityQueryTemplateKindEntityQueryTemplate} +} + +// KindBasicEntityTimelineItem enumerates the values for kind basic entity timeline item. +type KindBasicEntityTimelineItem string + +const ( + // KindBasicEntityTimelineItemKindActivity ... + KindBasicEntityTimelineItemKindActivity KindBasicEntityTimelineItem = "Activity" + // KindBasicEntityTimelineItemKindBookmark ... + KindBasicEntityTimelineItemKindBookmark KindBasicEntityTimelineItem = "Bookmark" + // KindBasicEntityTimelineItemKindEntityTimelineItem ... + KindBasicEntityTimelineItemKindEntityTimelineItem KindBasicEntityTimelineItem = "EntityTimelineItem" + // KindBasicEntityTimelineItemKindSecurityAlert ... + KindBasicEntityTimelineItemKindSecurityAlert KindBasicEntityTimelineItem = "SecurityAlert" +) + +// PossibleKindBasicEntityTimelineItemValues returns an array of possible values for the KindBasicEntityTimelineItem const type. +func PossibleKindBasicEntityTimelineItemValues() []KindBasicEntityTimelineItem { + return []KindBasicEntityTimelineItem{KindBasicEntityTimelineItemKindActivity, KindBasicEntityTimelineItemKindBookmark, KindBasicEntityTimelineItemKindEntityTimelineItem, KindBasicEntityTimelineItemKindSecurityAlert} +} + +// KindBasicSettings enumerates the values for kind basic settings. +type KindBasicSettings string + +const ( + // KindBasicSettingsKindAnomalies ... + KindBasicSettingsKindAnomalies KindBasicSettings = "Anomalies" + // KindBasicSettingsKindEntityAnalytics ... + KindBasicSettingsKindEntityAnalytics KindBasicSettings = "EntityAnalytics" + // KindBasicSettingsKindEyesOn ... + KindBasicSettingsKindEyesOn KindBasicSettings = "EyesOn" + // KindBasicSettingsKindSettings ... + KindBasicSettingsKindSettings KindBasicSettings = "Settings" + // KindBasicSettingsKindUeba ... + KindBasicSettingsKindUeba KindBasicSettings = "Ueba" +) + +// PossibleKindBasicSettingsValues returns an array of possible values for the KindBasicSettings const type. +func PossibleKindBasicSettingsValues() []KindBasicSettings { + return []KindBasicSettings{KindBasicSettingsKindAnomalies, KindBasicSettingsKindEntityAnalytics, KindBasicSettingsKindEyesOn, KindBasicSettingsKindSettings, KindBasicSettingsKindUeba} +} + +// KindBasicThreatIntelligenceInformation enumerates the values for kind basic threat intelligence information. +type KindBasicThreatIntelligenceInformation string + +const ( + // KindBasicThreatIntelligenceInformationKindIndicator ... + KindBasicThreatIntelligenceInformationKindIndicator KindBasicThreatIntelligenceInformation = "indicator" + // KindBasicThreatIntelligenceInformationKindThreatIntelligenceInformation ... + KindBasicThreatIntelligenceInformationKindThreatIntelligenceInformation KindBasicThreatIntelligenceInformation = "ThreatIntelligenceInformation" +) + +// PossibleKindBasicThreatIntelligenceInformationValues returns an array of possible values for the KindBasicThreatIntelligenceInformation const type. +func PossibleKindBasicThreatIntelligenceInformationValues() []KindBasicThreatIntelligenceInformation { + return []KindBasicThreatIntelligenceInformation{KindBasicThreatIntelligenceInformationKindIndicator, KindBasicThreatIntelligenceInformationKindThreatIntelligenceInformation} +} + +// MatchingMethod enumerates the values for matching method. +type MatchingMethod string + +const ( + // MatchingMethodAllEntities Grouping alerts into a single incident if all the entities match + MatchingMethodAllEntities MatchingMethod = "AllEntities" + // MatchingMethodAnyAlert Grouping any alerts triggered by this rule into a single incident + MatchingMethodAnyAlert MatchingMethod = "AnyAlert" + // MatchingMethodSelected Grouping alerts into a single incident if the selected entities, custom details + // and alert details match + MatchingMethodSelected MatchingMethod = "Selected" +) + +// PossibleMatchingMethodValues returns an array of possible values for the MatchingMethod const type. +func PossibleMatchingMethodValues() []MatchingMethod { + return []MatchingMethod{MatchingMethodAllEntities, MatchingMethodAnyAlert, MatchingMethodSelected} +} + +// MicrosoftSecurityProductName enumerates the values for microsoft security product name. +type MicrosoftSecurityProductName string + +const ( + // MicrosoftSecurityProductNameAzureActiveDirectoryIdentityProtection ... + MicrosoftSecurityProductNameAzureActiveDirectoryIdentityProtection MicrosoftSecurityProductName = "Azure Active Directory Identity Protection" + // MicrosoftSecurityProductNameAzureAdvancedThreatProtection ... + MicrosoftSecurityProductNameAzureAdvancedThreatProtection MicrosoftSecurityProductName = "Azure Advanced Threat Protection" + // MicrosoftSecurityProductNameAzureSecurityCenter ... + MicrosoftSecurityProductNameAzureSecurityCenter MicrosoftSecurityProductName = "Azure Security Center" + // MicrosoftSecurityProductNameAzureSecurityCenterforIoT ... + MicrosoftSecurityProductNameAzureSecurityCenterforIoT MicrosoftSecurityProductName = "Azure Security Center for IoT" + // MicrosoftSecurityProductNameMicrosoftCloudAppSecurity ... + MicrosoftSecurityProductNameMicrosoftCloudAppSecurity MicrosoftSecurityProductName = "Microsoft Cloud App Security" + // MicrosoftSecurityProductNameMicrosoftDefenderAdvancedThreatProtection ... + MicrosoftSecurityProductNameMicrosoftDefenderAdvancedThreatProtection MicrosoftSecurityProductName = "Microsoft Defender Advanced Threat Protection" + // MicrosoftSecurityProductNameOffice365AdvancedThreatProtection ... + MicrosoftSecurityProductNameOffice365AdvancedThreatProtection MicrosoftSecurityProductName = "Office 365 Advanced Threat Protection" +) + +// PossibleMicrosoftSecurityProductNameValues returns an array of possible values for the MicrosoftSecurityProductName const type. +func PossibleMicrosoftSecurityProductNameValues() []MicrosoftSecurityProductName { + return []MicrosoftSecurityProductName{MicrosoftSecurityProductNameAzureActiveDirectoryIdentityProtection, MicrosoftSecurityProductNameAzureAdvancedThreatProtection, MicrosoftSecurityProductNameAzureSecurityCenter, MicrosoftSecurityProductNameAzureSecurityCenterforIoT, MicrosoftSecurityProductNameMicrosoftCloudAppSecurity, MicrosoftSecurityProductNameMicrosoftDefenderAdvancedThreatProtection, MicrosoftSecurityProductNameOffice365AdvancedThreatProtection} +} + +// Operator enumerates the values for operator. +type Operator string + +const ( + // OperatorAND ... + OperatorAND Operator = "AND" + // OperatorOR ... + OperatorOR Operator = "OR" +) + +// PossibleOperatorValues returns an array of possible values for the Operator const type. +func PossibleOperatorValues() []Operator { + return []Operator{OperatorAND, OperatorOR} +} + +// OSFamily enumerates the values for os family. +type OSFamily string + +const ( + // OSFamilyAndroid Host with Android operating system. + OSFamilyAndroid OSFamily = "Android" + // OSFamilyIOS Host with IOS operating system. + OSFamilyIOS OSFamily = "IOS" + // OSFamilyLinux Host with Linux operating system. + OSFamilyLinux OSFamily = "Linux" + // OSFamilyUnknown Host with Unknown operating system. + OSFamilyUnknown OSFamily = "Unknown" + // OSFamilyWindows Host with Windows operating system. + OSFamilyWindows OSFamily = "Windows" +) + +// PossibleOSFamilyValues returns an array of possible values for the OSFamily const type. +func PossibleOSFamilyValues() []OSFamily { + return []OSFamily{OSFamilyAndroid, OSFamilyIOS, OSFamilyLinux, OSFamilyUnknown, OSFamilyWindows} +} + +// OutputType enumerates the values for output type. +type OutputType string + +const ( + // OutputTypeDate ... + OutputTypeDate OutputType = "Date" + // OutputTypeEntity ... + OutputTypeEntity OutputType = "Entity" + // OutputTypeNumber ... + OutputTypeNumber OutputType = "Number" + // OutputTypeString ... + OutputTypeString OutputType = "String" +) + +// PossibleOutputTypeValues returns an array of possible values for the OutputType const type. +func PossibleOutputTypeValues() []OutputType { + return []OutputType{OutputTypeDate, OutputTypeEntity, OutputTypeNumber, OutputTypeString} +} + +// OwnerType enumerates the values for owner type. +type OwnerType string + +const ( + // OwnerTypeGroup The incident owner type is an AAD group + OwnerTypeGroup OwnerType = "Group" + // OwnerTypeUnknown The incident owner type is unknown + OwnerTypeUnknown OwnerType = "Unknown" + // OwnerTypeUser The incident owner type is an AAD user + OwnerTypeUser OwnerType = "User" +) + +// PossibleOwnerTypeValues returns an array of possible values for the OwnerType const type. +func PossibleOwnerTypeValues() []OwnerType { + return []OwnerType{OwnerTypeGroup, OwnerTypeUnknown, OwnerTypeUser} +} + +// PermissionProviderScope enumerates the values for permission provider scope. +type PermissionProviderScope string + +const ( + // PermissionProviderScopeResourceGroup ... + PermissionProviderScopeResourceGroup PermissionProviderScope = "ResourceGroup" + // PermissionProviderScopeSubscription ... + PermissionProviderScopeSubscription PermissionProviderScope = "Subscription" + // PermissionProviderScopeWorkspace ... + PermissionProviderScopeWorkspace PermissionProviderScope = "Workspace" +) + +// PossiblePermissionProviderScopeValues returns an array of possible values for the PermissionProviderScope const type. +func PossiblePermissionProviderScopeValues() []PermissionProviderScope { + return []PermissionProviderScope{PermissionProviderScopeResourceGroup, PermissionProviderScopeSubscription, PermissionProviderScopeWorkspace} +} + +// PollingFrequency enumerates the values for polling frequency. +type PollingFrequency string + +const ( + // PollingFrequencyOnceADay Once a day + PollingFrequencyOnceADay PollingFrequency = "OnceADay" + // PollingFrequencyOnceAMinute Once a minute + PollingFrequencyOnceAMinute PollingFrequency = "OnceAMinute" + // PollingFrequencyOnceAnHour Once an hour + PollingFrequencyOnceAnHour PollingFrequency = "OnceAnHour" +) + +// PossiblePollingFrequencyValues returns an array of possible values for the PollingFrequency const type. +func PossiblePollingFrequencyValues() []PollingFrequency { + return []PollingFrequency{PollingFrequencyOnceADay, PollingFrequencyOnceAMinute, PollingFrequencyOnceAnHour} +} + +// ProviderName enumerates the values for provider name. +type ProviderName string + +const ( + // ProviderNameMicrosoftaadiamdiagnosticSettings ... + ProviderNameMicrosoftaadiamdiagnosticSettings ProviderName = "microsoft.aadiam/diagnosticSettings" + // ProviderNameMicrosoftAuthorizationpolicyAssignments ... + ProviderNameMicrosoftAuthorizationpolicyAssignments ProviderName = "Microsoft.Authorization/policyAssignments" + // ProviderNameMicrosoftOperationalInsightssolutions ... + ProviderNameMicrosoftOperationalInsightssolutions ProviderName = "Microsoft.OperationalInsights/solutions" + // ProviderNameMicrosoftOperationalInsightsworkspaces ... + ProviderNameMicrosoftOperationalInsightsworkspaces ProviderName = "Microsoft.OperationalInsights/workspaces" + // ProviderNameMicrosoftOperationalInsightsworkspacesdatasources ... + ProviderNameMicrosoftOperationalInsightsworkspacesdatasources ProviderName = "Microsoft.OperationalInsights/workspaces/datasources" + // ProviderNameMicrosoftOperationalInsightsworkspacessharedKeys ... + ProviderNameMicrosoftOperationalInsightsworkspacessharedKeys ProviderName = "Microsoft.OperationalInsights/workspaces/sharedKeys" +) + +// PossibleProviderNameValues returns an array of possible values for the ProviderName const type. +func PossibleProviderNameValues() []ProviderName { + return []ProviderName{ProviderNameMicrosoftaadiamdiagnosticSettings, ProviderNameMicrosoftAuthorizationpolicyAssignments, ProviderNameMicrosoftOperationalInsightssolutions, ProviderNameMicrosoftOperationalInsightsworkspaces, ProviderNameMicrosoftOperationalInsightsworkspacesdatasources, ProviderNameMicrosoftOperationalInsightsworkspacessharedKeys} +} + +// RegistryHive enumerates the values for registry hive. +type RegistryHive string + +const ( + // RegistryHiveHKEYA HKEY_A + RegistryHiveHKEYA RegistryHive = "HKEY_A" + // RegistryHiveHKEYCLASSESROOT HKEY_CLASSES_ROOT + RegistryHiveHKEYCLASSESROOT RegistryHive = "HKEY_CLASSES_ROOT" + // RegistryHiveHKEYCURRENTCONFIG HKEY_CURRENT_CONFIG + RegistryHiveHKEYCURRENTCONFIG RegistryHive = "HKEY_CURRENT_CONFIG" + // RegistryHiveHKEYCURRENTUSER HKEY_CURRENT_USER + RegistryHiveHKEYCURRENTUSER RegistryHive = "HKEY_CURRENT_USER" + // RegistryHiveHKEYCURRENTUSERLOCALSETTINGS HKEY_CURRENT_USER_LOCAL_SETTINGS + RegistryHiveHKEYCURRENTUSERLOCALSETTINGS RegistryHive = "HKEY_CURRENT_USER_LOCAL_SETTINGS" + // RegistryHiveHKEYLOCALMACHINE HKEY_LOCAL_MACHINE + RegistryHiveHKEYLOCALMACHINE RegistryHive = "HKEY_LOCAL_MACHINE" + // RegistryHiveHKEYPERFORMANCEDATA HKEY_PERFORMANCE_DATA + RegistryHiveHKEYPERFORMANCEDATA RegistryHive = "HKEY_PERFORMANCE_DATA" + // RegistryHiveHKEYPERFORMANCENLSTEXT HKEY_PERFORMANCE_NLSTEXT + RegistryHiveHKEYPERFORMANCENLSTEXT RegistryHive = "HKEY_PERFORMANCE_NLSTEXT" + // RegistryHiveHKEYPERFORMANCETEXT HKEY_PERFORMANCE_TEXT + RegistryHiveHKEYPERFORMANCETEXT RegistryHive = "HKEY_PERFORMANCE_TEXT" + // RegistryHiveHKEYUSERS HKEY_USERS + RegistryHiveHKEYUSERS RegistryHive = "HKEY_USERS" +) + +// PossibleRegistryHiveValues returns an array of possible values for the RegistryHive const type. +func PossibleRegistryHiveValues() []RegistryHive { + return []RegistryHive{RegistryHiveHKEYA, RegistryHiveHKEYCLASSESROOT, RegistryHiveHKEYCURRENTCONFIG, RegistryHiveHKEYCURRENTUSER, RegistryHiveHKEYCURRENTUSERLOCALSETTINGS, RegistryHiveHKEYLOCALMACHINE, RegistryHiveHKEYPERFORMANCEDATA, RegistryHiveHKEYPERFORMANCENLSTEXT, RegistryHiveHKEYPERFORMANCETEXT, RegistryHiveHKEYUSERS} +} + +// RegistryValueKind enumerates the values for registry value kind. +type RegistryValueKind string + +const ( + // RegistryValueKindBinary Binary value type + RegistryValueKindBinary RegistryValueKind = "Binary" + // RegistryValueKindDWord DWord value type + RegistryValueKindDWord RegistryValueKind = "DWord" + // RegistryValueKindExpandString ExpandString value type + RegistryValueKindExpandString RegistryValueKind = "ExpandString" + // RegistryValueKindMultiString MultiString value type + RegistryValueKindMultiString RegistryValueKind = "MultiString" + // RegistryValueKindNone None + RegistryValueKindNone RegistryValueKind = "None" + // RegistryValueKindQWord QWord value type + RegistryValueKindQWord RegistryValueKind = "QWord" + // RegistryValueKindString String value type + RegistryValueKindString RegistryValueKind = "String" + // RegistryValueKindUnknown Unknown value type + RegistryValueKindUnknown RegistryValueKind = "Unknown" +) + +// PossibleRegistryValueKindValues returns an array of possible values for the RegistryValueKind const type. +func PossibleRegistryValueKindValues() []RegistryValueKind { + return []RegistryValueKind{RegistryValueKindBinary, RegistryValueKindDWord, RegistryValueKindExpandString, RegistryValueKindMultiString, RegistryValueKindNone, RegistryValueKindQWord, RegistryValueKindString, RegistryValueKindUnknown} +} + +// RepoType enumerates the values for repo type. +type RepoType string + +const ( + // RepoTypeDevOps ... + RepoTypeDevOps RepoType = "DevOps" + // RepoTypeGithub ... + RepoTypeGithub RepoType = "Github" +) + +// PossibleRepoTypeValues returns an array of possible values for the RepoType const type. +func PossibleRepoTypeValues() []RepoType { + return []RepoType{RepoTypeDevOps, RepoTypeGithub} +} + +// SettingType enumerates the values for setting type. +type SettingType string + +const ( + // SettingTypeCopyableLabel ... + SettingTypeCopyableLabel SettingType = "CopyableLabel" + // SettingTypeInfoMessage ... + SettingTypeInfoMessage SettingType = "InfoMessage" + // SettingTypeInstructionStepsGroup ... + SettingTypeInstructionStepsGroup SettingType = "InstructionStepsGroup" +) + +// PossibleSettingTypeValues returns an array of possible values for the SettingType const type. +func PossibleSettingTypeValues() []SettingType { + return []SettingType{SettingTypeCopyableLabel, SettingTypeInfoMessage, SettingTypeInstructionStepsGroup} +} + +// SkuKind enumerates the values for sku kind. +type SkuKind string + +const ( + // SkuKindCapacityReservation ... + SkuKindCapacityReservation SkuKind = "CapacityReservation" + // SkuKindPerGB ... + SkuKindPerGB SkuKind = "PerGB" +) + +// PossibleSkuKindValues returns an array of possible values for the SkuKind const type. +func PossibleSkuKindValues() []SkuKind { + return []SkuKind{SkuKindCapacityReservation, SkuKindPerGB} +} + +// SourceKind enumerates the values for source kind. +type SourceKind string + +const ( + // SourceKindCommunity ... + SourceKindCommunity SourceKind = "Community" + // SourceKindLocalWorkspace ... + SourceKindLocalWorkspace SourceKind = "LocalWorkspace" + // SourceKindSolution ... + SourceKindSolution SourceKind = "Solution" + // SourceKindSourceRepository ... + SourceKindSourceRepository SourceKind = "SourceRepository" +) + +// PossibleSourceKindValues returns an array of possible values for the SourceKind const type. +func PossibleSourceKindValues() []SourceKind { + return []SourceKind{SourceKindCommunity, SourceKindLocalWorkspace, SourceKindSolution, SourceKindSourceRepository} +} + +// SourceType enumerates the values for source type. +type SourceType string + +const ( + // SourceTypeLocalfile ... + SourceTypeLocalfile SourceType = "Local file" + // SourceTypeRemotestorage ... + SourceTypeRemotestorage SourceType = "Remote storage" +) + +// PossibleSourceTypeValues returns an array of possible values for the SourceType const type. +func PossibleSourceTypeValues() []SourceType { + return []SourceType{SourceTypeLocalfile, SourceTypeRemotestorage} +} + +// SupportTier enumerates the values for support tier. +type SupportTier string + +const ( + // SupportTierCommunity ... + SupportTierCommunity SupportTier = "Community" + // SupportTierMicrosoft ... + SupportTierMicrosoft SupportTier = "Microsoft" + // SupportTierPartner ... + SupportTierPartner SupportTier = "Partner" +) + +// PossibleSupportTierValues returns an array of possible values for the SupportTier const type. +func PossibleSupportTierValues() []SupportTier { + return []SupportTier{SupportTierCommunity, SupportTierMicrosoft, SupportTierPartner} +} + +// TemplateStatus enumerates the values for template status. +type TemplateStatus string + +const ( + // TemplateStatusAvailable Alert rule template is available. + TemplateStatusAvailable TemplateStatus = "Available" + // TemplateStatusInstalled Alert rule template installed. and can not use more then once + TemplateStatusInstalled TemplateStatus = "Installed" + // TemplateStatusNotAvailable Alert rule template is not available + TemplateStatusNotAvailable TemplateStatus = "NotAvailable" +) + +// PossibleTemplateStatusValues returns an array of possible values for the TemplateStatus const type. +func PossibleTemplateStatusValues() []TemplateStatus { + return []TemplateStatus{TemplateStatusAvailable, TemplateStatusInstalled, TemplateStatusNotAvailable} +} + +// ThreatIntelligenceResourceKindEnum enumerates the values for threat intelligence resource kind enum. +type ThreatIntelligenceResourceKindEnum string + +const ( + // ThreatIntelligenceResourceKindEnumIndicator Entity represents threat intelligence indicator in the + // system. + ThreatIntelligenceResourceKindEnumIndicator ThreatIntelligenceResourceKindEnum = "indicator" +) + +// PossibleThreatIntelligenceResourceKindEnumValues returns an array of possible values for the ThreatIntelligenceResourceKindEnum const type. +func PossibleThreatIntelligenceResourceKindEnumValues() []ThreatIntelligenceResourceKindEnum { + return []ThreatIntelligenceResourceKindEnum{ThreatIntelligenceResourceKindEnumIndicator} +} + +// ThreatIntelligenceSortingCriteriaEnum enumerates the values for threat intelligence sorting criteria enum. +type ThreatIntelligenceSortingCriteriaEnum string + +const ( + // ThreatIntelligenceSortingCriteriaEnumAscending ... + ThreatIntelligenceSortingCriteriaEnumAscending ThreatIntelligenceSortingCriteriaEnum = "ascending" + // ThreatIntelligenceSortingCriteriaEnumDescending ... + ThreatIntelligenceSortingCriteriaEnumDescending ThreatIntelligenceSortingCriteriaEnum = "descending" + // ThreatIntelligenceSortingCriteriaEnumUnsorted ... + ThreatIntelligenceSortingCriteriaEnumUnsorted ThreatIntelligenceSortingCriteriaEnum = "unsorted" +) + +// PossibleThreatIntelligenceSortingCriteriaEnumValues returns an array of possible values for the ThreatIntelligenceSortingCriteriaEnum const type. +func PossibleThreatIntelligenceSortingCriteriaEnumValues() []ThreatIntelligenceSortingCriteriaEnum { + return []ThreatIntelligenceSortingCriteriaEnum{ThreatIntelligenceSortingCriteriaEnumAscending, ThreatIntelligenceSortingCriteriaEnumDescending, ThreatIntelligenceSortingCriteriaEnumUnsorted} +} + +// TriggerOperator enumerates the values for trigger operator. +type TriggerOperator string + +const ( + // TriggerOperatorEqual ... + TriggerOperatorEqual TriggerOperator = "Equal" + // TriggerOperatorGreaterThan ... + TriggerOperatorGreaterThan TriggerOperator = "GreaterThan" + // TriggerOperatorLessThan ... + TriggerOperatorLessThan TriggerOperator = "LessThan" + // TriggerOperatorNotEqual ... + TriggerOperatorNotEqual TriggerOperator = "NotEqual" +) + +// PossibleTriggerOperatorValues returns an array of possible values for the TriggerOperator const type. +func PossibleTriggerOperatorValues() []TriggerOperator { + return []TriggerOperator{TriggerOperatorEqual, TriggerOperatorGreaterThan, TriggerOperatorLessThan, TriggerOperatorNotEqual} +} + +// TriggersOn enumerates the values for triggers on. +type TriggersOn string + +const ( + // TriggersOnIncidents Trigger on Incidents + TriggersOnIncidents TriggersOn = "Incidents" +) + +// PossibleTriggersOnValues returns an array of possible values for the TriggersOn const type. +func PossibleTriggersOnValues() []TriggersOn { + return []TriggersOn{TriggersOnIncidents} +} + +// TriggersWhen enumerates the values for triggers when. +type TriggersWhen string + +const ( + // TriggersWhenCreated Trigger on created objects + TriggersWhenCreated TriggersWhen = "Created" +) + +// PossibleTriggersWhenValues returns an array of possible values for the TriggersWhen const type. +func PossibleTriggersWhenValues() []TriggersWhen { + return []TriggersWhen{TriggersWhenCreated} +} + +// UebaDataSources enumerates the values for ueba data sources. +type UebaDataSources string + +const ( + // UebaDataSourcesAuditLogs ... + UebaDataSourcesAuditLogs UebaDataSources = "AuditLogs" + // UebaDataSourcesAzureActivity ... + UebaDataSourcesAzureActivity UebaDataSources = "AzureActivity" + // UebaDataSourcesSecurityEvent ... + UebaDataSourcesSecurityEvent UebaDataSources = "SecurityEvent" + // UebaDataSourcesSigninLogs ... + UebaDataSourcesSigninLogs UebaDataSources = "SigninLogs" +) + +// PossibleUebaDataSourcesValues returns an array of possible values for the UebaDataSources const type. +func PossibleUebaDataSourcesValues() []UebaDataSources { + return []UebaDataSources{UebaDataSourcesAuditLogs, UebaDataSourcesAzureActivity, UebaDataSourcesSecurityEvent, UebaDataSourcesSigninLogs} +} + +// Version enumerates the values for version. +type Version string + +const ( + // VersionV1 ... + VersionV1 Version = "V1" + // VersionV2 ... + VersionV2 Version = "V2" +) + +// PossibleVersionValues returns an array of possible values for the Version const type. +func PossibleVersionValues() []Version { + return []Version{VersionV1, VersionV2} +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/incidentcomments.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/incidentcomments.go new file mode 100644 index 000000000000..60ca228b93d0 --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/incidentcomments.go @@ -0,0 +1,464 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// IncidentCommentsClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider +type IncidentCommentsClient struct { + BaseClient +} + +// NewIncidentCommentsClient creates an instance of the IncidentCommentsClient client. +func NewIncidentCommentsClient(subscriptionID string) IncidentCommentsClient { + return NewIncidentCommentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewIncidentCommentsClientWithBaseURI creates an instance of the IncidentCommentsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewIncidentCommentsClientWithBaseURI(baseURI string, subscriptionID string) IncidentCommentsClient { + return IncidentCommentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the incident comment. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// incidentID - incident ID +// incidentCommentID - incident comment ID +// incidentComment - the incident comment +func (client IncidentCommentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, incidentCommentID string, incidentComment IncidentComment) (result IncidentComment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IncidentCommentsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: incidentComment, + Constraints: []validation.Constraint{{Target: "incidentComment.IncidentCommentProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "incidentComment.IncidentCommentProperties.Message", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("securityinsight.IncidentCommentsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, incidentID, incidentCommentID, incidentComment) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentCommentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.IncidentCommentsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentCommentsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client IncidentCommentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, incidentCommentID string, incidentComment IncidentComment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "incidentCommentId": autorest.Encode("path", incidentCommentID), + "incidentId": autorest.Encode("path", incidentID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}", pathParameters), + autorest.WithJSON(incidentComment), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client IncidentCommentsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client IncidentCommentsClient) CreateOrUpdateResponder(resp *http.Response) (result IncidentComment, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the incident comment. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// incidentID - incident ID +// incidentCommentID - incident comment ID +func (client IncidentCommentsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, incidentCommentID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IncidentCommentsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.IncidentCommentsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, incidentID, incidentCommentID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentCommentsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "securityinsight.IncidentCommentsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentCommentsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client IncidentCommentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, incidentCommentID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "incidentCommentId": autorest.Encode("path", incidentCommentID), + "incidentId": autorest.Encode("path", incidentID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client IncidentCommentsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client IncidentCommentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an incident comment. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// incidentID - incident ID +// incidentCommentID - incident comment ID +func (client IncidentCommentsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, incidentCommentID string) (result IncidentComment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IncidentCommentsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.IncidentCommentsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, incidentID, incidentCommentID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentCommentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.IncidentCommentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentCommentsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client IncidentCommentsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, incidentCommentID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "incidentCommentId": autorest.Encode("path", incidentCommentID), + "incidentId": autorest.Encode("path", incidentID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client IncidentCommentsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client IncidentCommentsClient) GetResponder(resp *http.Response) (result IncidentComment, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all incident comments. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// incidentID - incident ID +// filter - filters the results, based on a Boolean condition. Optional. +// orderby - sorts the results. Optional. +// top - returns only the first n results. Optional. +// skipToken - skiptoken is only used if a previous operation returned a partial result. If a previous response +// contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that +// specifies a starting point to use for subsequent calls. Optional. +func (client IncidentCommentsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, filter string, orderby string, top *int32, skipToken string) (result IncidentCommentListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IncidentCommentsClient.List") + defer func() { + sc := -1 + if result.icl.Response.Response != nil { + sc = result.icl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.IncidentCommentsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, incidentID, filter, orderby, top, skipToken) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentCommentsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.icl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.IncidentCommentsClient", "List", resp, "Failure sending request") + return + } + + result.icl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentCommentsClient", "List", resp, "Failure responding to request") + return + } + if result.icl.hasNextLink() && result.icl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client IncidentCommentsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, filter string, orderby string, top *int32, skipToken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "incidentId": autorest.Encode("path", incidentID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(skipToken) > 0 { + queryParameters["$skipToken"] = autorest.Encode("query", skipToken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client IncidentCommentsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client IncidentCommentsClient) ListResponder(resp *http.Response) (result IncidentCommentList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client IncidentCommentsClient) listNextResults(ctx context.Context, lastResults IncidentCommentList) (result IncidentCommentList, err error) { + req, err := lastResults.incidentCommentListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "securityinsight.IncidentCommentsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "securityinsight.IncidentCommentsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentCommentsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client IncidentCommentsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, filter string, orderby string, top *int32, skipToken string) (result IncidentCommentListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IncidentCommentsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName, incidentID, filter, orderby, top, skipToken) + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/incidentrelations.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/incidentrelations.go new file mode 100644 index 000000000000..f3f6a42956bf --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/incidentrelations.go @@ -0,0 +1,464 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// IncidentRelationsClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider +type IncidentRelationsClient struct { + BaseClient +} + +// NewIncidentRelationsClient creates an instance of the IncidentRelationsClient client. +func NewIncidentRelationsClient(subscriptionID string) IncidentRelationsClient { + return NewIncidentRelationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewIncidentRelationsClientWithBaseURI creates an instance of the IncidentRelationsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewIncidentRelationsClientWithBaseURI(baseURI string, subscriptionID string) IncidentRelationsClient { + return IncidentRelationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the incident relation. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// incidentID - incident ID +// relationName - relation Name +// relation - the relation model +func (client IncidentRelationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, relationName string, relation Relation) (result Relation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IncidentRelationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: relation, + Constraints: []validation.Constraint{{Target: "relation.RelationProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "relation.RelationProperties.RelatedResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("securityinsight.IncidentRelationsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, incidentID, relationName, relation) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentRelationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.IncidentRelationsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentRelationsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client IncidentRelationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, relationName string, relation Relation) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "incidentId": autorest.Encode("path", incidentID), + "relationName": autorest.Encode("path", relationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations/{relationName}", pathParameters), + autorest.WithJSON(relation), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client IncidentRelationsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client IncidentRelationsClient) CreateOrUpdateResponder(resp *http.Response) (result Relation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the incident relation. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// incidentID - incident ID +// relationName - relation Name +func (client IncidentRelationsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, relationName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IncidentRelationsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.IncidentRelationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, incidentID, relationName) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentRelationsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "securityinsight.IncidentRelationsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentRelationsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client IncidentRelationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, relationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "incidentId": autorest.Encode("path", incidentID), + "relationName": autorest.Encode("path", relationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations/{relationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client IncidentRelationsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client IncidentRelationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an incident relation. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// incidentID - incident ID +// relationName - relation Name +func (client IncidentRelationsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, relationName string) (result Relation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IncidentRelationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.IncidentRelationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, incidentID, relationName) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentRelationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.IncidentRelationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentRelationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client IncidentRelationsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, relationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "incidentId": autorest.Encode("path", incidentID), + "relationName": autorest.Encode("path", relationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations/{relationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client IncidentRelationsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client IncidentRelationsClient) GetResponder(resp *http.Response) (result Relation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all incident relations. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// incidentID - incident ID +// filter - filters the results, based on a Boolean condition. Optional. +// orderby - sorts the results. Optional. +// top - returns only the first n results. Optional. +// skipToken - skiptoken is only used if a previous operation returned a partial result. If a previous response +// contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that +// specifies a starting point to use for subsequent calls. Optional. +func (client IncidentRelationsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, filter string, orderby string, top *int32, skipToken string) (result RelationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IncidentRelationsClient.List") + defer func() { + sc := -1 + if result.rl.Response.Response != nil { + sc = result.rl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.IncidentRelationsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, incidentID, filter, orderby, top, skipToken) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentRelationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.IncidentRelationsClient", "List", resp, "Failure sending request") + return + } + + result.rl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentRelationsClient", "List", resp, "Failure responding to request") + return + } + if result.rl.hasNextLink() && result.rl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client IncidentRelationsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, filter string, orderby string, top *int32, skipToken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "incidentId": autorest.Encode("path", incidentID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(skipToken) > 0 { + queryParameters["$skipToken"] = autorest.Encode("query", skipToken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client IncidentRelationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client IncidentRelationsClient) ListResponder(resp *http.Response) (result RelationList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client IncidentRelationsClient) listNextResults(ctx context.Context, lastResults RelationList) (result RelationList, err error) { + req, err := lastResults.relationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "securityinsight.IncidentRelationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "securityinsight.IncidentRelationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentRelationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client IncidentRelationsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, filter string, orderby string, top *int32, skipToken string) (result RelationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IncidentRelationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName, incidentID, filter, orderby, top, skipToken) + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/incidents.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/incidents.go new file mode 100644 index 000000000000..fef17ae53f93 --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/incidents.go @@ -0,0 +1,915 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// IncidentsClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider +type IncidentsClient struct { + BaseClient +} + +// NewIncidentsClient creates an instance of the IncidentsClient client. +func NewIncidentsClient(subscriptionID string) IncidentsClient { + return NewIncidentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewIncidentsClientWithBaseURI creates an instance of the IncidentsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewIncidentsClientWithBaseURI(baseURI string, subscriptionID string) IncidentsClient { + return IncidentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the incident. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// incidentID - incident ID +// incident - the incident +func (client IncidentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, incident Incident) (result Incident, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IncidentsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: incident, + Constraints: []validation.Constraint{{Target: "incident.IncidentProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "incident.IncidentProperties.Title", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("securityinsight.IncidentsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, incidentID, incident) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.IncidentsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client IncidentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, incident Incident) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "incidentId": autorest.Encode("path", incidentID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}", pathParameters), + autorest.WithJSON(incident), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client IncidentsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client IncidentsClient) CreateOrUpdateResponder(resp *http.Response) (result Incident, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateTeam creates a Microsoft team to investigate the incident by sharing information and insights between +// participants. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// incidentID - incident ID +// teamProperties - team properties +func (client IncidentsClient) CreateTeam(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, teamProperties TeamProperties) (result TeamInformation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IncidentsClient.CreateTeam") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: teamProperties, + Constraints: []validation.Constraint{{Target: "teamProperties.TeamName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.IncidentsClient", "CreateTeam", err.Error()) + } + + req, err := client.CreateTeamPreparer(ctx, resourceGroupName, workspaceName, incidentID, teamProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentsClient", "CreateTeam", nil, "Failure preparing request") + return + } + + resp, err := client.CreateTeamSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.IncidentsClient", "CreateTeam", resp, "Failure sending request") + return + } + + result, err = client.CreateTeamResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentsClient", "CreateTeam", resp, "Failure responding to request") + return + } + + return +} + +// CreateTeamPreparer prepares the CreateTeam request. +func (client IncidentsClient) CreateTeamPreparer(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, teamProperties TeamProperties) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "incidentId": autorest.Encode("path", incidentID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/createTeam", pathParameters), + autorest.WithJSON(teamProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateTeamSender sends the CreateTeam request. The method will close the +// http.Response Body if it receives an error. +func (client IncidentsClient) CreateTeamSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateTeamResponder handles the response to the CreateTeam request. The method always +// closes the http.Response Body. +func (client IncidentsClient) CreateTeamResponder(resp *http.Response) (result TeamInformation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the incident. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// incidentID - incident ID +func (client IncidentsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IncidentsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.IncidentsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, incidentID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "securityinsight.IncidentsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client IncidentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "incidentId": autorest.Encode("path", incidentID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client IncidentsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client IncidentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an incident. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// incidentID - incident ID +func (client IncidentsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string) (result Incident, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IncidentsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.IncidentsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, incidentID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.IncidentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client IncidentsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "incidentId": autorest.Encode("path", incidentID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client IncidentsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client IncidentsClient) GetResponder(resp *http.Response) (result Incident, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all incidents. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// filter - filters the results, based on a Boolean condition. Optional. +// orderby - sorts the results. Optional. +// top - returns only the first n results. Optional. +// skipToken - skiptoken is only used if a previous operation returned a partial result. If a previous response +// contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that +// specifies a starting point to use for subsequent calls. Optional. +func (client IncidentsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, filter string, orderby string, top *int32, skipToken string) (result IncidentListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IncidentsClient.List") + defer func() { + sc := -1 + if result.il.Response.Response != nil { + sc = result.il.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.IncidentsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, filter, orderby, top, skipToken) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.il.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.IncidentsClient", "List", resp, "Failure sending request") + return + } + + result.il, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentsClient", "List", resp, "Failure responding to request") + return + } + if result.il.hasNextLink() && result.il.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client IncidentsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, filter string, orderby string, top *int32, skipToken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(skipToken) > 0 { + queryParameters["$skipToken"] = autorest.Encode("query", skipToken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client IncidentsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client IncidentsClient) ListResponder(resp *http.Response) (result IncidentList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client IncidentsClient) listNextResults(ctx context.Context, lastResults IncidentList) (result IncidentList, err error) { + req, err := lastResults.incidentListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "securityinsight.IncidentsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "securityinsight.IncidentsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client IncidentsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, filter string, orderby string, top *int32, skipToken string) (result IncidentListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IncidentsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName, filter, orderby, top, skipToken) + return +} + +// ListAlerts gets all incident alerts. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// incidentID - incident ID +func (client IncidentsClient) ListAlerts(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string) (result IncidentAlertList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IncidentsClient.ListAlerts") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.IncidentsClient", "ListAlerts", err.Error()) + } + + req, err := client.ListAlertsPreparer(ctx, resourceGroupName, workspaceName, incidentID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentsClient", "ListAlerts", nil, "Failure preparing request") + return + } + + resp, err := client.ListAlertsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.IncidentsClient", "ListAlerts", resp, "Failure sending request") + return + } + + result, err = client.ListAlertsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentsClient", "ListAlerts", resp, "Failure responding to request") + return + } + + return +} + +// ListAlertsPreparer prepares the ListAlerts request. +func (client IncidentsClient) ListAlertsPreparer(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "incidentId": autorest.Encode("path", incidentID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/alerts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAlertsSender sends the ListAlerts request. The method will close the +// http.Response Body if it receives an error. +func (client IncidentsClient) ListAlertsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAlertsResponder handles the response to the ListAlerts request. The method always +// closes the http.Response Body. +func (client IncidentsClient) ListAlertsResponder(resp *http.Response) (result IncidentAlertList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBookmarks gets all incident bookmarks. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// incidentID - incident ID +func (client IncidentsClient) ListBookmarks(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string) (result IncidentBookmarkList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IncidentsClient.ListBookmarks") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.IncidentsClient", "ListBookmarks", err.Error()) + } + + req, err := client.ListBookmarksPreparer(ctx, resourceGroupName, workspaceName, incidentID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentsClient", "ListBookmarks", nil, "Failure preparing request") + return + } + + resp, err := client.ListBookmarksSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.IncidentsClient", "ListBookmarks", resp, "Failure sending request") + return + } + + result, err = client.ListBookmarksResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentsClient", "ListBookmarks", resp, "Failure responding to request") + return + } + + return +} + +// ListBookmarksPreparer prepares the ListBookmarks request. +func (client IncidentsClient) ListBookmarksPreparer(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "incidentId": autorest.Encode("path", incidentID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/bookmarks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBookmarksSender sends the ListBookmarks request. The method will close the +// http.Response Body if it receives an error. +func (client IncidentsClient) ListBookmarksSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBookmarksResponder handles the response to the ListBookmarks request. The method always +// closes the http.Response Body. +func (client IncidentsClient) ListBookmarksResponder(resp *http.Response) (result IncidentBookmarkList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListEntities gets all incident related entities. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// incidentID - incident ID +func (client IncidentsClient) ListEntities(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string) (result IncidentEntitiesResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IncidentsClient.ListEntities") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.IncidentsClient", "ListEntities", err.Error()) + } + + req, err := client.ListEntitiesPreparer(ctx, resourceGroupName, workspaceName, incidentID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentsClient", "ListEntities", nil, "Failure preparing request") + return + } + + resp, err := client.ListEntitiesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.IncidentsClient", "ListEntities", resp, "Failure sending request") + return + } + + result, err = client.ListEntitiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentsClient", "ListEntities", resp, "Failure responding to request") + return + } + + return +} + +// ListEntitiesPreparer prepares the ListEntities request. +func (client IncidentsClient) ListEntitiesPreparer(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "incidentId": autorest.Encode("path", incidentID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/entities", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListEntitiesSender sends the ListEntities request. The method will close the +// http.Response Body if it receives an error. +func (client IncidentsClient) ListEntitiesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListEntitiesResponder handles the response to the ListEntities request. The method always +// closes the http.Response Body. +func (client IncidentsClient) ListEntitiesResponder(resp *http.Response) (result IncidentEntitiesResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RunPlaybook triggers playbook on a specific incident +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +func (client IncidentsClient) RunPlaybook(ctx context.Context, resourceGroupName string, workspaceName string, incidentIdentifier string, requestBody *ManualTriggerRequestBody) (result SetObject, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IncidentsClient.RunPlaybook") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.IncidentsClient", "RunPlaybook", err.Error()) + } + + req, err := client.RunPlaybookPreparer(ctx, resourceGroupName, workspaceName, incidentIdentifier, requestBody) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentsClient", "RunPlaybook", nil, "Failure preparing request") + return + } + + resp, err := client.RunPlaybookSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.IncidentsClient", "RunPlaybook", resp, "Failure sending request") + return + } + + result, err = client.RunPlaybookResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IncidentsClient", "RunPlaybook", resp, "Failure responding to request") + return + } + + return +} + +// RunPlaybookPreparer prepares the RunPlaybook request. +func (client IncidentsClient) RunPlaybookPreparer(ctx context.Context, resourceGroupName string, workspaceName string, incidentIdentifier string, requestBody *ManualTriggerRequestBody) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "incidentIdentifier": autorest.Encode("path", incidentIdentifier), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentIdentifier}/runPlaybook", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if requestBody != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(requestBody)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RunPlaybookSender sends the RunPlaybook request. The method will close the +// http.Response Body if it receives an error. +func (client IncidentsClient) RunPlaybookSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RunPlaybookResponder handles the response to the RunPlaybook request. The method always +// closes the http.Response Body. +func (client IncidentsClient) RunPlaybookResponder(resp *http.Response) (result SetObject, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/ipgeodata.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/ipgeodata.go new file mode 100644 index 000000000000..aab1ef8f0fde --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/ipgeodata.go @@ -0,0 +1,117 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// IPGeodataClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider +type IPGeodataClient struct { + BaseClient +} + +// NewIPGeodataClient creates an instance of the IPGeodataClient client. +func NewIPGeodataClient(subscriptionID string) IPGeodataClient { + return NewIPGeodataClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewIPGeodataClientWithBaseURI creates an instance of the IPGeodataClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewIPGeodataClientWithBaseURI(baseURI string, subscriptionID string) IPGeodataClient { + return IPGeodataClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get geodata for a single IP address +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// IPAddress - IP address (v4 or v6) to be enriched +func (client IPGeodataClient) Get(ctx context.Context, resourceGroupName string, IPAddress string) (result EnrichmentIPGeodata, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPGeodataClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.IPGeodataClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, IPAddress) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IPGeodataClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.IPGeodataClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.IPGeodataClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client IPGeodataClient) GetPreparer(ctx context.Context, resourceGroupName string, IPAddress string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "ipAddress": autorest.Encode("query", IPAddress), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityInsights/enrichment/ip/geodata/", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client IPGeodataClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client IPGeodataClient) GetResponder(resp *http.Response) (result EnrichmentIPGeodata, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/metadata.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/metadata.go new file mode 100644 index 000000000000..a3e83bbe55dd --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/metadata.go @@ -0,0 +1,547 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// MetadataClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider +type MetadataClient struct { + BaseClient +} + +// NewMetadataClient creates an instance of the MetadataClient client. +func NewMetadataClient(subscriptionID string) MetadataClient { + return NewMetadataClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMetadataClientWithBaseURI creates an instance of the MetadataClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewMetadataClientWithBaseURI(baseURI string, subscriptionID string) MetadataClient { + return MetadataClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create a Metadata. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// metadataName - the Metadata name. +// metadata - metadata resource. +func (client MetadataClient) Create(ctx context.Context, resourceGroupName string, workspaceName string, metadataName string, metadata MetadataModel) (result MetadataModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MetadataClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: metadata, + Constraints: []validation.Constraint{{Target: "metadata.MetadataProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "metadata.MetadataProperties.ParentID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("securityinsight.MetadataClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, workspaceName, metadataName, metadata) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.MetadataClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.MetadataClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.MetadataClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client MetadataClient) CreatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, metadataName string, metadata MetadataModel) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "metadataName": autorest.Encode("path", metadataName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}", pathParameters), + autorest.WithJSON(metadata), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client MetadataClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client MetadataClient) CreateResponder(resp *http.Response) (result MetadataModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a Metadata. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// metadataName - the Metadata name. +func (client MetadataClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, metadataName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MetadataClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.MetadataClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, metadataName) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.MetadataClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "securityinsight.MetadataClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.MetadataClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client MetadataClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, metadataName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "metadataName": autorest.Encode("path", metadataName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client MetadataClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client MetadataClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a Metadata. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// metadataName - the Metadata name. +func (client MetadataClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, metadataName string) (result MetadataModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MetadataClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.MetadataClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, metadataName) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.MetadataClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.MetadataClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.MetadataClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client MetadataClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, metadataName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "metadataName": autorest.Encode("path", metadataName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client MetadataClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client MetadataClient) GetResponder(resp *http.Response) (result MetadataModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list of all metadata +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// filter - filters the results, based on a Boolean condition. Optional. +// orderby - sorts the results. Optional. +// top - returns only the first n results. Optional. +// skip - used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results +// if there are any left. +func (client MetadataClient) List(ctx context.Context, resourceGroupName string, workspaceName string, filter string, orderby string, top *int32, skip *int32) (result MetadataListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MetadataClient.List") + defer func() { + sc := -1 + if result.ml.Response.Response != nil { + sc = result.ml.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.MetadataClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, filter, orderby, top, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.MetadataClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ml.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.MetadataClient", "List", resp, "Failure sending request") + return + } + + result.ml, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.MetadataClient", "List", resp, "Failure responding to request") + return + } + if result.ml.hasNextLink() && result.ml.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client MetadataClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, filter string, orderby string, top *int32, skip *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client MetadataClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client MetadataClient) ListResponder(resp *http.Response) (result MetadataList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client MetadataClient) listNextResults(ctx context.Context, lastResults MetadataList) (result MetadataList, err error) { + req, err := lastResults.metadataListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "securityinsight.MetadataClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "securityinsight.MetadataClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.MetadataClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client MetadataClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, filter string, orderby string, top *int32, skip *int32) (result MetadataListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MetadataClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName, filter, orderby, top, skip) + return +} + +// Update update an existing Metadata. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// metadataName - the Metadata name. +// metadataPatch - partial metadata request. +func (client MetadataClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, metadataName string, metadataPatch MetadataPatch) (result MetadataModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MetadataClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.MetadataClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, workspaceName, metadataName, metadataPatch) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.MetadataClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.MetadataClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.MetadataClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client MetadataClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, metadataName string, metadataPatch MetadataPatch) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "metadataName": autorest.Encode("path", metadataName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}", pathParameters), + autorest.WithJSON(metadataPatch), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client MetadataClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client MetadataClient) UpdateResponder(resp *http.Response) (result MetadataModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/models.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/models.go new file mode 100644 index 000000000000..2606365be21b --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/models.go @@ -0,0 +1,26673 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "github.com/gofrs/uuid" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight" + +// AADCheckRequirements represents AAD (Azure Active Directory) requirements check request. +type AADCheckRequirements struct { + // AADCheckRequirementsProperties - AAD (Azure Active Directory) requirements check properties. + *AADCheckRequirementsProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorsCheckRequirementsKindDataConnectorsCheckRequirements', 'KindBasicDataConnectorsCheckRequirementsKindAzureActiveDirectory', 'KindBasicDataConnectorsCheckRequirementsKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindAzureSecurityCenter', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesS3', 'KindBasicDataConnectorsCheckRequirementsKindDynamics365', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindOfficeATP', 'KindBasicDataConnectorsCheckRequirementsKindOfficeIRM', 'KindBasicDataConnectorsCheckRequirementsKindOffice365Project', 'KindBasicDataConnectorsCheckRequirementsKindOfficePowerBI', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligenceTaxii', 'KindBasicDataConnectorsCheckRequirementsKindIOT' + Kind KindBasicDataConnectorsCheckRequirements `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for AADCheckRequirements. +func (acr AADCheckRequirements) MarshalJSON() ([]byte, error) { + acr.Kind = KindBasicDataConnectorsCheckRequirementsKindAzureActiveDirectory + objectMap := make(map[string]interface{}) + if acr.AADCheckRequirementsProperties != nil { + objectMap["properties"] = acr.AADCheckRequirementsProperties + } + if acr.Kind != "" { + objectMap["kind"] = acr.Kind + } + return json.Marshal(objectMap) +} + +// AsAADCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AADCheckRequirements. +func (acr AADCheckRequirements) AsAADCheckRequirements() (*AADCheckRequirements, bool) { + return &acr, true +} + +// AsAATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AADCheckRequirements. +func (acr AADCheckRequirements) AsAATPCheckRequirements() (*AATPCheckRequirements, bool) { + return nil, false +} + +// AsASCCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AADCheckRequirements. +func (acr AADCheckRequirements) AsASCCheckRequirements() (*ASCCheckRequirements, bool) { + return nil, false +} + +// AsAwsCloudTrailCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AADCheckRequirements. +func (acr AADCheckRequirements) AsAwsCloudTrailCheckRequirements() (*AwsCloudTrailCheckRequirements, bool) { + return nil, false +} + +// AsAwsS3CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AADCheckRequirements. +func (acr AADCheckRequirements) AsAwsS3CheckRequirements() (*AwsS3CheckRequirements, bool) { + return nil, false +} + +// AsDynamics365CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AADCheckRequirements. +func (acr AADCheckRequirements) AsDynamics365CheckRequirements() (*Dynamics365CheckRequirements, bool) { + return nil, false +} + +// AsMCASCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AADCheckRequirements. +func (acr AADCheckRequirements) AsMCASCheckRequirements() (*MCASCheckRequirements, bool) { + return nil, false +} + +// AsMDATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AADCheckRequirements. +func (acr AADCheckRequirements) AsMDATPCheckRequirements() (*MDATPCheckRequirements, bool) { + return nil, false +} + +// AsMSTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AADCheckRequirements. +func (acr AADCheckRequirements) AsMSTICheckRequirements() (*MSTICheckRequirements, bool) { + return nil, false +} + +// AsMtpCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AADCheckRequirements. +func (acr AADCheckRequirements) AsMtpCheckRequirements() (*MtpCheckRequirements, bool) { + return nil, false +} + +// AsOfficeATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AADCheckRequirements. +func (acr AADCheckRequirements) AsOfficeATPCheckRequirements() (*OfficeATPCheckRequirements, bool) { + return nil, false +} + +// AsOfficeIRMCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AADCheckRequirements. +func (acr AADCheckRequirements) AsOfficeIRMCheckRequirements() (*OfficeIRMCheckRequirements, bool) { + return nil, false +} + +// AsOffice365ProjectCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AADCheckRequirements. +func (acr AADCheckRequirements) AsOffice365ProjectCheckRequirements() (*Office365ProjectCheckRequirements, bool) { + return nil, false +} + +// AsOfficePowerBICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AADCheckRequirements. +func (acr AADCheckRequirements) AsOfficePowerBICheckRequirements() (*OfficePowerBICheckRequirements, bool) { + return nil, false +} + +// AsTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AADCheckRequirements. +func (acr AADCheckRequirements) AsTICheckRequirements() (*TICheckRequirements, bool) { + return nil, false +} + +// AsTiTaxiiCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AADCheckRequirements. +func (acr AADCheckRequirements) AsTiTaxiiCheckRequirements() (*TiTaxiiCheckRequirements, bool) { + return nil, false +} + +// AsIoTCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AADCheckRequirements. +func (acr AADCheckRequirements) AsIoTCheckRequirements() (*IoTCheckRequirements, bool) { + return nil, false +} + +// AsDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AADCheckRequirements. +func (acr AADCheckRequirements) AsDataConnectorsCheckRequirements() (*DataConnectorsCheckRequirements, bool) { + return nil, false +} + +// AsBasicDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AADCheckRequirements. +func (acr AADCheckRequirements) AsBasicDataConnectorsCheckRequirements() (BasicDataConnectorsCheckRequirements, bool) { + return &acr, true +} + +// UnmarshalJSON is the custom unmarshaler for AADCheckRequirements struct. +func (acr *AADCheckRequirements) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var aADCheckRequirementsProperties AADCheckRequirementsProperties + err = json.Unmarshal(*v, &aADCheckRequirementsProperties) + if err != nil { + return err + } + acr.AADCheckRequirementsProperties = &aADCheckRequirementsProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnectorsCheckRequirements + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + acr.Kind = kind + } + } + } + + return nil +} + +// AADCheckRequirementsProperties AAD (Azure Active Directory) requirements check properties. +type AADCheckRequirementsProperties struct { + // TenantID - The tenant id to connect to, and get the data from. + TenantID *string `json:"tenantId,omitempty"` +} + +// AADDataConnector represents AAD (Azure Active Directory) data connector. +type AADDataConnector struct { + // AADDataConnectorProperties - AAD (Azure Active Directory) data connector properties. + *AADDataConnectorProperties `json:"properties,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorKindDataConnector', 'KindBasicDataConnectorKindAzureActiveDirectory', 'KindBasicDataConnectorKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorKindMicrosoftThreatProtection', 'KindBasicDataConnectorKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorKindAzureSecurityCenter', 'KindBasicDataConnectorKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorKindAmazonWebServicesS3', 'KindBasicDataConnectorKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorKindDynamics365', 'KindBasicDataConnectorKindOfficeATP', 'KindBasicDataConnectorKindOffice365Project', 'KindBasicDataConnectorKindOfficePowerBI', 'KindBasicDataConnectorKindOfficeIRM', 'KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorKindOffice365', 'KindBasicDataConnectorKindThreatIntelligence', 'KindBasicDataConnectorKindThreatIntelligenceTaxii', 'KindBasicDataConnectorKindIOT', 'KindBasicDataConnectorKindGenericUI', 'KindBasicDataConnectorKindAPIPolling' + Kind KindBasicDataConnector `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for AADDataConnector. +func (adc AADDataConnector) MarshalJSON() ([]byte, error) { + adc.Kind = KindBasicDataConnectorKindAzureActiveDirectory + objectMap := make(map[string]interface{}) + if adc.AADDataConnectorProperties != nil { + objectMap["properties"] = adc.AADDataConnectorProperties + } + if adc.Kind != "" { + objectMap["kind"] = adc.Kind + } + if adc.Etag != nil { + objectMap["etag"] = adc.Etag + } + return json.Marshal(objectMap) +} + +// AsAADDataConnector is the BasicDataConnector implementation for AADDataConnector. +func (adc AADDataConnector) AsAADDataConnector() (*AADDataConnector, bool) { + return &adc, true +} + +// AsMSTIDataConnector is the BasicDataConnector implementation for AADDataConnector. +func (adc AADDataConnector) AsMSTIDataConnector() (*MSTIDataConnector, bool) { + return nil, false +} + +// AsMTPDataConnector is the BasicDataConnector implementation for AADDataConnector. +func (adc AADDataConnector) AsMTPDataConnector() (*MTPDataConnector, bool) { + return nil, false +} + +// AsAATPDataConnector is the BasicDataConnector implementation for AADDataConnector. +func (adc AADDataConnector) AsAATPDataConnector() (*AATPDataConnector, bool) { + return nil, false +} + +// AsASCDataConnector is the BasicDataConnector implementation for AADDataConnector. +func (adc AADDataConnector) AsASCDataConnector() (*ASCDataConnector, bool) { + return nil, false +} + +// AsAwsCloudTrailDataConnector is the BasicDataConnector implementation for AADDataConnector. +func (adc AADDataConnector) AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) { + return nil, false +} + +// AsAwsS3DataConnector is the BasicDataConnector implementation for AADDataConnector. +func (adc AADDataConnector) AsAwsS3DataConnector() (*AwsS3DataConnector, bool) { + return nil, false +} + +// AsMCASDataConnector is the BasicDataConnector implementation for AADDataConnector. +func (adc AADDataConnector) AsMCASDataConnector() (*MCASDataConnector, bool) { + return nil, false +} + +// AsDynamics365DataConnector is the BasicDataConnector implementation for AADDataConnector. +func (adc AADDataConnector) AsDynamics365DataConnector() (*Dynamics365DataConnector, bool) { + return nil, false +} + +// AsOfficeATPDataConnector is the BasicDataConnector implementation for AADDataConnector. +func (adc AADDataConnector) AsOfficeATPDataConnector() (*OfficeATPDataConnector, bool) { + return nil, false +} + +// AsOffice365ProjectDataConnector is the BasicDataConnector implementation for AADDataConnector. +func (adc AADDataConnector) AsOffice365ProjectDataConnector() (*Office365ProjectDataConnector, bool) { + return nil, false +} + +// AsOfficePowerBIDataConnector is the BasicDataConnector implementation for AADDataConnector. +func (adc AADDataConnector) AsOfficePowerBIDataConnector() (*OfficePowerBIDataConnector, bool) { + return nil, false +} + +// AsOfficeIRMDataConnector is the BasicDataConnector implementation for AADDataConnector. +func (adc AADDataConnector) AsOfficeIRMDataConnector() (*OfficeIRMDataConnector, bool) { + return nil, false +} + +// AsMDATPDataConnector is the BasicDataConnector implementation for AADDataConnector. +func (adc AADDataConnector) AsMDATPDataConnector() (*MDATPDataConnector, bool) { + return nil, false +} + +// AsOfficeDataConnector is the BasicDataConnector implementation for AADDataConnector. +func (adc AADDataConnector) AsOfficeDataConnector() (*OfficeDataConnector, bool) { + return nil, false +} + +// AsTIDataConnector is the BasicDataConnector implementation for AADDataConnector. +func (adc AADDataConnector) AsTIDataConnector() (*TIDataConnector, bool) { + return nil, false +} + +// AsTiTaxiiDataConnector is the BasicDataConnector implementation for AADDataConnector. +func (adc AADDataConnector) AsTiTaxiiDataConnector() (*TiTaxiiDataConnector, bool) { + return nil, false +} + +// AsIoTDataConnector is the BasicDataConnector implementation for AADDataConnector. +func (adc AADDataConnector) AsIoTDataConnector() (*IoTDataConnector, bool) { + return nil, false +} + +// AsCodelessUIDataConnector is the BasicDataConnector implementation for AADDataConnector. +func (adc AADDataConnector) AsCodelessUIDataConnector() (*CodelessUIDataConnector, bool) { + return nil, false +} + +// AsCodelessAPIPollingDataConnector is the BasicDataConnector implementation for AADDataConnector. +func (adc AADDataConnector) AsCodelessAPIPollingDataConnector() (*CodelessAPIPollingDataConnector, bool) { + return nil, false +} + +// AsDataConnector is the BasicDataConnector implementation for AADDataConnector. +func (adc AADDataConnector) AsDataConnector() (*DataConnector, bool) { + return nil, false +} + +// AsBasicDataConnector is the BasicDataConnector implementation for AADDataConnector. +func (adc AADDataConnector) AsBasicDataConnector() (BasicDataConnector, bool) { + return &adc, true +} + +// UnmarshalJSON is the custom unmarshaler for AADDataConnector struct. +func (adc *AADDataConnector) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var aADDataConnectorProperties AADDataConnectorProperties + err = json.Unmarshal(*v, &aADDataConnectorProperties) + if err != nil { + return err + } + adc.AADDataConnectorProperties = &aADDataConnectorProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnector + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + adc.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + adc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + adc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + adc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + adc.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + adc.SystemData = &systemData + } + } + } + + return nil +} + +// AADDataConnectorProperties AAD (Azure Active Directory) data connector properties. +type AADDataConnectorProperties struct { + // TenantID - The tenant id to connect to, and get the data from. + TenantID *string `json:"tenantId,omitempty"` + // DataTypes - The available data types for the connector. + DataTypes *AlertsDataTypeOfDataConnector `json:"dataTypes,omitempty"` +} + +// AATPCheckRequirements represents AATP (Azure Advanced Threat Protection) requirements check request. +type AATPCheckRequirements struct { + // AATPCheckRequirementsProperties - AATP (Azure Advanced Threat Protection) requirements check properties. + *AATPCheckRequirementsProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorsCheckRequirementsKindDataConnectorsCheckRequirements', 'KindBasicDataConnectorsCheckRequirementsKindAzureActiveDirectory', 'KindBasicDataConnectorsCheckRequirementsKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindAzureSecurityCenter', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesS3', 'KindBasicDataConnectorsCheckRequirementsKindDynamics365', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindOfficeATP', 'KindBasicDataConnectorsCheckRequirementsKindOfficeIRM', 'KindBasicDataConnectorsCheckRequirementsKindOffice365Project', 'KindBasicDataConnectorsCheckRequirementsKindOfficePowerBI', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligenceTaxii', 'KindBasicDataConnectorsCheckRequirementsKindIOT' + Kind KindBasicDataConnectorsCheckRequirements `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for AATPCheckRequirements. +func (acr AATPCheckRequirements) MarshalJSON() ([]byte, error) { + acr.Kind = KindBasicDataConnectorsCheckRequirementsKindAzureAdvancedThreatProtection + objectMap := make(map[string]interface{}) + if acr.AATPCheckRequirementsProperties != nil { + objectMap["properties"] = acr.AATPCheckRequirementsProperties + } + if acr.Kind != "" { + objectMap["kind"] = acr.Kind + } + return json.Marshal(objectMap) +} + +// AsAADCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AATPCheckRequirements. +func (acr AATPCheckRequirements) AsAADCheckRequirements() (*AADCheckRequirements, bool) { + return nil, false +} + +// AsAATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AATPCheckRequirements. +func (acr AATPCheckRequirements) AsAATPCheckRequirements() (*AATPCheckRequirements, bool) { + return &acr, true +} + +// AsASCCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AATPCheckRequirements. +func (acr AATPCheckRequirements) AsASCCheckRequirements() (*ASCCheckRequirements, bool) { + return nil, false +} + +// AsAwsCloudTrailCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AATPCheckRequirements. +func (acr AATPCheckRequirements) AsAwsCloudTrailCheckRequirements() (*AwsCloudTrailCheckRequirements, bool) { + return nil, false +} + +// AsAwsS3CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AATPCheckRequirements. +func (acr AATPCheckRequirements) AsAwsS3CheckRequirements() (*AwsS3CheckRequirements, bool) { + return nil, false +} + +// AsDynamics365CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AATPCheckRequirements. +func (acr AATPCheckRequirements) AsDynamics365CheckRequirements() (*Dynamics365CheckRequirements, bool) { + return nil, false +} + +// AsMCASCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AATPCheckRequirements. +func (acr AATPCheckRequirements) AsMCASCheckRequirements() (*MCASCheckRequirements, bool) { + return nil, false +} + +// AsMDATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AATPCheckRequirements. +func (acr AATPCheckRequirements) AsMDATPCheckRequirements() (*MDATPCheckRequirements, bool) { + return nil, false +} + +// AsMSTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AATPCheckRequirements. +func (acr AATPCheckRequirements) AsMSTICheckRequirements() (*MSTICheckRequirements, bool) { + return nil, false +} + +// AsMtpCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AATPCheckRequirements. +func (acr AATPCheckRequirements) AsMtpCheckRequirements() (*MtpCheckRequirements, bool) { + return nil, false +} + +// AsOfficeATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AATPCheckRequirements. +func (acr AATPCheckRequirements) AsOfficeATPCheckRequirements() (*OfficeATPCheckRequirements, bool) { + return nil, false +} + +// AsOfficeIRMCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AATPCheckRequirements. +func (acr AATPCheckRequirements) AsOfficeIRMCheckRequirements() (*OfficeIRMCheckRequirements, bool) { + return nil, false +} + +// AsOffice365ProjectCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AATPCheckRequirements. +func (acr AATPCheckRequirements) AsOffice365ProjectCheckRequirements() (*Office365ProjectCheckRequirements, bool) { + return nil, false +} + +// AsOfficePowerBICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AATPCheckRequirements. +func (acr AATPCheckRequirements) AsOfficePowerBICheckRequirements() (*OfficePowerBICheckRequirements, bool) { + return nil, false +} + +// AsTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AATPCheckRequirements. +func (acr AATPCheckRequirements) AsTICheckRequirements() (*TICheckRequirements, bool) { + return nil, false +} + +// AsTiTaxiiCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AATPCheckRequirements. +func (acr AATPCheckRequirements) AsTiTaxiiCheckRequirements() (*TiTaxiiCheckRequirements, bool) { + return nil, false +} + +// AsIoTCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AATPCheckRequirements. +func (acr AATPCheckRequirements) AsIoTCheckRequirements() (*IoTCheckRequirements, bool) { + return nil, false +} + +// AsDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AATPCheckRequirements. +func (acr AATPCheckRequirements) AsDataConnectorsCheckRequirements() (*DataConnectorsCheckRequirements, bool) { + return nil, false +} + +// AsBasicDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AATPCheckRequirements. +func (acr AATPCheckRequirements) AsBasicDataConnectorsCheckRequirements() (BasicDataConnectorsCheckRequirements, bool) { + return &acr, true +} + +// UnmarshalJSON is the custom unmarshaler for AATPCheckRequirements struct. +func (acr *AATPCheckRequirements) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var aATPCheckRequirementsProperties AATPCheckRequirementsProperties + err = json.Unmarshal(*v, &aATPCheckRequirementsProperties) + if err != nil { + return err + } + acr.AATPCheckRequirementsProperties = &aATPCheckRequirementsProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnectorsCheckRequirements + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + acr.Kind = kind + } + } + } + + return nil +} + +// AATPCheckRequirementsProperties AATP (Azure Advanced Threat Protection) requirements check properties. +type AATPCheckRequirementsProperties struct { + // TenantID - The tenant id to connect to, and get the data from. + TenantID *string `json:"tenantId,omitempty"` +} + +// AATPDataConnector represents AATP (Azure Advanced Threat Protection) data connector. +type AATPDataConnector struct { + // AATPDataConnectorProperties - AATP (Azure Advanced Threat Protection) data connector properties. + *AATPDataConnectorProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorKindDataConnector', 'KindBasicDataConnectorKindAzureActiveDirectory', 'KindBasicDataConnectorKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorKindMicrosoftThreatProtection', 'KindBasicDataConnectorKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorKindAzureSecurityCenter', 'KindBasicDataConnectorKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorKindAmazonWebServicesS3', 'KindBasicDataConnectorKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorKindDynamics365', 'KindBasicDataConnectorKindOfficeATP', 'KindBasicDataConnectorKindOffice365Project', 'KindBasicDataConnectorKindOfficePowerBI', 'KindBasicDataConnectorKindOfficeIRM', 'KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorKindOffice365', 'KindBasicDataConnectorKindThreatIntelligence', 'KindBasicDataConnectorKindThreatIntelligenceTaxii', 'KindBasicDataConnectorKindIOT', 'KindBasicDataConnectorKindGenericUI', 'KindBasicDataConnectorKindAPIPolling' + Kind KindBasicDataConnector `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for AATPDataConnector. +func (adc AATPDataConnector) MarshalJSON() ([]byte, error) { + adc.Kind = KindBasicDataConnectorKindAzureAdvancedThreatProtection + objectMap := make(map[string]interface{}) + if adc.AATPDataConnectorProperties != nil { + objectMap["properties"] = adc.AATPDataConnectorProperties + } + if adc.Kind != "" { + objectMap["kind"] = adc.Kind + } + if adc.Etag != nil { + objectMap["etag"] = adc.Etag + } + return json.Marshal(objectMap) +} + +// AsAADDataConnector is the BasicDataConnector implementation for AATPDataConnector. +func (adc AATPDataConnector) AsAADDataConnector() (*AADDataConnector, bool) { + return nil, false +} + +// AsMSTIDataConnector is the BasicDataConnector implementation for AATPDataConnector. +func (adc AATPDataConnector) AsMSTIDataConnector() (*MSTIDataConnector, bool) { + return nil, false +} + +// AsMTPDataConnector is the BasicDataConnector implementation for AATPDataConnector. +func (adc AATPDataConnector) AsMTPDataConnector() (*MTPDataConnector, bool) { + return nil, false +} + +// AsAATPDataConnector is the BasicDataConnector implementation for AATPDataConnector. +func (adc AATPDataConnector) AsAATPDataConnector() (*AATPDataConnector, bool) { + return &adc, true +} + +// AsASCDataConnector is the BasicDataConnector implementation for AATPDataConnector. +func (adc AATPDataConnector) AsASCDataConnector() (*ASCDataConnector, bool) { + return nil, false +} + +// AsAwsCloudTrailDataConnector is the BasicDataConnector implementation for AATPDataConnector. +func (adc AATPDataConnector) AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) { + return nil, false +} + +// AsAwsS3DataConnector is the BasicDataConnector implementation for AATPDataConnector. +func (adc AATPDataConnector) AsAwsS3DataConnector() (*AwsS3DataConnector, bool) { + return nil, false +} + +// AsMCASDataConnector is the BasicDataConnector implementation for AATPDataConnector. +func (adc AATPDataConnector) AsMCASDataConnector() (*MCASDataConnector, bool) { + return nil, false +} + +// AsDynamics365DataConnector is the BasicDataConnector implementation for AATPDataConnector. +func (adc AATPDataConnector) AsDynamics365DataConnector() (*Dynamics365DataConnector, bool) { + return nil, false +} + +// AsOfficeATPDataConnector is the BasicDataConnector implementation for AATPDataConnector. +func (adc AATPDataConnector) AsOfficeATPDataConnector() (*OfficeATPDataConnector, bool) { + return nil, false +} + +// AsOffice365ProjectDataConnector is the BasicDataConnector implementation for AATPDataConnector. +func (adc AATPDataConnector) AsOffice365ProjectDataConnector() (*Office365ProjectDataConnector, bool) { + return nil, false +} + +// AsOfficePowerBIDataConnector is the BasicDataConnector implementation for AATPDataConnector. +func (adc AATPDataConnector) AsOfficePowerBIDataConnector() (*OfficePowerBIDataConnector, bool) { + return nil, false +} + +// AsOfficeIRMDataConnector is the BasicDataConnector implementation for AATPDataConnector. +func (adc AATPDataConnector) AsOfficeIRMDataConnector() (*OfficeIRMDataConnector, bool) { + return nil, false +} + +// AsMDATPDataConnector is the BasicDataConnector implementation for AATPDataConnector. +func (adc AATPDataConnector) AsMDATPDataConnector() (*MDATPDataConnector, bool) { + return nil, false +} + +// AsOfficeDataConnector is the BasicDataConnector implementation for AATPDataConnector. +func (adc AATPDataConnector) AsOfficeDataConnector() (*OfficeDataConnector, bool) { + return nil, false +} + +// AsTIDataConnector is the BasicDataConnector implementation for AATPDataConnector. +func (adc AATPDataConnector) AsTIDataConnector() (*TIDataConnector, bool) { + return nil, false +} + +// AsTiTaxiiDataConnector is the BasicDataConnector implementation for AATPDataConnector. +func (adc AATPDataConnector) AsTiTaxiiDataConnector() (*TiTaxiiDataConnector, bool) { + return nil, false +} + +// AsIoTDataConnector is the BasicDataConnector implementation for AATPDataConnector. +func (adc AATPDataConnector) AsIoTDataConnector() (*IoTDataConnector, bool) { + return nil, false +} + +// AsCodelessUIDataConnector is the BasicDataConnector implementation for AATPDataConnector. +func (adc AATPDataConnector) AsCodelessUIDataConnector() (*CodelessUIDataConnector, bool) { + return nil, false +} + +// AsCodelessAPIPollingDataConnector is the BasicDataConnector implementation for AATPDataConnector. +func (adc AATPDataConnector) AsCodelessAPIPollingDataConnector() (*CodelessAPIPollingDataConnector, bool) { + return nil, false +} + +// AsDataConnector is the BasicDataConnector implementation for AATPDataConnector. +func (adc AATPDataConnector) AsDataConnector() (*DataConnector, bool) { + return nil, false +} + +// AsBasicDataConnector is the BasicDataConnector implementation for AATPDataConnector. +func (adc AATPDataConnector) AsBasicDataConnector() (BasicDataConnector, bool) { + return &adc, true +} + +// UnmarshalJSON is the custom unmarshaler for AATPDataConnector struct. +func (adc *AATPDataConnector) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var aATPDataConnectorProperties AATPDataConnectorProperties + err = json.Unmarshal(*v, &aATPDataConnectorProperties) + if err != nil { + return err + } + adc.AATPDataConnectorProperties = &aATPDataConnectorProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnector + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + adc.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + adc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + adc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + adc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + adc.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + adc.SystemData = &systemData + } + } + } + + return nil +} + +// AATPDataConnectorProperties AATP (Azure Advanced Threat Protection) data connector properties. +type AATPDataConnectorProperties struct { + // TenantID - The tenant id to connect to, and get the data from. + TenantID *string `json:"tenantId,omitempty"` + // DataTypes - The available data types for the connector. + DataTypes *AlertsDataTypeOfDataConnector `json:"dataTypes,omitempty"` +} + +// AccountEntity represents an account entity. +type AccountEntity struct { + // AccountEntityProperties - Account entity properties + *AccountEntityProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` + // Kind - Possible values include: 'KindBasicEntityKindEntity', 'KindBasicEntityKindURL', 'KindBasicEntityKindSubmissionMail', 'KindBasicEntityKindSecurityGroup', 'KindBasicEntityKindSecurityAlert', 'KindBasicEntityKindRegistryValue', 'KindBasicEntityKindRegistryKey', 'KindBasicEntityKindProcess', 'KindBasicEntityKindMalware', 'KindBasicEntityKindMailMessage', 'KindBasicEntityKindMailCluster', 'KindBasicEntityKindMailbox', 'KindBasicEntityKindIP', 'KindBasicEntityKindIoTDevice', 'KindBasicEntityKindBookmark', 'KindBasicEntityKindHost', 'KindBasicEntityKindFileHash', 'KindBasicEntityKindFile', 'KindBasicEntityKindDNSResolution', 'KindBasicEntityKindCloudApplication', 'KindBasicEntityKindAzureResource', 'KindBasicEntityKindAccount' + Kind KindBasicEntity `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountEntity. +func (ae AccountEntity) MarshalJSON() ([]byte, error) { + ae.Kind = KindBasicEntityKindAccount + objectMap := make(map[string]interface{}) + if ae.AccountEntityProperties != nil { + objectMap["properties"] = ae.AccountEntityProperties + } + if ae.Kind != "" { + objectMap["kind"] = ae.Kind + } + return json.Marshal(objectMap) +} + +// AsURLEntity is the BasicEntity implementation for AccountEntity. +func (ae AccountEntity) AsURLEntity() (*URLEntity, bool) { + return nil, false +} + +// AsSubmissionMailEntity is the BasicEntity implementation for AccountEntity. +func (ae AccountEntity) AsSubmissionMailEntity() (*SubmissionMailEntity, bool) { + return nil, false +} + +// AsSecurityGroupEntity is the BasicEntity implementation for AccountEntity. +func (ae AccountEntity) AsSecurityGroupEntity() (*SecurityGroupEntity, bool) { + return nil, false +} + +// AsSecurityAlert is the BasicEntity implementation for AccountEntity. +func (ae AccountEntity) AsSecurityAlert() (*SecurityAlert, bool) { + return nil, false +} + +// AsRegistryValueEntity is the BasicEntity implementation for AccountEntity. +func (ae AccountEntity) AsRegistryValueEntity() (*RegistryValueEntity, bool) { + return nil, false +} + +// AsRegistryKeyEntity is the BasicEntity implementation for AccountEntity. +func (ae AccountEntity) AsRegistryKeyEntity() (*RegistryKeyEntity, bool) { + return nil, false +} + +// AsProcessEntity is the BasicEntity implementation for AccountEntity. +func (ae AccountEntity) AsProcessEntity() (*ProcessEntity, bool) { + return nil, false +} + +// AsMalwareEntity is the BasicEntity implementation for AccountEntity. +func (ae AccountEntity) AsMalwareEntity() (*MalwareEntity, bool) { + return nil, false +} + +// AsMailMessageEntity is the BasicEntity implementation for AccountEntity. +func (ae AccountEntity) AsMailMessageEntity() (*MailMessageEntity, bool) { + return nil, false +} + +// AsMailClusterEntity is the BasicEntity implementation for AccountEntity. +func (ae AccountEntity) AsMailClusterEntity() (*MailClusterEntity, bool) { + return nil, false +} + +// AsMailboxEntity is the BasicEntity implementation for AccountEntity. +func (ae AccountEntity) AsMailboxEntity() (*MailboxEntity, bool) { + return nil, false +} + +// AsIPEntity is the BasicEntity implementation for AccountEntity. +func (ae AccountEntity) AsIPEntity() (*IPEntity, bool) { + return nil, false +} + +// AsIoTDeviceEntity is the BasicEntity implementation for AccountEntity. +func (ae AccountEntity) AsIoTDeviceEntity() (*IoTDeviceEntity, bool) { + return nil, false +} + +// AsHuntingBookmark is the BasicEntity implementation for AccountEntity. +func (ae AccountEntity) AsHuntingBookmark() (*HuntingBookmark, bool) { + return nil, false +} + +// AsHostEntity is the BasicEntity implementation for AccountEntity. +func (ae AccountEntity) AsHostEntity() (*HostEntity, bool) { + return nil, false +} + +// AsFileHashEntity is the BasicEntity implementation for AccountEntity. +func (ae AccountEntity) AsFileHashEntity() (*FileHashEntity, bool) { + return nil, false +} + +// AsFileEntity is the BasicEntity implementation for AccountEntity. +func (ae AccountEntity) AsFileEntity() (*FileEntity, bool) { + return nil, false +} + +// AsDNSEntity is the BasicEntity implementation for AccountEntity. +func (ae AccountEntity) AsDNSEntity() (*DNSEntity, bool) { + return nil, false +} + +// AsCloudApplicationEntity is the BasicEntity implementation for AccountEntity. +func (ae AccountEntity) AsCloudApplicationEntity() (*CloudApplicationEntity, bool) { + return nil, false +} + +// AsAzureResourceEntity is the BasicEntity implementation for AccountEntity. +func (ae AccountEntity) AsAzureResourceEntity() (*AzureResourceEntity, bool) { + return nil, false +} + +// AsAccountEntity is the BasicEntity implementation for AccountEntity. +func (ae AccountEntity) AsAccountEntity() (*AccountEntity, bool) { + return &ae, true +} + +// AsEntity is the BasicEntity implementation for AccountEntity. +func (ae AccountEntity) AsEntity() (*Entity, bool) { + return nil, false +} + +// AsBasicEntity is the BasicEntity implementation for AccountEntity. +func (ae AccountEntity) AsBasicEntity() (BasicEntity, bool) { + return &ae, true +} + +// UnmarshalJSON is the custom unmarshaler for AccountEntity struct. +func (ae *AccountEntity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var accountEntityProperties AccountEntityProperties + err = json.Unmarshal(*v, &accountEntityProperties) + if err != nil { + return err + } + ae.AccountEntityProperties = &accountEntityProperties + } + case "kind": + if v != nil { + var kind KindBasicEntity + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ae.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ae.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ae.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ae.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + ae.SystemData = &systemData + } + } + } + + return nil +} + +// AccountEntityProperties account entity property bag. +type AccountEntityProperties struct { + // AadTenantID - READ-ONLY; The Azure Active Directory tenant id. + AadTenantID *string `json:"aadTenantId,omitempty"` + // AadUserID - READ-ONLY; The Azure Active Directory user id. + AadUserID *string `json:"aadUserId,omitempty"` + // AccountName - READ-ONLY; The name of the account. This field should hold only the name without any domain added to it, i.e. administrator. + AccountName *string `json:"accountName,omitempty"` + // DisplayName - READ-ONLY; The display name of the account. + DisplayName *string `json:"displayName,omitempty"` + // HostEntityID - READ-ONLY; The Host entity id that contains the account in case it is a local account (not domain joined) + HostEntityID *string `json:"hostEntityId,omitempty"` + // IsDomainJoined - READ-ONLY; Determines whether this is a domain account. + IsDomainJoined *bool `json:"isDomainJoined,omitempty"` + // NtDomain - READ-ONLY; The NetBIOS domain name as it appears in the alert format domain/username. Examples: NT AUTHORITY. + NtDomain *string `json:"ntDomain,omitempty"` + // ObjectGUID - READ-ONLY; The objectGUID attribute is a single-value attribute that is the unique identifier for the object, assigned by active directory. + ObjectGUID *uuid.UUID `json:"objectGuid,omitempty"` + // Puid - READ-ONLY; The Azure Active Directory Passport User ID. + Puid *string `json:"puid,omitempty"` + // Sid - READ-ONLY; The account security identifier, e.g. S-1-5-18. + Sid *string `json:"sid,omitempty"` + // UpnSuffix - READ-ONLY; The user principal name suffix for the account, in some cases it is also the domain name. Examples: contoso.com. + UpnSuffix *string `json:"upnSuffix,omitempty"` + // DNSDomain - READ-ONLY; The fully qualified domain DNS name. + DNSDomain *string `json:"dnsDomain,omitempty"` + // AdditionalData - READ-ONLY; A bag of custom fields that should be part of the entity and will be presented to the user. + AdditionalData map[string]interface{} `json:"additionalData"` + // FriendlyName - READ-ONLY; The graph item display name which is a short humanly readable description of the graph item instance. This property is optional and might be system generated. + FriendlyName *string `json:"friendlyName,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountEntityProperties. +func (aep AccountEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ActionPropertiesBase action property bag base. +type ActionPropertiesBase struct { + // LogicAppResourceID - Logic App Resource Id, /subscriptions/{my-subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my-workflow-id}. + LogicAppResourceID *string `json:"logicAppResourceId,omitempty"` +} + +// ActionRequest action for alert rule. +type ActionRequest struct { + // ActionRequestProperties - Action properties for put request + *ActionRequestProperties `json:"properties,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ActionRequest. +func (ar ActionRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ar.ActionRequestProperties != nil { + objectMap["properties"] = ar.ActionRequestProperties + } + if ar.Etag != nil { + objectMap["etag"] = ar.Etag + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ActionRequest struct. +func (ar *ActionRequest) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var actionRequestProperties ActionRequestProperties + err = json.Unmarshal(*v, &actionRequestProperties) + if err != nil { + return err + } + ar.ActionRequestProperties = &actionRequestProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ar.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ar.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + ar.SystemData = &systemData + } + } + } + + return nil +} + +// ActionRequestProperties action property bag. +type ActionRequestProperties struct { + // TriggerURI - Logic App Callback URL for this specific workflow. + TriggerURI *string `json:"triggerUri,omitempty"` + // LogicAppResourceID - Logic App Resource Id, /subscriptions/{my-subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my-workflow-id}. + LogicAppResourceID *string `json:"logicAppResourceId,omitempty"` +} + +// ActionResponse action for alert rule. +type ActionResponse struct { + autorest.Response `json:"-"` + // ActionResponseProperties - Action properties for get request + *ActionResponseProperties `json:"properties,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ActionResponse. +func (ar ActionResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ar.ActionResponseProperties != nil { + objectMap["properties"] = ar.ActionResponseProperties + } + if ar.Etag != nil { + objectMap["etag"] = ar.Etag + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ActionResponse struct. +func (ar *ActionResponse) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var actionResponseProperties ActionResponseProperties + err = json.Unmarshal(*v, &actionResponseProperties) + if err != nil { + return err + } + ar.ActionResponseProperties = &actionResponseProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ar.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ar.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + ar.SystemData = &systemData + } + } + } + + return nil +} + +// ActionResponseProperties action property bag. +type ActionResponseProperties struct { + // WorkflowID - The name of the logic app's workflow. + WorkflowID *string `json:"workflowId,omitempty"` + // LogicAppResourceID - Logic App Resource Id, /subscriptions/{my-subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my-workflow-id}. + LogicAppResourceID *string `json:"logicAppResourceId,omitempty"` +} + +// ActionsList list all the actions. +type ActionsList struct { + autorest.Response `json:"-"` + // NextLink - READ-ONLY; URL to fetch the next set of actions. + NextLink *string `json:"nextLink,omitempty"` + // Value - Array of actions. + Value *[]ActionResponse `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for ActionsList. +func (al ActionsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if al.Value != nil { + objectMap["value"] = al.Value + } + return json.Marshal(objectMap) +} + +// ActionsListIterator provides access to a complete listing of ActionResponse values. +type ActionsListIterator struct { + i int + page ActionsListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ActionsListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ActionsListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ActionsListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ActionsListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ActionsListIterator) Response() ActionsList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ActionsListIterator) Value() ActionResponse { + if !iter.page.NotDone() { + return ActionResponse{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ActionsListIterator type. +func NewActionsListIterator(page ActionsListPage) ActionsListIterator { + return ActionsListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (al ActionsList) IsEmpty() bool { + return al.Value == nil || len(*al.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (al ActionsList) hasNextLink() bool { + return al.NextLink != nil && len(*al.NextLink) != 0 +} + +// actionsListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (al ActionsList) actionsListPreparer(ctx context.Context) (*http.Request, error) { + if !al.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(al.NextLink))) +} + +// ActionsListPage contains a page of ActionResponse values. +type ActionsListPage struct { + fn func(context.Context, ActionsList) (ActionsList, error) + al ActionsList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ActionsListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ActionsListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.al) + if err != nil { + return err + } + page.al = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ActionsListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ActionsListPage) NotDone() bool { + return !page.al.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ActionsListPage) Response() ActionsList { + return page.al +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ActionsListPage) Values() []ActionResponse { + if page.al.IsEmpty() { + return nil + } + return *page.al.Value +} + +// Creates a new instance of the ActionsListPage type. +func NewActionsListPage(cur ActionsList, getNextPage func(context.Context, ActionsList) (ActionsList, error)) ActionsListPage { + return ActionsListPage{ + fn: getNextPage, + al: cur, + } +} + +// ActivityCustomEntityQuery represents Activity entity query. +type ActivityCustomEntityQuery struct { + // ActivityEntityQueriesProperties - Activity entity query properties + *ActivityEntityQueriesProperties `json:"properties,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` + // Kind - Possible values include: 'KindBasicCustomEntityQueryKindCustomEntityQuery', 'KindBasicCustomEntityQueryKindActivity' + Kind KindBasicCustomEntityQuery `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for ActivityCustomEntityQuery. +func (aceq ActivityCustomEntityQuery) MarshalJSON() ([]byte, error) { + aceq.Kind = KindBasicCustomEntityQueryKindActivity + objectMap := make(map[string]interface{}) + if aceq.ActivityEntityQueriesProperties != nil { + objectMap["properties"] = aceq.ActivityEntityQueriesProperties + } + if aceq.Kind != "" { + objectMap["kind"] = aceq.Kind + } + if aceq.Etag != nil { + objectMap["etag"] = aceq.Etag + } + return json.Marshal(objectMap) +} + +// AsActivityCustomEntityQuery is the BasicCustomEntityQuery implementation for ActivityCustomEntityQuery. +func (aceq ActivityCustomEntityQuery) AsActivityCustomEntityQuery() (*ActivityCustomEntityQuery, bool) { + return &aceq, true +} + +// AsCustomEntityQuery is the BasicCustomEntityQuery implementation for ActivityCustomEntityQuery. +func (aceq ActivityCustomEntityQuery) AsCustomEntityQuery() (*CustomEntityQuery, bool) { + return nil, false +} + +// AsBasicCustomEntityQuery is the BasicCustomEntityQuery implementation for ActivityCustomEntityQuery. +func (aceq ActivityCustomEntityQuery) AsBasicCustomEntityQuery() (BasicCustomEntityQuery, bool) { + return &aceq, true +} + +// UnmarshalJSON is the custom unmarshaler for ActivityCustomEntityQuery struct. +func (aceq *ActivityCustomEntityQuery) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var activityEntityQueriesProperties ActivityEntityQueriesProperties + err = json.Unmarshal(*v, &activityEntityQueriesProperties) + if err != nil { + return err + } + aceq.ActivityEntityQueriesProperties = &activityEntityQueriesProperties + } + case "kind": + if v != nil { + var kind KindBasicCustomEntityQuery + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + aceq.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + aceq.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + aceq.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + aceq.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + aceq.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + aceq.SystemData = &systemData + } + } + } + + return nil +} + +// ActivityEntityQueriesProperties describes activity entity query properties +type ActivityEntityQueriesProperties struct { + // Title - The entity query title + Title *string `json:"title,omitempty"` + // Content - The entity query content to display in timeline + Content *string `json:"content,omitempty"` + // Description - The entity query description + Description *string `json:"description,omitempty"` + // QueryDefinitions - The Activity query definitions + QueryDefinitions *ActivityEntityQueriesPropertiesQueryDefinitions `json:"queryDefinitions,omitempty"` + // InputEntityType - The type of the query's source entity. Possible values include: 'EntityTypeAccount', 'EntityTypeHost', 'EntityTypeFile', 'EntityTypeAzureResource', 'EntityTypeCloudApplication', 'EntityTypeDNS', 'EntityTypeFileHash', 'EntityTypeIP', 'EntityTypeMalware', 'EntityTypeProcess', 'EntityTypeRegistryKey', 'EntityTypeRegistryValue', 'EntityTypeSecurityGroup', 'EntityTypeURL', 'EntityTypeIoTDevice', 'EntityTypeSecurityAlert', 'EntityTypeHuntingBookmark', 'EntityTypeMailCluster', 'EntityTypeMailMessage', 'EntityTypeMailbox', 'EntityTypeSubmissionMail' + InputEntityType EntityType `json:"inputEntityType,omitempty"` + // RequiredInputFieldsSets - List of the fields of the source entity that are required to run the query + RequiredInputFieldsSets *[][]string `json:"requiredInputFieldsSets,omitempty"` + // EntitiesFilter - The query applied only to entities matching to all filters + EntitiesFilter map[string][]string `json:"entitiesFilter"` + // TemplateName - The template id this activity was created from + TemplateName *string `json:"templateName,omitempty"` + // Enabled - Determines whether this activity is enabled or disabled. + Enabled *bool `json:"enabled,omitempty"` + // CreatedTimeUtc - READ-ONLY; The time the activity was created + CreatedTimeUtc *date.Time `json:"createdTimeUtc,omitempty"` + // LastModifiedTimeUtc - READ-ONLY; The last time the activity was updated + LastModifiedTimeUtc *date.Time `json:"lastModifiedTimeUtc,omitempty"` +} + +// MarshalJSON is the custom marshaler for ActivityEntityQueriesProperties. +func (aeqp ActivityEntityQueriesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aeqp.Title != nil { + objectMap["title"] = aeqp.Title + } + if aeqp.Content != nil { + objectMap["content"] = aeqp.Content + } + if aeqp.Description != nil { + objectMap["description"] = aeqp.Description + } + if aeqp.QueryDefinitions != nil { + objectMap["queryDefinitions"] = aeqp.QueryDefinitions + } + if aeqp.InputEntityType != "" { + objectMap["inputEntityType"] = aeqp.InputEntityType + } + if aeqp.RequiredInputFieldsSets != nil { + objectMap["requiredInputFieldsSets"] = aeqp.RequiredInputFieldsSets + } + if aeqp.EntitiesFilter != nil { + objectMap["entitiesFilter"] = aeqp.EntitiesFilter + } + if aeqp.TemplateName != nil { + objectMap["templateName"] = aeqp.TemplateName + } + if aeqp.Enabled != nil { + objectMap["enabled"] = aeqp.Enabled + } + return json.Marshal(objectMap) +} + +// ActivityEntityQueriesPropertiesQueryDefinitions the Activity query definitions +type ActivityEntityQueriesPropertiesQueryDefinitions struct { + // Query - The Activity query to run on a given entity + Query *string `json:"query,omitempty"` +} + +// ActivityEntityQuery represents Activity entity query. +type ActivityEntityQuery struct { + // ActivityEntityQueriesProperties - Activity entity query properties + *ActivityEntityQueriesProperties `json:"properties,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` + // Kind - Possible values include: 'KindBasicEntityQueryKindEntityQuery', 'KindBasicEntityQueryKindExpansion', 'KindBasicEntityQueryKindActivity' + Kind KindBasicEntityQuery `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for ActivityEntityQuery. +func (aeq ActivityEntityQuery) MarshalJSON() ([]byte, error) { + aeq.Kind = KindBasicEntityQueryKindActivity + objectMap := make(map[string]interface{}) + if aeq.ActivityEntityQueriesProperties != nil { + objectMap["properties"] = aeq.ActivityEntityQueriesProperties + } + if aeq.Kind != "" { + objectMap["kind"] = aeq.Kind + } + if aeq.Etag != nil { + objectMap["etag"] = aeq.Etag + } + return json.Marshal(objectMap) +} + +// AsExpansionEntityQuery is the BasicEntityQuery implementation for ActivityEntityQuery. +func (aeq ActivityEntityQuery) AsExpansionEntityQuery() (*ExpansionEntityQuery, bool) { + return nil, false +} + +// AsActivityEntityQuery is the BasicEntityQuery implementation for ActivityEntityQuery. +func (aeq ActivityEntityQuery) AsActivityEntityQuery() (*ActivityEntityQuery, bool) { + return &aeq, true +} + +// AsEntityQuery is the BasicEntityQuery implementation for ActivityEntityQuery. +func (aeq ActivityEntityQuery) AsEntityQuery() (*EntityQuery, bool) { + return nil, false +} + +// AsBasicEntityQuery is the BasicEntityQuery implementation for ActivityEntityQuery. +func (aeq ActivityEntityQuery) AsBasicEntityQuery() (BasicEntityQuery, bool) { + return &aeq, true +} + +// UnmarshalJSON is the custom unmarshaler for ActivityEntityQuery struct. +func (aeq *ActivityEntityQuery) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var activityEntityQueriesProperties ActivityEntityQueriesProperties + err = json.Unmarshal(*v, &activityEntityQueriesProperties) + if err != nil { + return err + } + aeq.ActivityEntityQueriesProperties = &activityEntityQueriesProperties + } + case "kind": + if v != nil { + var kind KindBasicEntityQuery + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + aeq.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + aeq.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + aeq.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + aeq.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + aeq.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + aeq.SystemData = &systemData + } + } + } + + return nil +} + +// ActivityEntityQueryTemplate represents Activity entity query. +type ActivityEntityQueryTemplate struct { + // ActivityEntityQueryTemplateProperties - Activity entity query properties + *ActivityEntityQueryTemplateProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` + // Kind - Possible values include: 'KindBasicEntityQueryTemplateKindEntityQueryTemplate', 'KindBasicEntityQueryTemplateKindActivity' + Kind KindBasicEntityQueryTemplate `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for ActivityEntityQueryTemplate. +func (aeqt ActivityEntityQueryTemplate) MarshalJSON() ([]byte, error) { + aeqt.Kind = KindBasicEntityQueryTemplateKindActivity + objectMap := make(map[string]interface{}) + if aeqt.ActivityEntityQueryTemplateProperties != nil { + objectMap["properties"] = aeqt.ActivityEntityQueryTemplateProperties + } + if aeqt.Kind != "" { + objectMap["kind"] = aeqt.Kind + } + return json.Marshal(objectMap) +} + +// AsActivityEntityQueryTemplate is the BasicEntityQueryTemplate implementation for ActivityEntityQueryTemplate. +func (aeqt ActivityEntityQueryTemplate) AsActivityEntityQueryTemplate() (*ActivityEntityQueryTemplate, bool) { + return &aeqt, true +} + +// AsEntityQueryTemplate is the BasicEntityQueryTemplate implementation for ActivityEntityQueryTemplate. +func (aeqt ActivityEntityQueryTemplate) AsEntityQueryTemplate() (*EntityQueryTemplate, bool) { + return nil, false +} + +// AsBasicEntityQueryTemplate is the BasicEntityQueryTemplate implementation for ActivityEntityQueryTemplate. +func (aeqt ActivityEntityQueryTemplate) AsBasicEntityQueryTemplate() (BasicEntityQueryTemplate, bool) { + return &aeqt, true +} + +// UnmarshalJSON is the custom unmarshaler for ActivityEntityQueryTemplate struct. +func (aeqt *ActivityEntityQueryTemplate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var activityEntityQueryTemplateProperties ActivityEntityQueryTemplateProperties + err = json.Unmarshal(*v, &activityEntityQueryTemplateProperties) + if err != nil { + return err + } + aeqt.ActivityEntityQueryTemplateProperties = &activityEntityQueryTemplateProperties + } + case "kind": + if v != nil { + var kind KindBasicEntityQueryTemplate + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + aeqt.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + aeqt.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + aeqt.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + aeqt.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + aeqt.SystemData = &systemData + } + } + } + + return nil +} + +// ActivityEntityQueryTemplateProperties describes activity entity query properties +type ActivityEntityQueryTemplateProperties struct { + // Title - The entity query title + Title *string `json:"title,omitempty"` + // Content - The entity query content to display in timeline + Content *string `json:"content,omitempty"` + // Description - The entity query description + Description *string `json:"description,omitempty"` + // QueryDefinitions - The Activity query definitions + QueryDefinitions *ActivityEntityQueryTemplatePropertiesQueryDefinitions `json:"queryDefinitions,omitempty"` + // DataTypes - List of required data types for the given entity query template + DataTypes *[]DataTypeDefinitions `json:"dataTypes,omitempty"` + // InputEntityType - The type of the query's source entity. Possible values include: 'EntityTypeAccount', 'EntityTypeHost', 'EntityTypeFile', 'EntityTypeAzureResource', 'EntityTypeCloudApplication', 'EntityTypeDNS', 'EntityTypeFileHash', 'EntityTypeIP', 'EntityTypeMalware', 'EntityTypeProcess', 'EntityTypeRegistryKey', 'EntityTypeRegistryValue', 'EntityTypeSecurityGroup', 'EntityTypeURL', 'EntityTypeIoTDevice', 'EntityTypeSecurityAlert', 'EntityTypeHuntingBookmark', 'EntityTypeMailCluster', 'EntityTypeMailMessage', 'EntityTypeMailbox', 'EntityTypeSubmissionMail' + InputEntityType EntityType `json:"inputEntityType,omitempty"` + // RequiredInputFieldsSets - List of the fields of the source entity that are required to run the query + RequiredInputFieldsSets *[][]string `json:"requiredInputFieldsSets,omitempty"` + // EntitiesFilter - The query applied only to entities matching to all filters + EntitiesFilter map[string][]string `json:"entitiesFilter"` +} + +// MarshalJSON is the custom marshaler for ActivityEntityQueryTemplateProperties. +func (aeqtp ActivityEntityQueryTemplateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aeqtp.Title != nil { + objectMap["title"] = aeqtp.Title + } + if aeqtp.Content != nil { + objectMap["content"] = aeqtp.Content + } + if aeqtp.Description != nil { + objectMap["description"] = aeqtp.Description + } + if aeqtp.QueryDefinitions != nil { + objectMap["queryDefinitions"] = aeqtp.QueryDefinitions + } + if aeqtp.DataTypes != nil { + objectMap["dataTypes"] = aeqtp.DataTypes + } + if aeqtp.InputEntityType != "" { + objectMap["inputEntityType"] = aeqtp.InputEntityType + } + if aeqtp.RequiredInputFieldsSets != nil { + objectMap["requiredInputFieldsSets"] = aeqtp.RequiredInputFieldsSets + } + if aeqtp.EntitiesFilter != nil { + objectMap["entitiesFilter"] = aeqtp.EntitiesFilter + } + return json.Marshal(objectMap) +} + +// ActivityEntityQueryTemplatePropertiesQueryDefinitions the Activity query definitions +type ActivityEntityQueryTemplatePropertiesQueryDefinitions struct { + // Query - The Activity query to run on a given entity + Query *string `json:"query,omitempty"` + // SummarizeBy - The dimensions we want to summarize the timeline results on, this is comma separated list + SummarizeBy *string `json:"summarizeBy,omitempty"` +} + +// ActivityTimelineItem represents Activity timeline item. +type ActivityTimelineItem struct { + // QueryID - The activity query id. + QueryID *string `json:"queryId,omitempty"` + // BucketStartTimeUTC - The grouping bucket start time. + BucketStartTimeUTC *date.Time `json:"bucketStartTimeUTC,omitempty"` + // BucketEndTimeUTC - The grouping bucket end time. + BucketEndTimeUTC *date.Time `json:"bucketEndTimeUTC,omitempty"` + // FirstActivityTimeUTC - The time of the first activity in the grouping bucket. + FirstActivityTimeUTC *date.Time `json:"firstActivityTimeUTC,omitempty"` + // LastActivityTimeUTC - The time of the last activity in the grouping bucket. + LastActivityTimeUTC *date.Time `json:"lastActivityTimeUTC,omitempty"` + // Content - The activity timeline content. + Content *string `json:"content,omitempty"` + // Title - The activity timeline title. + Title *string `json:"title,omitempty"` + // Kind - Possible values include: 'KindBasicEntityTimelineItemKindEntityTimelineItem', 'KindBasicEntityTimelineItemKindActivity', 'KindBasicEntityTimelineItemKindBookmark', 'KindBasicEntityTimelineItemKindSecurityAlert' + Kind KindBasicEntityTimelineItem `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for ActivityTimelineItem. +func (ati ActivityTimelineItem) MarshalJSON() ([]byte, error) { + ati.Kind = KindBasicEntityTimelineItemKindActivity + objectMap := make(map[string]interface{}) + if ati.QueryID != nil { + objectMap["queryId"] = ati.QueryID + } + if ati.BucketStartTimeUTC != nil { + objectMap["bucketStartTimeUTC"] = ati.BucketStartTimeUTC + } + if ati.BucketEndTimeUTC != nil { + objectMap["bucketEndTimeUTC"] = ati.BucketEndTimeUTC + } + if ati.FirstActivityTimeUTC != nil { + objectMap["firstActivityTimeUTC"] = ati.FirstActivityTimeUTC + } + if ati.LastActivityTimeUTC != nil { + objectMap["lastActivityTimeUTC"] = ati.LastActivityTimeUTC + } + if ati.Content != nil { + objectMap["content"] = ati.Content + } + if ati.Title != nil { + objectMap["title"] = ati.Title + } + if ati.Kind != "" { + objectMap["kind"] = ati.Kind + } + return json.Marshal(objectMap) +} + +// AsActivityTimelineItem is the BasicEntityTimelineItem implementation for ActivityTimelineItem. +func (ati ActivityTimelineItem) AsActivityTimelineItem() (*ActivityTimelineItem, bool) { + return &ati, true +} + +// AsBookmarkTimelineItem is the BasicEntityTimelineItem implementation for ActivityTimelineItem. +func (ati ActivityTimelineItem) AsBookmarkTimelineItem() (*BookmarkTimelineItem, bool) { + return nil, false +} + +// AsSecurityAlertTimelineItem is the BasicEntityTimelineItem implementation for ActivityTimelineItem. +func (ati ActivityTimelineItem) AsSecurityAlertTimelineItem() (*SecurityAlertTimelineItem, bool) { + return nil, false +} + +// AsEntityTimelineItem is the BasicEntityTimelineItem implementation for ActivityTimelineItem. +func (ati ActivityTimelineItem) AsEntityTimelineItem() (*EntityTimelineItem, bool) { + return nil, false +} + +// AsBasicEntityTimelineItem is the BasicEntityTimelineItem implementation for ActivityTimelineItem. +func (ati ActivityTimelineItem) AsBasicEntityTimelineItem() (BasicEntityTimelineItem, bool) { + return &ati, true +} + +// AlertDetailsOverride settings for how to dynamically override alert static details +type AlertDetailsOverride struct { + // AlertDisplayNameFormat - the format containing columns name(s) to override the alert name + AlertDisplayNameFormat *string `json:"alertDisplayNameFormat,omitempty"` + // AlertDescriptionFormat - the format containing columns name(s) to override the alert description + AlertDescriptionFormat *string `json:"alertDescriptionFormat,omitempty"` + // AlertTacticsColumnName - the column name to take the alert tactics from + AlertTacticsColumnName *string `json:"alertTacticsColumnName,omitempty"` + // AlertSeverityColumnName - the column name to take the alert severity from + AlertSeverityColumnName *string `json:"alertSeverityColumnName,omitempty"` +} + +// BasicAlertRule alert rule. +type BasicAlertRule interface { + AsMLBehaviorAnalyticsAlertRule() (*MLBehaviorAnalyticsAlertRule, bool) + AsFusionAlertRule() (*FusionAlertRule, bool) + AsThreatIntelligenceAlertRule() (*ThreatIntelligenceAlertRule, bool) + AsMicrosoftSecurityIncidentCreationAlertRule() (*MicrosoftSecurityIncidentCreationAlertRule, bool) + AsScheduledAlertRule() (*ScheduledAlertRule, bool) + AsNrtAlertRule() (*NrtAlertRule, bool) + AsAlertRule() (*AlertRule, bool) +} + +// AlertRule alert rule. +type AlertRule struct { + autorest.Response `json:"-"` + // Kind - Possible values include: 'KindBasicAlertRuleKindAlertRule', 'KindBasicAlertRuleKindMLBehaviorAnalytics', 'KindBasicAlertRuleKindFusion', 'KindBasicAlertRuleKindThreatIntelligence', 'KindBasicAlertRuleKindMicrosoftSecurityIncidentCreation', 'KindBasicAlertRuleKindScheduled', 'KindBasicAlertRuleKindNRT' + Kind KindBasicAlertRule `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +func unmarshalBasicAlertRule(body []byte) (BasicAlertRule, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["kind"] { + case string(KindBasicAlertRuleKindMLBehaviorAnalytics): + var mbaar MLBehaviorAnalyticsAlertRule + err := json.Unmarshal(body, &mbaar) + return mbaar, err + case string(KindBasicAlertRuleKindFusion): + var far FusionAlertRule + err := json.Unmarshal(body, &far) + return far, err + case string(KindBasicAlertRuleKindThreatIntelligence): + var tiar ThreatIntelligenceAlertRule + err := json.Unmarshal(body, &tiar) + return tiar, err + case string(KindBasicAlertRuleKindMicrosoftSecurityIncidentCreation): + var msicar MicrosoftSecurityIncidentCreationAlertRule + err := json.Unmarshal(body, &msicar) + return msicar, err + case string(KindBasicAlertRuleKindScheduled): + var sar ScheduledAlertRule + err := json.Unmarshal(body, &sar) + return sar, err + case string(KindBasicAlertRuleKindNRT): + var nar NrtAlertRule + err := json.Unmarshal(body, &nar) + return nar, err + default: + var ar AlertRule + err := json.Unmarshal(body, &ar) + return ar, err + } +} +func unmarshalBasicAlertRuleArray(body []byte) ([]BasicAlertRule, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + arArray := make([]BasicAlertRule, len(rawMessages)) + + for index, rawMessage := range rawMessages { + ar, err := unmarshalBasicAlertRule(*rawMessage) + if err != nil { + return nil, err + } + arArray[index] = ar + } + return arArray, nil +} + +// MarshalJSON is the custom marshaler for AlertRule. +func (ar AlertRule) MarshalJSON() ([]byte, error) { + ar.Kind = KindBasicAlertRuleKindAlertRule + objectMap := make(map[string]interface{}) + if ar.Kind != "" { + objectMap["kind"] = ar.Kind + } + if ar.Etag != nil { + objectMap["etag"] = ar.Etag + } + return json.Marshal(objectMap) +} + +// AsMLBehaviorAnalyticsAlertRule is the BasicAlertRule implementation for AlertRule. +func (ar AlertRule) AsMLBehaviorAnalyticsAlertRule() (*MLBehaviorAnalyticsAlertRule, bool) { + return nil, false +} + +// AsFusionAlertRule is the BasicAlertRule implementation for AlertRule. +func (ar AlertRule) AsFusionAlertRule() (*FusionAlertRule, bool) { + return nil, false +} + +// AsThreatIntelligenceAlertRule is the BasicAlertRule implementation for AlertRule. +func (ar AlertRule) AsThreatIntelligenceAlertRule() (*ThreatIntelligenceAlertRule, bool) { + return nil, false +} + +// AsMicrosoftSecurityIncidentCreationAlertRule is the BasicAlertRule implementation for AlertRule. +func (ar AlertRule) AsMicrosoftSecurityIncidentCreationAlertRule() (*MicrosoftSecurityIncidentCreationAlertRule, bool) { + return nil, false +} + +// AsScheduledAlertRule is the BasicAlertRule implementation for AlertRule. +func (ar AlertRule) AsScheduledAlertRule() (*ScheduledAlertRule, bool) { + return nil, false +} + +// AsNrtAlertRule is the BasicAlertRule implementation for AlertRule. +func (ar AlertRule) AsNrtAlertRule() (*NrtAlertRule, bool) { + return nil, false +} + +// AsAlertRule is the BasicAlertRule implementation for AlertRule. +func (ar AlertRule) AsAlertRule() (*AlertRule, bool) { + return &ar, true +} + +// AsBasicAlertRule is the BasicAlertRule implementation for AlertRule. +func (ar AlertRule) AsBasicAlertRule() (BasicAlertRule, bool) { + return &ar, true +} + +// AlertRuleModel ... +type AlertRuleModel struct { + autorest.Response `json:"-"` + Value BasicAlertRule `json:"value,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for AlertRuleModel struct. +func (arm *AlertRuleModel) UnmarshalJSON(body []byte) error { + ar, err := unmarshalBasicAlertRule(body) + if err != nil { + return err + } + arm.Value = ar + + return nil +} + +// AlertRulesList list all the alert rules. +type AlertRulesList struct { + autorest.Response `json:"-"` + // NextLink - READ-ONLY; URL to fetch the next set of alert rules. + NextLink *string `json:"nextLink,omitempty"` + // Value - Array of alert rules. + Value *[]BasicAlertRule `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for AlertRulesList. +func (arl AlertRulesList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if arl.Value != nil { + objectMap["value"] = arl.Value + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AlertRulesList struct. +func (arl *AlertRulesList) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "nextLink": + if v != nil { + var nextLink string + err = json.Unmarshal(*v, &nextLink) + if err != nil { + return err + } + arl.NextLink = &nextLink + } + case "value": + if v != nil { + value, err := unmarshalBasicAlertRuleArray(*v) + if err != nil { + return err + } + arl.Value = &value + } + } + } + + return nil +} + +// AlertRulesListIterator provides access to a complete listing of AlertRule values. +type AlertRulesListIterator struct { + i int + page AlertRulesListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AlertRulesListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AlertRulesListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AlertRulesListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AlertRulesListIterator) Response() AlertRulesList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AlertRulesListIterator) Value() BasicAlertRule { + if !iter.page.NotDone() { + return AlertRule{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AlertRulesListIterator type. +func NewAlertRulesListIterator(page AlertRulesListPage) AlertRulesListIterator { + return AlertRulesListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (arl AlertRulesList) IsEmpty() bool { + return arl.Value == nil || len(*arl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (arl AlertRulesList) hasNextLink() bool { + return arl.NextLink != nil && len(*arl.NextLink) != 0 +} + +// alertRulesListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (arl AlertRulesList) alertRulesListPreparer(ctx context.Context) (*http.Request, error) { + if !arl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(arl.NextLink))) +} + +// AlertRulesListPage contains a page of BasicAlertRule values. +type AlertRulesListPage struct { + fn func(context.Context, AlertRulesList) (AlertRulesList, error) + arl AlertRulesList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AlertRulesListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.arl) + if err != nil { + return err + } + page.arl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AlertRulesListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AlertRulesListPage) NotDone() bool { + return !page.arl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AlertRulesListPage) Response() AlertRulesList { + return page.arl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AlertRulesListPage) Values() []BasicAlertRule { + if page.arl.IsEmpty() { + return nil + } + return *page.arl.Value +} + +// Creates a new instance of the AlertRulesListPage type. +func NewAlertRulesListPage(cur AlertRulesList, getNextPage func(context.Context, AlertRulesList) (AlertRulesList, error)) AlertRulesListPage { + return AlertRulesListPage{ + fn: getNextPage, + arl: cur, + } +} + +// BasicAlertRuleTemplate alert rule template. +type BasicAlertRuleTemplate interface { + AsMLBehaviorAnalyticsAlertRuleTemplate() (*MLBehaviorAnalyticsAlertRuleTemplate, bool) + AsFusionAlertRuleTemplate() (*FusionAlertRuleTemplate, bool) + AsThreatIntelligenceAlertRuleTemplate() (*ThreatIntelligenceAlertRuleTemplate, bool) + AsMicrosoftSecurityIncidentCreationAlertRuleTemplate() (*MicrosoftSecurityIncidentCreationAlertRuleTemplate, bool) + AsScheduledAlertRuleTemplate() (*ScheduledAlertRuleTemplate, bool) + AsNrtAlertRuleTemplate() (*NrtAlertRuleTemplate, bool) + AsAlertRuleTemplate() (*AlertRuleTemplate, bool) +} + +// AlertRuleTemplate alert rule template. +type AlertRuleTemplate struct { + autorest.Response `json:"-"` + // Kind - Possible values include: 'KindBasicAlertRuleTemplateKindAlertRuleTemplate', 'KindBasicAlertRuleTemplateKindMLBehaviorAnalytics', 'KindBasicAlertRuleTemplateKindFusion', 'KindBasicAlertRuleTemplateKindThreatIntelligence', 'KindBasicAlertRuleTemplateKindMicrosoftSecurityIncidentCreation', 'KindBasicAlertRuleTemplateKindScheduled', 'KindBasicAlertRuleTemplateKindNRT' + Kind KindBasicAlertRuleTemplate `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +func unmarshalBasicAlertRuleTemplate(body []byte) (BasicAlertRuleTemplate, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["kind"] { + case string(KindBasicAlertRuleTemplateKindMLBehaviorAnalytics): + var mbaart MLBehaviorAnalyticsAlertRuleTemplate + err := json.Unmarshal(body, &mbaart) + return mbaart, err + case string(KindBasicAlertRuleTemplateKindFusion): + var fart FusionAlertRuleTemplate + err := json.Unmarshal(body, &fart) + return fart, err + case string(KindBasicAlertRuleTemplateKindThreatIntelligence): + var tiart ThreatIntelligenceAlertRuleTemplate + err := json.Unmarshal(body, &tiart) + return tiart, err + case string(KindBasicAlertRuleTemplateKindMicrosoftSecurityIncidentCreation): + var msicart MicrosoftSecurityIncidentCreationAlertRuleTemplate + err := json.Unmarshal(body, &msicart) + return msicart, err + case string(KindBasicAlertRuleTemplateKindScheduled): + var sart ScheduledAlertRuleTemplate + err := json.Unmarshal(body, &sart) + return sart, err + case string(KindBasicAlertRuleTemplateKindNRT): + var nart NrtAlertRuleTemplate + err := json.Unmarshal(body, &nart) + return nart, err + default: + var art AlertRuleTemplate + err := json.Unmarshal(body, &art) + return art, err + } +} +func unmarshalBasicAlertRuleTemplateArray(body []byte) ([]BasicAlertRuleTemplate, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + artArray := make([]BasicAlertRuleTemplate, len(rawMessages)) + + for index, rawMessage := range rawMessages { + art, err := unmarshalBasicAlertRuleTemplate(*rawMessage) + if err != nil { + return nil, err + } + artArray[index] = art + } + return artArray, nil +} + +// MarshalJSON is the custom marshaler for AlertRuleTemplate. +func (art AlertRuleTemplate) MarshalJSON() ([]byte, error) { + art.Kind = KindBasicAlertRuleTemplateKindAlertRuleTemplate + objectMap := make(map[string]interface{}) + if art.Kind != "" { + objectMap["kind"] = art.Kind + } + return json.Marshal(objectMap) +} + +// AsMLBehaviorAnalyticsAlertRuleTemplate is the BasicAlertRuleTemplate implementation for AlertRuleTemplate. +func (art AlertRuleTemplate) AsMLBehaviorAnalyticsAlertRuleTemplate() (*MLBehaviorAnalyticsAlertRuleTemplate, bool) { + return nil, false +} + +// AsFusionAlertRuleTemplate is the BasicAlertRuleTemplate implementation for AlertRuleTemplate. +func (art AlertRuleTemplate) AsFusionAlertRuleTemplate() (*FusionAlertRuleTemplate, bool) { + return nil, false +} + +// AsThreatIntelligenceAlertRuleTemplate is the BasicAlertRuleTemplate implementation for AlertRuleTemplate. +func (art AlertRuleTemplate) AsThreatIntelligenceAlertRuleTemplate() (*ThreatIntelligenceAlertRuleTemplate, bool) { + return nil, false +} + +// AsMicrosoftSecurityIncidentCreationAlertRuleTemplate is the BasicAlertRuleTemplate implementation for AlertRuleTemplate. +func (art AlertRuleTemplate) AsMicrosoftSecurityIncidentCreationAlertRuleTemplate() (*MicrosoftSecurityIncidentCreationAlertRuleTemplate, bool) { + return nil, false +} + +// AsScheduledAlertRuleTemplate is the BasicAlertRuleTemplate implementation for AlertRuleTemplate. +func (art AlertRuleTemplate) AsScheduledAlertRuleTemplate() (*ScheduledAlertRuleTemplate, bool) { + return nil, false +} + +// AsNrtAlertRuleTemplate is the BasicAlertRuleTemplate implementation for AlertRuleTemplate. +func (art AlertRuleTemplate) AsNrtAlertRuleTemplate() (*NrtAlertRuleTemplate, bool) { + return nil, false +} + +// AsAlertRuleTemplate is the BasicAlertRuleTemplate implementation for AlertRuleTemplate. +func (art AlertRuleTemplate) AsAlertRuleTemplate() (*AlertRuleTemplate, bool) { + return &art, true +} + +// AsBasicAlertRuleTemplate is the BasicAlertRuleTemplate implementation for AlertRuleTemplate. +func (art AlertRuleTemplate) AsBasicAlertRuleTemplate() (BasicAlertRuleTemplate, bool) { + return &art, true +} + +// AlertRuleTemplateDataSource alert rule template data sources +type AlertRuleTemplateDataSource struct { + // ConnectorID - The connector id that provides the following data types + ConnectorID *string `json:"connectorId,omitempty"` + // DataTypes - The data types used by the alert rule template + DataTypes *[]string `json:"dataTypes,omitempty"` +} + +// AlertRuleTemplateModel ... +type AlertRuleTemplateModel struct { + autorest.Response `json:"-"` + Value BasicAlertRuleTemplate `json:"value,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for AlertRuleTemplateModel struct. +func (artm *AlertRuleTemplateModel) UnmarshalJSON(body []byte) error { + art, err := unmarshalBasicAlertRuleTemplate(body) + if err != nil { + return err + } + artm.Value = art + + return nil +} + +// AlertRuleTemplatePropertiesBase base alert rule template property bag. +type AlertRuleTemplatePropertiesBase struct { + // AlertRulesCreatedByTemplateCount - the number of alert rules that were created by this template + AlertRulesCreatedByTemplateCount *int32 `json:"alertRulesCreatedByTemplateCount,omitempty"` + // LastUpdatedDateUTC - READ-ONLY; The last time that this alert rule template has been updated. + LastUpdatedDateUTC *date.Time `json:"lastUpdatedDateUTC,omitempty"` + // CreatedDateUTC - READ-ONLY; The time that this alert rule template has been added. + CreatedDateUTC *date.Time `json:"createdDateUTC,omitempty"` + // Description - The description of the alert rule template. + Description *string `json:"description,omitempty"` + // DisplayName - The display name for alert rule template. + DisplayName *string `json:"displayName,omitempty"` + // RequiredDataConnectors - The required data sources for this template + RequiredDataConnectors *[]AlertRuleTemplateDataSource `json:"requiredDataConnectors,omitempty"` + // Status - The alert rule template status. Possible values include: 'TemplateStatusInstalled', 'TemplateStatusAvailable', 'TemplateStatusNotAvailable' + Status TemplateStatus `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for AlertRuleTemplatePropertiesBase. +func (artpb AlertRuleTemplatePropertiesBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if artpb.AlertRulesCreatedByTemplateCount != nil { + objectMap["alertRulesCreatedByTemplateCount"] = artpb.AlertRulesCreatedByTemplateCount + } + if artpb.Description != nil { + objectMap["description"] = artpb.Description + } + if artpb.DisplayName != nil { + objectMap["displayName"] = artpb.DisplayName + } + if artpb.RequiredDataConnectors != nil { + objectMap["requiredDataConnectors"] = artpb.RequiredDataConnectors + } + if artpb.Status != "" { + objectMap["status"] = artpb.Status + } + return json.Marshal(objectMap) +} + +// AlertRuleTemplatesList list all the alert rule templates. +type AlertRuleTemplatesList struct { + autorest.Response `json:"-"` + // NextLink - READ-ONLY; URL to fetch the next set of alert rule templates. + NextLink *string `json:"nextLink,omitempty"` + // Value - Array of alert rule templates. + Value *[]BasicAlertRuleTemplate `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for AlertRuleTemplatesList. +func (artl AlertRuleTemplatesList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if artl.Value != nil { + objectMap["value"] = artl.Value + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AlertRuleTemplatesList struct. +func (artl *AlertRuleTemplatesList) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "nextLink": + if v != nil { + var nextLink string + err = json.Unmarshal(*v, &nextLink) + if err != nil { + return err + } + artl.NextLink = &nextLink + } + case "value": + if v != nil { + value, err := unmarshalBasicAlertRuleTemplateArray(*v) + if err != nil { + return err + } + artl.Value = &value + } + } + } + + return nil +} + +// AlertRuleTemplatesListIterator provides access to a complete listing of AlertRuleTemplate values. +type AlertRuleTemplatesListIterator struct { + i int + page AlertRuleTemplatesListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AlertRuleTemplatesListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleTemplatesListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AlertRuleTemplatesListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AlertRuleTemplatesListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AlertRuleTemplatesListIterator) Response() AlertRuleTemplatesList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AlertRuleTemplatesListIterator) Value() BasicAlertRuleTemplate { + if !iter.page.NotDone() { + return AlertRuleTemplate{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AlertRuleTemplatesListIterator type. +func NewAlertRuleTemplatesListIterator(page AlertRuleTemplatesListPage) AlertRuleTemplatesListIterator { + return AlertRuleTemplatesListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (artl AlertRuleTemplatesList) IsEmpty() bool { + return artl.Value == nil || len(*artl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (artl AlertRuleTemplatesList) hasNextLink() bool { + return artl.NextLink != nil && len(*artl.NextLink) != 0 +} + +// alertRuleTemplatesListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (artl AlertRuleTemplatesList) alertRuleTemplatesListPreparer(ctx context.Context) (*http.Request, error) { + if !artl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(artl.NextLink))) +} + +// AlertRuleTemplatesListPage contains a page of BasicAlertRuleTemplate values. +type AlertRuleTemplatesListPage struct { + fn func(context.Context, AlertRuleTemplatesList) (AlertRuleTemplatesList, error) + artl AlertRuleTemplatesList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AlertRuleTemplatesListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleTemplatesListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.artl) + if err != nil { + return err + } + page.artl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AlertRuleTemplatesListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AlertRuleTemplatesListPage) NotDone() bool { + return !page.artl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AlertRuleTemplatesListPage) Response() AlertRuleTemplatesList { + return page.artl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AlertRuleTemplatesListPage) Values() []BasicAlertRuleTemplate { + if page.artl.IsEmpty() { + return nil + } + return *page.artl.Value +} + +// Creates a new instance of the AlertRuleTemplatesListPage type. +func NewAlertRuleTemplatesListPage(cur AlertRuleTemplatesList, getNextPage func(context.Context, AlertRuleTemplatesList) (AlertRuleTemplatesList, error)) AlertRuleTemplatesListPage { + return AlertRuleTemplatesListPage{ + fn: getNextPage, + artl: cur, + } +} + +// AlertRuleTemplateWithMitreProperties alert rule template with MITRE property bag. +type AlertRuleTemplateWithMitreProperties struct { + // Tactics - The tactics of the alert rule + Tactics *[]AttackTactic `json:"tactics,omitempty"` + // Techniques - The techniques of the alert rule + Techniques *[]string `json:"techniques,omitempty"` + // AlertRulesCreatedByTemplateCount - the number of alert rules that were created by this template + AlertRulesCreatedByTemplateCount *int32 `json:"alertRulesCreatedByTemplateCount,omitempty"` + // LastUpdatedDateUTC - READ-ONLY; The last time that this alert rule template has been updated. + LastUpdatedDateUTC *date.Time `json:"lastUpdatedDateUTC,omitempty"` + // CreatedDateUTC - READ-ONLY; The time that this alert rule template has been added. + CreatedDateUTC *date.Time `json:"createdDateUTC,omitempty"` + // Description - The description of the alert rule template. + Description *string `json:"description,omitempty"` + // DisplayName - The display name for alert rule template. + DisplayName *string `json:"displayName,omitempty"` + // RequiredDataConnectors - The required data sources for this template + RequiredDataConnectors *[]AlertRuleTemplateDataSource `json:"requiredDataConnectors,omitempty"` + // Status - The alert rule template status. Possible values include: 'TemplateStatusInstalled', 'TemplateStatusAvailable', 'TemplateStatusNotAvailable' + Status TemplateStatus `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for AlertRuleTemplateWithMitreProperties. +func (artwmp AlertRuleTemplateWithMitreProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if artwmp.Tactics != nil { + objectMap["tactics"] = artwmp.Tactics + } + if artwmp.Techniques != nil { + objectMap["techniques"] = artwmp.Techniques + } + if artwmp.AlertRulesCreatedByTemplateCount != nil { + objectMap["alertRulesCreatedByTemplateCount"] = artwmp.AlertRulesCreatedByTemplateCount + } + if artwmp.Description != nil { + objectMap["description"] = artwmp.Description + } + if artwmp.DisplayName != nil { + objectMap["displayName"] = artwmp.DisplayName + } + if artwmp.RequiredDataConnectors != nil { + objectMap["requiredDataConnectors"] = artwmp.RequiredDataConnectors + } + if artwmp.Status != "" { + objectMap["status"] = artwmp.Status + } + return json.Marshal(objectMap) +} + +// AlertsDataTypeOfDataConnector alerts data type for data connectors. +type AlertsDataTypeOfDataConnector struct { + // Alerts - Alerts data type connection. + Alerts *DataConnectorDataTypeCommon `json:"alerts,omitempty"` +} + +// Anomalies settings with single toggle. +type Anomalies struct { + // AnomaliesSettingsProperties - Anomalies properties + *AnomaliesSettingsProperties `json:"properties,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` + // Kind - Possible values include: 'KindBasicSettingsKindSettings', 'KindBasicSettingsKindAnomalies', 'KindBasicSettingsKindEyesOn', 'KindBasicSettingsKindEntityAnalytics', 'KindBasicSettingsKindUeba' + Kind KindBasicSettings `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for Anomalies. +func (a Anomalies) MarshalJSON() ([]byte, error) { + a.Kind = KindBasicSettingsKindAnomalies + objectMap := make(map[string]interface{}) + if a.AnomaliesSettingsProperties != nil { + objectMap["properties"] = a.AnomaliesSettingsProperties + } + if a.Kind != "" { + objectMap["kind"] = a.Kind + } + if a.Etag != nil { + objectMap["etag"] = a.Etag + } + return json.Marshal(objectMap) +} + +// AsAnomalies is the BasicSettings implementation for Anomalies. +func (a Anomalies) AsAnomalies() (*Anomalies, bool) { + return &a, true +} + +// AsEyesOn is the BasicSettings implementation for Anomalies. +func (a Anomalies) AsEyesOn() (*EyesOn, bool) { + return nil, false +} + +// AsEntityAnalytics is the BasicSettings implementation for Anomalies. +func (a Anomalies) AsEntityAnalytics() (*EntityAnalytics, bool) { + return nil, false +} + +// AsUeba is the BasicSettings implementation for Anomalies. +func (a Anomalies) AsUeba() (*Ueba, bool) { + return nil, false +} + +// AsSettings is the BasicSettings implementation for Anomalies. +func (a Anomalies) AsSettings() (*Settings, bool) { + return nil, false +} + +// AsBasicSettings is the BasicSettings implementation for Anomalies. +func (a Anomalies) AsBasicSettings() (BasicSettings, bool) { + return &a, true +} + +// UnmarshalJSON is the custom unmarshaler for Anomalies struct. +func (a *Anomalies) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var anomaliesSettingsProperties AnomaliesSettingsProperties + err = json.Unmarshal(*v, &anomaliesSettingsProperties) + if err != nil { + return err + } + a.AnomaliesSettingsProperties = &anomaliesSettingsProperties + } + case "kind": + if v != nil { + var kind KindBasicSettings + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + a.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + a.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + a.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + a.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + a.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + a.SystemData = &systemData + } + } + } + + return nil +} + +// AnomaliesSettingsProperties anomalies property bag. +type AnomaliesSettingsProperties struct { + // IsEnabled - READ-ONLY; Determines whether the setting is enable or disabled. + IsEnabled *bool `json:"isEnabled,omitempty"` +} + +// MarshalJSON is the custom marshaler for AnomaliesSettingsProperties. +func (asp AnomaliesSettingsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// APIPollingParameters represents Codeless API Polling data connector +type APIPollingParameters struct { + // ConnectorUIConfig - Config to describe the instructions blade + ConnectorUIConfig *CodelessUIConnectorConfigProperties `json:"connectorUiConfig,omitempty"` + // PollingConfig - Config to describe the polling instructions + PollingConfig *CodelessConnectorPollingConfigProperties `json:"pollingConfig,omitempty"` +} + +// ASCCheckRequirements represents ASC (Azure Security Center) requirements check request. +type ASCCheckRequirements struct { + // ASCCheckRequirementsProperties - ASC (Azure Security Center) requirements check properties. + *ASCCheckRequirementsProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorsCheckRequirementsKindDataConnectorsCheckRequirements', 'KindBasicDataConnectorsCheckRequirementsKindAzureActiveDirectory', 'KindBasicDataConnectorsCheckRequirementsKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindAzureSecurityCenter', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesS3', 'KindBasicDataConnectorsCheckRequirementsKindDynamics365', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindOfficeATP', 'KindBasicDataConnectorsCheckRequirementsKindOfficeIRM', 'KindBasicDataConnectorsCheckRequirementsKindOffice365Project', 'KindBasicDataConnectorsCheckRequirementsKindOfficePowerBI', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligenceTaxii', 'KindBasicDataConnectorsCheckRequirementsKindIOT' + Kind KindBasicDataConnectorsCheckRequirements `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for ASCCheckRequirements. +func (acr ASCCheckRequirements) MarshalJSON() ([]byte, error) { + acr.Kind = KindBasicDataConnectorsCheckRequirementsKindAzureSecurityCenter + objectMap := make(map[string]interface{}) + if acr.ASCCheckRequirementsProperties != nil { + objectMap["properties"] = acr.ASCCheckRequirementsProperties + } + if acr.Kind != "" { + objectMap["kind"] = acr.Kind + } + return json.Marshal(objectMap) +} + +// AsAADCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for ASCCheckRequirements. +func (acr ASCCheckRequirements) AsAADCheckRequirements() (*AADCheckRequirements, bool) { + return nil, false +} + +// AsAATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for ASCCheckRequirements. +func (acr ASCCheckRequirements) AsAATPCheckRequirements() (*AATPCheckRequirements, bool) { + return nil, false +} + +// AsASCCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for ASCCheckRequirements. +func (acr ASCCheckRequirements) AsASCCheckRequirements() (*ASCCheckRequirements, bool) { + return &acr, true +} + +// AsAwsCloudTrailCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for ASCCheckRequirements. +func (acr ASCCheckRequirements) AsAwsCloudTrailCheckRequirements() (*AwsCloudTrailCheckRequirements, bool) { + return nil, false +} + +// AsAwsS3CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for ASCCheckRequirements. +func (acr ASCCheckRequirements) AsAwsS3CheckRequirements() (*AwsS3CheckRequirements, bool) { + return nil, false +} + +// AsDynamics365CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for ASCCheckRequirements. +func (acr ASCCheckRequirements) AsDynamics365CheckRequirements() (*Dynamics365CheckRequirements, bool) { + return nil, false +} + +// AsMCASCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for ASCCheckRequirements. +func (acr ASCCheckRequirements) AsMCASCheckRequirements() (*MCASCheckRequirements, bool) { + return nil, false +} + +// AsMDATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for ASCCheckRequirements. +func (acr ASCCheckRequirements) AsMDATPCheckRequirements() (*MDATPCheckRequirements, bool) { + return nil, false +} + +// AsMSTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for ASCCheckRequirements. +func (acr ASCCheckRequirements) AsMSTICheckRequirements() (*MSTICheckRequirements, bool) { + return nil, false +} + +// AsMtpCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for ASCCheckRequirements. +func (acr ASCCheckRequirements) AsMtpCheckRequirements() (*MtpCheckRequirements, bool) { + return nil, false +} + +// AsOfficeATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for ASCCheckRequirements. +func (acr ASCCheckRequirements) AsOfficeATPCheckRequirements() (*OfficeATPCheckRequirements, bool) { + return nil, false +} + +// AsOfficeIRMCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for ASCCheckRequirements. +func (acr ASCCheckRequirements) AsOfficeIRMCheckRequirements() (*OfficeIRMCheckRequirements, bool) { + return nil, false +} + +// AsOffice365ProjectCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for ASCCheckRequirements. +func (acr ASCCheckRequirements) AsOffice365ProjectCheckRequirements() (*Office365ProjectCheckRequirements, bool) { + return nil, false +} + +// AsOfficePowerBICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for ASCCheckRequirements. +func (acr ASCCheckRequirements) AsOfficePowerBICheckRequirements() (*OfficePowerBICheckRequirements, bool) { + return nil, false +} + +// AsTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for ASCCheckRequirements. +func (acr ASCCheckRequirements) AsTICheckRequirements() (*TICheckRequirements, bool) { + return nil, false +} + +// AsTiTaxiiCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for ASCCheckRequirements. +func (acr ASCCheckRequirements) AsTiTaxiiCheckRequirements() (*TiTaxiiCheckRequirements, bool) { + return nil, false +} + +// AsIoTCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for ASCCheckRequirements. +func (acr ASCCheckRequirements) AsIoTCheckRequirements() (*IoTCheckRequirements, bool) { + return nil, false +} + +// AsDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for ASCCheckRequirements. +func (acr ASCCheckRequirements) AsDataConnectorsCheckRequirements() (*DataConnectorsCheckRequirements, bool) { + return nil, false +} + +// AsBasicDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for ASCCheckRequirements. +func (acr ASCCheckRequirements) AsBasicDataConnectorsCheckRequirements() (BasicDataConnectorsCheckRequirements, bool) { + return &acr, true +} + +// UnmarshalJSON is the custom unmarshaler for ASCCheckRequirements struct. +func (acr *ASCCheckRequirements) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var aSCCheckRequirementsProperties ASCCheckRequirementsProperties + err = json.Unmarshal(*v, &aSCCheckRequirementsProperties) + if err != nil { + return err + } + acr.ASCCheckRequirementsProperties = &aSCCheckRequirementsProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnectorsCheckRequirements + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + acr.Kind = kind + } + } + } + + return nil +} + +// ASCCheckRequirementsProperties ASC (Azure Security Center) requirements check properties. +type ASCCheckRequirementsProperties struct { + // SubscriptionID - The subscription id to connect to, and get the data from. + SubscriptionID *string `json:"subscriptionId,omitempty"` +} + +// ASCDataConnector represents ASC (Azure Security Center) data connector. +type ASCDataConnector struct { + // ASCDataConnectorProperties - ASC (Azure Security Center) data connector properties. + *ASCDataConnectorProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorKindDataConnector', 'KindBasicDataConnectorKindAzureActiveDirectory', 'KindBasicDataConnectorKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorKindMicrosoftThreatProtection', 'KindBasicDataConnectorKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorKindAzureSecurityCenter', 'KindBasicDataConnectorKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorKindAmazonWebServicesS3', 'KindBasicDataConnectorKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorKindDynamics365', 'KindBasicDataConnectorKindOfficeATP', 'KindBasicDataConnectorKindOffice365Project', 'KindBasicDataConnectorKindOfficePowerBI', 'KindBasicDataConnectorKindOfficeIRM', 'KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorKindOffice365', 'KindBasicDataConnectorKindThreatIntelligence', 'KindBasicDataConnectorKindThreatIntelligenceTaxii', 'KindBasicDataConnectorKindIOT', 'KindBasicDataConnectorKindGenericUI', 'KindBasicDataConnectorKindAPIPolling' + Kind KindBasicDataConnector `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ASCDataConnector. +func (adc ASCDataConnector) MarshalJSON() ([]byte, error) { + adc.Kind = KindBasicDataConnectorKindAzureSecurityCenter + objectMap := make(map[string]interface{}) + if adc.ASCDataConnectorProperties != nil { + objectMap["properties"] = adc.ASCDataConnectorProperties + } + if adc.Kind != "" { + objectMap["kind"] = adc.Kind + } + if adc.Etag != nil { + objectMap["etag"] = adc.Etag + } + return json.Marshal(objectMap) +} + +// AsAADDataConnector is the BasicDataConnector implementation for ASCDataConnector. +func (adc ASCDataConnector) AsAADDataConnector() (*AADDataConnector, bool) { + return nil, false +} + +// AsMSTIDataConnector is the BasicDataConnector implementation for ASCDataConnector. +func (adc ASCDataConnector) AsMSTIDataConnector() (*MSTIDataConnector, bool) { + return nil, false +} + +// AsMTPDataConnector is the BasicDataConnector implementation for ASCDataConnector. +func (adc ASCDataConnector) AsMTPDataConnector() (*MTPDataConnector, bool) { + return nil, false +} + +// AsAATPDataConnector is the BasicDataConnector implementation for ASCDataConnector. +func (adc ASCDataConnector) AsAATPDataConnector() (*AATPDataConnector, bool) { + return nil, false +} + +// AsASCDataConnector is the BasicDataConnector implementation for ASCDataConnector. +func (adc ASCDataConnector) AsASCDataConnector() (*ASCDataConnector, bool) { + return &adc, true +} + +// AsAwsCloudTrailDataConnector is the BasicDataConnector implementation for ASCDataConnector. +func (adc ASCDataConnector) AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) { + return nil, false +} + +// AsAwsS3DataConnector is the BasicDataConnector implementation for ASCDataConnector. +func (adc ASCDataConnector) AsAwsS3DataConnector() (*AwsS3DataConnector, bool) { + return nil, false +} + +// AsMCASDataConnector is the BasicDataConnector implementation for ASCDataConnector. +func (adc ASCDataConnector) AsMCASDataConnector() (*MCASDataConnector, bool) { + return nil, false +} + +// AsDynamics365DataConnector is the BasicDataConnector implementation for ASCDataConnector. +func (adc ASCDataConnector) AsDynamics365DataConnector() (*Dynamics365DataConnector, bool) { + return nil, false +} + +// AsOfficeATPDataConnector is the BasicDataConnector implementation for ASCDataConnector. +func (adc ASCDataConnector) AsOfficeATPDataConnector() (*OfficeATPDataConnector, bool) { + return nil, false +} + +// AsOffice365ProjectDataConnector is the BasicDataConnector implementation for ASCDataConnector. +func (adc ASCDataConnector) AsOffice365ProjectDataConnector() (*Office365ProjectDataConnector, bool) { + return nil, false +} + +// AsOfficePowerBIDataConnector is the BasicDataConnector implementation for ASCDataConnector. +func (adc ASCDataConnector) AsOfficePowerBIDataConnector() (*OfficePowerBIDataConnector, bool) { + return nil, false +} + +// AsOfficeIRMDataConnector is the BasicDataConnector implementation for ASCDataConnector. +func (adc ASCDataConnector) AsOfficeIRMDataConnector() (*OfficeIRMDataConnector, bool) { + return nil, false +} + +// AsMDATPDataConnector is the BasicDataConnector implementation for ASCDataConnector. +func (adc ASCDataConnector) AsMDATPDataConnector() (*MDATPDataConnector, bool) { + return nil, false +} + +// AsOfficeDataConnector is the BasicDataConnector implementation for ASCDataConnector. +func (adc ASCDataConnector) AsOfficeDataConnector() (*OfficeDataConnector, bool) { + return nil, false +} + +// AsTIDataConnector is the BasicDataConnector implementation for ASCDataConnector. +func (adc ASCDataConnector) AsTIDataConnector() (*TIDataConnector, bool) { + return nil, false +} + +// AsTiTaxiiDataConnector is the BasicDataConnector implementation for ASCDataConnector. +func (adc ASCDataConnector) AsTiTaxiiDataConnector() (*TiTaxiiDataConnector, bool) { + return nil, false +} + +// AsIoTDataConnector is the BasicDataConnector implementation for ASCDataConnector. +func (adc ASCDataConnector) AsIoTDataConnector() (*IoTDataConnector, bool) { + return nil, false +} + +// AsCodelessUIDataConnector is the BasicDataConnector implementation for ASCDataConnector. +func (adc ASCDataConnector) AsCodelessUIDataConnector() (*CodelessUIDataConnector, bool) { + return nil, false +} + +// AsCodelessAPIPollingDataConnector is the BasicDataConnector implementation for ASCDataConnector. +func (adc ASCDataConnector) AsCodelessAPIPollingDataConnector() (*CodelessAPIPollingDataConnector, bool) { + return nil, false +} + +// AsDataConnector is the BasicDataConnector implementation for ASCDataConnector. +func (adc ASCDataConnector) AsDataConnector() (*DataConnector, bool) { + return nil, false +} + +// AsBasicDataConnector is the BasicDataConnector implementation for ASCDataConnector. +func (adc ASCDataConnector) AsBasicDataConnector() (BasicDataConnector, bool) { + return &adc, true +} + +// UnmarshalJSON is the custom unmarshaler for ASCDataConnector struct. +func (adc *ASCDataConnector) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var aSCDataConnectorProperties ASCDataConnectorProperties + err = json.Unmarshal(*v, &aSCDataConnectorProperties) + if err != nil { + return err + } + adc.ASCDataConnectorProperties = &aSCDataConnectorProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnector + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + adc.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + adc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + adc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + adc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + adc.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + adc.SystemData = &systemData + } + } + } + + return nil +} + +// ASCDataConnectorProperties ASC (Azure Security Center) data connector properties. +type ASCDataConnectorProperties struct { + // SubscriptionID - The subscription id to connect to, and get the data from. + SubscriptionID *string `json:"subscriptionId,omitempty"` + // DataTypes - The available data types for the connector. + DataTypes *AlertsDataTypeOfDataConnector `json:"dataTypes,omitempty"` +} + +// AutomationRule ... +type AutomationRule struct { + autorest.Response `json:"-"` + *AutomationRuleProperties `json:"properties,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutomationRule. +func (ar AutomationRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ar.AutomationRuleProperties != nil { + objectMap["properties"] = ar.AutomationRuleProperties + } + if ar.Etag != nil { + objectMap["etag"] = ar.Etag + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AutomationRule struct. +func (ar *AutomationRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var automationRuleProperties AutomationRuleProperties + err = json.Unmarshal(*v, &automationRuleProperties) + if err != nil { + return err + } + ar.AutomationRuleProperties = &automationRuleProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ar.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ar.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + ar.SystemData = &systemData + } + } + } + + return nil +} + +// BasicAutomationRuleAction describes an automation rule action +type BasicAutomationRuleAction interface { + AsAutomationRuleModifyPropertiesAction() (*AutomationRuleModifyPropertiesAction, bool) + AsAutomationRuleRunPlaybookAction() (*AutomationRuleRunPlaybookAction, bool) + AsAutomationRuleAction() (*AutomationRuleAction, bool) +} + +// AutomationRuleAction describes an automation rule action +type AutomationRuleAction struct { + Order *int32 `json:"order,omitempty"` + // ActionType - Possible values include: 'ActionTypeBasicAutomationRuleActionActionTypeAutomationRuleAction', 'ActionTypeBasicAutomationRuleActionActionTypeModifyProperties', 'ActionTypeBasicAutomationRuleActionActionTypeRunPlaybook' + ActionType ActionTypeBasicAutomationRuleAction `json:"actionType,omitempty"` +} + +func unmarshalBasicAutomationRuleAction(body []byte) (BasicAutomationRuleAction, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["actionType"] { + case string(ActionTypeBasicAutomationRuleActionActionTypeModifyProperties): + var armpa AutomationRuleModifyPropertiesAction + err := json.Unmarshal(body, &armpa) + return armpa, err + case string(ActionTypeBasicAutomationRuleActionActionTypeRunPlaybook): + var arrpa AutomationRuleRunPlaybookAction + err := json.Unmarshal(body, &arrpa) + return arrpa, err + default: + var ara AutomationRuleAction + err := json.Unmarshal(body, &ara) + return ara, err + } +} +func unmarshalBasicAutomationRuleActionArray(body []byte) ([]BasicAutomationRuleAction, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + araArray := make([]BasicAutomationRuleAction, len(rawMessages)) + + for index, rawMessage := range rawMessages { + ara, err := unmarshalBasicAutomationRuleAction(*rawMessage) + if err != nil { + return nil, err + } + araArray[index] = ara + } + return araArray, nil +} + +// MarshalJSON is the custom marshaler for AutomationRuleAction. +func (ara AutomationRuleAction) MarshalJSON() ([]byte, error) { + ara.ActionType = ActionTypeBasicAutomationRuleActionActionTypeAutomationRuleAction + objectMap := make(map[string]interface{}) + if ara.Order != nil { + objectMap["order"] = ara.Order + } + if ara.ActionType != "" { + objectMap["actionType"] = ara.ActionType + } + return json.Marshal(objectMap) +} + +// AsAutomationRuleModifyPropertiesAction is the BasicAutomationRuleAction implementation for AutomationRuleAction. +func (ara AutomationRuleAction) AsAutomationRuleModifyPropertiesAction() (*AutomationRuleModifyPropertiesAction, bool) { + return nil, false +} + +// AsAutomationRuleRunPlaybookAction is the BasicAutomationRuleAction implementation for AutomationRuleAction. +func (ara AutomationRuleAction) AsAutomationRuleRunPlaybookAction() (*AutomationRuleRunPlaybookAction, bool) { + return nil, false +} + +// AsAutomationRuleAction is the BasicAutomationRuleAction implementation for AutomationRuleAction. +func (ara AutomationRuleAction) AsAutomationRuleAction() (*AutomationRuleAction, bool) { + return &ara, true +} + +// AsBasicAutomationRuleAction is the BasicAutomationRuleAction implementation for AutomationRuleAction. +func (ara AutomationRuleAction) AsBasicAutomationRuleAction() (BasicAutomationRuleAction, bool) { + return &ara, true +} + +// BasicAutomationRuleCondition describes an automation rule condition +type BasicAutomationRuleCondition interface { + AsPropertyConditionProperties() (*PropertyConditionProperties, bool) + AsAutomationRuleCondition() (*AutomationRuleCondition, bool) +} + +// AutomationRuleCondition describes an automation rule condition +type AutomationRuleCondition struct { + // ConditionType - Possible values include: 'ConditionTypeBasicAutomationRuleConditionConditionTypeAutomationRuleCondition', 'ConditionTypeBasicAutomationRuleConditionConditionTypeProperty' + ConditionType ConditionTypeBasicAutomationRuleCondition `json:"conditionType,omitempty"` +} + +func unmarshalBasicAutomationRuleCondition(body []byte) (BasicAutomationRuleCondition, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["conditionType"] { + case string(ConditionTypeBasicAutomationRuleConditionConditionTypeProperty): + var pcp PropertyConditionProperties + err := json.Unmarshal(body, &pcp) + return pcp, err + default: + var arc AutomationRuleCondition + err := json.Unmarshal(body, &arc) + return arc, err + } +} +func unmarshalBasicAutomationRuleConditionArray(body []byte) ([]BasicAutomationRuleCondition, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + arcArray := make([]BasicAutomationRuleCondition, len(rawMessages)) + + for index, rawMessage := range rawMessages { + arc, err := unmarshalBasicAutomationRuleCondition(*rawMessage) + if err != nil { + return nil, err + } + arcArray[index] = arc + } + return arcArray, nil +} + +// MarshalJSON is the custom marshaler for AutomationRuleCondition. +func (arc AutomationRuleCondition) MarshalJSON() ([]byte, error) { + arc.ConditionType = ConditionTypeBasicAutomationRuleConditionConditionTypeAutomationRuleCondition + objectMap := make(map[string]interface{}) + if arc.ConditionType != "" { + objectMap["conditionType"] = arc.ConditionType + } + return json.Marshal(objectMap) +} + +// AsPropertyConditionProperties is the BasicAutomationRuleCondition implementation for AutomationRuleCondition. +func (arc AutomationRuleCondition) AsPropertyConditionProperties() (*PropertyConditionProperties, bool) { + return nil, false +} + +// AsAutomationRuleCondition is the BasicAutomationRuleCondition implementation for AutomationRuleCondition. +func (arc AutomationRuleCondition) AsAutomationRuleCondition() (*AutomationRuleCondition, bool) { + return &arc, true +} + +// AsBasicAutomationRuleCondition is the BasicAutomationRuleCondition implementation for AutomationRuleCondition. +func (arc AutomationRuleCondition) AsBasicAutomationRuleCondition() (BasicAutomationRuleCondition, bool) { + return &arc, true +} + +// AutomationRuleModifyPropertiesAction describes an automation rule action to modify an object's +// properties +type AutomationRuleModifyPropertiesAction struct { + ActionConfiguration *IncidentPropertiesAction `json:"actionConfiguration,omitempty"` + Order *int32 `json:"order,omitempty"` + // ActionType - Possible values include: 'ActionTypeBasicAutomationRuleActionActionTypeAutomationRuleAction', 'ActionTypeBasicAutomationRuleActionActionTypeModifyProperties', 'ActionTypeBasicAutomationRuleActionActionTypeRunPlaybook' + ActionType ActionTypeBasicAutomationRuleAction `json:"actionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutomationRuleModifyPropertiesAction. +func (armpa AutomationRuleModifyPropertiesAction) MarshalJSON() ([]byte, error) { + armpa.ActionType = ActionTypeBasicAutomationRuleActionActionTypeModifyProperties + objectMap := make(map[string]interface{}) + if armpa.ActionConfiguration != nil { + objectMap["actionConfiguration"] = armpa.ActionConfiguration + } + if armpa.Order != nil { + objectMap["order"] = armpa.Order + } + if armpa.ActionType != "" { + objectMap["actionType"] = armpa.ActionType + } + return json.Marshal(objectMap) +} + +// AsAutomationRuleModifyPropertiesAction is the BasicAutomationRuleAction implementation for AutomationRuleModifyPropertiesAction. +func (armpa AutomationRuleModifyPropertiesAction) AsAutomationRuleModifyPropertiesAction() (*AutomationRuleModifyPropertiesAction, bool) { + return &armpa, true +} + +// AsAutomationRuleRunPlaybookAction is the BasicAutomationRuleAction implementation for AutomationRuleModifyPropertiesAction. +func (armpa AutomationRuleModifyPropertiesAction) AsAutomationRuleRunPlaybookAction() (*AutomationRuleRunPlaybookAction, bool) { + return nil, false +} + +// AsAutomationRuleAction is the BasicAutomationRuleAction implementation for AutomationRuleModifyPropertiesAction. +func (armpa AutomationRuleModifyPropertiesAction) AsAutomationRuleAction() (*AutomationRuleAction, bool) { + return nil, false +} + +// AsBasicAutomationRuleAction is the BasicAutomationRuleAction implementation for AutomationRuleModifyPropertiesAction. +func (armpa AutomationRuleModifyPropertiesAction) AsBasicAutomationRuleAction() (BasicAutomationRuleAction, bool) { + return &armpa, true +} + +// AutomationRuleProperties automation rule properties +type AutomationRuleProperties struct { + // DisplayName - The display name of the automation rule + DisplayName *string `json:"displayName,omitempty"` + // Order - The order of execution of the automation rule + Order *int32 `json:"order,omitempty"` + TriggeringLogic *AutomationRuleTriggeringLogic `json:"triggeringLogic,omitempty"` + // Actions - The actions to execute when the automation rule is triggered + Actions *[]BasicAutomationRuleAction `json:"actions,omitempty"` + // LastModifiedTimeUtc - READ-ONLY; The last time the automation rule was updated + LastModifiedTimeUtc *date.Time `json:"lastModifiedTimeUtc,omitempty"` + // CreatedTimeUtc - READ-ONLY; The time the automation rule was created + CreatedTimeUtc *date.Time `json:"createdTimeUtc,omitempty"` + // LastModifiedBy - READ-ONLY + LastModifiedBy *ClientInfo `json:"lastModifiedBy,omitempty"` + // CreatedBy - READ-ONLY + CreatedBy *ClientInfo `json:"createdBy,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutomationRuleProperties. +func (arp AutomationRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if arp.DisplayName != nil { + objectMap["displayName"] = arp.DisplayName + } + if arp.Order != nil { + objectMap["order"] = arp.Order + } + if arp.TriggeringLogic != nil { + objectMap["triggeringLogic"] = arp.TriggeringLogic + } + if arp.Actions != nil { + objectMap["actions"] = arp.Actions + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AutomationRuleProperties struct. +func (arp *AutomationRuleProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "displayName": + if v != nil { + var displayName string + err = json.Unmarshal(*v, &displayName) + if err != nil { + return err + } + arp.DisplayName = &displayName + } + case "order": + if v != nil { + var order int32 + err = json.Unmarshal(*v, &order) + if err != nil { + return err + } + arp.Order = &order + } + case "triggeringLogic": + if v != nil { + var triggeringLogic AutomationRuleTriggeringLogic + err = json.Unmarshal(*v, &triggeringLogic) + if err != nil { + return err + } + arp.TriggeringLogic = &triggeringLogic + } + case "actions": + if v != nil { + actions, err := unmarshalBasicAutomationRuleActionArray(*v) + if err != nil { + return err + } + arp.Actions = &actions + } + case "lastModifiedTimeUtc": + if v != nil { + var lastModifiedTimeUtc date.Time + err = json.Unmarshal(*v, &lastModifiedTimeUtc) + if err != nil { + return err + } + arp.LastModifiedTimeUtc = &lastModifiedTimeUtc + } + case "createdTimeUtc": + if v != nil { + var createdTimeUtc date.Time + err = json.Unmarshal(*v, &createdTimeUtc) + if err != nil { + return err + } + arp.CreatedTimeUtc = &createdTimeUtc + } + case "lastModifiedBy": + if v != nil { + var lastModifiedBy ClientInfo + err = json.Unmarshal(*v, &lastModifiedBy) + if err != nil { + return err + } + arp.LastModifiedBy = &lastModifiedBy + } + case "createdBy": + if v != nil { + var createdBy ClientInfo + err = json.Unmarshal(*v, &createdBy) + if err != nil { + return err + } + arp.CreatedBy = &createdBy + } + } + } + + return nil +} + +// AutomationRulePropertyValuesCondition ... +type AutomationRulePropertyValuesCondition struct { + // PropertyName - Possible values include: 'AutomationRulePropertyConditionSupportedPropertyIncidentTitle', 'AutomationRulePropertyConditionSupportedPropertyIncidentDescription', 'AutomationRulePropertyConditionSupportedPropertyIncidentSeverity', 'AutomationRulePropertyConditionSupportedPropertyIncidentStatus', 'AutomationRulePropertyConditionSupportedPropertyIncidentRelatedAnalyticRuleIds', 'AutomationRulePropertyConditionSupportedPropertyIncidentTactics', 'AutomationRulePropertyConditionSupportedPropertyIncidentLabel', 'AutomationRulePropertyConditionSupportedPropertyIncidentProviderName', 'AutomationRulePropertyConditionSupportedPropertyAccountAadTenantID', 'AutomationRulePropertyConditionSupportedPropertyAccountAadUserID', 'AutomationRulePropertyConditionSupportedPropertyAccountName', 'AutomationRulePropertyConditionSupportedPropertyAccountNTDomain', 'AutomationRulePropertyConditionSupportedPropertyAccountPUID', 'AutomationRulePropertyConditionSupportedPropertyAccountSid', 'AutomationRulePropertyConditionSupportedPropertyAccountObjectGUID', 'AutomationRulePropertyConditionSupportedPropertyAccountUPNSuffix', 'AutomationRulePropertyConditionSupportedPropertyAlertProductNames', 'AutomationRulePropertyConditionSupportedPropertyAzureResourceResourceID', 'AutomationRulePropertyConditionSupportedPropertyAzureResourceSubscriptionID', 'AutomationRulePropertyConditionSupportedPropertyCloudApplicationAppID', 'AutomationRulePropertyConditionSupportedPropertyCloudApplicationAppName', 'AutomationRulePropertyConditionSupportedPropertyDNSDomainName', 'AutomationRulePropertyConditionSupportedPropertyFileDirectory', 'AutomationRulePropertyConditionSupportedPropertyFileName', 'AutomationRulePropertyConditionSupportedPropertyFileHashValue', 'AutomationRulePropertyConditionSupportedPropertyHostAzureID', 'AutomationRulePropertyConditionSupportedPropertyHostName', 'AutomationRulePropertyConditionSupportedPropertyHostNetBiosName', 'AutomationRulePropertyConditionSupportedPropertyHostNTDomain', 'AutomationRulePropertyConditionSupportedPropertyHostOSVersion', 'AutomationRulePropertyConditionSupportedPropertyIoTDeviceID', 'AutomationRulePropertyConditionSupportedPropertyIoTDeviceName', 'AutomationRulePropertyConditionSupportedPropertyIoTDeviceType', 'AutomationRulePropertyConditionSupportedPropertyIoTDeviceVendor', 'AutomationRulePropertyConditionSupportedPropertyIoTDeviceModel', 'AutomationRulePropertyConditionSupportedPropertyIoTDeviceOperatingSystem', 'AutomationRulePropertyConditionSupportedPropertyIPAddress', 'AutomationRulePropertyConditionSupportedPropertyMailboxDisplayName', 'AutomationRulePropertyConditionSupportedPropertyMailboxPrimaryAddress', 'AutomationRulePropertyConditionSupportedPropertyMailboxUPN', 'AutomationRulePropertyConditionSupportedPropertyMailMessageDeliveryAction', 'AutomationRulePropertyConditionSupportedPropertyMailMessageDeliveryLocation', 'AutomationRulePropertyConditionSupportedPropertyMailMessageRecipient', 'AutomationRulePropertyConditionSupportedPropertyMailMessageSenderIP', 'AutomationRulePropertyConditionSupportedPropertyMailMessageSubject', 'AutomationRulePropertyConditionSupportedPropertyMailMessageP1Sender', 'AutomationRulePropertyConditionSupportedPropertyMailMessageP2Sender', 'AutomationRulePropertyConditionSupportedPropertyMalwareCategory', 'AutomationRulePropertyConditionSupportedPropertyMalwareName', 'AutomationRulePropertyConditionSupportedPropertyProcessCommandLine', 'AutomationRulePropertyConditionSupportedPropertyProcessID', 'AutomationRulePropertyConditionSupportedPropertyRegistryKey', 'AutomationRulePropertyConditionSupportedPropertyRegistryValueData', 'AutomationRulePropertyConditionSupportedPropertyURL' + PropertyName AutomationRulePropertyConditionSupportedProperty `json:"propertyName,omitempty"` + // Operator - Possible values include: 'AutomationRulePropertyConditionSupportedOperatorEquals', 'AutomationRulePropertyConditionSupportedOperatorNotEquals', 'AutomationRulePropertyConditionSupportedOperatorContains', 'AutomationRulePropertyConditionSupportedOperatorNotContains', 'AutomationRulePropertyConditionSupportedOperatorStartsWith', 'AutomationRulePropertyConditionSupportedOperatorNotStartsWith', 'AutomationRulePropertyConditionSupportedOperatorEndsWith', 'AutomationRulePropertyConditionSupportedOperatorNotEndsWith' + Operator AutomationRulePropertyConditionSupportedOperator `json:"operator,omitempty"` + PropertyValues *[]string `json:"propertyValues,omitempty"` +} + +// AutomationRuleRunPlaybookAction describes an automation rule action to run a playbook +type AutomationRuleRunPlaybookAction struct { + ActionConfiguration *PlaybookActionProperties `json:"actionConfiguration,omitempty"` + Order *int32 `json:"order,omitempty"` + // ActionType - Possible values include: 'ActionTypeBasicAutomationRuleActionActionTypeAutomationRuleAction', 'ActionTypeBasicAutomationRuleActionActionTypeModifyProperties', 'ActionTypeBasicAutomationRuleActionActionTypeRunPlaybook' + ActionType ActionTypeBasicAutomationRuleAction `json:"actionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutomationRuleRunPlaybookAction. +func (arrpa AutomationRuleRunPlaybookAction) MarshalJSON() ([]byte, error) { + arrpa.ActionType = ActionTypeBasicAutomationRuleActionActionTypeRunPlaybook + objectMap := make(map[string]interface{}) + if arrpa.ActionConfiguration != nil { + objectMap["actionConfiguration"] = arrpa.ActionConfiguration + } + if arrpa.Order != nil { + objectMap["order"] = arrpa.Order + } + if arrpa.ActionType != "" { + objectMap["actionType"] = arrpa.ActionType + } + return json.Marshal(objectMap) +} + +// AsAutomationRuleModifyPropertiesAction is the BasicAutomationRuleAction implementation for AutomationRuleRunPlaybookAction. +func (arrpa AutomationRuleRunPlaybookAction) AsAutomationRuleModifyPropertiesAction() (*AutomationRuleModifyPropertiesAction, bool) { + return nil, false +} + +// AsAutomationRuleRunPlaybookAction is the BasicAutomationRuleAction implementation for AutomationRuleRunPlaybookAction. +func (arrpa AutomationRuleRunPlaybookAction) AsAutomationRuleRunPlaybookAction() (*AutomationRuleRunPlaybookAction, bool) { + return &arrpa, true +} + +// AsAutomationRuleAction is the BasicAutomationRuleAction implementation for AutomationRuleRunPlaybookAction. +func (arrpa AutomationRuleRunPlaybookAction) AsAutomationRuleAction() (*AutomationRuleAction, bool) { + return nil, false +} + +// AsBasicAutomationRuleAction is the BasicAutomationRuleAction implementation for AutomationRuleRunPlaybookAction. +func (arrpa AutomationRuleRunPlaybookAction) AsBasicAutomationRuleAction() (BasicAutomationRuleAction, bool) { + return &arrpa, true +} + +// AutomationRulesList ... +type AutomationRulesList struct { + autorest.Response `json:"-"` + Value *[]AutomationRule `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// AutomationRulesListIterator provides access to a complete listing of AutomationRule values. +type AutomationRulesListIterator struct { + i int + page AutomationRulesListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AutomationRulesListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationRulesListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AutomationRulesListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AutomationRulesListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AutomationRulesListIterator) Response() AutomationRulesList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AutomationRulesListIterator) Value() AutomationRule { + if !iter.page.NotDone() { + return AutomationRule{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AutomationRulesListIterator type. +func NewAutomationRulesListIterator(page AutomationRulesListPage) AutomationRulesListIterator { + return AutomationRulesListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (arl AutomationRulesList) IsEmpty() bool { + return arl.Value == nil || len(*arl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (arl AutomationRulesList) hasNextLink() bool { + return arl.NextLink != nil && len(*arl.NextLink) != 0 +} + +// automationRulesListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (arl AutomationRulesList) automationRulesListPreparer(ctx context.Context) (*http.Request, error) { + if !arl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(arl.NextLink))) +} + +// AutomationRulesListPage contains a page of AutomationRule values. +type AutomationRulesListPage struct { + fn func(context.Context, AutomationRulesList) (AutomationRulesList, error) + arl AutomationRulesList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AutomationRulesListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationRulesListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.arl) + if err != nil { + return err + } + page.arl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AutomationRulesListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AutomationRulesListPage) NotDone() bool { + return !page.arl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AutomationRulesListPage) Response() AutomationRulesList { + return page.arl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AutomationRulesListPage) Values() []AutomationRule { + if page.arl.IsEmpty() { + return nil + } + return *page.arl.Value +} + +// Creates a new instance of the AutomationRulesListPage type. +func NewAutomationRulesListPage(cur AutomationRulesList, getNextPage func(context.Context, AutomationRulesList) (AutomationRulesList, error)) AutomationRulesListPage { + return AutomationRulesListPage{ + fn: getNextPage, + arl: cur, + } +} + +// AutomationRuleTriggeringLogic describes automation rule triggering logic +type AutomationRuleTriggeringLogic struct { + // IsEnabled - Determines whether the automation rule is enabled or disabled + IsEnabled *bool `json:"isEnabled,omitempty"` + // ExpirationTimeUtc - Determines when the automation rule should automatically expire and be disabled. + ExpirationTimeUtc *date.Time `json:"expirationTimeUtc,omitempty"` + TriggersOn *string `json:"triggersOn,omitempty"` + TriggersWhen *string `json:"triggersWhen,omitempty"` + // Conditions - The conditions to evaluate to determine if the automation rule should be triggered on a given object + Conditions *[]BasicAutomationRuleCondition `json:"conditions,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for AutomationRuleTriggeringLogic struct. +func (artl *AutomationRuleTriggeringLogic) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "isEnabled": + if v != nil { + var isEnabled bool + err = json.Unmarshal(*v, &isEnabled) + if err != nil { + return err + } + artl.IsEnabled = &isEnabled + } + case "expirationTimeUtc": + if v != nil { + var expirationTimeUtc date.Time + err = json.Unmarshal(*v, &expirationTimeUtc) + if err != nil { + return err + } + artl.ExpirationTimeUtc = &expirationTimeUtc + } + case "triggersOn": + if v != nil { + var triggersOn string + err = json.Unmarshal(*v, &triggersOn) + if err != nil { + return err + } + artl.TriggersOn = &triggersOn + } + case "triggersWhen": + if v != nil { + var triggersWhen string + err = json.Unmarshal(*v, &triggersWhen) + if err != nil { + return err + } + artl.TriggersWhen = &triggersWhen + } + case "conditions": + if v != nil { + conditions, err := unmarshalBasicAutomationRuleConditionArray(*v) + if err != nil { + return err + } + artl.Conditions = &conditions + } + } + } + + return nil +} + +// Availability connector Availability Status +type Availability struct { + // Status - The connector Availability Status + Status *int32 `json:"status,omitempty"` + // IsPreview - Set connector as preview + IsPreview *bool `json:"isPreview,omitempty"` +} + +// AwsCloudTrailCheckRequirements amazon Web Services CloudTrail requirements check request. +type AwsCloudTrailCheckRequirements struct { + // Kind - Possible values include: 'KindBasicDataConnectorsCheckRequirementsKindDataConnectorsCheckRequirements', 'KindBasicDataConnectorsCheckRequirementsKindAzureActiveDirectory', 'KindBasicDataConnectorsCheckRequirementsKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindAzureSecurityCenter', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesS3', 'KindBasicDataConnectorsCheckRequirementsKindDynamics365', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindOfficeATP', 'KindBasicDataConnectorsCheckRequirementsKindOfficeIRM', 'KindBasicDataConnectorsCheckRequirementsKindOffice365Project', 'KindBasicDataConnectorsCheckRequirementsKindOfficePowerBI', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligenceTaxii', 'KindBasicDataConnectorsCheckRequirementsKindIOT' + Kind KindBasicDataConnectorsCheckRequirements `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for AwsCloudTrailCheckRequirements. +func (actcr AwsCloudTrailCheckRequirements) MarshalJSON() ([]byte, error) { + actcr.Kind = KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesCloudTrail + objectMap := make(map[string]interface{}) + if actcr.Kind != "" { + objectMap["kind"] = actcr.Kind + } + return json.Marshal(objectMap) +} + +// AsAADCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsCloudTrailCheckRequirements. +func (actcr AwsCloudTrailCheckRequirements) AsAADCheckRequirements() (*AADCheckRequirements, bool) { + return nil, false +} + +// AsAATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsCloudTrailCheckRequirements. +func (actcr AwsCloudTrailCheckRequirements) AsAATPCheckRequirements() (*AATPCheckRequirements, bool) { + return nil, false +} + +// AsASCCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsCloudTrailCheckRequirements. +func (actcr AwsCloudTrailCheckRequirements) AsASCCheckRequirements() (*ASCCheckRequirements, bool) { + return nil, false +} + +// AsAwsCloudTrailCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsCloudTrailCheckRequirements. +func (actcr AwsCloudTrailCheckRequirements) AsAwsCloudTrailCheckRequirements() (*AwsCloudTrailCheckRequirements, bool) { + return &actcr, true +} + +// AsAwsS3CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsCloudTrailCheckRequirements. +func (actcr AwsCloudTrailCheckRequirements) AsAwsS3CheckRequirements() (*AwsS3CheckRequirements, bool) { + return nil, false +} + +// AsDynamics365CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsCloudTrailCheckRequirements. +func (actcr AwsCloudTrailCheckRequirements) AsDynamics365CheckRequirements() (*Dynamics365CheckRequirements, bool) { + return nil, false +} + +// AsMCASCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsCloudTrailCheckRequirements. +func (actcr AwsCloudTrailCheckRequirements) AsMCASCheckRequirements() (*MCASCheckRequirements, bool) { + return nil, false +} + +// AsMDATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsCloudTrailCheckRequirements. +func (actcr AwsCloudTrailCheckRequirements) AsMDATPCheckRequirements() (*MDATPCheckRequirements, bool) { + return nil, false +} + +// AsMSTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsCloudTrailCheckRequirements. +func (actcr AwsCloudTrailCheckRequirements) AsMSTICheckRequirements() (*MSTICheckRequirements, bool) { + return nil, false +} + +// AsMtpCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsCloudTrailCheckRequirements. +func (actcr AwsCloudTrailCheckRequirements) AsMtpCheckRequirements() (*MtpCheckRequirements, bool) { + return nil, false +} + +// AsOfficeATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsCloudTrailCheckRequirements. +func (actcr AwsCloudTrailCheckRequirements) AsOfficeATPCheckRequirements() (*OfficeATPCheckRequirements, bool) { + return nil, false +} + +// AsOfficeIRMCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsCloudTrailCheckRequirements. +func (actcr AwsCloudTrailCheckRequirements) AsOfficeIRMCheckRequirements() (*OfficeIRMCheckRequirements, bool) { + return nil, false +} + +// AsOffice365ProjectCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsCloudTrailCheckRequirements. +func (actcr AwsCloudTrailCheckRequirements) AsOffice365ProjectCheckRequirements() (*Office365ProjectCheckRequirements, bool) { + return nil, false +} + +// AsOfficePowerBICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsCloudTrailCheckRequirements. +func (actcr AwsCloudTrailCheckRequirements) AsOfficePowerBICheckRequirements() (*OfficePowerBICheckRequirements, bool) { + return nil, false +} + +// AsTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsCloudTrailCheckRequirements. +func (actcr AwsCloudTrailCheckRequirements) AsTICheckRequirements() (*TICheckRequirements, bool) { + return nil, false +} + +// AsTiTaxiiCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsCloudTrailCheckRequirements. +func (actcr AwsCloudTrailCheckRequirements) AsTiTaxiiCheckRequirements() (*TiTaxiiCheckRequirements, bool) { + return nil, false +} + +// AsIoTCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsCloudTrailCheckRequirements. +func (actcr AwsCloudTrailCheckRequirements) AsIoTCheckRequirements() (*IoTCheckRequirements, bool) { + return nil, false +} + +// AsDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsCloudTrailCheckRequirements. +func (actcr AwsCloudTrailCheckRequirements) AsDataConnectorsCheckRequirements() (*DataConnectorsCheckRequirements, bool) { + return nil, false +} + +// AsBasicDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsCloudTrailCheckRequirements. +func (actcr AwsCloudTrailCheckRequirements) AsBasicDataConnectorsCheckRequirements() (BasicDataConnectorsCheckRequirements, bool) { + return &actcr, true +} + +// AwsCloudTrailDataConnector represents Amazon Web Services CloudTrail data connector. +type AwsCloudTrailDataConnector struct { + // AwsCloudTrailDataConnectorProperties - Amazon Web Services CloudTrail data connector properties. + *AwsCloudTrailDataConnectorProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorKindDataConnector', 'KindBasicDataConnectorKindAzureActiveDirectory', 'KindBasicDataConnectorKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorKindMicrosoftThreatProtection', 'KindBasicDataConnectorKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorKindAzureSecurityCenter', 'KindBasicDataConnectorKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorKindAmazonWebServicesS3', 'KindBasicDataConnectorKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorKindDynamics365', 'KindBasicDataConnectorKindOfficeATP', 'KindBasicDataConnectorKindOffice365Project', 'KindBasicDataConnectorKindOfficePowerBI', 'KindBasicDataConnectorKindOfficeIRM', 'KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorKindOffice365', 'KindBasicDataConnectorKindThreatIntelligence', 'KindBasicDataConnectorKindThreatIntelligenceTaxii', 'KindBasicDataConnectorKindIOT', 'KindBasicDataConnectorKindGenericUI', 'KindBasicDataConnectorKindAPIPolling' + Kind KindBasicDataConnector `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for AwsCloudTrailDataConnector. +func (actdc AwsCloudTrailDataConnector) MarshalJSON() ([]byte, error) { + actdc.Kind = KindBasicDataConnectorKindAmazonWebServicesCloudTrail + objectMap := make(map[string]interface{}) + if actdc.AwsCloudTrailDataConnectorProperties != nil { + objectMap["properties"] = actdc.AwsCloudTrailDataConnectorProperties + } + if actdc.Kind != "" { + objectMap["kind"] = actdc.Kind + } + if actdc.Etag != nil { + objectMap["etag"] = actdc.Etag + } + return json.Marshal(objectMap) +} + +// AsAADDataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. +func (actdc AwsCloudTrailDataConnector) AsAADDataConnector() (*AADDataConnector, bool) { + return nil, false +} + +// AsMSTIDataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. +func (actdc AwsCloudTrailDataConnector) AsMSTIDataConnector() (*MSTIDataConnector, bool) { + return nil, false +} + +// AsMTPDataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. +func (actdc AwsCloudTrailDataConnector) AsMTPDataConnector() (*MTPDataConnector, bool) { + return nil, false +} + +// AsAATPDataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. +func (actdc AwsCloudTrailDataConnector) AsAATPDataConnector() (*AATPDataConnector, bool) { + return nil, false +} + +// AsASCDataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. +func (actdc AwsCloudTrailDataConnector) AsASCDataConnector() (*ASCDataConnector, bool) { + return nil, false +} + +// AsAwsCloudTrailDataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. +func (actdc AwsCloudTrailDataConnector) AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) { + return &actdc, true +} + +// AsAwsS3DataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. +func (actdc AwsCloudTrailDataConnector) AsAwsS3DataConnector() (*AwsS3DataConnector, bool) { + return nil, false +} + +// AsMCASDataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. +func (actdc AwsCloudTrailDataConnector) AsMCASDataConnector() (*MCASDataConnector, bool) { + return nil, false +} + +// AsDynamics365DataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. +func (actdc AwsCloudTrailDataConnector) AsDynamics365DataConnector() (*Dynamics365DataConnector, bool) { + return nil, false +} + +// AsOfficeATPDataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. +func (actdc AwsCloudTrailDataConnector) AsOfficeATPDataConnector() (*OfficeATPDataConnector, bool) { + return nil, false +} + +// AsOffice365ProjectDataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. +func (actdc AwsCloudTrailDataConnector) AsOffice365ProjectDataConnector() (*Office365ProjectDataConnector, bool) { + return nil, false +} + +// AsOfficePowerBIDataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. +func (actdc AwsCloudTrailDataConnector) AsOfficePowerBIDataConnector() (*OfficePowerBIDataConnector, bool) { + return nil, false +} + +// AsOfficeIRMDataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. +func (actdc AwsCloudTrailDataConnector) AsOfficeIRMDataConnector() (*OfficeIRMDataConnector, bool) { + return nil, false +} + +// AsMDATPDataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. +func (actdc AwsCloudTrailDataConnector) AsMDATPDataConnector() (*MDATPDataConnector, bool) { + return nil, false +} + +// AsOfficeDataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. +func (actdc AwsCloudTrailDataConnector) AsOfficeDataConnector() (*OfficeDataConnector, bool) { + return nil, false +} + +// AsTIDataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. +func (actdc AwsCloudTrailDataConnector) AsTIDataConnector() (*TIDataConnector, bool) { + return nil, false +} + +// AsTiTaxiiDataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. +func (actdc AwsCloudTrailDataConnector) AsTiTaxiiDataConnector() (*TiTaxiiDataConnector, bool) { + return nil, false +} + +// AsIoTDataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. +func (actdc AwsCloudTrailDataConnector) AsIoTDataConnector() (*IoTDataConnector, bool) { + return nil, false +} + +// AsCodelessUIDataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. +func (actdc AwsCloudTrailDataConnector) AsCodelessUIDataConnector() (*CodelessUIDataConnector, bool) { + return nil, false +} + +// AsCodelessAPIPollingDataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. +func (actdc AwsCloudTrailDataConnector) AsCodelessAPIPollingDataConnector() (*CodelessAPIPollingDataConnector, bool) { + return nil, false +} + +// AsDataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. +func (actdc AwsCloudTrailDataConnector) AsDataConnector() (*DataConnector, bool) { + return nil, false +} + +// AsBasicDataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. +func (actdc AwsCloudTrailDataConnector) AsBasicDataConnector() (BasicDataConnector, bool) { + return &actdc, true +} + +// UnmarshalJSON is the custom unmarshaler for AwsCloudTrailDataConnector struct. +func (actdc *AwsCloudTrailDataConnector) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var awsCloudTrailDataConnectorProperties AwsCloudTrailDataConnectorProperties + err = json.Unmarshal(*v, &awsCloudTrailDataConnectorProperties) + if err != nil { + return err + } + actdc.AwsCloudTrailDataConnectorProperties = &awsCloudTrailDataConnectorProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnector + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + actdc.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + actdc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + actdc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + actdc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + actdc.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + actdc.SystemData = &systemData + } + } + } + + return nil +} + +// AwsCloudTrailDataConnectorDataTypes the available data types for Amazon Web Services CloudTrail data +// connector. +type AwsCloudTrailDataConnectorDataTypes struct { + // Logs - Logs data type. + Logs *AwsCloudTrailDataConnectorDataTypesLogs `json:"logs,omitempty"` +} + +// AwsCloudTrailDataConnectorDataTypesLogs logs data type. +type AwsCloudTrailDataConnectorDataTypesLogs struct { + // State - Describe whether this data type connection is enabled or not. Possible values include: 'DataTypeStateEnabled', 'DataTypeStateDisabled' + State DataTypeState `json:"state,omitempty"` +} + +// AwsCloudTrailDataConnectorProperties amazon Web Services CloudTrail data connector properties. +type AwsCloudTrailDataConnectorProperties struct { + // AwsRoleArn - The Aws Role Arn (with CloudTrailReadOnly policy) that is used to access the Aws account. + AwsRoleArn *string `json:"awsRoleArn,omitempty"` + // DataTypes - The available data types for the connector. + DataTypes *AwsCloudTrailDataConnectorDataTypes `json:"dataTypes,omitempty"` +} + +// AwsS3CheckRequirements amazon Web Services S3 requirements check request. +type AwsS3CheckRequirements struct { + // Kind - Possible values include: 'KindBasicDataConnectorsCheckRequirementsKindDataConnectorsCheckRequirements', 'KindBasicDataConnectorsCheckRequirementsKindAzureActiveDirectory', 'KindBasicDataConnectorsCheckRequirementsKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindAzureSecurityCenter', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesS3', 'KindBasicDataConnectorsCheckRequirementsKindDynamics365', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindOfficeATP', 'KindBasicDataConnectorsCheckRequirementsKindOfficeIRM', 'KindBasicDataConnectorsCheckRequirementsKindOffice365Project', 'KindBasicDataConnectorsCheckRequirementsKindOfficePowerBI', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligenceTaxii', 'KindBasicDataConnectorsCheckRequirementsKindIOT' + Kind KindBasicDataConnectorsCheckRequirements `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for AwsS3CheckRequirements. +func (ascr AwsS3CheckRequirements) MarshalJSON() ([]byte, error) { + ascr.Kind = KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesS3 + objectMap := make(map[string]interface{}) + if ascr.Kind != "" { + objectMap["kind"] = ascr.Kind + } + return json.Marshal(objectMap) +} + +// AsAADCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsS3CheckRequirements. +func (ascr AwsS3CheckRequirements) AsAADCheckRequirements() (*AADCheckRequirements, bool) { + return nil, false +} + +// AsAATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsS3CheckRequirements. +func (ascr AwsS3CheckRequirements) AsAATPCheckRequirements() (*AATPCheckRequirements, bool) { + return nil, false +} + +// AsASCCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsS3CheckRequirements. +func (ascr AwsS3CheckRequirements) AsASCCheckRequirements() (*ASCCheckRequirements, bool) { + return nil, false +} + +// AsAwsCloudTrailCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsS3CheckRequirements. +func (ascr AwsS3CheckRequirements) AsAwsCloudTrailCheckRequirements() (*AwsCloudTrailCheckRequirements, bool) { + return nil, false +} + +// AsAwsS3CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsS3CheckRequirements. +func (ascr AwsS3CheckRequirements) AsAwsS3CheckRequirements() (*AwsS3CheckRequirements, bool) { + return &ascr, true +} + +// AsDynamics365CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsS3CheckRequirements. +func (ascr AwsS3CheckRequirements) AsDynamics365CheckRequirements() (*Dynamics365CheckRequirements, bool) { + return nil, false +} + +// AsMCASCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsS3CheckRequirements. +func (ascr AwsS3CheckRequirements) AsMCASCheckRequirements() (*MCASCheckRequirements, bool) { + return nil, false +} + +// AsMDATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsS3CheckRequirements. +func (ascr AwsS3CheckRequirements) AsMDATPCheckRequirements() (*MDATPCheckRequirements, bool) { + return nil, false +} + +// AsMSTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsS3CheckRequirements. +func (ascr AwsS3CheckRequirements) AsMSTICheckRequirements() (*MSTICheckRequirements, bool) { + return nil, false +} + +// AsMtpCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsS3CheckRequirements. +func (ascr AwsS3CheckRequirements) AsMtpCheckRequirements() (*MtpCheckRequirements, bool) { + return nil, false +} + +// AsOfficeATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsS3CheckRequirements. +func (ascr AwsS3CheckRequirements) AsOfficeATPCheckRequirements() (*OfficeATPCheckRequirements, bool) { + return nil, false +} + +// AsOfficeIRMCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsS3CheckRequirements. +func (ascr AwsS3CheckRequirements) AsOfficeIRMCheckRequirements() (*OfficeIRMCheckRequirements, bool) { + return nil, false +} + +// AsOffice365ProjectCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsS3CheckRequirements. +func (ascr AwsS3CheckRequirements) AsOffice365ProjectCheckRequirements() (*Office365ProjectCheckRequirements, bool) { + return nil, false +} + +// AsOfficePowerBICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsS3CheckRequirements. +func (ascr AwsS3CheckRequirements) AsOfficePowerBICheckRequirements() (*OfficePowerBICheckRequirements, bool) { + return nil, false +} + +// AsTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsS3CheckRequirements. +func (ascr AwsS3CheckRequirements) AsTICheckRequirements() (*TICheckRequirements, bool) { + return nil, false +} + +// AsTiTaxiiCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsS3CheckRequirements. +func (ascr AwsS3CheckRequirements) AsTiTaxiiCheckRequirements() (*TiTaxiiCheckRequirements, bool) { + return nil, false +} + +// AsIoTCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsS3CheckRequirements. +func (ascr AwsS3CheckRequirements) AsIoTCheckRequirements() (*IoTCheckRequirements, bool) { + return nil, false +} + +// AsDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsS3CheckRequirements. +func (ascr AwsS3CheckRequirements) AsDataConnectorsCheckRequirements() (*DataConnectorsCheckRequirements, bool) { + return nil, false +} + +// AsBasicDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for AwsS3CheckRequirements. +func (ascr AwsS3CheckRequirements) AsBasicDataConnectorsCheckRequirements() (BasicDataConnectorsCheckRequirements, bool) { + return &ascr, true +} + +// AwsS3DataConnector represents Amazon Web Services S3 data connector. +type AwsS3DataConnector struct { + // AwsS3DataConnectorProperties - Amazon Web Services S3 data connector properties. + *AwsS3DataConnectorProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorKindDataConnector', 'KindBasicDataConnectorKindAzureActiveDirectory', 'KindBasicDataConnectorKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorKindMicrosoftThreatProtection', 'KindBasicDataConnectorKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorKindAzureSecurityCenter', 'KindBasicDataConnectorKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorKindAmazonWebServicesS3', 'KindBasicDataConnectorKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorKindDynamics365', 'KindBasicDataConnectorKindOfficeATP', 'KindBasicDataConnectorKindOffice365Project', 'KindBasicDataConnectorKindOfficePowerBI', 'KindBasicDataConnectorKindOfficeIRM', 'KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorKindOffice365', 'KindBasicDataConnectorKindThreatIntelligence', 'KindBasicDataConnectorKindThreatIntelligenceTaxii', 'KindBasicDataConnectorKindIOT', 'KindBasicDataConnectorKindGenericUI', 'KindBasicDataConnectorKindAPIPolling' + Kind KindBasicDataConnector `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for AwsS3DataConnector. +func (asdc AwsS3DataConnector) MarshalJSON() ([]byte, error) { + asdc.Kind = KindBasicDataConnectorKindAmazonWebServicesS3 + objectMap := make(map[string]interface{}) + if asdc.AwsS3DataConnectorProperties != nil { + objectMap["properties"] = asdc.AwsS3DataConnectorProperties + } + if asdc.Kind != "" { + objectMap["kind"] = asdc.Kind + } + if asdc.Etag != nil { + objectMap["etag"] = asdc.Etag + } + return json.Marshal(objectMap) +} + +// AsAADDataConnector is the BasicDataConnector implementation for AwsS3DataConnector. +func (asdc AwsS3DataConnector) AsAADDataConnector() (*AADDataConnector, bool) { + return nil, false +} + +// AsMSTIDataConnector is the BasicDataConnector implementation for AwsS3DataConnector. +func (asdc AwsS3DataConnector) AsMSTIDataConnector() (*MSTIDataConnector, bool) { + return nil, false +} + +// AsMTPDataConnector is the BasicDataConnector implementation for AwsS3DataConnector. +func (asdc AwsS3DataConnector) AsMTPDataConnector() (*MTPDataConnector, bool) { + return nil, false +} + +// AsAATPDataConnector is the BasicDataConnector implementation for AwsS3DataConnector. +func (asdc AwsS3DataConnector) AsAATPDataConnector() (*AATPDataConnector, bool) { + return nil, false +} + +// AsASCDataConnector is the BasicDataConnector implementation for AwsS3DataConnector. +func (asdc AwsS3DataConnector) AsASCDataConnector() (*ASCDataConnector, bool) { + return nil, false +} + +// AsAwsCloudTrailDataConnector is the BasicDataConnector implementation for AwsS3DataConnector. +func (asdc AwsS3DataConnector) AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) { + return nil, false +} + +// AsAwsS3DataConnector is the BasicDataConnector implementation for AwsS3DataConnector. +func (asdc AwsS3DataConnector) AsAwsS3DataConnector() (*AwsS3DataConnector, bool) { + return &asdc, true +} + +// AsMCASDataConnector is the BasicDataConnector implementation for AwsS3DataConnector. +func (asdc AwsS3DataConnector) AsMCASDataConnector() (*MCASDataConnector, bool) { + return nil, false +} + +// AsDynamics365DataConnector is the BasicDataConnector implementation for AwsS3DataConnector. +func (asdc AwsS3DataConnector) AsDynamics365DataConnector() (*Dynamics365DataConnector, bool) { + return nil, false +} + +// AsOfficeATPDataConnector is the BasicDataConnector implementation for AwsS3DataConnector. +func (asdc AwsS3DataConnector) AsOfficeATPDataConnector() (*OfficeATPDataConnector, bool) { + return nil, false +} + +// AsOffice365ProjectDataConnector is the BasicDataConnector implementation for AwsS3DataConnector. +func (asdc AwsS3DataConnector) AsOffice365ProjectDataConnector() (*Office365ProjectDataConnector, bool) { + return nil, false +} + +// AsOfficePowerBIDataConnector is the BasicDataConnector implementation for AwsS3DataConnector. +func (asdc AwsS3DataConnector) AsOfficePowerBIDataConnector() (*OfficePowerBIDataConnector, bool) { + return nil, false +} + +// AsOfficeIRMDataConnector is the BasicDataConnector implementation for AwsS3DataConnector. +func (asdc AwsS3DataConnector) AsOfficeIRMDataConnector() (*OfficeIRMDataConnector, bool) { + return nil, false +} + +// AsMDATPDataConnector is the BasicDataConnector implementation for AwsS3DataConnector. +func (asdc AwsS3DataConnector) AsMDATPDataConnector() (*MDATPDataConnector, bool) { + return nil, false +} + +// AsOfficeDataConnector is the BasicDataConnector implementation for AwsS3DataConnector. +func (asdc AwsS3DataConnector) AsOfficeDataConnector() (*OfficeDataConnector, bool) { + return nil, false +} + +// AsTIDataConnector is the BasicDataConnector implementation for AwsS3DataConnector. +func (asdc AwsS3DataConnector) AsTIDataConnector() (*TIDataConnector, bool) { + return nil, false +} + +// AsTiTaxiiDataConnector is the BasicDataConnector implementation for AwsS3DataConnector. +func (asdc AwsS3DataConnector) AsTiTaxiiDataConnector() (*TiTaxiiDataConnector, bool) { + return nil, false +} + +// AsIoTDataConnector is the BasicDataConnector implementation for AwsS3DataConnector. +func (asdc AwsS3DataConnector) AsIoTDataConnector() (*IoTDataConnector, bool) { + return nil, false +} + +// AsCodelessUIDataConnector is the BasicDataConnector implementation for AwsS3DataConnector. +func (asdc AwsS3DataConnector) AsCodelessUIDataConnector() (*CodelessUIDataConnector, bool) { + return nil, false +} + +// AsCodelessAPIPollingDataConnector is the BasicDataConnector implementation for AwsS3DataConnector. +func (asdc AwsS3DataConnector) AsCodelessAPIPollingDataConnector() (*CodelessAPIPollingDataConnector, bool) { + return nil, false +} + +// AsDataConnector is the BasicDataConnector implementation for AwsS3DataConnector. +func (asdc AwsS3DataConnector) AsDataConnector() (*DataConnector, bool) { + return nil, false +} + +// AsBasicDataConnector is the BasicDataConnector implementation for AwsS3DataConnector. +func (asdc AwsS3DataConnector) AsBasicDataConnector() (BasicDataConnector, bool) { + return &asdc, true +} + +// UnmarshalJSON is the custom unmarshaler for AwsS3DataConnector struct. +func (asdc *AwsS3DataConnector) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var awsS3DataConnectorProperties AwsS3DataConnectorProperties + err = json.Unmarshal(*v, &awsS3DataConnectorProperties) + if err != nil { + return err + } + asdc.AwsS3DataConnectorProperties = &awsS3DataConnectorProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnector + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + asdc.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + asdc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + asdc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + asdc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + asdc.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + asdc.SystemData = &systemData + } + } + } + + return nil +} + +// AwsS3DataConnectorDataTypes the available data types for Amazon Web Services S3 data connector. +type AwsS3DataConnectorDataTypes struct { + // Logs - Logs data type. + Logs *AwsS3DataConnectorDataTypesLogs `json:"logs,omitempty"` +} + +// AwsS3DataConnectorDataTypesLogs logs data type. +type AwsS3DataConnectorDataTypesLogs struct { + // State - Describe whether this data type connection is enabled or not. Possible values include: 'DataTypeStateEnabled', 'DataTypeStateDisabled' + State DataTypeState `json:"state,omitempty"` +} + +// AwsS3DataConnectorProperties amazon Web Services S3 data connector properties. +type AwsS3DataConnectorProperties struct { + // DestinationTable - The logs destination table name in LogAnalytics. + DestinationTable *string `json:"destinationTable,omitempty"` + // SqsUrls - The AWS sqs urls for the connector. + SqsUrls *[]string `json:"sqsUrls,omitempty"` + // RoleArn - The Aws Role Arn that is used to access the Aws account. + RoleArn *string `json:"roleArn,omitempty"` + // DataTypes - The available data types for the connector. + DataTypes *AwsS3DataConnectorDataTypes `json:"dataTypes,omitempty"` +} + +// AzureDevOpsResourceInfo resources created in Azure DevOps repository. +type AzureDevOpsResourceInfo struct { + // PipelineID - Id of the pipeline created for the source-control. + PipelineID *string `json:"pipelineId,omitempty"` + // ServiceConnectionID - Id of the service-connection created for the source-control. + ServiceConnectionID *string `json:"serviceConnectionId,omitempty"` +} + +// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. +type AzureEntityResource struct { + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureEntityResource. +func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AzureResourceEntity represents an azure resource entity. +type AzureResourceEntity struct { + // AzureResourceEntityProperties - AzureResource entity properties + *AzureResourceEntityProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicEntityKindEntity', 'KindBasicEntityKindURL', 'KindBasicEntityKindSubmissionMail', 'KindBasicEntityKindSecurityGroup', 'KindBasicEntityKindSecurityAlert', 'KindBasicEntityKindRegistryValue', 'KindBasicEntityKindRegistryKey', 'KindBasicEntityKindProcess', 'KindBasicEntityKindMalware', 'KindBasicEntityKindMailMessage', 'KindBasicEntityKindMailCluster', 'KindBasicEntityKindMailbox', 'KindBasicEntityKindIP', 'KindBasicEntityKindIoTDevice', 'KindBasicEntityKindBookmark', 'KindBasicEntityKindHost', 'KindBasicEntityKindFileHash', 'KindBasicEntityKindFile', 'KindBasicEntityKindDNSResolution', 'KindBasicEntityKindCloudApplication', 'KindBasicEntityKindAzureResource', 'KindBasicEntityKindAccount' + Kind KindBasicEntity `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureResourceEntity. +func (are AzureResourceEntity) MarshalJSON() ([]byte, error) { + are.Kind = KindBasicEntityKindAzureResource + objectMap := make(map[string]interface{}) + if are.AzureResourceEntityProperties != nil { + objectMap["properties"] = are.AzureResourceEntityProperties + } + if are.Kind != "" { + objectMap["kind"] = are.Kind + } + return json.Marshal(objectMap) +} + +// AsURLEntity is the BasicEntity implementation for AzureResourceEntity. +func (are AzureResourceEntity) AsURLEntity() (*URLEntity, bool) { + return nil, false +} + +// AsSubmissionMailEntity is the BasicEntity implementation for AzureResourceEntity. +func (are AzureResourceEntity) AsSubmissionMailEntity() (*SubmissionMailEntity, bool) { + return nil, false +} + +// AsSecurityGroupEntity is the BasicEntity implementation for AzureResourceEntity. +func (are AzureResourceEntity) AsSecurityGroupEntity() (*SecurityGroupEntity, bool) { + return nil, false +} + +// AsSecurityAlert is the BasicEntity implementation for AzureResourceEntity. +func (are AzureResourceEntity) AsSecurityAlert() (*SecurityAlert, bool) { + return nil, false +} + +// AsRegistryValueEntity is the BasicEntity implementation for AzureResourceEntity. +func (are AzureResourceEntity) AsRegistryValueEntity() (*RegistryValueEntity, bool) { + return nil, false +} + +// AsRegistryKeyEntity is the BasicEntity implementation for AzureResourceEntity. +func (are AzureResourceEntity) AsRegistryKeyEntity() (*RegistryKeyEntity, bool) { + return nil, false +} + +// AsProcessEntity is the BasicEntity implementation for AzureResourceEntity. +func (are AzureResourceEntity) AsProcessEntity() (*ProcessEntity, bool) { + return nil, false +} + +// AsMalwareEntity is the BasicEntity implementation for AzureResourceEntity. +func (are AzureResourceEntity) AsMalwareEntity() (*MalwareEntity, bool) { + return nil, false +} + +// AsMailMessageEntity is the BasicEntity implementation for AzureResourceEntity. +func (are AzureResourceEntity) AsMailMessageEntity() (*MailMessageEntity, bool) { + return nil, false +} + +// AsMailClusterEntity is the BasicEntity implementation for AzureResourceEntity. +func (are AzureResourceEntity) AsMailClusterEntity() (*MailClusterEntity, bool) { + return nil, false +} + +// AsMailboxEntity is the BasicEntity implementation for AzureResourceEntity. +func (are AzureResourceEntity) AsMailboxEntity() (*MailboxEntity, bool) { + return nil, false +} + +// AsIPEntity is the BasicEntity implementation for AzureResourceEntity. +func (are AzureResourceEntity) AsIPEntity() (*IPEntity, bool) { + return nil, false +} + +// AsIoTDeviceEntity is the BasicEntity implementation for AzureResourceEntity. +func (are AzureResourceEntity) AsIoTDeviceEntity() (*IoTDeviceEntity, bool) { + return nil, false +} + +// AsHuntingBookmark is the BasicEntity implementation for AzureResourceEntity. +func (are AzureResourceEntity) AsHuntingBookmark() (*HuntingBookmark, bool) { + return nil, false +} + +// AsHostEntity is the BasicEntity implementation for AzureResourceEntity. +func (are AzureResourceEntity) AsHostEntity() (*HostEntity, bool) { + return nil, false +} + +// AsFileHashEntity is the BasicEntity implementation for AzureResourceEntity. +func (are AzureResourceEntity) AsFileHashEntity() (*FileHashEntity, bool) { + return nil, false +} + +// AsFileEntity is the BasicEntity implementation for AzureResourceEntity. +func (are AzureResourceEntity) AsFileEntity() (*FileEntity, bool) { + return nil, false +} + +// AsDNSEntity is the BasicEntity implementation for AzureResourceEntity. +func (are AzureResourceEntity) AsDNSEntity() (*DNSEntity, bool) { + return nil, false +} + +// AsCloudApplicationEntity is the BasicEntity implementation for AzureResourceEntity. +func (are AzureResourceEntity) AsCloudApplicationEntity() (*CloudApplicationEntity, bool) { + return nil, false +} + +// AsAzureResourceEntity is the BasicEntity implementation for AzureResourceEntity. +func (are AzureResourceEntity) AsAzureResourceEntity() (*AzureResourceEntity, bool) { + return &are, true +} + +// AsAccountEntity is the BasicEntity implementation for AzureResourceEntity. +func (are AzureResourceEntity) AsAccountEntity() (*AccountEntity, bool) { + return nil, false +} + +// AsEntity is the BasicEntity implementation for AzureResourceEntity. +func (are AzureResourceEntity) AsEntity() (*Entity, bool) { + return nil, false +} + +// AsBasicEntity is the BasicEntity implementation for AzureResourceEntity. +func (are AzureResourceEntity) AsBasicEntity() (BasicEntity, bool) { + return &are, true +} + +// UnmarshalJSON is the custom unmarshaler for AzureResourceEntity struct. +func (are *AzureResourceEntity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var azureResourceEntityProperties AzureResourceEntityProperties + err = json.Unmarshal(*v, &azureResourceEntityProperties) + if err != nil { + return err + } + are.AzureResourceEntityProperties = &azureResourceEntityProperties + } + case "kind": + if v != nil { + var kind KindBasicEntity + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + are.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + are.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + are.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + are.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + are.SystemData = &systemData + } + } + } + + return nil +} + +// AzureResourceEntityProperties azureResource entity property bag. +type AzureResourceEntityProperties struct { + // ResourceID - READ-ONLY; The azure resource id of the resource + ResourceID *string `json:"resourceId,omitempty"` + // SubscriptionID - READ-ONLY; The subscription id of the resource + SubscriptionID *string `json:"subscriptionId,omitempty"` + // AdditionalData - READ-ONLY; A bag of custom fields that should be part of the entity and will be presented to the user. + AdditionalData map[string]interface{} `json:"additionalData"` + // FriendlyName - READ-ONLY; The graph item display name which is a short humanly readable description of the graph item instance. This property is optional and might be system generated. + FriendlyName *string `json:"friendlyName,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureResourceEntityProperties. +func (arep AzureResourceEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Bookmark represents a bookmark in Azure Security Insights. +type Bookmark struct { + autorest.Response `json:"-"` + // BookmarkProperties - Bookmark properties + *BookmarkProperties `json:"properties,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Bookmark. +func (b Bookmark) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if b.BookmarkProperties != nil { + objectMap["properties"] = b.BookmarkProperties + } + if b.Etag != nil { + objectMap["etag"] = b.Etag + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Bookmark struct. +func (b *Bookmark) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var bookmarkProperties BookmarkProperties + err = json.Unmarshal(*v, &bookmarkProperties) + if err != nil { + return err + } + b.BookmarkProperties = &bookmarkProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + b.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + b.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + b.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + b.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + b.SystemData = &systemData + } + } + } + + return nil +} + +// BookmarkEntityMappings describes the entity mappings of a single entity +type BookmarkEntityMappings struct { + // EntityType - The entity type + EntityType *string `json:"entityType,omitempty"` + // FieldMappings - Array of fields mapping for that entity type + FieldMappings *[]EntityFieldMapping `json:"fieldMappings,omitempty"` +} + +// BookmarkExpandParameters the parameters required to execute an expand operation on the given bookmark. +type BookmarkExpandParameters struct { + // EndTime - The end date filter, so the only expansion results returned are before this date. + EndTime *date.Time `json:"endTime,omitempty"` + // ExpansionID - The Id of the expansion to perform. + ExpansionID *uuid.UUID `json:"expansionId,omitempty"` + // StartTime - The start date filter, so the only expansion results returned are after this date. + StartTime *date.Time `json:"startTime,omitempty"` +} + +// BookmarkExpandResponse the entity expansion result operation response. +type BookmarkExpandResponse struct { + autorest.Response `json:"-"` + // MetaData - The metadata from the expansion operation results. + MetaData *ExpansionResultsMetadata `json:"metaData,omitempty"` + // Value - The expansion result values. + Value *BookmarkExpandResponseValue `json:"value,omitempty"` +} + +// BookmarkExpandResponseValue the expansion result values. +type BookmarkExpandResponseValue struct { + // Entities - Array of the expansion result entities. + Entities *[]BasicEntity `json:"entities,omitempty"` + // Edges - Array of expansion result connected entities + Edges *[]ConnectedEntity `json:"edges,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for BookmarkExpandResponseValue struct. +func (ber *BookmarkExpandResponseValue) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "entities": + if v != nil { + entities, err := unmarshalBasicEntityArray(*v) + if err != nil { + return err + } + ber.Entities = &entities + } + case "edges": + if v != nil { + var edges []ConnectedEntity + err = json.Unmarshal(*v, &edges) + if err != nil { + return err + } + ber.Edges = &edges + } + } + } + + return nil +} + +// BookmarkList list all the bookmarks. +type BookmarkList struct { + autorest.Response `json:"-"` + // NextLink - READ-ONLY; URL to fetch the next set of bookmarks. + NextLink *string `json:"nextLink,omitempty"` + // Value - Array of bookmarks. + Value *[]Bookmark `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for BookmarkList. +func (bl BookmarkList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bl.Value != nil { + objectMap["value"] = bl.Value + } + return json.Marshal(objectMap) +} + +// BookmarkListIterator provides access to a complete listing of Bookmark values. +type BookmarkListIterator struct { + i int + page BookmarkListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *BookmarkListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BookmarkListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *BookmarkListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BookmarkListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter BookmarkListIterator) Response() BookmarkList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter BookmarkListIterator) Value() Bookmark { + if !iter.page.NotDone() { + return Bookmark{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BookmarkListIterator type. +func NewBookmarkListIterator(page BookmarkListPage) BookmarkListIterator { + return BookmarkListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (bl BookmarkList) IsEmpty() bool { + return bl.Value == nil || len(*bl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (bl BookmarkList) hasNextLink() bool { + return bl.NextLink != nil && len(*bl.NextLink) != 0 +} + +// bookmarkListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (bl BookmarkList) bookmarkListPreparer(ctx context.Context) (*http.Request, error) { + if !bl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(bl.NextLink))) +} + +// BookmarkListPage contains a page of Bookmark values. +type BookmarkListPage struct { + fn func(context.Context, BookmarkList) (BookmarkList, error) + bl BookmarkList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *BookmarkListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BookmarkListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.bl) + if err != nil { + return err + } + page.bl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *BookmarkListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BookmarkListPage) NotDone() bool { + return !page.bl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BookmarkListPage) Response() BookmarkList { + return page.bl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BookmarkListPage) Values() []Bookmark { + if page.bl.IsEmpty() { + return nil + } + return *page.bl.Value +} + +// Creates a new instance of the BookmarkListPage type. +func NewBookmarkListPage(cur BookmarkList, getNextPage func(context.Context, BookmarkList) (BookmarkList, error)) BookmarkListPage { + return BookmarkListPage{ + fn: getNextPage, + bl: cur, + } +} + +// BookmarkProperties describes bookmark properties +type BookmarkProperties struct { + // Created - The time the bookmark was created + Created *date.Time `json:"created,omitempty"` + // CreatedBy - Describes a user that created the bookmark + CreatedBy *UserInfo `json:"createdBy,omitempty"` + // DisplayName - The display name of the bookmark + DisplayName *string `json:"displayName,omitempty"` + // Labels - List of labels relevant to this bookmark + Labels *[]string `json:"labels,omitempty"` + // Notes - The notes of the bookmark + Notes *string `json:"notes,omitempty"` + // Query - The query of the bookmark. + Query *string `json:"query,omitempty"` + // QueryResult - The query result of the bookmark. + QueryResult *string `json:"queryResult,omitempty"` + // Updated - The last time the bookmark was updated + Updated *date.Time `json:"updated,omitempty"` + // UpdatedBy - Describes a user that updated the bookmark + UpdatedBy *UserInfo `json:"updatedBy,omitempty"` + // EventTime - The bookmark event time + EventTime *date.Time `json:"eventTime,omitempty"` + // QueryStartTime - The start time for the query + QueryStartTime *date.Time `json:"queryStartTime,omitempty"` + // QueryEndTime - The end time for the query + QueryEndTime *date.Time `json:"queryEndTime,omitempty"` + // IncidentInfo - Describes an incident that relates to bookmark + IncidentInfo *IncidentInfo `json:"incidentInfo,omitempty"` + // EntityMappings - Describes the entity mappings of the bookmark + EntityMappings *[]BookmarkEntityMappings `json:"entityMappings,omitempty"` + // Tactics - A list of relevant mitre attacks + Tactics *[]AttackTactic `json:"tactics,omitempty"` + // Techniques - A list of relevant mitre techniques + Techniques *[]string `json:"techniques,omitempty"` +} + +// BookmarkTimelineItem represents bookmark timeline item. +type BookmarkTimelineItem struct { + // AzureResourceID - The bookmark azure resource id. + AzureResourceID *string `json:"azureResourceId,omitempty"` + // DisplayName - The bookmark display name. + DisplayName *string `json:"displayName,omitempty"` + // Notes - The notes of the bookmark + Notes *string `json:"notes,omitempty"` + // EndTimeUtc - The bookmark end time. + EndTimeUtc *date.Time `json:"endTimeUtc,omitempty"` + // StartTimeUtc - The bookmark start time. + StartTimeUtc *date.Time `json:"startTimeUtc,omitempty"` + // EventTime - The bookmark event time. + EventTime *date.Time `json:"eventTime,omitempty"` + // CreatedBy - Describes a user that created the bookmark + CreatedBy *UserInfo `json:"createdBy,omitempty"` + // Labels - List of labels relevant to this bookmark + Labels *[]string `json:"labels,omitempty"` + // Kind - Possible values include: 'KindBasicEntityTimelineItemKindEntityTimelineItem', 'KindBasicEntityTimelineItemKindActivity', 'KindBasicEntityTimelineItemKindBookmark', 'KindBasicEntityTimelineItemKindSecurityAlert' + Kind KindBasicEntityTimelineItem `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for BookmarkTimelineItem. +func (bti BookmarkTimelineItem) MarshalJSON() ([]byte, error) { + bti.Kind = KindBasicEntityTimelineItemKindBookmark + objectMap := make(map[string]interface{}) + if bti.AzureResourceID != nil { + objectMap["azureResourceId"] = bti.AzureResourceID + } + if bti.DisplayName != nil { + objectMap["displayName"] = bti.DisplayName + } + if bti.Notes != nil { + objectMap["notes"] = bti.Notes + } + if bti.EndTimeUtc != nil { + objectMap["endTimeUtc"] = bti.EndTimeUtc + } + if bti.StartTimeUtc != nil { + objectMap["startTimeUtc"] = bti.StartTimeUtc + } + if bti.EventTime != nil { + objectMap["eventTime"] = bti.EventTime + } + if bti.CreatedBy != nil { + objectMap["createdBy"] = bti.CreatedBy + } + if bti.Labels != nil { + objectMap["labels"] = bti.Labels + } + if bti.Kind != "" { + objectMap["kind"] = bti.Kind + } + return json.Marshal(objectMap) +} + +// AsActivityTimelineItem is the BasicEntityTimelineItem implementation for BookmarkTimelineItem. +func (bti BookmarkTimelineItem) AsActivityTimelineItem() (*ActivityTimelineItem, bool) { + return nil, false +} + +// AsBookmarkTimelineItem is the BasicEntityTimelineItem implementation for BookmarkTimelineItem. +func (bti BookmarkTimelineItem) AsBookmarkTimelineItem() (*BookmarkTimelineItem, bool) { + return &bti, true +} + +// AsSecurityAlertTimelineItem is the BasicEntityTimelineItem implementation for BookmarkTimelineItem. +func (bti BookmarkTimelineItem) AsSecurityAlertTimelineItem() (*SecurityAlertTimelineItem, bool) { + return nil, false +} + +// AsEntityTimelineItem is the BasicEntityTimelineItem implementation for BookmarkTimelineItem. +func (bti BookmarkTimelineItem) AsEntityTimelineItem() (*EntityTimelineItem, bool) { + return nil, false +} + +// AsBasicEntityTimelineItem is the BasicEntityTimelineItem implementation for BookmarkTimelineItem. +func (bti BookmarkTimelineItem) AsBasicEntityTimelineItem() (BasicEntityTimelineItem, bool) { + return &bti, true +} + +// ClientInfo information on the client (user or application) that made some action +type ClientInfo struct { + // Email - The email of the client. + Email *string `json:"email,omitempty"` + // Name - The name of the client. + Name *string `json:"name,omitempty"` + // ObjectID - The object id of the client. + ObjectID *uuid.UUID `json:"objectId,omitempty"` + // UserPrincipalName - The user principal name of the client. + UserPrincipalName *string `json:"userPrincipalName,omitempty"` +} + +// CloudApplicationEntity represents a cloud application entity. +type CloudApplicationEntity struct { + // CloudApplicationEntityProperties - CloudApplication entity properties + *CloudApplicationEntityProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicEntityKindEntity', 'KindBasicEntityKindURL', 'KindBasicEntityKindSubmissionMail', 'KindBasicEntityKindSecurityGroup', 'KindBasicEntityKindSecurityAlert', 'KindBasicEntityKindRegistryValue', 'KindBasicEntityKindRegistryKey', 'KindBasicEntityKindProcess', 'KindBasicEntityKindMalware', 'KindBasicEntityKindMailMessage', 'KindBasicEntityKindMailCluster', 'KindBasicEntityKindMailbox', 'KindBasicEntityKindIP', 'KindBasicEntityKindIoTDevice', 'KindBasicEntityKindBookmark', 'KindBasicEntityKindHost', 'KindBasicEntityKindFileHash', 'KindBasicEntityKindFile', 'KindBasicEntityKindDNSResolution', 'KindBasicEntityKindCloudApplication', 'KindBasicEntityKindAzureResource', 'KindBasicEntityKindAccount' + Kind KindBasicEntity `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for CloudApplicationEntity. +func (cae CloudApplicationEntity) MarshalJSON() ([]byte, error) { + cae.Kind = KindBasicEntityKindCloudApplication + objectMap := make(map[string]interface{}) + if cae.CloudApplicationEntityProperties != nil { + objectMap["properties"] = cae.CloudApplicationEntityProperties + } + if cae.Kind != "" { + objectMap["kind"] = cae.Kind + } + return json.Marshal(objectMap) +} + +// AsURLEntity is the BasicEntity implementation for CloudApplicationEntity. +func (cae CloudApplicationEntity) AsURLEntity() (*URLEntity, bool) { + return nil, false +} + +// AsSubmissionMailEntity is the BasicEntity implementation for CloudApplicationEntity. +func (cae CloudApplicationEntity) AsSubmissionMailEntity() (*SubmissionMailEntity, bool) { + return nil, false +} + +// AsSecurityGroupEntity is the BasicEntity implementation for CloudApplicationEntity. +func (cae CloudApplicationEntity) AsSecurityGroupEntity() (*SecurityGroupEntity, bool) { + return nil, false +} + +// AsSecurityAlert is the BasicEntity implementation for CloudApplicationEntity. +func (cae CloudApplicationEntity) AsSecurityAlert() (*SecurityAlert, bool) { + return nil, false +} + +// AsRegistryValueEntity is the BasicEntity implementation for CloudApplicationEntity. +func (cae CloudApplicationEntity) AsRegistryValueEntity() (*RegistryValueEntity, bool) { + return nil, false +} + +// AsRegistryKeyEntity is the BasicEntity implementation for CloudApplicationEntity. +func (cae CloudApplicationEntity) AsRegistryKeyEntity() (*RegistryKeyEntity, bool) { + return nil, false +} + +// AsProcessEntity is the BasicEntity implementation for CloudApplicationEntity. +func (cae CloudApplicationEntity) AsProcessEntity() (*ProcessEntity, bool) { + return nil, false +} + +// AsMalwareEntity is the BasicEntity implementation for CloudApplicationEntity. +func (cae CloudApplicationEntity) AsMalwareEntity() (*MalwareEntity, bool) { + return nil, false +} + +// AsMailMessageEntity is the BasicEntity implementation for CloudApplicationEntity. +func (cae CloudApplicationEntity) AsMailMessageEntity() (*MailMessageEntity, bool) { + return nil, false +} + +// AsMailClusterEntity is the BasicEntity implementation for CloudApplicationEntity. +func (cae CloudApplicationEntity) AsMailClusterEntity() (*MailClusterEntity, bool) { + return nil, false +} + +// AsMailboxEntity is the BasicEntity implementation for CloudApplicationEntity. +func (cae CloudApplicationEntity) AsMailboxEntity() (*MailboxEntity, bool) { + return nil, false +} + +// AsIPEntity is the BasicEntity implementation for CloudApplicationEntity. +func (cae CloudApplicationEntity) AsIPEntity() (*IPEntity, bool) { + return nil, false +} + +// AsIoTDeviceEntity is the BasicEntity implementation for CloudApplicationEntity. +func (cae CloudApplicationEntity) AsIoTDeviceEntity() (*IoTDeviceEntity, bool) { + return nil, false +} + +// AsHuntingBookmark is the BasicEntity implementation for CloudApplicationEntity. +func (cae CloudApplicationEntity) AsHuntingBookmark() (*HuntingBookmark, bool) { + return nil, false +} + +// AsHostEntity is the BasicEntity implementation for CloudApplicationEntity. +func (cae CloudApplicationEntity) AsHostEntity() (*HostEntity, bool) { + return nil, false +} + +// AsFileHashEntity is the BasicEntity implementation for CloudApplicationEntity. +func (cae CloudApplicationEntity) AsFileHashEntity() (*FileHashEntity, bool) { + return nil, false +} + +// AsFileEntity is the BasicEntity implementation for CloudApplicationEntity. +func (cae CloudApplicationEntity) AsFileEntity() (*FileEntity, bool) { + return nil, false +} + +// AsDNSEntity is the BasicEntity implementation for CloudApplicationEntity. +func (cae CloudApplicationEntity) AsDNSEntity() (*DNSEntity, bool) { + return nil, false +} + +// AsCloudApplicationEntity is the BasicEntity implementation for CloudApplicationEntity. +func (cae CloudApplicationEntity) AsCloudApplicationEntity() (*CloudApplicationEntity, bool) { + return &cae, true +} + +// AsAzureResourceEntity is the BasicEntity implementation for CloudApplicationEntity. +func (cae CloudApplicationEntity) AsAzureResourceEntity() (*AzureResourceEntity, bool) { + return nil, false +} + +// AsAccountEntity is the BasicEntity implementation for CloudApplicationEntity. +func (cae CloudApplicationEntity) AsAccountEntity() (*AccountEntity, bool) { + return nil, false +} + +// AsEntity is the BasicEntity implementation for CloudApplicationEntity. +func (cae CloudApplicationEntity) AsEntity() (*Entity, bool) { + return nil, false +} + +// AsBasicEntity is the BasicEntity implementation for CloudApplicationEntity. +func (cae CloudApplicationEntity) AsBasicEntity() (BasicEntity, bool) { + return &cae, true +} + +// UnmarshalJSON is the custom unmarshaler for CloudApplicationEntity struct. +func (cae *CloudApplicationEntity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var cloudApplicationEntityProperties CloudApplicationEntityProperties + err = json.Unmarshal(*v, &cloudApplicationEntityProperties) + if err != nil { + return err + } + cae.CloudApplicationEntityProperties = &cloudApplicationEntityProperties + } + case "kind": + if v != nil { + var kind KindBasicEntity + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + cae.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cae.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cae.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cae.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + cae.SystemData = &systemData + } + } + } + + return nil +} + +// CloudApplicationEntityProperties cloudApplication entity property bag. +type CloudApplicationEntityProperties struct { + // AppID - READ-ONLY; The technical identifier of the application. + AppID *int32 `json:"appId,omitempty"` + // AppName - READ-ONLY; The name of the related cloud application. + AppName *string `json:"appName,omitempty"` + // InstanceName - READ-ONLY; The user defined instance name of the cloud application. It is often used to distinguish between several applications of the same type that a customer has. + InstanceName *string `json:"instanceName,omitempty"` + // AdditionalData - READ-ONLY; A bag of custom fields that should be part of the entity and will be presented to the user. + AdditionalData map[string]interface{} `json:"additionalData"` + // FriendlyName - READ-ONLY; The graph item display name which is a short humanly readable description of the graph item instance. This property is optional and might be system generated. + FriendlyName *string `json:"friendlyName,omitempty"` +} + +// MarshalJSON is the custom marshaler for CloudApplicationEntityProperties. +func (caep CloudApplicationEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CloudError error response structure. +type CloudError struct { + // Error - Error data + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody error details. +type CloudErrorBody struct { + // Code - READ-ONLY; An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for CloudErrorBody. +func (ceb CloudErrorBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CodelessAPIPollingDataConnector represents Codeless API Polling data connector. +type CodelessAPIPollingDataConnector struct { + // APIPollingParameters - Codeless poling data connector properties + *APIPollingParameters `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorKindDataConnector', 'KindBasicDataConnectorKindAzureActiveDirectory', 'KindBasicDataConnectorKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorKindMicrosoftThreatProtection', 'KindBasicDataConnectorKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorKindAzureSecurityCenter', 'KindBasicDataConnectorKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorKindAmazonWebServicesS3', 'KindBasicDataConnectorKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorKindDynamics365', 'KindBasicDataConnectorKindOfficeATP', 'KindBasicDataConnectorKindOffice365Project', 'KindBasicDataConnectorKindOfficePowerBI', 'KindBasicDataConnectorKindOfficeIRM', 'KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorKindOffice365', 'KindBasicDataConnectorKindThreatIntelligence', 'KindBasicDataConnectorKindThreatIntelligenceTaxii', 'KindBasicDataConnectorKindIOT', 'KindBasicDataConnectorKindGenericUI', 'KindBasicDataConnectorKindAPIPolling' + Kind KindBasicDataConnector `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for CodelessAPIPollingDataConnector. +func (capdc CodelessAPIPollingDataConnector) MarshalJSON() ([]byte, error) { + capdc.Kind = KindBasicDataConnectorKindAPIPolling + objectMap := make(map[string]interface{}) + if capdc.APIPollingParameters != nil { + objectMap["properties"] = capdc.APIPollingParameters + } + if capdc.Kind != "" { + objectMap["kind"] = capdc.Kind + } + if capdc.Etag != nil { + objectMap["etag"] = capdc.Etag + } + return json.Marshal(objectMap) +} + +// AsAADDataConnector is the BasicDataConnector implementation for CodelessAPIPollingDataConnector. +func (capdc CodelessAPIPollingDataConnector) AsAADDataConnector() (*AADDataConnector, bool) { + return nil, false +} + +// AsMSTIDataConnector is the BasicDataConnector implementation for CodelessAPIPollingDataConnector. +func (capdc CodelessAPIPollingDataConnector) AsMSTIDataConnector() (*MSTIDataConnector, bool) { + return nil, false +} + +// AsMTPDataConnector is the BasicDataConnector implementation for CodelessAPIPollingDataConnector. +func (capdc CodelessAPIPollingDataConnector) AsMTPDataConnector() (*MTPDataConnector, bool) { + return nil, false +} + +// AsAATPDataConnector is the BasicDataConnector implementation for CodelessAPIPollingDataConnector. +func (capdc CodelessAPIPollingDataConnector) AsAATPDataConnector() (*AATPDataConnector, bool) { + return nil, false +} + +// AsASCDataConnector is the BasicDataConnector implementation for CodelessAPIPollingDataConnector. +func (capdc CodelessAPIPollingDataConnector) AsASCDataConnector() (*ASCDataConnector, bool) { + return nil, false +} + +// AsAwsCloudTrailDataConnector is the BasicDataConnector implementation for CodelessAPIPollingDataConnector. +func (capdc CodelessAPIPollingDataConnector) AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) { + return nil, false +} + +// AsAwsS3DataConnector is the BasicDataConnector implementation for CodelessAPIPollingDataConnector. +func (capdc CodelessAPIPollingDataConnector) AsAwsS3DataConnector() (*AwsS3DataConnector, bool) { + return nil, false +} + +// AsMCASDataConnector is the BasicDataConnector implementation for CodelessAPIPollingDataConnector. +func (capdc CodelessAPIPollingDataConnector) AsMCASDataConnector() (*MCASDataConnector, bool) { + return nil, false +} + +// AsDynamics365DataConnector is the BasicDataConnector implementation for CodelessAPIPollingDataConnector. +func (capdc CodelessAPIPollingDataConnector) AsDynamics365DataConnector() (*Dynamics365DataConnector, bool) { + return nil, false +} + +// AsOfficeATPDataConnector is the BasicDataConnector implementation for CodelessAPIPollingDataConnector. +func (capdc CodelessAPIPollingDataConnector) AsOfficeATPDataConnector() (*OfficeATPDataConnector, bool) { + return nil, false +} + +// AsOffice365ProjectDataConnector is the BasicDataConnector implementation for CodelessAPIPollingDataConnector. +func (capdc CodelessAPIPollingDataConnector) AsOffice365ProjectDataConnector() (*Office365ProjectDataConnector, bool) { + return nil, false +} + +// AsOfficePowerBIDataConnector is the BasicDataConnector implementation for CodelessAPIPollingDataConnector. +func (capdc CodelessAPIPollingDataConnector) AsOfficePowerBIDataConnector() (*OfficePowerBIDataConnector, bool) { + return nil, false +} + +// AsOfficeIRMDataConnector is the BasicDataConnector implementation for CodelessAPIPollingDataConnector. +func (capdc CodelessAPIPollingDataConnector) AsOfficeIRMDataConnector() (*OfficeIRMDataConnector, bool) { + return nil, false +} + +// AsMDATPDataConnector is the BasicDataConnector implementation for CodelessAPIPollingDataConnector. +func (capdc CodelessAPIPollingDataConnector) AsMDATPDataConnector() (*MDATPDataConnector, bool) { + return nil, false +} + +// AsOfficeDataConnector is the BasicDataConnector implementation for CodelessAPIPollingDataConnector. +func (capdc CodelessAPIPollingDataConnector) AsOfficeDataConnector() (*OfficeDataConnector, bool) { + return nil, false +} + +// AsTIDataConnector is the BasicDataConnector implementation for CodelessAPIPollingDataConnector. +func (capdc CodelessAPIPollingDataConnector) AsTIDataConnector() (*TIDataConnector, bool) { + return nil, false +} + +// AsTiTaxiiDataConnector is the BasicDataConnector implementation for CodelessAPIPollingDataConnector. +func (capdc CodelessAPIPollingDataConnector) AsTiTaxiiDataConnector() (*TiTaxiiDataConnector, bool) { + return nil, false +} + +// AsIoTDataConnector is the BasicDataConnector implementation for CodelessAPIPollingDataConnector. +func (capdc CodelessAPIPollingDataConnector) AsIoTDataConnector() (*IoTDataConnector, bool) { + return nil, false +} + +// AsCodelessUIDataConnector is the BasicDataConnector implementation for CodelessAPIPollingDataConnector. +func (capdc CodelessAPIPollingDataConnector) AsCodelessUIDataConnector() (*CodelessUIDataConnector, bool) { + return nil, false +} + +// AsCodelessAPIPollingDataConnector is the BasicDataConnector implementation for CodelessAPIPollingDataConnector. +func (capdc CodelessAPIPollingDataConnector) AsCodelessAPIPollingDataConnector() (*CodelessAPIPollingDataConnector, bool) { + return &capdc, true +} + +// AsDataConnector is the BasicDataConnector implementation for CodelessAPIPollingDataConnector. +func (capdc CodelessAPIPollingDataConnector) AsDataConnector() (*DataConnector, bool) { + return nil, false +} + +// AsBasicDataConnector is the BasicDataConnector implementation for CodelessAPIPollingDataConnector. +func (capdc CodelessAPIPollingDataConnector) AsBasicDataConnector() (BasicDataConnector, bool) { + return &capdc, true +} + +// UnmarshalJSON is the custom unmarshaler for CodelessAPIPollingDataConnector struct. +func (capdc *CodelessAPIPollingDataConnector) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var APIPollingParameters APIPollingParameters + err = json.Unmarshal(*v, &APIPollingParameters) + if err != nil { + return err + } + capdc.APIPollingParameters = &APIPollingParameters + } + case "kind": + if v != nil { + var kind KindBasicDataConnector + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + capdc.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + capdc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + capdc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + capdc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + capdc.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + capdc.SystemData = &systemData + } + } + } + + return nil +} + +// CodelessConnectorPollingAuthProperties describe the authentication properties needed to successfully +// authenticate with the server +type CodelessConnectorPollingAuthProperties struct { + // AuthType - The authentication type + AuthType *string `json:"authType,omitempty"` + // APIKeyName - The header name which the token is sent with + APIKeyName *string `json:"apiKeyName,omitempty"` + // APIKeyIdentifier - A prefix send in the header before the actual token + APIKeyIdentifier *string `json:"apiKeyIdentifier,omitempty"` + // IsAPIKeyInPostPayload - Marks if the key should sent in header + IsAPIKeyInPostPayload *string `json:"isApiKeyInPostPayload,omitempty"` + // FlowName - Describes the flow name, for example 'AuthCode' for Oauth 2.0 + FlowName *string `json:"flowName,omitempty"` + // TokenEndpoint - The endpoint used to issue a token, used in Oauth 2.0 flow + TokenEndpoint *string `json:"tokenEndpoint,omitempty"` + // AuthorizationEndpoint - The endpoint used to authorize the user, used in Oauth 2.0 flow + AuthorizationEndpoint *string `json:"authorizationEndpoint,omitempty"` + // AuthorizationEndpointQueryParameters - The query parameters used in authorization request, used in Oauth 2.0 flow + AuthorizationEndpointQueryParameters interface{} `json:"authorizationEndpointQueryParameters,omitempty"` + // RedirectionEndpoint - The redirect endpoint where we will get the authorization code, used in Oauth 2.0 flow + RedirectionEndpoint *string `json:"redirectionEndpoint,omitempty"` + // TokenEndpointHeaders - The query headers used in token request, used in Oauth 2.0 flow + TokenEndpointHeaders interface{} `json:"tokenEndpointHeaders,omitempty"` + // TokenEndpointQueryParameters - The query parameters used in token request, used in Oauth 2.0 flow + TokenEndpointQueryParameters interface{} `json:"tokenEndpointQueryParameters,omitempty"` + // IsClientSecretInHeader - Marks if we should send the client secret in header or payload, used in Oauth 2.0 flow + IsClientSecretInHeader *bool `json:"isClientSecretInHeader,omitempty"` + // Scope - The OAuth token scope + Scope *string `json:"scope,omitempty"` +} + +// CodelessConnectorPollingConfigProperties config to describe the polling config for API poller connector +type CodelessConnectorPollingConfigProperties struct { + // IsActive - The poller active status + IsActive *bool `json:"isActive,omitempty"` + // Auth - Describe the authentication type of the poller + Auth *CodelessConnectorPollingAuthProperties `json:"auth,omitempty"` + // Request - Describe the poll request config parameters of the poller + Request *CodelessConnectorPollingRequestProperties `json:"request,omitempty"` + // Paging - Describe the poll request paging config of the poller + Paging *CodelessConnectorPollingPagingProperties `json:"paging,omitempty"` + // Response - Describe the response config parameters of the poller + Response *CodelessConnectorPollingResponseProperties `json:"response,omitempty"` +} + +// CodelessConnectorPollingPagingProperties describe the properties needed to make a pagination call +type CodelessConnectorPollingPagingProperties struct { + // PagingType - Describes the type. could be 'None', 'PageToken', 'PageCount', 'TimeStamp' + PagingType *string `json:"pagingType,omitempty"` + // NextPageParaName - Defines the name of a next page attribute + NextPageParaName *string `json:"nextPageParaName,omitempty"` + // NextPageTokenJSONPath - Defines the path to a next page token JSON + NextPageTokenJSONPath *string `json:"nextPageTokenJsonPath,omitempty"` + // PageCountAttributePath - Defines the path to a page count attribute + PageCountAttributePath *string `json:"pageCountAttributePath,omitempty"` + // PageTotalCountAttributePath - Defines the path to a page total count attribute + PageTotalCountAttributePath *string `json:"pageTotalCountAttributePath,omitempty"` + // PageTimeStampAttributePath - Defines the path to a paging time stamp attribute + PageTimeStampAttributePath *string `json:"pageTimeStampAttributePath,omitempty"` + // SearchTheLatestTimeStampFromEventsList - Determines whether to search for the latest time stamp in the events list + SearchTheLatestTimeStampFromEventsList *string `json:"searchTheLatestTimeStampFromEventsList,omitempty"` + // PageSizeParaName - Defines the name of the page size parameter + PageSizeParaName *string `json:"pageSizeParaName,omitempty"` + // PageSize - Defines the paging size + PageSize *int32 `json:"pageSize,omitempty"` +} + +// CodelessConnectorPollingRequestProperties describe the request properties needed to successfully pull +// from the server +type CodelessConnectorPollingRequestProperties struct { + // APIEndpoint - Describe the endpoint we should pull the data from + APIEndpoint *string `json:"apiEndpoint,omitempty"` + // RateLimitQPS - Defines the rate limit QPS + RateLimitQPS *int32 `json:"rateLimitQps,omitempty"` + // QueryWindowInMin - The window interval we will use the pull the data + QueryWindowInMin *int32 `json:"queryWindowInMin,omitempty"` + // HTTPMethod - The http method type we will use in the poll request, GET or POST + HTTPMethod *string `json:"httpMethod,omitempty"` + // QueryTimeFormat - The time format will be used the query events in a specific window + QueryTimeFormat *string `json:"queryTimeFormat,omitempty"` + // RetryCount - Describe the amount of time we should try and poll the data in case of failure + RetryCount *int32 `json:"retryCount,omitempty"` + // TimeoutInSeconds - The number of seconds we will consider as a request timeout + TimeoutInSeconds *int32 `json:"timeoutInSeconds,omitempty"` + // Headers - Describe the headers sent in the poll request + Headers interface{} `json:"headers,omitempty"` + // QueryParameters - Describe the query parameters sent in the poll request + QueryParameters interface{} `json:"queryParameters,omitempty"` + // QueryParametersTemplate - For advanced scenarios for example user name/password embedded in nested JSON payload + QueryParametersTemplate *string `json:"queryParametersTemplate,omitempty"` + // StartTimeAttributeName - This will be used the query events from a start of the time window + StartTimeAttributeName *string `json:"startTimeAttributeName,omitempty"` + // EndTimeAttributeName - This will be used the query events from the end of the time window + EndTimeAttributeName *string `json:"endTimeAttributeName,omitempty"` +} + +// CodelessConnectorPollingResponseProperties describes the response from the external server +type CodelessConnectorPollingResponseProperties struct { + // EventsJSONPaths - Describes the path we should extract the data in the response + EventsJSONPaths *[]string `json:"eventsJsonPaths,omitempty"` + // SuccessStatusJSONPath - Describes the path we should extract the status code in the response + SuccessStatusJSONPath *string `json:"successStatusJsonPath,omitempty"` + // SuccessStatusValue - Describes the path we should extract the status value in the response + SuccessStatusValue *string `json:"successStatusValue,omitempty"` + // IsGzipCompressed - Describes if the data in the response is Gzip + IsGzipCompressed *bool `json:"isGzipCompressed,omitempty"` +} + +// CodelessParameters represents Codeless UI data connector +type CodelessParameters struct { + // ConnectorUIConfig - Config to describe the instructions blade + ConnectorUIConfig *CodelessUIConnectorConfigProperties `json:"connectorUiConfig,omitempty"` +} + +// CodelessUIConnectorConfigProperties config to describe the instructions blade +type CodelessUIConnectorConfigProperties struct { + // Title - Connector blade title + Title *string `json:"title,omitempty"` + // Publisher - Connector publisher name + Publisher *string `json:"publisher,omitempty"` + // DescriptionMarkdown - Connector description + DescriptionMarkdown *string `json:"descriptionMarkdown,omitempty"` + // CustomImage - An optional custom image to be used when displaying the connector within Azure Sentinel's connector's gallery + CustomImage *string `json:"customImage,omitempty"` + // GraphQueriesTableName - Name of the table the connector will insert the data to + GraphQueriesTableName *string `json:"graphQueriesTableName,omitempty"` + // GraphQueries - The graph query to show the current data status + GraphQueries *[]CodelessUIConnectorConfigPropertiesGraphQueriesItem `json:"graphQueries,omitempty"` + // SampleQueries - The sample queries for the connector + SampleQueries *[]CodelessUIConnectorConfigPropertiesSampleQueriesItem `json:"sampleQueries,omitempty"` + // DataTypes - Data types to check for last data received + DataTypes *[]CodelessUIConnectorConfigPropertiesDataTypesItem `json:"dataTypes,omitempty"` + // ConnectivityCriteria - Define the way the connector check connectivity + ConnectivityCriteria *[]CodelessUIConnectorConfigPropertiesConnectivityCriteriaItem `json:"connectivityCriteria,omitempty"` + // Availability - Connector Availability Status + Availability *Availability `json:"availability,omitempty"` + // Permissions - Permissions required for the connector + Permissions *Permissions `json:"permissions,omitempty"` + // InstructionSteps - Instruction steps to enable the connector + InstructionSteps *[]CodelessUIConnectorConfigPropertiesInstructionStepsItem `json:"instructionSteps,omitempty"` +} + +// CodelessUIConnectorConfigPropertiesConnectivityCriteriaItem ... +type CodelessUIConnectorConfigPropertiesConnectivityCriteriaItem struct { + // Type - type of connectivity. Possible values include: 'ConnectivityTypeIsConnectedQuery' + Type ConnectivityType `json:"type,omitempty"` + // Value - Queries for checking connectivity + Value *[]string `json:"value,omitempty"` +} + +// CodelessUIConnectorConfigPropertiesDataTypesItem ... +type CodelessUIConnectorConfigPropertiesDataTypesItem struct { + // Name - Name of the data type to show in the graph. can be use with {{graphQueriesTableName}} placeholder + Name *string `json:"name,omitempty"` + // LastDataReceivedQuery - Query for indicate last data received + LastDataReceivedQuery *string `json:"lastDataReceivedQuery,omitempty"` +} + +// CodelessUIConnectorConfigPropertiesGraphQueriesItem ... +type CodelessUIConnectorConfigPropertiesGraphQueriesItem struct { + // MetricName - the metric that the query is checking + MetricName *string `json:"metricName,omitempty"` + // Legend - The legend for the graph + Legend *string `json:"legend,omitempty"` + // BaseQuery - The base query for the graph + BaseQuery *string `json:"baseQuery,omitempty"` +} + +// CodelessUIConnectorConfigPropertiesInstructionStepsItem ... +type CodelessUIConnectorConfigPropertiesInstructionStepsItem struct { + // Title - Instruction step title + Title *string `json:"title,omitempty"` + // Description - Instruction step description + Description *string `json:"description,omitempty"` + // Instructions - Instruction step details + Instructions *[]InstructionStepsInstructionsItem `json:"instructions,omitempty"` +} + +// CodelessUIConnectorConfigPropertiesSampleQueriesItem ... +type CodelessUIConnectorConfigPropertiesSampleQueriesItem struct { + // Description - The sample query description + Description *string `json:"description,omitempty"` + // Query - the sample query + Query *string `json:"query,omitempty"` +} + +// CodelessUIDataConnector represents Codeless UI data connector. +type CodelessUIDataConnector struct { + // CodelessParameters - Codeless UI data connector properties + *CodelessParameters `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorKindDataConnector', 'KindBasicDataConnectorKindAzureActiveDirectory', 'KindBasicDataConnectorKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorKindMicrosoftThreatProtection', 'KindBasicDataConnectorKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorKindAzureSecurityCenter', 'KindBasicDataConnectorKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorKindAmazonWebServicesS3', 'KindBasicDataConnectorKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorKindDynamics365', 'KindBasicDataConnectorKindOfficeATP', 'KindBasicDataConnectorKindOffice365Project', 'KindBasicDataConnectorKindOfficePowerBI', 'KindBasicDataConnectorKindOfficeIRM', 'KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorKindOffice365', 'KindBasicDataConnectorKindThreatIntelligence', 'KindBasicDataConnectorKindThreatIntelligenceTaxii', 'KindBasicDataConnectorKindIOT', 'KindBasicDataConnectorKindGenericUI', 'KindBasicDataConnectorKindAPIPolling' + Kind KindBasicDataConnector `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for CodelessUIDataConnector. +func (cudc CodelessUIDataConnector) MarshalJSON() ([]byte, error) { + cudc.Kind = KindBasicDataConnectorKindGenericUI + objectMap := make(map[string]interface{}) + if cudc.CodelessParameters != nil { + objectMap["properties"] = cudc.CodelessParameters + } + if cudc.Kind != "" { + objectMap["kind"] = cudc.Kind + } + if cudc.Etag != nil { + objectMap["etag"] = cudc.Etag + } + return json.Marshal(objectMap) +} + +// AsAADDataConnector is the BasicDataConnector implementation for CodelessUIDataConnector. +func (cudc CodelessUIDataConnector) AsAADDataConnector() (*AADDataConnector, bool) { + return nil, false +} + +// AsMSTIDataConnector is the BasicDataConnector implementation for CodelessUIDataConnector. +func (cudc CodelessUIDataConnector) AsMSTIDataConnector() (*MSTIDataConnector, bool) { + return nil, false +} + +// AsMTPDataConnector is the BasicDataConnector implementation for CodelessUIDataConnector. +func (cudc CodelessUIDataConnector) AsMTPDataConnector() (*MTPDataConnector, bool) { + return nil, false +} + +// AsAATPDataConnector is the BasicDataConnector implementation for CodelessUIDataConnector. +func (cudc CodelessUIDataConnector) AsAATPDataConnector() (*AATPDataConnector, bool) { + return nil, false +} + +// AsASCDataConnector is the BasicDataConnector implementation for CodelessUIDataConnector. +func (cudc CodelessUIDataConnector) AsASCDataConnector() (*ASCDataConnector, bool) { + return nil, false +} + +// AsAwsCloudTrailDataConnector is the BasicDataConnector implementation for CodelessUIDataConnector. +func (cudc CodelessUIDataConnector) AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) { + return nil, false +} + +// AsAwsS3DataConnector is the BasicDataConnector implementation for CodelessUIDataConnector. +func (cudc CodelessUIDataConnector) AsAwsS3DataConnector() (*AwsS3DataConnector, bool) { + return nil, false +} + +// AsMCASDataConnector is the BasicDataConnector implementation for CodelessUIDataConnector. +func (cudc CodelessUIDataConnector) AsMCASDataConnector() (*MCASDataConnector, bool) { + return nil, false +} + +// AsDynamics365DataConnector is the BasicDataConnector implementation for CodelessUIDataConnector. +func (cudc CodelessUIDataConnector) AsDynamics365DataConnector() (*Dynamics365DataConnector, bool) { + return nil, false +} + +// AsOfficeATPDataConnector is the BasicDataConnector implementation for CodelessUIDataConnector. +func (cudc CodelessUIDataConnector) AsOfficeATPDataConnector() (*OfficeATPDataConnector, bool) { + return nil, false +} + +// AsOffice365ProjectDataConnector is the BasicDataConnector implementation for CodelessUIDataConnector. +func (cudc CodelessUIDataConnector) AsOffice365ProjectDataConnector() (*Office365ProjectDataConnector, bool) { + return nil, false +} + +// AsOfficePowerBIDataConnector is the BasicDataConnector implementation for CodelessUIDataConnector. +func (cudc CodelessUIDataConnector) AsOfficePowerBIDataConnector() (*OfficePowerBIDataConnector, bool) { + return nil, false +} + +// AsOfficeIRMDataConnector is the BasicDataConnector implementation for CodelessUIDataConnector. +func (cudc CodelessUIDataConnector) AsOfficeIRMDataConnector() (*OfficeIRMDataConnector, bool) { + return nil, false +} + +// AsMDATPDataConnector is the BasicDataConnector implementation for CodelessUIDataConnector. +func (cudc CodelessUIDataConnector) AsMDATPDataConnector() (*MDATPDataConnector, bool) { + return nil, false +} + +// AsOfficeDataConnector is the BasicDataConnector implementation for CodelessUIDataConnector. +func (cudc CodelessUIDataConnector) AsOfficeDataConnector() (*OfficeDataConnector, bool) { + return nil, false +} + +// AsTIDataConnector is the BasicDataConnector implementation for CodelessUIDataConnector. +func (cudc CodelessUIDataConnector) AsTIDataConnector() (*TIDataConnector, bool) { + return nil, false +} + +// AsTiTaxiiDataConnector is the BasicDataConnector implementation for CodelessUIDataConnector. +func (cudc CodelessUIDataConnector) AsTiTaxiiDataConnector() (*TiTaxiiDataConnector, bool) { + return nil, false +} + +// AsIoTDataConnector is the BasicDataConnector implementation for CodelessUIDataConnector. +func (cudc CodelessUIDataConnector) AsIoTDataConnector() (*IoTDataConnector, bool) { + return nil, false +} + +// AsCodelessUIDataConnector is the BasicDataConnector implementation for CodelessUIDataConnector. +func (cudc CodelessUIDataConnector) AsCodelessUIDataConnector() (*CodelessUIDataConnector, bool) { + return &cudc, true +} + +// AsCodelessAPIPollingDataConnector is the BasicDataConnector implementation for CodelessUIDataConnector. +func (cudc CodelessUIDataConnector) AsCodelessAPIPollingDataConnector() (*CodelessAPIPollingDataConnector, bool) { + return nil, false +} + +// AsDataConnector is the BasicDataConnector implementation for CodelessUIDataConnector. +func (cudc CodelessUIDataConnector) AsDataConnector() (*DataConnector, bool) { + return nil, false +} + +// AsBasicDataConnector is the BasicDataConnector implementation for CodelessUIDataConnector. +func (cudc CodelessUIDataConnector) AsBasicDataConnector() (BasicDataConnector, bool) { + return &cudc, true +} + +// UnmarshalJSON is the custom unmarshaler for CodelessUIDataConnector struct. +func (cudc *CodelessUIDataConnector) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var codelessParameters CodelessParameters + err = json.Unmarshal(*v, &codelessParameters) + if err != nil { + return err + } + cudc.CodelessParameters = &codelessParameters + } + case "kind": + if v != nil { + var kind KindBasicDataConnector + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + cudc.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + cudc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cudc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cudc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cudc.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + cudc.SystemData = &systemData + } + } + } + + return nil +} + +// ConnectedEntity expansion result connected entities +type ConnectedEntity struct { + // TargetEntityID - Entity Id of the connected entity + TargetEntityID *string `json:"targetEntityId,omitempty"` + // AdditionalData - key-value pairs for a connected entity mapping + AdditionalData interface{} `json:"additionalData,omitempty"` +} + +// ConnectivityCriteria setting for the connector check connectivity +type ConnectivityCriteria struct { + // Type - type of connectivity. Possible values include: 'ConnectivityTypeIsConnectedQuery' + Type ConnectivityType `json:"type,omitempty"` + // Value - Queries for checking connectivity + Value *[]string `json:"value,omitempty"` +} + +// ConnectorInstructionModelBase instruction step details +type ConnectorInstructionModelBase struct { + // Parameters - The parameters for the setting + Parameters interface{} `json:"parameters,omitempty"` + // Type - The kind of the setting. Possible values include: 'SettingTypeCopyableLabel', 'SettingTypeInstructionStepsGroup', 'SettingTypeInfoMessage' + Type SettingType `json:"type,omitempty"` +} + +// ContentPathMap the mapping of content type to a repo path. +type ContentPathMap struct { + // ContentType - Content type. Possible values include: 'ContentTypeAnalyticRule', 'ContentTypeWorkbook' + ContentType ContentType `json:"contentType,omitempty"` + // Path - The path to the content. + Path *string `json:"path,omitempty"` +} + +// BasicCustomEntityQuery specific entity query that supports put requests. +type BasicCustomEntityQuery interface { + AsActivityCustomEntityQuery() (*ActivityCustomEntityQuery, bool) + AsCustomEntityQuery() (*CustomEntityQuery, bool) +} + +// CustomEntityQuery specific entity query that supports put requests. +type CustomEntityQuery struct { + // Kind - Possible values include: 'KindBasicCustomEntityQueryKindCustomEntityQuery', 'KindBasicCustomEntityQueryKindActivity' + Kind KindBasicCustomEntityQuery `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +func unmarshalBasicCustomEntityQuery(body []byte) (BasicCustomEntityQuery, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["kind"] { + case string(KindBasicCustomEntityQueryKindActivity): + var aceq ActivityCustomEntityQuery + err := json.Unmarshal(body, &aceq) + return aceq, err + default: + var ceq CustomEntityQuery + err := json.Unmarshal(body, &ceq) + return ceq, err + } +} +func unmarshalBasicCustomEntityQueryArray(body []byte) ([]BasicCustomEntityQuery, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + ceqArray := make([]BasicCustomEntityQuery, len(rawMessages)) + + for index, rawMessage := range rawMessages { + ceq, err := unmarshalBasicCustomEntityQuery(*rawMessage) + if err != nil { + return nil, err + } + ceqArray[index] = ceq + } + return ceqArray, nil +} + +// MarshalJSON is the custom marshaler for CustomEntityQuery. +func (ceq CustomEntityQuery) MarshalJSON() ([]byte, error) { + ceq.Kind = KindBasicCustomEntityQueryKindCustomEntityQuery + objectMap := make(map[string]interface{}) + if ceq.Kind != "" { + objectMap["kind"] = ceq.Kind + } + if ceq.Etag != nil { + objectMap["etag"] = ceq.Etag + } + return json.Marshal(objectMap) +} + +// AsActivityCustomEntityQuery is the BasicCustomEntityQuery implementation for CustomEntityQuery. +func (ceq CustomEntityQuery) AsActivityCustomEntityQuery() (*ActivityCustomEntityQuery, bool) { + return nil, false +} + +// AsCustomEntityQuery is the BasicCustomEntityQuery implementation for CustomEntityQuery. +func (ceq CustomEntityQuery) AsCustomEntityQuery() (*CustomEntityQuery, bool) { + return &ceq, true +} + +// AsBasicCustomEntityQuery is the BasicCustomEntityQuery implementation for CustomEntityQuery. +func (ceq CustomEntityQuery) AsBasicCustomEntityQuery() (BasicCustomEntityQuery, bool) { + return &ceq, true +} + +// Customs customs permissions required for the connector +type Customs struct { + // Name - Customs permissions name + Name *string `json:"name,omitempty"` + // Description - Customs permissions description + Description *string `json:"description,omitempty"` +} + +// CustomsPermission customs permissions required for the connector +type CustomsPermission struct { + // Name - Customs permissions name + Name *string `json:"name,omitempty"` + // Description - Customs permissions description + Description *string `json:"description,omitempty"` +} + +// BasicDataConnector data connector +type BasicDataConnector interface { + AsAADDataConnector() (*AADDataConnector, bool) + AsMSTIDataConnector() (*MSTIDataConnector, bool) + AsMTPDataConnector() (*MTPDataConnector, bool) + AsAATPDataConnector() (*AATPDataConnector, bool) + AsASCDataConnector() (*ASCDataConnector, bool) + AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) + AsAwsS3DataConnector() (*AwsS3DataConnector, bool) + AsMCASDataConnector() (*MCASDataConnector, bool) + AsDynamics365DataConnector() (*Dynamics365DataConnector, bool) + AsOfficeATPDataConnector() (*OfficeATPDataConnector, bool) + AsOffice365ProjectDataConnector() (*Office365ProjectDataConnector, bool) + AsOfficePowerBIDataConnector() (*OfficePowerBIDataConnector, bool) + AsOfficeIRMDataConnector() (*OfficeIRMDataConnector, bool) + AsMDATPDataConnector() (*MDATPDataConnector, bool) + AsOfficeDataConnector() (*OfficeDataConnector, bool) + AsTIDataConnector() (*TIDataConnector, bool) + AsTiTaxiiDataConnector() (*TiTaxiiDataConnector, bool) + AsIoTDataConnector() (*IoTDataConnector, bool) + AsCodelessUIDataConnector() (*CodelessUIDataConnector, bool) + AsCodelessAPIPollingDataConnector() (*CodelessAPIPollingDataConnector, bool) + AsDataConnector() (*DataConnector, bool) +} + +// DataConnector data connector +type DataConnector struct { + autorest.Response `json:"-"` + // Kind - Possible values include: 'KindBasicDataConnectorKindDataConnector', 'KindBasicDataConnectorKindAzureActiveDirectory', 'KindBasicDataConnectorKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorKindMicrosoftThreatProtection', 'KindBasicDataConnectorKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorKindAzureSecurityCenter', 'KindBasicDataConnectorKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorKindAmazonWebServicesS3', 'KindBasicDataConnectorKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorKindDynamics365', 'KindBasicDataConnectorKindOfficeATP', 'KindBasicDataConnectorKindOffice365Project', 'KindBasicDataConnectorKindOfficePowerBI', 'KindBasicDataConnectorKindOfficeIRM', 'KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorKindOffice365', 'KindBasicDataConnectorKindThreatIntelligence', 'KindBasicDataConnectorKindThreatIntelligenceTaxii', 'KindBasicDataConnectorKindIOT', 'KindBasicDataConnectorKindGenericUI', 'KindBasicDataConnectorKindAPIPolling' + Kind KindBasicDataConnector `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +func unmarshalBasicDataConnector(body []byte) (BasicDataConnector, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["kind"] { + case string(KindBasicDataConnectorKindAzureActiveDirectory): + var adc AADDataConnector + err := json.Unmarshal(body, &adc) + return adc, err + case string(KindBasicDataConnectorKindMicrosoftThreatIntelligence): + var mdc MSTIDataConnector + err := json.Unmarshal(body, &mdc) + return mdc, err + case string(KindBasicDataConnectorKindMicrosoftThreatProtection): + var mdc MTPDataConnector + err := json.Unmarshal(body, &mdc) + return mdc, err + case string(KindBasicDataConnectorKindAzureAdvancedThreatProtection): + var adc AATPDataConnector + err := json.Unmarshal(body, &adc) + return adc, err + case string(KindBasicDataConnectorKindAzureSecurityCenter): + var adc ASCDataConnector + err := json.Unmarshal(body, &adc) + return adc, err + case string(KindBasicDataConnectorKindAmazonWebServicesCloudTrail): + var actdc AwsCloudTrailDataConnector + err := json.Unmarshal(body, &actdc) + return actdc, err + case string(KindBasicDataConnectorKindAmazonWebServicesS3): + var asdc AwsS3DataConnector + err := json.Unmarshal(body, &asdc) + return asdc, err + case string(KindBasicDataConnectorKindMicrosoftCloudAppSecurity): + var mdc MCASDataConnector + err := json.Unmarshal(body, &mdc) + return mdc, err + case string(KindBasicDataConnectorKindDynamics365): + var d3dc Dynamics365DataConnector + err := json.Unmarshal(body, &d3dc) + return d3dc, err + case string(KindBasicDataConnectorKindOfficeATP): + var oadc OfficeATPDataConnector + err := json.Unmarshal(body, &oadc) + return oadc, err + case string(KindBasicDataConnectorKindOffice365Project): + var o3pdc Office365ProjectDataConnector + err := json.Unmarshal(body, &o3pdc) + return o3pdc, err + case string(KindBasicDataConnectorKindOfficePowerBI): + var opbdc OfficePowerBIDataConnector + err := json.Unmarshal(body, &opbdc) + return opbdc, err + case string(KindBasicDataConnectorKindOfficeIRM): + var oidc OfficeIRMDataConnector + err := json.Unmarshal(body, &oidc) + return oidc, err + case string(KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection): + var mdc MDATPDataConnector + err := json.Unmarshal(body, &mdc) + return mdc, err + case string(KindBasicDataConnectorKindOffice365): + var odc OfficeDataConnector + err := json.Unmarshal(body, &odc) + return odc, err + case string(KindBasicDataConnectorKindThreatIntelligence): + var tdc TIDataConnector + err := json.Unmarshal(body, &tdc) + return tdc, err + case string(KindBasicDataConnectorKindThreatIntelligenceTaxii): + var ttdc TiTaxiiDataConnector + err := json.Unmarshal(body, &ttdc) + return ttdc, err + case string(KindBasicDataConnectorKindIOT): + var itdc IoTDataConnector + err := json.Unmarshal(body, &itdc) + return itdc, err + case string(KindBasicDataConnectorKindGenericUI): + var cudc CodelessUIDataConnector + err := json.Unmarshal(body, &cudc) + return cudc, err + case string(KindBasicDataConnectorKindAPIPolling): + var capdc CodelessAPIPollingDataConnector + err := json.Unmarshal(body, &capdc) + return capdc, err + default: + var dc DataConnector + err := json.Unmarshal(body, &dc) + return dc, err + } +} +func unmarshalBasicDataConnectorArray(body []byte) ([]BasicDataConnector, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + dcArray := make([]BasicDataConnector, len(rawMessages)) + + for index, rawMessage := range rawMessages { + dc, err := unmarshalBasicDataConnector(*rawMessage) + if err != nil { + return nil, err + } + dcArray[index] = dc + } + return dcArray, nil +} + +// MarshalJSON is the custom marshaler for DataConnector. +func (dc DataConnector) MarshalJSON() ([]byte, error) { + dc.Kind = KindBasicDataConnectorKindDataConnector + objectMap := make(map[string]interface{}) + if dc.Kind != "" { + objectMap["kind"] = dc.Kind + } + if dc.Etag != nil { + objectMap["etag"] = dc.Etag + } + return json.Marshal(objectMap) +} + +// AsAADDataConnector is the BasicDataConnector implementation for DataConnector. +func (dc DataConnector) AsAADDataConnector() (*AADDataConnector, bool) { + return nil, false +} + +// AsMSTIDataConnector is the BasicDataConnector implementation for DataConnector. +func (dc DataConnector) AsMSTIDataConnector() (*MSTIDataConnector, bool) { + return nil, false +} + +// AsMTPDataConnector is the BasicDataConnector implementation for DataConnector. +func (dc DataConnector) AsMTPDataConnector() (*MTPDataConnector, bool) { + return nil, false +} + +// AsAATPDataConnector is the BasicDataConnector implementation for DataConnector. +func (dc DataConnector) AsAATPDataConnector() (*AATPDataConnector, bool) { + return nil, false +} + +// AsASCDataConnector is the BasicDataConnector implementation for DataConnector. +func (dc DataConnector) AsASCDataConnector() (*ASCDataConnector, bool) { + return nil, false +} + +// AsAwsCloudTrailDataConnector is the BasicDataConnector implementation for DataConnector. +func (dc DataConnector) AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) { + return nil, false +} + +// AsAwsS3DataConnector is the BasicDataConnector implementation for DataConnector. +func (dc DataConnector) AsAwsS3DataConnector() (*AwsS3DataConnector, bool) { + return nil, false +} + +// AsMCASDataConnector is the BasicDataConnector implementation for DataConnector. +func (dc DataConnector) AsMCASDataConnector() (*MCASDataConnector, bool) { + return nil, false +} + +// AsDynamics365DataConnector is the BasicDataConnector implementation for DataConnector. +func (dc DataConnector) AsDynamics365DataConnector() (*Dynamics365DataConnector, bool) { + return nil, false +} + +// AsOfficeATPDataConnector is the BasicDataConnector implementation for DataConnector. +func (dc DataConnector) AsOfficeATPDataConnector() (*OfficeATPDataConnector, bool) { + return nil, false +} + +// AsOffice365ProjectDataConnector is the BasicDataConnector implementation for DataConnector. +func (dc DataConnector) AsOffice365ProjectDataConnector() (*Office365ProjectDataConnector, bool) { + return nil, false +} + +// AsOfficePowerBIDataConnector is the BasicDataConnector implementation for DataConnector. +func (dc DataConnector) AsOfficePowerBIDataConnector() (*OfficePowerBIDataConnector, bool) { + return nil, false +} + +// AsOfficeIRMDataConnector is the BasicDataConnector implementation for DataConnector. +func (dc DataConnector) AsOfficeIRMDataConnector() (*OfficeIRMDataConnector, bool) { + return nil, false +} + +// AsMDATPDataConnector is the BasicDataConnector implementation for DataConnector. +func (dc DataConnector) AsMDATPDataConnector() (*MDATPDataConnector, bool) { + return nil, false +} + +// AsOfficeDataConnector is the BasicDataConnector implementation for DataConnector. +func (dc DataConnector) AsOfficeDataConnector() (*OfficeDataConnector, bool) { + return nil, false +} + +// AsTIDataConnector is the BasicDataConnector implementation for DataConnector. +func (dc DataConnector) AsTIDataConnector() (*TIDataConnector, bool) { + return nil, false +} + +// AsTiTaxiiDataConnector is the BasicDataConnector implementation for DataConnector. +func (dc DataConnector) AsTiTaxiiDataConnector() (*TiTaxiiDataConnector, bool) { + return nil, false +} + +// AsIoTDataConnector is the BasicDataConnector implementation for DataConnector. +func (dc DataConnector) AsIoTDataConnector() (*IoTDataConnector, bool) { + return nil, false +} + +// AsCodelessUIDataConnector is the BasicDataConnector implementation for DataConnector. +func (dc DataConnector) AsCodelessUIDataConnector() (*CodelessUIDataConnector, bool) { + return nil, false +} + +// AsCodelessAPIPollingDataConnector is the BasicDataConnector implementation for DataConnector. +func (dc DataConnector) AsCodelessAPIPollingDataConnector() (*CodelessAPIPollingDataConnector, bool) { + return nil, false +} + +// AsDataConnector is the BasicDataConnector implementation for DataConnector. +func (dc DataConnector) AsDataConnector() (*DataConnector, bool) { + return &dc, true +} + +// AsBasicDataConnector is the BasicDataConnector implementation for DataConnector. +func (dc DataConnector) AsBasicDataConnector() (BasicDataConnector, bool) { + return &dc, true +} + +// DataConnectorConnectBody represents Codeless API Polling data connector. +type DataConnectorConnectBody struct { + // Kind - The authentication kind used to poll the data. Possible values include: 'ConnectAuthKindBasic', 'ConnectAuthKindOAuth2', 'ConnectAuthKindAPIKey' + Kind ConnectAuthKind `json:"kind,omitempty"` + // APIKey - The API key of the audit server. + APIKey *string `json:"apiKey,omitempty"` + // ClientSecret - The client secret of the OAuth 2.0 application. + ClientSecret *string `json:"clientSecret,omitempty"` + // ClientID - The client id of the OAuth 2.0 application. + ClientID *string `json:"clientId,omitempty"` + // AuthorizationCode - The authorization code used in OAuth 2.0 code flow to issue a token. + AuthorizationCode *string `json:"authorizationCode,omitempty"` + // UserName - The user name in the audit log server. + UserName *string `json:"userName,omitempty"` + // Password - The user password in the audit log server. + Password *string `json:"password,omitempty"` + RequestConfigUserInputValues *[]interface{} `json:"requestConfigUserInputValues,omitempty"` +} + +// DataConnectorDataTypeCommon common field for data type in data connectors. +type DataConnectorDataTypeCommon struct { + // State - Describe whether this data type connection is enabled or not. Possible values include: 'DataTypeStateEnabled', 'DataTypeStateDisabled' + State DataTypeState `json:"state,omitempty"` +} + +// DataConnectorList list all the data connectors. +type DataConnectorList struct { + autorest.Response `json:"-"` + // NextLink - READ-ONLY; URL to fetch the next set of data connectors. + NextLink *string `json:"nextLink,omitempty"` + // Value - Array of data connectors. + Value *[]BasicDataConnector `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataConnectorList. +func (dcl DataConnectorList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dcl.Value != nil { + objectMap["value"] = dcl.Value + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DataConnectorList struct. +func (dcl *DataConnectorList) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "nextLink": + if v != nil { + var nextLink string + err = json.Unmarshal(*v, &nextLink) + if err != nil { + return err + } + dcl.NextLink = &nextLink + } + case "value": + if v != nil { + value, err := unmarshalBasicDataConnectorArray(*v) + if err != nil { + return err + } + dcl.Value = &value + } + } + } + + return nil +} + +// DataConnectorListIterator provides access to a complete listing of DataConnector values. +type DataConnectorListIterator struct { + i int + page DataConnectorListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DataConnectorListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataConnectorListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DataConnectorListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DataConnectorListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DataConnectorListIterator) Response() DataConnectorList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DataConnectorListIterator) Value() BasicDataConnector { + if !iter.page.NotDone() { + return DataConnector{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DataConnectorListIterator type. +func NewDataConnectorListIterator(page DataConnectorListPage) DataConnectorListIterator { + return DataConnectorListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dcl DataConnectorList) IsEmpty() bool { + return dcl.Value == nil || len(*dcl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dcl DataConnectorList) hasNextLink() bool { + return dcl.NextLink != nil && len(*dcl.NextLink) != 0 +} + +// dataConnectorListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dcl DataConnectorList) dataConnectorListPreparer(ctx context.Context) (*http.Request, error) { + if !dcl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dcl.NextLink))) +} + +// DataConnectorListPage contains a page of BasicDataConnector values. +type DataConnectorListPage struct { + fn func(context.Context, DataConnectorList) (DataConnectorList, error) + dcl DataConnectorList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DataConnectorListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataConnectorListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.dcl) + if err != nil { + return err + } + page.dcl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DataConnectorListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DataConnectorListPage) NotDone() bool { + return !page.dcl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DataConnectorListPage) Response() DataConnectorList { + return page.dcl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DataConnectorListPage) Values() []BasicDataConnector { + if page.dcl.IsEmpty() { + return nil + } + return *page.dcl.Value +} + +// Creates a new instance of the DataConnectorListPage type. +func NewDataConnectorListPage(cur DataConnectorList, getNextPage func(context.Context, DataConnectorList) (DataConnectorList, error)) DataConnectorListPage { + return DataConnectorListPage{ + fn: getNextPage, + dcl: cur, + } +} + +// DataConnectorModel ... +type DataConnectorModel struct { + autorest.Response `json:"-"` + Value BasicDataConnector `json:"value,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for DataConnectorModel struct. +func (dcm *DataConnectorModel) UnmarshalJSON(body []byte) error { + dc, err := unmarshalBasicDataConnector(body) + if err != nil { + return err + } + dcm.Value = dc + + return nil +} + +// DataConnectorRequirementsState data connector requirements status. +type DataConnectorRequirementsState struct { + autorest.Response `json:"-"` + // AuthorizationState - Authorization state for this connector. Possible values include: 'DataConnectorAuthorizationStateValid', 'DataConnectorAuthorizationStateInvalid' + AuthorizationState DataConnectorAuthorizationState `json:"authorizationState,omitempty"` + // LicenseState - License state for this connector. Possible values include: 'DataConnectorLicenseStateValid', 'DataConnectorLicenseStateInvalid', 'DataConnectorLicenseStateUnknown' + LicenseState DataConnectorLicenseState `json:"licenseState,omitempty"` +} + +// BasicDataConnectorsCheckRequirements data connector requirements properties. +type BasicDataConnectorsCheckRequirements interface { + AsAADCheckRequirements() (*AADCheckRequirements, bool) + AsAATPCheckRequirements() (*AATPCheckRequirements, bool) + AsASCCheckRequirements() (*ASCCheckRequirements, bool) + AsAwsCloudTrailCheckRequirements() (*AwsCloudTrailCheckRequirements, bool) + AsAwsS3CheckRequirements() (*AwsS3CheckRequirements, bool) + AsDynamics365CheckRequirements() (*Dynamics365CheckRequirements, bool) + AsMCASCheckRequirements() (*MCASCheckRequirements, bool) + AsMDATPCheckRequirements() (*MDATPCheckRequirements, bool) + AsMSTICheckRequirements() (*MSTICheckRequirements, bool) + AsMtpCheckRequirements() (*MtpCheckRequirements, bool) + AsOfficeATPCheckRequirements() (*OfficeATPCheckRequirements, bool) + AsOfficeIRMCheckRequirements() (*OfficeIRMCheckRequirements, bool) + AsOffice365ProjectCheckRequirements() (*Office365ProjectCheckRequirements, bool) + AsOfficePowerBICheckRequirements() (*OfficePowerBICheckRequirements, bool) + AsTICheckRequirements() (*TICheckRequirements, bool) + AsTiTaxiiCheckRequirements() (*TiTaxiiCheckRequirements, bool) + AsIoTCheckRequirements() (*IoTCheckRequirements, bool) + AsDataConnectorsCheckRequirements() (*DataConnectorsCheckRequirements, bool) +} + +// DataConnectorsCheckRequirements data connector requirements properties. +type DataConnectorsCheckRequirements struct { + // Kind - Possible values include: 'KindBasicDataConnectorsCheckRequirementsKindDataConnectorsCheckRequirements', 'KindBasicDataConnectorsCheckRequirementsKindAzureActiveDirectory', 'KindBasicDataConnectorsCheckRequirementsKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindAzureSecurityCenter', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesS3', 'KindBasicDataConnectorsCheckRequirementsKindDynamics365', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindOfficeATP', 'KindBasicDataConnectorsCheckRequirementsKindOfficeIRM', 'KindBasicDataConnectorsCheckRequirementsKindOffice365Project', 'KindBasicDataConnectorsCheckRequirementsKindOfficePowerBI', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligenceTaxii', 'KindBasicDataConnectorsCheckRequirementsKindIOT' + Kind KindBasicDataConnectorsCheckRequirements `json:"kind,omitempty"` +} + +func unmarshalBasicDataConnectorsCheckRequirements(body []byte) (BasicDataConnectorsCheckRequirements, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["kind"] { + case string(KindBasicDataConnectorsCheckRequirementsKindAzureActiveDirectory): + var acr AADCheckRequirements + err := json.Unmarshal(body, &acr) + return acr, err + case string(KindBasicDataConnectorsCheckRequirementsKindAzureAdvancedThreatProtection): + var acr AATPCheckRequirements + err := json.Unmarshal(body, &acr) + return acr, err + case string(KindBasicDataConnectorsCheckRequirementsKindAzureSecurityCenter): + var acr ASCCheckRequirements + err := json.Unmarshal(body, &acr) + return acr, err + case string(KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesCloudTrail): + var actcr AwsCloudTrailCheckRequirements + err := json.Unmarshal(body, &actcr) + return actcr, err + case string(KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesS3): + var ascr AwsS3CheckRequirements + err := json.Unmarshal(body, &ascr) + return ascr, err + case string(KindBasicDataConnectorsCheckRequirementsKindDynamics365): + var d3cr Dynamics365CheckRequirements + err := json.Unmarshal(body, &d3cr) + return d3cr, err + case string(KindBasicDataConnectorsCheckRequirementsKindMicrosoftCloudAppSecurity): + var mcr MCASCheckRequirements + err := json.Unmarshal(body, &mcr) + return mcr, err + case string(KindBasicDataConnectorsCheckRequirementsKindMicrosoftDefenderAdvancedThreatProtection): + var mcr MDATPCheckRequirements + err := json.Unmarshal(body, &mcr) + return mcr, err + case string(KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatIntelligence): + var mcr MSTICheckRequirements + err := json.Unmarshal(body, &mcr) + return mcr, err + case string(KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatProtection): + var mcr MtpCheckRequirements + err := json.Unmarshal(body, &mcr) + return mcr, err + case string(KindBasicDataConnectorsCheckRequirementsKindOfficeATP): + var oacr OfficeATPCheckRequirements + err := json.Unmarshal(body, &oacr) + return oacr, err + case string(KindBasicDataConnectorsCheckRequirementsKindOfficeIRM): + var oicr OfficeIRMCheckRequirements + err := json.Unmarshal(body, &oicr) + return oicr, err + case string(KindBasicDataConnectorsCheckRequirementsKindOffice365Project): + var o3pcr Office365ProjectCheckRequirements + err := json.Unmarshal(body, &o3pcr) + return o3pcr, err + case string(KindBasicDataConnectorsCheckRequirementsKindOfficePowerBI): + var opbcr OfficePowerBICheckRequirements + err := json.Unmarshal(body, &opbcr) + return opbcr, err + case string(KindBasicDataConnectorsCheckRequirementsKindThreatIntelligence): + var tcr TICheckRequirements + err := json.Unmarshal(body, &tcr) + return tcr, err + case string(KindBasicDataConnectorsCheckRequirementsKindThreatIntelligenceTaxii): + var ttcr TiTaxiiCheckRequirements + err := json.Unmarshal(body, &ttcr) + return ttcr, err + case string(KindBasicDataConnectorsCheckRequirementsKindIOT): + var itcr IoTCheckRequirements + err := json.Unmarshal(body, &itcr) + return itcr, err + default: + var dccr DataConnectorsCheckRequirements + err := json.Unmarshal(body, &dccr) + return dccr, err + } +} +func unmarshalBasicDataConnectorsCheckRequirementsArray(body []byte) ([]BasicDataConnectorsCheckRequirements, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + dccrArray := make([]BasicDataConnectorsCheckRequirements, len(rawMessages)) + + for index, rawMessage := range rawMessages { + dccr, err := unmarshalBasicDataConnectorsCheckRequirements(*rawMessage) + if err != nil { + return nil, err + } + dccrArray[index] = dccr + } + return dccrArray, nil +} + +// MarshalJSON is the custom marshaler for DataConnectorsCheckRequirements. +func (dccr DataConnectorsCheckRequirements) MarshalJSON() ([]byte, error) { + dccr.Kind = KindBasicDataConnectorsCheckRequirementsKindDataConnectorsCheckRequirements + objectMap := make(map[string]interface{}) + if dccr.Kind != "" { + objectMap["kind"] = dccr.Kind + } + return json.Marshal(objectMap) +} + +// AsAADCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for DataConnectorsCheckRequirements. +func (dccr DataConnectorsCheckRequirements) AsAADCheckRequirements() (*AADCheckRequirements, bool) { + return nil, false +} + +// AsAATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for DataConnectorsCheckRequirements. +func (dccr DataConnectorsCheckRequirements) AsAATPCheckRequirements() (*AATPCheckRequirements, bool) { + return nil, false +} + +// AsASCCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for DataConnectorsCheckRequirements. +func (dccr DataConnectorsCheckRequirements) AsASCCheckRequirements() (*ASCCheckRequirements, bool) { + return nil, false +} + +// AsAwsCloudTrailCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for DataConnectorsCheckRequirements. +func (dccr DataConnectorsCheckRequirements) AsAwsCloudTrailCheckRequirements() (*AwsCloudTrailCheckRequirements, bool) { + return nil, false +} + +// AsAwsS3CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for DataConnectorsCheckRequirements. +func (dccr DataConnectorsCheckRequirements) AsAwsS3CheckRequirements() (*AwsS3CheckRequirements, bool) { + return nil, false +} + +// AsDynamics365CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for DataConnectorsCheckRequirements. +func (dccr DataConnectorsCheckRequirements) AsDynamics365CheckRequirements() (*Dynamics365CheckRequirements, bool) { + return nil, false +} + +// AsMCASCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for DataConnectorsCheckRequirements. +func (dccr DataConnectorsCheckRequirements) AsMCASCheckRequirements() (*MCASCheckRequirements, bool) { + return nil, false +} + +// AsMDATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for DataConnectorsCheckRequirements. +func (dccr DataConnectorsCheckRequirements) AsMDATPCheckRequirements() (*MDATPCheckRequirements, bool) { + return nil, false +} + +// AsMSTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for DataConnectorsCheckRequirements. +func (dccr DataConnectorsCheckRequirements) AsMSTICheckRequirements() (*MSTICheckRequirements, bool) { + return nil, false +} + +// AsMtpCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for DataConnectorsCheckRequirements. +func (dccr DataConnectorsCheckRequirements) AsMtpCheckRequirements() (*MtpCheckRequirements, bool) { + return nil, false +} + +// AsOfficeATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for DataConnectorsCheckRequirements. +func (dccr DataConnectorsCheckRequirements) AsOfficeATPCheckRequirements() (*OfficeATPCheckRequirements, bool) { + return nil, false +} + +// AsOfficeIRMCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for DataConnectorsCheckRequirements. +func (dccr DataConnectorsCheckRequirements) AsOfficeIRMCheckRequirements() (*OfficeIRMCheckRequirements, bool) { + return nil, false +} + +// AsOffice365ProjectCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for DataConnectorsCheckRequirements. +func (dccr DataConnectorsCheckRequirements) AsOffice365ProjectCheckRequirements() (*Office365ProjectCheckRequirements, bool) { + return nil, false +} + +// AsOfficePowerBICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for DataConnectorsCheckRequirements. +func (dccr DataConnectorsCheckRequirements) AsOfficePowerBICheckRequirements() (*OfficePowerBICheckRequirements, bool) { + return nil, false +} + +// AsTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for DataConnectorsCheckRequirements. +func (dccr DataConnectorsCheckRequirements) AsTICheckRequirements() (*TICheckRequirements, bool) { + return nil, false +} + +// AsTiTaxiiCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for DataConnectorsCheckRequirements. +func (dccr DataConnectorsCheckRequirements) AsTiTaxiiCheckRequirements() (*TiTaxiiCheckRequirements, bool) { + return nil, false +} + +// AsIoTCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for DataConnectorsCheckRequirements. +func (dccr DataConnectorsCheckRequirements) AsIoTCheckRequirements() (*IoTCheckRequirements, bool) { + return nil, false +} + +// AsDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for DataConnectorsCheckRequirements. +func (dccr DataConnectorsCheckRequirements) AsDataConnectorsCheckRequirements() (*DataConnectorsCheckRequirements, bool) { + return &dccr, true +} + +// AsBasicDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for DataConnectorsCheckRequirements. +func (dccr DataConnectorsCheckRequirements) AsBasicDataConnectorsCheckRequirements() (BasicDataConnectorsCheckRequirements, bool) { + return &dccr, true +} + +// DataConnectorTenantID properties data connector on tenant level. +type DataConnectorTenantID struct { + // TenantID - The tenant id to connect to, and get the data from. + TenantID *string `json:"tenantId,omitempty"` +} + +// DataConnectorWithAlertsProperties data connector properties. +type DataConnectorWithAlertsProperties struct { + // DataTypes - The available data types for the connector. + DataTypes *AlertsDataTypeOfDataConnector `json:"dataTypes,omitempty"` +} + +// DataTypeDefinitions the data type definition +type DataTypeDefinitions struct { + // DataType - The data type name + DataType *string `json:"dataType,omitempty"` +} + +// Deployment description about a deployment. +type Deployment struct { + // DeploymentID - Deployment identifier. + DeploymentID *string `json:"deploymentId,omitempty"` + // DeploymentState - Current status of the deployment. Possible values include: 'DeploymentStateInProgress', 'DeploymentStateCompleted', 'DeploymentStateQueued', 'DeploymentStateCanceling' + DeploymentState DeploymentState `json:"deploymentState,omitempty"` + // DeploymentResult - The outcome of the deployment. Possible values include: 'DeploymentResultSuccess', 'DeploymentResultCanceled', 'DeploymentResultFailed' + DeploymentResult DeploymentResult `json:"deploymentResult,omitempty"` + // DeploymentTime - The time when the deployment finished. + DeploymentTime *date.Time `json:"deploymentTime,omitempty"` + // DeploymentLogsURL - Url to access repository action logs. + DeploymentLogsURL *string `json:"deploymentLogsUrl,omitempty"` +} + +// DeploymentInfo information regarding a deployment. +type DeploymentInfo struct { + // DeploymentFetchStatus - Status while fetching the last deployment. Possible values include: 'DeploymentFetchStatusSuccess', 'DeploymentFetchStatusUnauthorized', 'DeploymentFetchStatusNotFound' + DeploymentFetchStatus DeploymentFetchStatus `json:"deploymentFetchStatus,omitempty"` + // Deployment - Deployment information. + Deployment *Deployment `json:"deployment,omitempty"` + // Message - Additional details about the deployment that can be shown to the user. + Message *string `json:"message,omitempty"` +} + +// DNSEntity represents a dns entity. +type DNSEntity struct { + // DNSEntityProperties - Dns entity properties + *DNSEntityProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicEntityKindEntity', 'KindBasicEntityKindURL', 'KindBasicEntityKindSubmissionMail', 'KindBasicEntityKindSecurityGroup', 'KindBasicEntityKindSecurityAlert', 'KindBasicEntityKindRegistryValue', 'KindBasicEntityKindRegistryKey', 'KindBasicEntityKindProcess', 'KindBasicEntityKindMalware', 'KindBasicEntityKindMailMessage', 'KindBasicEntityKindMailCluster', 'KindBasicEntityKindMailbox', 'KindBasicEntityKindIP', 'KindBasicEntityKindIoTDevice', 'KindBasicEntityKindBookmark', 'KindBasicEntityKindHost', 'KindBasicEntityKindFileHash', 'KindBasicEntityKindFile', 'KindBasicEntityKindDNSResolution', 'KindBasicEntityKindCloudApplication', 'KindBasicEntityKindAzureResource', 'KindBasicEntityKindAccount' + Kind KindBasicEntity `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for DNSEntity. +func (de DNSEntity) MarshalJSON() ([]byte, error) { + de.Kind = KindBasicEntityKindDNSResolution + objectMap := make(map[string]interface{}) + if de.DNSEntityProperties != nil { + objectMap["properties"] = de.DNSEntityProperties + } + if de.Kind != "" { + objectMap["kind"] = de.Kind + } + return json.Marshal(objectMap) +} + +// AsURLEntity is the BasicEntity implementation for DNSEntity. +func (de DNSEntity) AsURLEntity() (*URLEntity, bool) { + return nil, false +} + +// AsSubmissionMailEntity is the BasicEntity implementation for DNSEntity. +func (de DNSEntity) AsSubmissionMailEntity() (*SubmissionMailEntity, bool) { + return nil, false +} + +// AsSecurityGroupEntity is the BasicEntity implementation for DNSEntity. +func (de DNSEntity) AsSecurityGroupEntity() (*SecurityGroupEntity, bool) { + return nil, false +} + +// AsSecurityAlert is the BasicEntity implementation for DNSEntity. +func (de DNSEntity) AsSecurityAlert() (*SecurityAlert, bool) { + return nil, false +} + +// AsRegistryValueEntity is the BasicEntity implementation for DNSEntity. +func (de DNSEntity) AsRegistryValueEntity() (*RegistryValueEntity, bool) { + return nil, false +} + +// AsRegistryKeyEntity is the BasicEntity implementation for DNSEntity. +func (de DNSEntity) AsRegistryKeyEntity() (*RegistryKeyEntity, bool) { + return nil, false +} + +// AsProcessEntity is the BasicEntity implementation for DNSEntity. +func (de DNSEntity) AsProcessEntity() (*ProcessEntity, bool) { + return nil, false +} + +// AsMalwareEntity is the BasicEntity implementation for DNSEntity. +func (de DNSEntity) AsMalwareEntity() (*MalwareEntity, bool) { + return nil, false +} + +// AsMailMessageEntity is the BasicEntity implementation for DNSEntity. +func (de DNSEntity) AsMailMessageEntity() (*MailMessageEntity, bool) { + return nil, false +} + +// AsMailClusterEntity is the BasicEntity implementation for DNSEntity. +func (de DNSEntity) AsMailClusterEntity() (*MailClusterEntity, bool) { + return nil, false +} + +// AsMailboxEntity is the BasicEntity implementation for DNSEntity. +func (de DNSEntity) AsMailboxEntity() (*MailboxEntity, bool) { + return nil, false +} + +// AsIPEntity is the BasicEntity implementation for DNSEntity. +func (de DNSEntity) AsIPEntity() (*IPEntity, bool) { + return nil, false +} + +// AsIoTDeviceEntity is the BasicEntity implementation for DNSEntity. +func (de DNSEntity) AsIoTDeviceEntity() (*IoTDeviceEntity, bool) { + return nil, false +} + +// AsHuntingBookmark is the BasicEntity implementation for DNSEntity. +func (de DNSEntity) AsHuntingBookmark() (*HuntingBookmark, bool) { + return nil, false +} + +// AsHostEntity is the BasicEntity implementation for DNSEntity. +func (de DNSEntity) AsHostEntity() (*HostEntity, bool) { + return nil, false +} + +// AsFileHashEntity is the BasicEntity implementation for DNSEntity. +func (de DNSEntity) AsFileHashEntity() (*FileHashEntity, bool) { + return nil, false +} + +// AsFileEntity is the BasicEntity implementation for DNSEntity. +func (de DNSEntity) AsFileEntity() (*FileEntity, bool) { + return nil, false +} + +// AsDNSEntity is the BasicEntity implementation for DNSEntity. +func (de DNSEntity) AsDNSEntity() (*DNSEntity, bool) { + return &de, true +} + +// AsCloudApplicationEntity is the BasicEntity implementation for DNSEntity. +func (de DNSEntity) AsCloudApplicationEntity() (*CloudApplicationEntity, bool) { + return nil, false +} + +// AsAzureResourceEntity is the BasicEntity implementation for DNSEntity. +func (de DNSEntity) AsAzureResourceEntity() (*AzureResourceEntity, bool) { + return nil, false +} + +// AsAccountEntity is the BasicEntity implementation for DNSEntity. +func (de DNSEntity) AsAccountEntity() (*AccountEntity, bool) { + return nil, false +} + +// AsEntity is the BasicEntity implementation for DNSEntity. +func (de DNSEntity) AsEntity() (*Entity, bool) { + return nil, false +} + +// AsBasicEntity is the BasicEntity implementation for DNSEntity. +func (de DNSEntity) AsBasicEntity() (BasicEntity, bool) { + return &de, true +} + +// UnmarshalJSON is the custom unmarshaler for DNSEntity struct. +func (de *DNSEntity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var DNSEntityProperties DNSEntityProperties + err = json.Unmarshal(*v, &DNSEntityProperties) + if err != nil { + return err + } + de.DNSEntityProperties = &DNSEntityProperties + } + case "kind": + if v != nil { + var kind KindBasicEntity + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + de.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + de.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + de.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + de.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + de.SystemData = &systemData + } + } + } + + return nil +} + +// DNSEntityProperties dns entity property bag. +type DNSEntityProperties struct { + // DNSServerIPEntityID - READ-ONLY; An ip entity id for the dns server resolving the request + DNSServerIPEntityID *string `json:"dnsServerIpEntityId,omitempty"` + // DomainName - READ-ONLY; The name of the dns record associated with the alert + DomainName *string `json:"domainName,omitempty"` + // HostIPAddressEntityID - READ-ONLY; An ip entity id for the dns request client + HostIPAddressEntityID *string `json:"hostIpAddressEntityId,omitempty"` + // IPAddressEntityIds - READ-ONLY; Ip entity identifiers for the resolved ip address. + IPAddressEntityIds *[]string `json:"ipAddressEntityIds,omitempty"` + // AdditionalData - READ-ONLY; A bag of custom fields that should be part of the entity and will be presented to the user. + AdditionalData map[string]interface{} `json:"additionalData"` + // FriendlyName - READ-ONLY; The graph item display name which is a short humanly readable description of the graph item instance. This property is optional and might be system generated. + FriendlyName *string `json:"friendlyName,omitempty"` +} + +// MarshalJSON is the custom marshaler for DNSEntityProperties. +func (dep DNSEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Dynamics365CheckRequirements represents Dynamics365 requirements check request. +type Dynamics365CheckRequirements struct { + // Dynamics365CheckRequirementsProperties - Dynamics365 requirements check properties. + *Dynamics365CheckRequirementsProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorsCheckRequirementsKindDataConnectorsCheckRequirements', 'KindBasicDataConnectorsCheckRequirementsKindAzureActiveDirectory', 'KindBasicDataConnectorsCheckRequirementsKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindAzureSecurityCenter', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesS3', 'KindBasicDataConnectorsCheckRequirementsKindDynamics365', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindOfficeATP', 'KindBasicDataConnectorsCheckRequirementsKindOfficeIRM', 'KindBasicDataConnectorsCheckRequirementsKindOffice365Project', 'KindBasicDataConnectorsCheckRequirementsKindOfficePowerBI', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligenceTaxii', 'KindBasicDataConnectorsCheckRequirementsKindIOT' + Kind KindBasicDataConnectorsCheckRequirements `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for Dynamics365CheckRequirements. +func (d3cr Dynamics365CheckRequirements) MarshalJSON() ([]byte, error) { + d3cr.Kind = KindBasicDataConnectorsCheckRequirementsKindDynamics365 + objectMap := make(map[string]interface{}) + if d3cr.Dynamics365CheckRequirementsProperties != nil { + objectMap["properties"] = d3cr.Dynamics365CheckRequirementsProperties + } + if d3cr.Kind != "" { + objectMap["kind"] = d3cr.Kind + } + return json.Marshal(objectMap) +} + +// AsAADCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Dynamics365CheckRequirements. +func (d3cr Dynamics365CheckRequirements) AsAADCheckRequirements() (*AADCheckRequirements, bool) { + return nil, false +} + +// AsAATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Dynamics365CheckRequirements. +func (d3cr Dynamics365CheckRequirements) AsAATPCheckRequirements() (*AATPCheckRequirements, bool) { + return nil, false +} + +// AsASCCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Dynamics365CheckRequirements. +func (d3cr Dynamics365CheckRequirements) AsASCCheckRequirements() (*ASCCheckRequirements, bool) { + return nil, false +} + +// AsAwsCloudTrailCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Dynamics365CheckRequirements. +func (d3cr Dynamics365CheckRequirements) AsAwsCloudTrailCheckRequirements() (*AwsCloudTrailCheckRequirements, bool) { + return nil, false +} + +// AsAwsS3CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Dynamics365CheckRequirements. +func (d3cr Dynamics365CheckRequirements) AsAwsS3CheckRequirements() (*AwsS3CheckRequirements, bool) { + return nil, false +} + +// AsDynamics365CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Dynamics365CheckRequirements. +func (d3cr Dynamics365CheckRequirements) AsDynamics365CheckRequirements() (*Dynamics365CheckRequirements, bool) { + return &d3cr, true +} + +// AsMCASCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Dynamics365CheckRequirements. +func (d3cr Dynamics365CheckRequirements) AsMCASCheckRequirements() (*MCASCheckRequirements, bool) { + return nil, false +} + +// AsMDATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Dynamics365CheckRequirements. +func (d3cr Dynamics365CheckRequirements) AsMDATPCheckRequirements() (*MDATPCheckRequirements, bool) { + return nil, false +} + +// AsMSTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Dynamics365CheckRequirements. +func (d3cr Dynamics365CheckRequirements) AsMSTICheckRequirements() (*MSTICheckRequirements, bool) { + return nil, false +} + +// AsMtpCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Dynamics365CheckRequirements. +func (d3cr Dynamics365CheckRequirements) AsMtpCheckRequirements() (*MtpCheckRequirements, bool) { + return nil, false +} + +// AsOfficeATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Dynamics365CheckRequirements. +func (d3cr Dynamics365CheckRequirements) AsOfficeATPCheckRequirements() (*OfficeATPCheckRequirements, bool) { + return nil, false +} + +// AsOfficeIRMCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Dynamics365CheckRequirements. +func (d3cr Dynamics365CheckRequirements) AsOfficeIRMCheckRequirements() (*OfficeIRMCheckRequirements, bool) { + return nil, false +} + +// AsOffice365ProjectCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Dynamics365CheckRequirements. +func (d3cr Dynamics365CheckRequirements) AsOffice365ProjectCheckRequirements() (*Office365ProjectCheckRequirements, bool) { + return nil, false +} + +// AsOfficePowerBICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Dynamics365CheckRequirements. +func (d3cr Dynamics365CheckRequirements) AsOfficePowerBICheckRequirements() (*OfficePowerBICheckRequirements, bool) { + return nil, false +} + +// AsTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Dynamics365CheckRequirements. +func (d3cr Dynamics365CheckRequirements) AsTICheckRequirements() (*TICheckRequirements, bool) { + return nil, false +} + +// AsTiTaxiiCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Dynamics365CheckRequirements. +func (d3cr Dynamics365CheckRequirements) AsTiTaxiiCheckRequirements() (*TiTaxiiCheckRequirements, bool) { + return nil, false +} + +// AsIoTCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Dynamics365CheckRequirements. +func (d3cr Dynamics365CheckRequirements) AsIoTCheckRequirements() (*IoTCheckRequirements, bool) { + return nil, false +} + +// AsDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Dynamics365CheckRequirements. +func (d3cr Dynamics365CheckRequirements) AsDataConnectorsCheckRequirements() (*DataConnectorsCheckRequirements, bool) { + return nil, false +} + +// AsBasicDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Dynamics365CheckRequirements. +func (d3cr Dynamics365CheckRequirements) AsBasicDataConnectorsCheckRequirements() (BasicDataConnectorsCheckRequirements, bool) { + return &d3cr, true +} + +// UnmarshalJSON is the custom unmarshaler for Dynamics365CheckRequirements struct. +func (d3cr *Dynamics365CheckRequirements) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var dynamics365CheckRequirementsProperties Dynamics365CheckRequirementsProperties + err = json.Unmarshal(*v, &dynamics365CheckRequirementsProperties) + if err != nil { + return err + } + d3cr.Dynamics365CheckRequirementsProperties = &dynamics365CheckRequirementsProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnectorsCheckRequirements + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + d3cr.Kind = kind + } + } + } + + return nil +} + +// Dynamics365CheckRequirementsProperties dynamics365 requirements check properties. +type Dynamics365CheckRequirementsProperties struct { + // TenantID - The tenant id to connect to, and get the data from. + TenantID *string `json:"tenantId,omitempty"` +} + +// Dynamics365DataConnector represents Dynamics365 data connector. +type Dynamics365DataConnector struct { + // Dynamics365DataConnectorProperties - Dynamics365 data connector properties. + *Dynamics365DataConnectorProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorKindDataConnector', 'KindBasicDataConnectorKindAzureActiveDirectory', 'KindBasicDataConnectorKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorKindMicrosoftThreatProtection', 'KindBasicDataConnectorKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorKindAzureSecurityCenter', 'KindBasicDataConnectorKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorKindAmazonWebServicesS3', 'KindBasicDataConnectorKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorKindDynamics365', 'KindBasicDataConnectorKindOfficeATP', 'KindBasicDataConnectorKindOffice365Project', 'KindBasicDataConnectorKindOfficePowerBI', 'KindBasicDataConnectorKindOfficeIRM', 'KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorKindOffice365', 'KindBasicDataConnectorKindThreatIntelligence', 'KindBasicDataConnectorKindThreatIntelligenceTaxii', 'KindBasicDataConnectorKindIOT', 'KindBasicDataConnectorKindGenericUI', 'KindBasicDataConnectorKindAPIPolling' + Kind KindBasicDataConnector `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Dynamics365DataConnector. +func (d3dc Dynamics365DataConnector) MarshalJSON() ([]byte, error) { + d3dc.Kind = KindBasicDataConnectorKindDynamics365 + objectMap := make(map[string]interface{}) + if d3dc.Dynamics365DataConnectorProperties != nil { + objectMap["properties"] = d3dc.Dynamics365DataConnectorProperties + } + if d3dc.Kind != "" { + objectMap["kind"] = d3dc.Kind + } + if d3dc.Etag != nil { + objectMap["etag"] = d3dc.Etag + } + return json.Marshal(objectMap) +} + +// AsAADDataConnector is the BasicDataConnector implementation for Dynamics365DataConnector. +func (d3dc Dynamics365DataConnector) AsAADDataConnector() (*AADDataConnector, bool) { + return nil, false +} + +// AsMSTIDataConnector is the BasicDataConnector implementation for Dynamics365DataConnector. +func (d3dc Dynamics365DataConnector) AsMSTIDataConnector() (*MSTIDataConnector, bool) { + return nil, false +} + +// AsMTPDataConnector is the BasicDataConnector implementation for Dynamics365DataConnector. +func (d3dc Dynamics365DataConnector) AsMTPDataConnector() (*MTPDataConnector, bool) { + return nil, false +} + +// AsAATPDataConnector is the BasicDataConnector implementation for Dynamics365DataConnector. +func (d3dc Dynamics365DataConnector) AsAATPDataConnector() (*AATPDataConnector, bool) { + return nil, false +} + +// AsASCDataConnector is the BasicDataConnector implementation for Dynamics365DataConnector. +func (d3dc Dynamics365DataConnector) AsASCDataConnector() (*ASCDataConnector, bool) { + return nil, false +} + +// AsAwsCloudTrailDataConnector is the BasicDataConnector implementation for Dynamics365DataConnector. +func (d3dc Dynamics365DataConnector) AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) { + return nil, false +} + +// AsAwsS3DataConnector is the BasicDataConnector implementation for Dynamics365DataConnector. +func (d3dc Dynamics365DataConnector) AsAwsS3DataConnector() (*AwsS3DataConnector, bool) { + return nil, false +} + +// AsMCASDataConnector is the BasicDataConnector implementation for Dynamics365DataConnector. +func (d3dc Dynamics365DataConnector) AsMCASDataConnector() (*MCASDataConnector, bool) { + return nil, false +} + +// AsDynamics365DataConnector is the BasicDataConnector implementation for Dynamics365DataConnector. +func (d3dc Dynamics365DataConnector) AsDynamics365DataConnector() (*Dynamics365DataConnector, bool) { + return &d3dc, true +} + +// AsOfficeATPDataConnector is the BasicDataConnector implementation for Dynamics365DataConnector. +func (d3dc Dynamics365DataConnector) AsOfficeATPDataConnector() (*OfficeATPDataConnector, bool) { + return nil, false +} + +// AsOffice365ProjectDataConnector is the BasicDataConnector implementation for Dynamics365DataConnector. +func (d3dc Dynamics365DataConnector) AsOffice365ProjectDataConnector() (*Office365ProjectDataConnector, bool) { + return nil, false +} + +// AsOfficePowerBIDataConnector is the BasicDataConnector implementation for Dynamics365DataConnector. +func (d3dc Dynamics365DataConnector) AsOfficePowerBIDataConnector() (*OfficePowerBIDataConnector, bool) { + return nil, false +} + +// AsOfficeIRMDataConnector is the BasicDataConnector implementation for Dynamics365DataConnector. +func (d3dc Dynamics365DataConnector) AsOfficeIRMDataConnector() (*OfficeIRMDataConnector, bool) { + return nil, false +} + +// AsMDATPDataConnector is the BasicDataConnector implementation for Dynamics365DataConnector. +func (d3dc Dynamics365DataConnector) AsMDATPDataConnector() (*MDATPDataConnector, bool) { + return nil, false +} + +// AsOfficeDataConnector is the BasicDataConnector implementation for Dynamics365DataConnector. +func (d3dc Dynamics365DataConnector) AsOfficeDataConnector() (*OfficeDataConnector, bool) { + return nil, false +} + +// AsTIDataConnector is the BasicDataConnector implementation for Dynamics365DataConnector. +func (d3dc Dynamics365DataConnector) AsTIDataConnector() (*TIDataConnector, bool) { + return nil, false +} + +// AsTiTaxiiDataConnector is the BasicDataConnector implementation for Dynamics365DataConnector. +func (d3dc Dynamics365DataConnector) AsTiTaxiiDataConnector() (*TiTaxiiDataConnector, bool) { + return nil, false +} + +// AsIoTDataConnector is the BasicDataConnector implementation for Dynamics365DataConnector. +func (d3dc Dynamics365DataConnector) AsIoTDataConnector() (*IoTDataConnector, bool) { + return nil, false +} + +// AsCodelessUIDataConnector is the BasicDataConnector implementation for Dynamics365DataConnector. +func (d3dc Dynamics365DataConnector) AsCodelessUIDataConnector() (*CodelessUIDataConnector, bool) { + return nil, false +} + +// AsCodelessAPIPollingDataConnector is the BasicDataConnector implementation for Dynamics365DataConnector. +func (d3dc Dynamics365DataConnector) AsCodelessAPIPollingDataConnector() (*CodelessAPIPollingDataConnector, bool) { + return nil, false +} + +// AsDataConnector is the BasicDataConnector implementation for Dynamics365DataConnector. +func (d3dc Dynamics365DataConnector) AsDataConnector() (*DataConnector, bool) { + return nil, false +} + +// AsBasicDataConnector is the BasicDataConnector implementation for Dynamics365DataConnector. +func (d3dc Dynamics365DataConnector) AsBasicDataConnector() (BasicDataConnector, bool) { + return &d3dc, true +} + +// UnmarshalJSON is the custom unmarshaler for Dynamics365DataConnector struct. +func (d3dc *Dynamics365DataConnector) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var dynamics365DataConnectorProperties Dynamics365DataConnectorProperties + err = json.Unmarshal(*v, &dynamics365DataConnectorProperties) + if err != nil { + return err + } + d3dc.Dynamics365DataConnectorProperties = &dynamics365DataConnectorProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnector + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + d3dc.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + d3dc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + d3dc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + d3dc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + d3dc.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + d3dc.SystemData = &systemData + } + } + } + + return nil +} + +// Dynamics365DataConnectorDataTypes the available data types for Dynamics365 data connector. +type Dynamics365DataConnectorDataTypes struct { + // Dynamics365CdsActivities - Common Data Service data type connection. + Dynamics365CdsActivities *Dynamics365DataConnectorDataTypesDynamics365CdsActivities `json:"dynamics365CdsActivities,omitempty"` +} + +// Dynamics365DataConnectorDataTypesDynamics365CdsActivities common Data Service data type connection. +type Dynamics365DataConnectorDataTypesDynamics365CdsActivities struct { + // State - Describe whether this data type connection is enabled or not. Possible values include: 'DataTypeStateEnabled', 'DataTypeStateDisabled' + State DataTypeState `json:"state,omitempty"` +} + +// Dynamics365DataConnectorProperties dynamics365 data connector properties. +type Dynamics365DataConnectorProperties struct { + // DataTypes - The available data types for the connector. + DataTypes *Dynamics365DataConnectorDataTypes `json:"dataTypes,omitempty"` + // TenantID - The tenant id to connect to, and get the data from. + TenantID *string `json:"tenantId,omitempty"` +} + +// EnrichmentDomainWhois whois information for a given domain and associated metadata +type EnrichmentDomainWhois struct { + autorest.Response `json:"-"` + // Domain - The domain for this whois record + Domain *string `json:"domain,omitempty"` + // Server - The hostname of this registrar's whois server + Server *string `json:"server,omitempty"` + // Created - The timestamp at which this record was created + Created *date.Time `json:"created,omitempty"` + // Updated - The timestamp at which this record was last updated + Updated *date.Time `json:"updated,omitempty"` + // Expires - The timestamp at which this record will expire + Expires *date.Time `json:"expires,omitempty"` + // ParsedWhois - The whois record for a given domain + ParsedWhois *EnrichmentDomainWhoisDetails `json:"parsedWhois,omitempty"` +} + +// EnrichmentDomainWhoisContact an individual contact associated with this domain +type EnrichmentDomainWhoisContact struct { + // Name - The name of this contact + Name *string `json:"name,omitempty"` + // Org - The organization for this contact + Org *string `json:"org,omitempty"` + // Street - A list describing the street address for this contact + Street *[]string `json:"street,omitempty"` + // City - The city for this contact + City *string `json:"city,omitempty"` + // State - The state for this contact + State *string `json:"state,omitempty"` + // Postal - The postal code for this contact + Postal *string `json:"postal,omitempty"` + // Country - The country for this contact + Country *string `json:"country,omitempty"` + // Phone - The phone number for this contact + Phone *string `json:"phone,omitempty"` + // Fax - The fax number for this contact + Fax *string `json:"fax,omitempty"` + // Email - The email address for this contact + Email *string `json:"email,omitempty"` +} + +// EnrichmentDomainWhoisContacts the set of contacts associated with this domain +type EnrichmentDomainWhoisContacts struct { + // Admin - The admin contact for this whois record + Admin *EnrichmentDomainWhoisContact `json:"admin,omitempty"` + // Billing - The billing contact for this whois record + Billing *EnrichmentDomainWhoisContact `json:"billing,omitempty"` + // Registrant - The registrant contact for this whois record + Registrant *EnrichmentDomainWhoisContact `json:"registrant,omitempty"` + // Tech - The technical contact for this whois record + Tech *EnrichmentDomainWhoisContact `json:"tech,omitempty"` +} + +// EnrichmentDomainWhoisDetails the whois record for a given domain +type EnrichmentDomainWhoisDetails struct { + // Registrar - The registrar associated with this domain + Registrar *EnrichmentDomainWhoisRegistrarDetails `json:"registrar,omitempty"` + // Contacts - The set of contacts associated with this domain + Contacts *EnrichmentDomainWhoisContacts `json:"contacts,omitempty"` + // NameServers - A list of name servers associated with this domain + NameServers *[]string `json:"nameServers,omitempty"` + // Statuses - The set of status flags for this whois record + Statuses *[]string `json:"statuses,omitempty"` +} + +// EnrichmentDomainWhoisRegistrarDetails the registrar associated with this domain +type EnrichmentDomainWhoisRegistrarDetails struct { + // Name - The name of this registrar + Name *string `json:"name,omitempty"` + // AbuseContactEmail - This registrar's abuse contact email + AbuseContactEmail *string `json:"abuseContactEmail,omitempty"` + // AbuseContactPhone - This registrar's abuse contact phone number + AbuseContactPhone *string `json:"abuseContactPhone,omitempty"` + // IanaID - This registrar's Internet Assigned Numbers Authority id + IanaID *string `json:"ianaId,omitempty"` + // URL - This registrar's URL + URL *string `json:"url,omitempty"` + // WhoisServer - The hostname of this registrar's whois server + WhoisServer *string `json:"whoisServer,omitempty"` +} + +// EnrichmentIPGeodata geodata information for a given IP address +type EnrichmentIPGeodata struct { + autorest.Response `json:"-"` + // Asn - The autonomous system number associated with this IP address + Asn *string `json:"asn,omitempty"` + // Carrier - The name of the carrier for this IP address + Carrier *string `json:"carrier,omitempty"` + // City - The city this IP address is located in + City *string `json:"city,omitempty"` + // CityCf - A numeric rating of confidence that the value in the 'city' field is correct, on a scale of 0-100 + CityCf *int32 `json:"cityCf,omitempty"` + // Continent - The continent this IP address is located on + Continent *string `json:"continent,omitempty"` + // Country - The county this IP address is located in + Country *string `json:"country,omitempty"` + // CountryCf - A numeric rating of confidence that the value in the 'country' field is correct on a scale of 0-100 + CountryCf *int32 `json:"countryCf,omitempty"` + // IPAddr - The dotted-decimal or colon-separated string representation of the IP address + IPAddr *string `json:"ipAddr,omitempty"` + // IPRoutingType - A description of the connection type of this IP address + IPRoutingType *string `json:"ipRoutingType,omitempty"` + // Latitude - The latitude of this IP address + Latitude *string `json:"latitude,omitempty"` + // Longitude - The longitude of this IP address + Longitude *string `json:"longitude,omitempty"` + // Organization - The name of the organization for this IP address + Organization *string `json:"organization,omitempty"` + // OrganizationType - The type of the organization for this IP address + OrganizationType *string `json:"organizationType,omitempty"` + // Region - The geographic region this IP address is located in + Region *string `json:"region,omitempty"` + // State - The state this IP address is located in + State *string `json:"state,omitempty"` + // StateCf - A numeric rating of confidence that the value in the 'state' field is correct on a scale of 0-100 + StateCf *int32 `json:"stateCf,omitempty"` + // StateCode - The abbreviated name for the state this IP address is located in + StateCode *string `json:"stateCode,omitempty"` +} + +// BasicEntity specific entity. +type BasicEntity interface { + AsURLEntity() (*URLEntity, bool) + AsSubmissionMailEntity() (*SubmissionMailEntity, bool) + AsSecurityGroupEntity() (*SecurityGroupEntity, bool) + AsSecurityAlert() (*SecurityAlert, bool) + AsRegistryValueEntity() (*RegistryValueEntity, bool) + AsRegistryKeyEntity() (*RegistryKeyEntity, bool) + AsProcessEntity() (*ProcessEntity, bool) + AsMalwareEntity() (*MalwareEntity, bool) + AsMailMessageEntity() (*MailMessageEntity, bool) + AsMailClusterEntity() (*MailClusterEntity, bool) + AsMailboxEntity() (*MailboxEntity, bool) + AsIPEntity() (*IPEntity, bool) + AsIoTDeviceEntity() (*IoTDeviceEntity, bool) + AsHuntingBookmark() (*HuntingBookmark, bool) + AsHostEntity() (*HostEntity, bool) + AsFileHashEntity() (*FileHashEntity, bool) + AsFileEntity() (*FileEntity, bool) + AsDNSEntity() (*DNSEntity, bool) + AsCloudApplicationEntity() (*CloudApplicationEntity, bool) + AsAzureResourceEntity() (*AzureResourceEntity, bool) + AsAccountEntity() (*AccountEntity, bool) + AsEntity() (*Entity, bool) +} + +// Entity specific entity. +type Entity struct { + autorest.Response `json:"-"` + // Kind - Possible values include: 'KindBasicEntityKindEntity', 'KindBasicEntityKindURL', 'KindBasicEntityKindSubmissionMail', 'KindBasicEntityKindSecurityGroup', 'KindBasicEntityKindSecurityAlert', 'KindBasicEntityKindRegistryValue', 'KindBasicEntityKindRegistryKey', 'KindBasicEntityKindProcess', 'KindBasicEntityKindMalware', 'KindBasicEntityKindMailMessage', 'KindBasicEntityKindMailCluster', 'KindBasicEntityKindMailbox', 'KindBasicEntityKindIP', 'KindBasicEntityKindIoTDevice', 'KindBasicEntityKindBookmark', 'KindBasicEntityKindHost', 'KindBasicEntityKindFileHash', 'KindBasicEntityKindFile', 'KindBasicEntityKindDNSResolution', 'KindBasicEntityKindCloudApplication', 'KindBasicEntityKindAzureResource', 'KindBasicEntityKindAccount' + Kind KindBasicEntity `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +func unmarshalBasicEntity(body []byte) (BasicEntity, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["kind"] { + case string(KindBasicEntityKindURL): + var ue URLEntity + err := json.Unmarshal(body, &ue) + return ue, err + case string(KindBasicEntityKindSubmissionMail): + var sme SubmissionMailEntity + err := json.Unmarshal(body, &sme) + return sme, err + case string(KindBasicEntityKindSecurityGroup): + var sge SecurityGroupEntity + err := json.Unmarshal(body, &sge) + return sge, err + case string(KindBasicEntityKindSecurityAlert): + var sa SecurityAlert + err := json.Unmarshal(body, &sa) + return sa, err + case string(KindBasicEntityKindRegistryValue): + var rve RegistryValueEntity + err := json.Unmarshal(body, &rve) + return rve, err + case string(KindBasicEntityKindRegistryKey): + var rke RegistryKeyEntity + err := json.Unmarshal(body, &rke) + return rke, err + case string(KindBasicEntityKindProcess): + var peVar ProcessEntity + err := json.Unmarshal(body, &peVar) + return peVar, err + case string(KindBasicEntityKindMalware): + var me MalwareEntity + err := json.Unmarshal(body, &me) + return me, err + case string(KindBasicEntityKindMailMessage): + var mme MailMessageEntity + err := json.Unmarshal(body, &mme) + return mme, err + case string(KindBasicEntityKindMailCluster): + var mce MailClusterEntity + err := json.Unmarshal(body, &mce) + return mce, err + case string(KindBasicEntityKindMailbox): + var me MailboxEntity + err := json.Unmarshal(body, &me) + return me, err + case string(KindBasicEntityKindIP): + var ie IPEntity + err := json.Unmarshal(body, &ie) + return ie, err + case string(KindBasicEntityKindIoTDevice): + var itde IoTDeviceEntity + err := json.Unmarshal(body, &itde) + return itde, err + case string(KindBasicEntityKindBookmark): + var hb HuntingBookmark + err := json.Unmarshal(body, &hb) + return hb, err + case string(KindBasicEntityKindHost): + var he HostEntity + err := json.Unmarshal(body, &he) + return he, err + case string(KindBasicEntityKindFileHash): + var fhe FileHashEntity + err := json.Unmarshal(body, &fhe) + return fhe, err + case string(KindBasicEntityKindFile): + var fe FileEntity + err := json.Unmarshal(body, &fe) + return fe, err + case string(KindBasicEntityKindDNSResolution): + var de DNSEntity + err := json.Unmarshal(body, &de) + return de, err + case string(KindBasicEntityKindCloudApplication): + var cae CloudApplicationEntity + err := json.Unmarshal(body, &cae) + return cae, err + case string(KindBasicEntityKindAzureResource): + var are AzureResourceEntity + err := json.Unmarshal(body, &are) + return are, err + case string(KindBasicEntityKindAccount): + var ae AccountEntity + err := json.Unmarshal(body, &ae) + return ae, err + default: + var e Entity + err := json.Unmarshal(body, &e) + return e, err + } +} +func unmarshalBasicEntityArray(body []byte) ([]BasicEntity, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + eArray := make([]BasicEntity, len(rawMessages)) + + for index, rawMessage := range rawMessages { + e, err := unmarshalBasicEntity(*rawMessage) + if err != nil { + return nil, err + } + eArray[index] = e + } + return eArray, nil +} + +// MarshalJSON is the custom marshaler for Entity. +func (e Entity) MarshalJSON() ([]byte, error) { + e.Kind = KindBasicEntityKindEntity + objectMap := make(map[string]interface{}) + if e.Kind != "" { + objectMap["kind"] = e.Kind + } + return json.Marshal(objectMap) +} + +// AsURLEntity is the BasicEntity implementation for Entity. +func (e Entity) AsURLEntity() (*URLEntity, bool) { + return nil, false +} + +// AsSubmissionMailEntity is the BasicEntity implementation for Entity. +func (e Entity) AsSubmissionMailEntity() (*SubmissionMailEntity, bool) { + return nil, false +} + +// AsSecurityGroupEntity is the BasicEntity implementation for Entity. +func (e Entity) AsSecurityGroupEntity() (*SecurityGroupEntity, bool) { + return nil, false +} + +// AsSecurityAlert is the BasicEntity implementation for Entity. +func (e Entity) AsSecurityAlert() (*SecurityAlert, bool) { + return nil, false +} + +// AsRegistryValueEntity is the BasicEntity implementation for Entity. +func (e Entity) AsRegistryValueEntity() (*RegistryValueEntity, bool) { + return nil, false +} + +// AsRegistryKeyEntity is the BasicEntity implementation for Entity. +func (e Entity) AsRegistryKeyEntity() (*RegistryKeyEntity, bool) { + return nil, false +} + +// AsProcessEntity is the BasicEntity implementation for Entity. +func (e Entity) AsProcessEntity() (*ProcessEntity, bool) { + return nil, false +} + +// AsMalwareEntity is the BasicEntity implementation for Entity. +func (e Entity) AsMalwareEntity() (*MalwareEntity, bool) { + return nil, false +} + +// AsMailMessageEntity is the BasicEntity implementation for Entity. +func (e Entity) AsMailMessageEntity() (*MailMessageEntity, bool) { + return nil, false +} + +// AsMailClusterEntity is the BasicEntity implementation for Entity. +func (e Entity) AsMailClusterEntity() (*MailClusterEntity, bool) { + return nil, false +} + +// AsMailboxEntity is the BasicEntity implementation for Entity. +func (e Entity) AsMailboxEntity() (*MailboxEntity, bool) { + return nil, false +} + +// AsIPEntity is the BasicEntity implementation for Entity. +func (e Entity) AsIPEntity() (*IPEntity, bool) { + return nil, false +} + +// AsIoTDeviceEntity is the BasicEntity implementation for Entity. +func (e Entity) AsIoTDeviceEntity() (*IoTDeviceEntity, bool) { + return nil, false +} + +// AsHuntingBookmark is the BasicEntity implementation for Entity. +func (e Entity) AsHuntingBookmark() (*HuntingBookmark, bool) { + return nil, false +} + +// AsHostEntity is the BasicEntity implementation for Entity. +func (e Entity) AsHostEntity() (*HostEntity, bool) { + return nil, false +} + +// AsFileHashEntity is the BasicEntity implementation for Entity. +func (e Entity) AsFileHashEntity() (*FileHashEntity, bool) { + return nil, false +} + +// AsFileEntity is the BasicEntity implementation for Entity. +func (e Entity) AsFileEntity() (*FileEntity, bool) { + return nil, false +} + +// AsDNSEntity is the BasicEntity implementation for Entity. +func (e Entity) AsDNSEntity() (*DNSEntity, bool) { + return nil, false +} + +// AsCloudApplicationEntity is the BasicEntity implementation for Entity. +func (e Entity) AsCloudApplicationEntity() (*CloudApplicationEntity, bool) { + return nil, false +} + +// AsAzureResourceEntity is the BasicEntity implementation for Entity. +func (e Entity) AsAzureResourceEntity() (*AzureResourceEntity, bool) { + return nil, false +} + +// AsAccountEntity is the BasicEntity implementation for Entity. +func (e Entity) AsAccountEntity() (*AccountEntity, bool) { + return nil, false +} + +// AsEntity is the BasicEntity implementation for Entity. +func (e Entity) AsEntity() (*Entity, bool) { + return &e, true +} + +// AsBasicEntity is the BasicEntity implementation for Entity. +func (e Entity) AsBasicEntity() (BasicEntity, bool) { + return &e, true +} + +// EntityAnalytics settings with single toggle. +type EntityAnalytics struct { + // EntityAnalyticsProperties - EntityAnalytics properties + *EntityAnalyticsProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicSettingsKindSettings', 'KindBasicSettingsKindAnomalies', 'KindBasicSettingsKindEyesOn', 'KindBasicSettingsKindEntityAnalytics', 'KindBasicSettingsKindUeba' + Kind KindBasicSettings `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for EntityAnalytics. +func (ea EntityAnalytics) MarshalJSON() ([]byte, error) { + ea.Kind = KindBasicSettingsKindEntityAnalytics + objectMap := make(map[string]interface{}) + if ea.EntityAnalyticsProperties != nil { + objectMap["properties"] = ea.EntityAnalyticsProperties + } + if ea.Kind != "" { + objectMap["kind"] = ea.Kind + } + if ea.Etag != nil { + objectMap["etag"] = ea.Etag + } + return json.Marshal(objectMap) +} + +// AsAnomalies is the BasicSettings implementation for EntityAnalytics. +func (ea EntityAnalytics) AsAnomalies() (*Anomalies, bool) { + return nil, false +} + +// AsEyesOn is the BasicSettings implementation for EntityAnalytics. +func (ea EntityAnalytics) AsEyesOn() (*EyesOn, bool) { + return nil, false +} + +// AsEntityAnalytics is the BasicSettings implementation for EntityAnalytics. +func (ea EntityAnalytics) AsEntityAnalytics() (*EntityAnalytics, bool) { + return &ea, true +} + +// AsUeba is the BasicSettings implementation for EntityAnalytics. +func (ea EntityAnalytics) AsUeba() (*Ueba, bool) { + return nil, false +} + +// AsSettings is the BasicSettings implementation for EntityAnalytics. +func (ea EntityAnalytics) AsSettings() (*Settings, bool) { + return nil, false +} + +// AsBasicSettings is the BasicSettings implementation for EntityAnalytics. +func (ea EntityAnalytics) AsBasicSettings() (BasicSettings, bool) { + return &ea, true +} + +// UnmarshalJSON is the custom unmarshaler for EntityAnalytics struct. +func (ea *EntityAnalytics) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var entityAnalyticsProperties EntityAnalyticsProperties + err = json.Unmarshal(*v, &entityAnalyticsProperties) + if err != nil { + return err + } + ea.EntityAnalyticsProperties = &entityAnalyticsProperties + } + case "kind": + if v != nil { + var kind KindBasicSettings + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ea.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ea.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ea.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ea.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ea.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + ea.SystemData = &systemData + } + } + } + + return nil +} + +// EntityAnalyticsProperties entityAnalytics property bag. +type EntityAnalyticsProperties struct { + // IsEnabled - READ-ONLY; Determines whether the setting is enable or disabled. + IsEnabled *bool `json:"isEnabled,omitempty"` +} + +// MarshalJSON is the custom marshaler for EntityAnalyticsProperties. +func (eap EntityAnalyticsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// EntityCommonProperties entity common property bag. +type EntityCommonProperties struct { + // AdditionalData - READ-ONLY; A bag of custom fields that should be part of the entity and will be presented to the user. + AdditionalData map[string]interface{} `json:"additionalData"` + // FriendlyName - READ-ONLY; The graph item display name which is a short humanly readable description of the graph item instance. This property is optional and might be system generated. + FriendlyName *string `json:"friendlyName,omitempty"` +} + +// MarshalJSON is the custom marshaler for EntityCommonProperties. +func (ecp EntityCommonProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// EntityEdges the edge that connects the entity to the other entity. +type EntityEdges struct { + // TargetEntityID - The target entity Id. + TargetEntityID *string `json:"targetEntityId,omitempty"` + // AdditionalData - A bag of custom fields that should be part of the entity and will be presented to the user. + AdditionalData map[string]interface{} `json:"additionalData"` +} + +// MarshalJSON is the custom marshaler for EntityEdges. +func (ee EntityEdges) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ee.TargetEntityID != nil { + objectMap["targetEntityId"] = ee.TargetEntityID + } + if ee.AdditionalData != nil { + objectMap["additionalData"] = ee.AdditionalData + } + return json.Marshal(objectMap) +} + +// EntityExpandParameters the parameters required to execute an expand operation on the given entity. +type EntityExpandParameters struct { + // EndTime - The end date filter, so the only expansion results returned are before this date. + EndTime *date.Time `json:"endTime,omitempty"` + // ExpansionID - The Id of the expansion to perform. + ExpansionID *uuid.UUID `json:"expansionId,omitempty"` + // StartTime - The start date filter, so the only expansion results returned are after this date. + StartTime *date.Time `json:"startTime,omitempty"` +} + +// EntityExpandResponse the entity expansion result operation response. +type EntityExpandResponse struct { + autorest.Response `json:"-"` + // MetaData - The metadata from the expansion operation results. + MetaData *ExpansionResultsMetadata `json:"metaData,omitempty"` + // Value - The expansion result values. + Value *EntityExpandResponseValue `json:"value,omitempty"` +} + +// EntityExpandResponseValue the expansion result values. +type EntityExpandResponseValue struct { + // Entities - Array of the expansion result entities. + Entities *[]BasicEntity `json:"entities,omitempty"` + // Edges - Array of edges that connects the entity to the list of entities. + Edges *[]EntityEdges `json:"edges,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for EntityExpandResponseValue struct. +func (eer *EntityExpandResponseValue) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "entities": + if v != nil { + entities, err := unmarshalBasicEntityArray(*v) + if err != nil { + return err + } + eer.Entities = &entities + } + case "edges": + if v != nil { + var edges []EntityEdges + err = json.Unmarshal(*v, &edges) + if err != nil { + return err + } + eer.Edges = &edges + } + } + } + + return nil +} + +// EntityFieldMapping map identifiers of a single entity +type EntityFieldMapping struct { + // Identifier - Alert V3 identifier + Identifier *string `json:"identifier,omitempty"` + // Value - The value of the identifier + Value *string `json:"value,omitempty"` +} + +// EntityGetInsightsParameters the parameters required to execute insights operation on the given entity. +type EntityGetInsightsParameters struct { + // StartTime - The start timeline date, so the results returned are after this date. + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - The end timeline date, so the results returned are before this date. + EndTime *date.Time `json:"endTime,omitempty"` + // AddDefaultExtendedTimeRange - Indicates if query time range should be extended with default time range of the query. Default value is false + AddDefaultExtendedTimeRange *bool `json:"addDefaultExtendedTimeRange,omitempty"` + // InsightQueryIds - List of Insights Query Id. If empty, default value is all insights of this entity + InsightQueryIds *[]uuid.UUID `json:"insightQueryIds,omitempty"` +} + +// EntityGetInsightsResponse the Get Insights result operation response. +type EntityGetInsightsResponse struct { + autorest.Response `json:"-"` + // MetaData - The metadata from the get insights operation results. + MetaData *GetInsightsResultsMetadata `json:"metaData,omitempty"` + // Value - The insights result values. + Value *[]EntityInsightItem `json:"value,omitempty"` +} + +// EntityInsightItem entity insight Item. +type EntityInsightItem struct { + // QueryID - The query id of the insight + QueryID *string `json:"queryId,omitempty"` + // QueryTimeInterval - The Time interval that the query actually executed on. + QueryTimeInterval *EntityInsightItemQueryTimeInterval `json:"queryTimeInterval,omitempty"` + // TableQueryResults - Query results for table insights query. + TableQueryResults *InsightsTableResult `json:"tableQueryResults,omitempty"` + // ChartQueryResults - Query results for table insights query. + ChartQueryResults *[]InsightsTableResult `json:"chartQueryResults,omitempty"` +} + +// EntityInsightItemQueryTimeInterval the Time interval that the query actually executed on. +type EntityInsightItemQueryTimeInterval struct { + // StartTime - Insight query start time + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - Insight query end time + EndTime *date.Time `json:"endTime,omitempty"` +} + +// EntityList list of all the entities. +type EntityList struct { + autorest.Response `json:"-"` + // NextLink - READ-ONLY; URL to fetch the next set of entities. + NextLink *string `json:"nextLink,omitempty"` + // Value - Array of entities. + Value *[]BasicEntity `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for EntityList. +func (el EntityList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if el.Value != nil { + objectMap["value"] = el.Value + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for EntityList struct. +func (el *EntityList) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "nextLink": + if v != nil { + var nextLink string + err = json.Unmarshal(*v, &nextLink) + if err != nil { + return err + } + el.NextLink = &nextLink + } + case "value": + if v != nil { + value, err := unmarshalBasicEntityArray(*v) + if err != nil { + return err + } + el.Value = &value + } + } + } + + return nil +} + +// EntityListIterator provides access to a complete listing of Entity values. +type EntityListIterator struct { + i int + page EntityListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *EntityListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EntityListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *EntityListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter EntityListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter EntityListIterator) Response() EntityList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter EntityListIterator) Value() BasicEntity { + if !iter.page.NotDone() { + return Entity{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the EntityListIterator type. +func NewEntityListIterator(page EntityListPage) EntityListIterator { + return EntityListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (el EntityList) IsEmpty() bool { + return el.Value == nil || len(*el.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (el EntityList) hasNextLink() bool { + return el.NextLink != nil && len(*el.NextLink) != 0 +} + +// entityListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (el EntityList) entityListPreparer(ctx context.Context) (*http.Request, error) { + if !el.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(el.NextLink))) +} + +// EntityListPage contains a page of BasicEntity values. +type EntityListPage struct { + fn func(context.Context, EntityList) (EntityList, error) + el EntityList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *EntityListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EntityListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.el) + if err != nil { + return err + } + page.el = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *EntityListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page EntityListPage) NotDone() bool { + return !page.el.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page EntityListPage) Response() EntityList { + return page.el +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page EntityListPage) Values() []BasicEntity { + if page.el.IsEmpty() { + return nil + } + return *page.el.Value +} + +// Creates a new instance of the EntityListPage type. +func NewEntityListPage(cur EntityList, getNextPage func(context.Context, EntityList) (EntityList, error)) EntityListPage { + return EntityListPage{ + fn: getNextPage, + el: cur, + } +} + +// EntityMapping single entity mapping for the alert rule +type EntityMapping struct { + // EntityType - Possible values include: 'EntityMappingTypeAccount', 'EntityMappingTypeHost', 'EntityMappingTypeIP', 'EntityMappingTypeMalware', 'EntityMappingTypeFile', 'EntityMappingTypeProcess', 'EntityMappingTypeCloudApplication', 'EntityMappingTypeDNS', 'EntityMappingTypeAzureResource', 'EntityMappingTypeFileHash', 'EntityMappingTypeRegistryKey', 'EntityMappingTypeRegistryValue', 'EntityMappingTypeSecurityGroup', 'EntityMappingTypeURL', 'EntityMappingTypeMailbox', 'EntityMappingTypeMailCluster', 'EntityMappingTypeMailMessage', 'EntityMappingTypeSubmissionMail' + EntityType EntityMappingType `json:"entityType,omitempty"` + // FieldMappings - array of field mappings for the given entity mapping + FieldMappings *[]FieldMapping `json:"fieldMappings,omitempty"` +} + +// EntityModel ... +type EntityModel struct { + autorest.Response `json:"-"` + Value BasicEntity `json:"value,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for EntityModel struct. +func (em *EntityModel) UnmarshalJSON(body []byte) error { + e, err := unmarshalBasicEntity(body) + if err != nil { + return err + } + em.Value = e + + return nil +} + +// BasicEntityQuery specific entity query. +type BasicEntityQuery interface { + AsExpansionEntityQuery() (*ExpansionEntityQuery, bool) + AsActivityEntityQuery() (*ActivityEntityQuery, bool) + AsEntityQuery() (*EntityQuery, bool) +} + +// EntityQuery specific entity query. +type EntityQuery struct { + autorest.Response `json:"-"` + // Kind - Possible values include: 'KindBasicEntityQueryKindEntityQuery', 'KindBasicEntityQueryKindExpansion', 'KindBasicEntityQueryKindActivity' + Kind KindBasicEntityQuery `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +func unmarshalBasicEntityQuery(body []byte) (BasicEntityQuery, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["kind"] { + case string(KindBasicEntityQueryKindExpansion): + var eeq ExpansionEntityQuery + err := json.Unmarshal(body, &eeq) + return eeq, err + case string(KindBasicEntityQueryKindActivity): + var aeq ActivityEntityQuery + err := json.Unmarshal(body, &aeq) + return aeq, err + default: + var eq EntityQuery + err := json.Unmarshal(body, &eq) + return eq, err + } +} +func unmarshalBasicEntityQueryArray(body []byte) ([]BasicEntityQuery, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + eqArray := make([]BasicEntityQuery, len(rawMessages)) + + for index, rawMessage := range rawMessages { + eq, err := unmarshalBasicEntityQuery(*rawMessage) + if err != nil { + return nil, err + } + eqArray[index] = eq + } + return eqArray, nil +} + +// MarshalJSON is the custom marshaler for EntityQuery. +func (eq EntityQuery) MarshalJSON() ([]byte, error) { + eq.Kind = KindBasicEntityQueryKindEntityQuery + objectMap := make(map[string]interface{}) + if eq.Kind != "" { + objectMap["kind"] = eq.Kind + } + if eq.Etag != nil { + objectMap["etag"] = eq.Etag + } + return json.Marshal(objectMap) +} + +// AsExpansionEntityQuery is the BasicEntityQuery implementation for EntityQuery. +func (eq EntityQuery) AsExpansionEntityQuery() (*ExpansionEntityQuery, bool) { + return nil, false +} + +// AsActivityEntityQuery is the BasicEntityQuery implementation for EntityQuery. +func (eq EntityQuery) AsActivityEntityQuery() (*ActivityEntityQuery, bool) { + return nil, false +} + +// AsEntityQuery is the BasicEntityQuery implementation for EntityQuery. +func (eq EntityQuery) AsEntityQuery() (*EntityQuery, bool) { + return &eq, true +} + +// AsBasicEntityQuery is the BasicEntityQuery implementation for EntityQuery. +func (eq EntityQuery) AsBasicEntityQuery() (BasicEntityQuery, bool) { + return &eq, true +} + +// BasicEntityQueryItem an abstract Query item for entity +type BasicEntityQueryItem interface { + AsInsightQueryItem() (*InsightQueryItem, bool) + AsEntityQueryItem() (*EntityQueryItem, bool) +} + +// EntityQueryItem an abstract Query item for entity +type EntityQueryItem struct { + // ID - READ-ONLY; Query Template ARM ID + ID *string `json:"id,omitempty"` + // Name - Query Template ARM Name + Name *string `json:"name,omitempty"` + // Type - ARM Type + Type *string `json:"type,omitempty"` + // Kind - Possible values include: 'KindBasicEntityQueryItemKindEntityQueryItem', 'KindBasicEntityQueryItemKindInsight' + Kind KindBasicEntityQueryItem `json:"kind,omitempty"` +} + +func unmarshalBasicEntityQueryItem(body []byte) (BasicEntityQueryItem, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["kind"] { + case string(KindBasicEntityQueryItemKindInsight): + var iqi InsightQueryItem + err := json.Unmarshal(body, &iqi) + return iqi, err + default: + var eqi EntityQueryItem + err := json.Unmarshal(body, &eqi) + return eqi, err + } +} +func unmarshalBasicEntityQueryItemArray(body []byte) ([]BasicEntityQueryItem, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + eqiArray := make([]BasicEntityQueryItem, len(rawMessages)) + + for index, rawMessage := range rawMessages { + eqi, err := unmarshalBasicEntityQueryItem(*rawMessage) + if err != nil { + return nil, err + } + eqiArray[index] = eqi + } + return eqiArray, nil +} + +// MarshalJSON is the custom marshaler for EntityQueryItem. +func (eqi EntityQueryItem) MarshalJSON() ([]byte, error) { + eqi.Kind = KindBasicEntityQueryItemKindEntityQueryItem + objectMap := make(map[string]interface{}) + if eqi.Name != nil { + objectMap["name"] = eqi.Name + } + if eqi.Type != nil { + objectMap["type"] = eqi.Type + } + if eqi.Kind != "" { + objectMap["kind"] = eqi.Kind + } + return json.Marshal(objectMap) +} + +// AsInsightQueryItem is the BasicEntityQueryItem implementation for EntityQueryItem. +func (eqi EntityQueryItem) AsInsightQueryItem() (*InsightQueryItem, bool) { + return nil, false +} + +// AsEntityQueryItem is the BasicEntityQueryItem implementation for EntityQueryItem. +func (eqi EntityQueryItem) AsEntityQueryItem() (*EntityQueryItem, bool) { + return &eqi, true +} + +// AsBasicEntityQueryItem is the BasicEntityQueryItem implementation for EntityQueryItem. +func (eqi EntityQueryItem) AsBasicEntityQueryItem() (BasicEntityQueryItem, bool) { + return &eqi, true +} + +// EntityQueryItemProperties an properties abstract Query item for entity +type EntityQueryItemProperties struct { + // DataTypes - Data types for template + DataTypes *[]EntityQueryItemPropertiesDataTypesItem `json:"dataTypes,omitempty"` + // InputEntityType - The type of the entity. Possible values include: 'EntityTypeAccount', 'EntityTypeHost', 'EntityTypeFile', 'EntityTypeAzureResource', 'EntityTypeCloudApplication', 'EntityTypeDNS', 'EntityTypeFileHash', 'EntityTypeIP', 'EntityTypeMalware', 'EntityTypeProcess', 'EntityTypeRegistryKey', 'EntityTypeRegistryValue', 'EntityTypeSecurityGroup', 'EntityTypeURL', 'EntityTypeIoTDevice', 'EntityTypeSecurityAlert', 'EntityTypeHuntingBookmark', 'EntityTypeMailCluster', 'EntityTypeMailMessage', 'EntityTypeMailbox', 'EntityTypeSubmissionMail' + InputEntityType EntityType `json:"inputEntityType,omitempty"` + // RequiredInputFieldsSets - Data types for template + RequiredInputFieldsSets *[][]string `json:"requiredInputFieldsSets,omitempty"` + // EntitiesFilter - The query applied only to entities matching to all filters + EntitiesFilter interface{} `json:"entitiesFilter,omitempty"` +} + +// EntityQueryItemPropertiesDataTypesItem ... +type EntityQueryItemPropertiesDataTypesItem struct { + // DataType - Data type name + DataType *string `json:"dataType,omitempty"` +} + +// EntityQueryList list of all the entity queries. +type EntityQueryList struct { + autorest.Response `json:"-"` + // NextLink - READ-ONLY; URL to fetch the next set of entity queries. + NextLink *string `json:"nextLink,omitempty"` + // Value - Array of entity queries. + Value *[]BasicEntityQuery `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for EntityQueryList. +func (eql EntityQueryList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if eql.Value != nil { + objectMap["value"] = eql.Value + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for EntityQueryList struct. +func (eql *EntityQueryList) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "nextLink": + if v != nil { + var nextLink string + err = json.Unmarshal(*v, &nextLink) + if err != nil { + return err + } + eql.NextLink = &nextLink + } + case "value": + if v != nil { + value, err := unmarshalBasicEntityQueryArray(*v) + if err != nil { + return err + } + eql.Value = &value + } + } + } + + return nil +} + +// EntityQueryListIterator provides access to a complete listing of EntityQuery values. +type EntityQueryListIterator struct { + i int + page EntityQueryListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *EntityQueryListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EntityQueryListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *EntityQueryListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter EntityQueryListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter EntityQueryListIterator) Response() EntityQueryList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter EntityQueryListIterator) Value() BasicEntityQuery { + if !iter.page.NotDone() { + return EntityQuery{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the EntityQueryListIterator type. +func NewEntityQueryListIterator(page EntityQueryListPage) EntityQueryListIterator { + return EntityQueryListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (eql EntityQueryList) IsEmpty() bool { + return eql.Value == nil || len(*eql.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (eql EntityQueryList) hasNextLink() bool { + return eql.NextLink != nil && len(*eql.NextLink) != 0 +} + +// entityQueryListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (eql EntityQueryList) entityQueryListPreparer(ctx context.Context) (*http.Request, error) { + if !eql.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(eql.NextLink))) +} + +// EntityQueryListPage contains a page of BasicEntityQuery values. +type EntityQueryListPage struct { + fn func(context.Context, EntityQueryList) (EntityQueryList, error) + eql EntityQueryList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *EntityQueryListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EntityQueryListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.eql) + if err != nil { + return err + } + page.eql = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *EntityQueryListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page EntityQueryListPage) NotDone() bool { + return !page.eql.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page EntityQueryListPage) Response() EntityQueryList { + return page.eql +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page EntityQueryListPage) Values() []BasicEntityQuery { + if page.eql.IsEmpty() { + return nil + } + return *page.eql.Value +} + +// Creates a new instance of the EntityQueryListPage type. +func NewEntityQueryListPage(cur EntityQueryList, getNextPage func(context.Context, EntityQueryList) (EntityQueryList, error)) EntityQueryListPage { + return EntityQueryListPage{ + fn: getNextPage, + eql: cur, + } +} + +// EntityQueryModel ... +type EntityQueryModel struct { + autorest.Response `json:"-"` + Value BasicEntityQuery `json:"value,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for EntityQueryModel struct. +func (eqm *EntityQueryModel) UnmarshalJSON(body []byte) error { + eq, err := unmarshalBasicEntityQuery(body) + if err != nil { + return err + } + eqm.Value = eq + + return nil +} + +// BasicEntityQueryTemplate specific entity query template. +type BasicEntityQueryTemplate interface { + AsActivityEntityQueryTemplate() (*ActivityEntityQueryTemplate, bool) + AsEntityQueryTemplate() (*EntityQueryTemplate, bool) +} + +// EntityQueryTemplate specific entity query template. +type EntityQueryTemplate struct { + autorest.Response `json:"-"` + // Kind - Possible values include: 'KindBasicEntityQueryTemplateKindEntityQueryTemplate', 'KindBasicEntityQueryTemplateKindActivity' + Kind KindBasicEntityQueryTemplate `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +func unmarshalBasicEntityQueryTemplate(body []byte) (BasicEntityQueryTemplate, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["kind"] { + case string(KindBasicEntityQueryTemplateKindActivity): + var aeqt ActivityEntityQueryTemplate + err := json.Unmarshal(body, &aeqt) + return aeqt, err + default: + var eqt EntityQueryTemplate + err := json.Unmarshal(body, &eqt) + return eqt, err + } +} +func unmarshalBasicEntityQueryTemplateArray(body []byte) ([]BasicEntityQueryTemplate, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + eqtArray := make([]BasicEntityQueryTemplate, len(rawMessages)) + + for index, rawMessage := range rawMessages { + eqt, err := unmarshalBasicEntityQueryTemplate(*rawMessage) + if err != nil { + return nil, err + } + eqtArray[index] = eqt + } + return eqtArray, nil +} + +// MarshalJSON is the custom marshaler for EntityQueryTemplate. +func (eqt EntityQueryTemplate) MarshalJSON() ([]byte, error) { + eqt.Kind = KindBasicEntityQueryTemplateKindEntityQueryTemplate + objectMap := make(map[string]interface{}) + if eqt.Kind != "" { + objectMap["kind"] = eqt.Kind + } + return json.Marshal(objectMap) +} + +// AsActivityEntityQueryTemplate is the BasicEntityQueryTemplate implementation for EntityQueryTemplate. +func (eqt EntityQueryTemplate) AsActivityEntityQueryTemplate() (*ActivityEntityQueryTemplate, bool) { + return nil, false +} + +// AsEntityQueryTemplate is the BasicEntityQueryTemplate implementation for EntityQueryTemplate. +func (eqt EntityQueryTemplate) AsEntityQueryTemplate() (*EntityQueryTemplate, bool) { + return &eqt, true +} + +// AsBasicEntityQueryTemplate is the BasicEntityQueryTemplate implementation for EntityQueryTemplate. +func (eqt EntityQueryTemplate) AsBasicEntityQueryTemplate() (BasicEntityQueryTemplate, bool) { + return &eqt, true +} + +// EntityQueryTemplateList list of all the entity query templates. +type EntityQueryTemplateList struct { + autorest.Response `json:"-"` + // NextLink - READ-ONLY; URL to fetch the next set of entity query templates. + NextLink *string `json:"nextLink,omitempty"` + // Value - Array of entity query templates. + Value *[]BasicEntityQueryTemplate `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for EntityQueryTemplateList. +func (eqtl EntityQueryTemplateList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if eqtl.Value != nil { + objectMap["value"] = eqtl.Value + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for EntityQueryTemplateList struct. +func (eqtl *EntityQueryTemplateList) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "nextLink": + if v != nil { + var nextLink string + err = json.Unmarshal(*v, &nextLink) + if err != nil { + return err + } + eqtl.NextLink = &nextLink + } + case "value": + if v != nil { + value, err := unmarshalBasicEntityQueryTemplateArray(*v) + if err != nil { + return err + } + eqtl.Value = &value + } + } + } + + return nil +} + +// EntityQueryTemplateListIterator provides access to a complete listing of EntityQueryTemplate values. +type EntityQueryTemplateListIterator struct { + i int + page EntityQueryTemplateListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *EntityQueryTemplateListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EntityQueryTemplateListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *EntityQueryTemplateListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter EntityQueryTemplateListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter EntityQueryTemplateListIterator) Response() EntityQueryTemplateList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter EntityQueryTemplateListIterator) Value() BasicEntityQueryTemplate { + if !iter.page.NotDone() { + return EntityQueryTemplate{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the EntityQueryTemplateListIterator type. +func NewEntityQueryTemplateListIterator(page EntityQueryTemplateListPage) EntityQueryTemplateListIterator { + return EntityQueryTemplateListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (eqtl EntityQueryTemplateList) IsEmpty() bool { + return eqtl.Value == nil || len(*eqtl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (eqtl EntityQueryTemplateList) hasNextLink() bool { + return eqtl.NextLink != nil && len(*eqtl.NextLink) != 0 +} + +// entityQueryTemplateListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (eqtl EntityQueryTemplateList) entityQueryTemplateListPreparer(ctx context.Context) (*http.Request, error) { + if !eqtl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(eqtl.NextLink))) +} + +// EntityQueryTemplateListPage contains a page of BasicEntityQueryTemplate values. +type EntityQueryTemplateListPage struct { + fn func(context.Context, EntityQueryTemplateList) (EntityQueryTemplateList, error) + eqtl EntityQueryTemplateList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *EntityQueryTemplateListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EntityQueryTemplateListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.eqtl) + if err != nil { + return err + } + page.eqtl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *EntityQueryTemplateListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page EntityQueryTemplateListPage) NotDone() bool { + return !page.eqtl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page EntityQueryTemplateListPage) Response() EntityQueryTemplateList { + return page.eqtl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page EntityQueryTemplateListPage) Values() []BasicEntityQueryTemplate { + if page.eqtl.IsEmpty() { + return nil + } + return *page.eqtl.Value +} + +// Creates a new instance of the EntityQueryTemplateListPage type. +func NewEntityQueryTemplateListPage(cur EntityQueryTemplateList, getNextPage func(context.Context, EntityQueryTemplateList) (EntityQueryTemplateList, error)) EntityQueryTemplateListPage { + return EntityQueryTemplateListPage{ + fn: getNextPage, + eqtl: cur, + } +} + +// EntityQueryTemplateModel ... +type EntityQueryTemplateModel struct { + autorest.Response `json:"-"` + Value BasicEntityQueryTemplate `json:"value,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for EntityQueryTemplateModel struct. +func (eqtm *EntityQueryTemplateModel) UnmarshalJSON(body []byte) error { + eqt, err := unmarshalBasicEntityQueryTemplate(body) + if err != nil { + return err + } + eqtm.Value = eqt + + return nil +} + +// BasicEntityTimelineItem entity timeline Item. +type BasicEntityTimelineItem interface { + AsActivityTimelineItem() (*ActivityTimelineItem, bool) + AsBookmarkTimelineItem() (*BookmarkTimelineItem, bool) + AsSecurityAlertTimelineItem() (*SecurityAlertTimelineItem, bool) + AsEntityTimelineItem() (*EntityTimelineItem, bool) +} + +// EntityTimelineItem entity timeline Item. +type EntityTimelineItem struct { + // Kind - Possible values include: 'KindBasicEntityTimelineItemKindEntityTimelineItem', 'KindBasicEntityTimelineItemKindActivity', 'KindBasicEntityTimelineItemKindBookmark', 'KindBasicEntityTimelineItemKindSecurityAlert' + Kind KindBasicEntityTimelineItem `json:"kind,omitempty"` +} + +func unmarshalBasicEntityTimelineItem(body []byte) (BasicEntityTimelineItem, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["kind"] { + case string(KindBasicEntityTimelineItemKindActivity): + var ati ActivityTimelineItem + err := json.Unmarshal(body, &ati) + return ati, err + case string(KindBasicEntityTimelineItemKindBookmark): + var bti BookmarkTimelineItem + err := json.Unmarshal(body, &bti) + return bti, err + case string(KindBasicEntityTimelineItemKindSecurityAlert): + var sati SecurityAlertTimelineItem + err := json.Unmarshal(body, &sati) + return sati, err + default: + var eti EntityTimelineItem + err := json.Unmarshal(body, &eti) + return eti, err + } +} +func unmarshalBasicEntityTimelineItemArray(body []byte) ([]BasicEntityTimelineItem, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + etiArray := make([]BasicEntityTimelineItem, len(rawMessages)) + + for index, rawMessage := range rawMessages { + eti, err := unmarshalBasicEntityTimelineItem(*rawMessage) + if err != nil { + return nil, err + } + etiArray[index] = eti + } + return etiArray, nil +} + +// MarshalJSON is the custom marshaler for EntityTimelineItem. +func (eti EntityTimelineItem) MarshalJSON() ([]byte, error) { + eti.Kind = KindBasicEntityTimelineItemKindEntityTimelineItem + objectMap := make(map[string]interface{}) + if eti.Kind != "" { + objectMap["kind"] = eti.Kind + } + return json.Marshal(objectMap) +} + +// AsActivityTimelineItem is the BasicEntityTimelineItem implementation for EntityTimelineItem. +func (eti EntityTimelineItem) AsActivityTimelineItem() (*ActivityTimelineItem, bool) { + return nil, false +} + +// AsBookmarkTimelineItem is the BasicEntityTimelineItem implementation for EntityTimelineItem. +func (eti EntityTimelineItem) AsBookmarkTimelineItem() (*BookmarkTimelineItem, bool) { + return nil, false +} + +// AsSecurityAlertTimelineItem is the BasicEntityTimelineItem implementation for EntityTimelineItem. +func (eti EntityTimelineItem) AsSecurityAlertTimelineItem() (*SecurityAlertTimelineItem, bool) { + return nil, false +} + +// AsEntityTimelineItem is the BasicEntityTimelineItem implementation for EntityTimelineItem. +func (eti EntityTimelineItem) AsEntityTimelineItem() (*EntityTimelineItem, bool) { + return &eti, true +} + +// AsBasicEntityTimelineItem is the BasicEntityTimelineItem implementation for EntityTimelineItem. +func (eti EntityTimelineItem) AsBasicEntityTimelineItem() (BasicEntityTimelineItem, bool) { + return &eti, true +} + +// EntityTimelineParameters the parameters required to execute s timeline operation on the given entity. +type EntityTimelineParameters struct { + // Kinds - Array of timeline Item kinds. + Kinds *[]EntityTimelineKind `json:"kinds,omitempty"` + // StartTime - The start timeline date, so the results returned are after this date. + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - The end timeline date, so the results returned are before this date. + EndTime *date.Time `json:"endTime,omitempty"` + // NumberOfBucket - The number of bucket for timeline queries aggregation. + NumberOfBucket *int32 `json:"numberOfBucket,omitempty"` +} + +// EntityTimelineResponse the entity timeline result operation response. +type EntityTimelineResponse struct { + autorest.Response `json:"-"` + // MetaData - The metadata from the timeline operation results. + MetaData *TimelineResultsMetadata `json:"metaData,omitempty"` + // Value - The timeline result values. + Value *[]BasicEntityTimelineItem `json:"value,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for EntityTimelineResponse struct. +func (etr *EntityTimelineResponse) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "metaData": + if v != nil { + var metaData TimelineResultsMetadata + err = json.Unmarshal(*v, &metaData) + if err != nil { + return err + } + etr.MetaData = &metaData + } + case "value": + if v != nil { + value, err := unmarshalBasicEntityTimelineItemArray(*v) + if err != nil { + return err + } + etr.Value = &value + } + } + } + + return nil +} + +// EventGroupingSettings event grouping settings property bag. +type EventGroupingSettings struct { + // AggregationKind - Possible values include: 'EventGroupingAggregationKindSingleAlert', 'EventGroupingAggregationKindAlertPerResult' + AggregationKind EventGroupingAggregationKind `json:"aggregationKind,omitempty"` +} + +// ExpansionEntityQueriesProperties describes expansion entity query properties +type ExpansionEntityQueriesProperties struct { + // DataSources - List of the data sources that are required to run the query + DataSources *[]string `json:"dataSources,omitempty"` + // DisplayName - The query display name + DisplayName *string `json:"displayName,omitempty"` + // InputEntityType - The type of the query's source entity. Possible values include: 'EntityTypeAccount', 'EntityTypeHost', 'EntityTypeFile', 'EntityTypeAzureResource', 'EntityTypeCloudApplication', 'EntityTypeDNS', 'EntityTypeFileHash', 'EntityTypeIP', 'EntityTypeMalware', 'EntityTypeProcess', 'EntityTypeRegistryKey', 'EntityTypeRegistryValue', 'EntityTypeSecurityGroup', 'EntityTypeURL', 'EntityTypeIoTDevice', 'EntityTypeSecurityAlert', 'EntityTypeHuntingBookmark', 'EntityTypeMailCluster', 'EntityTypeMailMessage', 'EntityTypeMailbox', 'EntityTypeSubmissionMail' + InputEntityType EntityType `json:"inputEntityType,omitempty"` + // InputFields - List of the fields of the source entity that are required to run the query + InputFields *[]string `json:"inputFields,omitempty"` + // OutputEntityTypes - List of the desired output types to be constructed from the result + OutputEntityTypes *[]EntityType `json:"outputEntityTypes,omitempty"` + // QueryTemplate - The template query string to be parsed and formatted + QueryTemplate *string `json:"queryTemplate,omitempty"` +} + +// ExpansionEntityQuery represents Expansion entity query. +type ExpansionEntityQuery struct { + // ExpansionEntityQueriesProperties - Expansion entity query properties + *ExpansionEntityQueriesProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicEntityQueryKindEntityQuery', 'KindBasicEntityQueryKindExpansion', 'KindBasicEntityQueryKindActivity' + Kind KindBasicEntityQuery `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpansionEntityQuery. +func (eeq ExpansionEntityQuery) MarshalJSON() ([]byte, error) { + eeq.Kind = KindBasicEntityQueryKindExpansion + objectMap := make(map[string]interface{}) + if eeq.ExpansionEntityQueriesProperties != nil { + objectMap["properties"] = eeq.ExpansionEntityQueriesProperties + } + if eeq.Kind != "" { + objectMap["kind"] = eeq.Kind + } + if eeq.Etag != nil { + objectMap["etag"] = eeq.Etag + } + return json.Marshal(objectMap) +} + +// AsExpansionEntityQuery is the BasicEntityQuery implementation for ExpansionEntityQuery. +func (eeq ExpansionEntityQuery) AsExpansionEntityQuery() (*ExpansionEntityQuery, bool) { + return &eeq, true +} + +// AsActivityEntityQuery is the BasicEntityQuery implementation for ExpansionEntityQuery. +func (eeq ExpansionEntityQuery) AsActivityEntityQuery() (*ActivityEntityQuery, bool) { + return nil, false +} + +// AsEntityQuery is the BasicEntityQuery implementation for ExpansionEntityQuery. +func (eeq ExpansionEntityQuery) AsEntityQuery() (*EntityQuery, bool) { + return nil, false +} + +// AsBasicEntityQuery is the BasicEntityQuery implementation for ExpansionEntityQuery. +func (eeq ExpansionEntityQuery) AsBasicEntityQuery() (BasicEntityQuery, bool) { + return &eeq, true +} + +// UnmarshalJSON is the custom unmarshaler for ExpansionEntityQuery struct. +func (eeq *ExpansionEntityQuery) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var expansionEntityQueriesProperties ExpansionEntityQueriesProperties + err = json.Unmarshal(*v, &expansionEntityQueriesProperties) + if err != nil { + return err + } + eeq.ExpansionEntityQueriesProperties = &expansionEntityQueriesProperties + } + case "kind": + if v != nil { + var kind KindBasicEntityQuery + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + eeq.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + eeq.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + eeq.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + eeq.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + eeq.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + eeq.SystemData = &systemData + } + } + } + + return nil +} + +// ExpansionResultAggregation information of a specific aggregation in the expansion result. +type ExpansionResultAggregation struct { + // AggregationType - The common type of the aggregation. (for e.g. entity field name) + AggregationType *string `json:"aggregationType,omitempty"` + // Count - Total number of aggregations of the given kind (and aggregationType if given) in the expansion result. + Count *int32 `json:"count,omitempty"` + // DisplayName - The display name of the aggregation by type. + DisplayName *string `json:"displayName,omitempty"` + // EntityKind - The kind of the aggregated entity. Possible values include: 'EntityKindAccount', 'EntityKindHost', 'EntityKindFile', 'EntityKindAzureResource', 'EntityKindCloudApplication', 'EntityKindDNSResolution', 'EntityKindFileHash', 'EntityKindIP', 'EntityKindMalware', 'EntityKindProcess', 'EntityKindRegistryKey', 'EntityKindRegistryValue', 'EntityKindSecurityGroup', 'EntityKindURL', 'EntityKindIoTDevice', 'EntityKindSecurityAlert', 'EntityKindBookmark', 'EntityKindMailCluster', 'EntityKindMailMessage', 'EntityKindMailbox', 'EntityKindSubmissionMail' + EntityKind EntityKind `json:"entityKind,omitempty"` +} + +// ExpansionResultsMetadata expansion result metadata. +type ExpansionResultsMetadata struct { + // Aggregations - Information of the aggregated nodes in the expansion result. + Aggregations *[]ExpansionResultAggregation `json:"aggregations,omitempty"` +} + +// EyesOn settings with single toggle. +type EyesOn struct { + // EyesOnSettingsProperties - EyesOn properties + *EyesOnSettingsProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicSettingsKindSettings', 'KindBasicSettingsKindAnomalies', 'KindBasicSettingsKindEyesOn', 'KindBasicSettingsKindEntityAnalytics', 'KindBasicSettingsKindUeba' + Kind KindBasicSettings `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for EyesOn. +func (eo EyesOn) MarshalJSON() ([]byte, error) { + eo.Kind = KindBasicSettingsKindEyesOn + objectMap := make(map[string]interface{}) + if eo.EyesOnSettingsProperties != nil { + objectMap["properties"] = eo.EyesOnSettingsProperties + } + if eo.Kind != "" { + objectMap["kind"] = eo.Kind + } + if eo.Etag != nil { + objectMap["etag"] = eo.Etag + } + return json.Marshal(objectMap) +} + +// AsAnomalies is the BasicSettings implementation for EyesOn. +func (eo EyesOn) AsAnomalies() (*Anomalies, bool) { + return nil, false +} + +// AsEyesOn is the BasicSettings implementation for EyesOn. +func (eo EyesOn) AsEyesOn() (*EyesOn, bool) { + return &eo, true +} + +// AsEntityAnalytics is the BasicSettings implementation for EyesOn. +func (eo EyesOn) AsEntityAnalytics() (*EntityAnalytics, bool) { + return nil, false +} + +// AsUeba is the BasicSettings implementation for EyesOn. +func (eo EyesOn) AsUeba() (*Ueba, bool) { + return nil, false +} + +// AsSettings is the BasicSettings implementation for EyesOn. +func (eo EyesOn) AsSettings() (*Settings, bool) { + return nil, false +} + +// AsBasicSettings is the BasicSettings implementation for EyesOn. +func (eo EyesOn) AsBasicSettings() (BasicSettings, bool) { + return &eo, true +} + +// UnmarshalJSON is the custom unmarshaler for EyesOn struct. +func (eo *EyesOn) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var eyesOnSettingsProperties EyesOnSettingsProperties + err = json.Unmarshal(*v, &eyesOnSettingsProperties) + if err != nil { + return err + } + eo.EyesOnSettingsProperties = &eyesOnSettingsProperties + } + case "kind": + if v != nil { + var kind KindBasicSettings + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + eo.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + eo.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + eo.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + eo.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + eo.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + eo.SystemData = &systemData + } + } + } + + return nil +} + +// EyesOnSettingsProperties eyesOn property bag. +type EyesOnSettingsProperties struct { + // IsEnabled - READ-ONLY; Determines whether the setting is enable or disabled. + IsEnabled *bool `json:"isEnabled,omitempty"` +} + +// MarshalJSON is the custom marshaler for EyesOnSettingsProperties. +func (eosp EyesOnSettingsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// FieldMapping a single field mapping of the mapped entity +type FieldMapping struct { + // Identifier - the V3 identifier of the entity + Identifier *string `json:"identifier,omitempty"` + // ColumnName - the column name to be mapped to the identifier + ColumnName *string `json:"columnName,omitempty"` +} + +// FileEntity represents a file entity. +type FileEntity struct { + // FileEntityProperties - File entity properties + *FileEntityProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicEntityKindEntity', 'KindBasicEntityKindURL', 'KindBasicEntityKindSubmissionMail', 'KindBasicEntityKindSecurityGroup', 'KindBasicEntityKindSecurityAlert', 'KindBasicEntityKindRegistryValue', 'KindBasicEntityKindRegistryKey', 'KindBasicEntityKindProcess', 'KindBasicEntityKindMalware', 'KindBasicEntityKindMailMessage', 'KindBasicEntityKindMailCluster', 'KindBasicEntityKindMailbox', 'KindBasicEntityKindIP', 'KindBasicEntityKindIoTDevice', 'KindBasicEntityKindBookmark', 'KindBasicEntityKindHost', 'KindBasicEntityKindFileHash', 'KindBasicEntityKindFile', 'KindBasicEntityKindDNSResolution', 'KindBasicEntityKindCloudApplication', 'KindBasicEntityKindAzureResource', 'KindBasicEntityKindAccount' + Kind KindBasicEntity `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for FileEntity. +func (fe FileEntity) MarshalJSON() ([]byte, error) { + fe.Kind = KindBasicEntityKindFile + objectMap := make(map[string]interface{}) + if fe.FileEntityProperties != nil { + objectMap["properties"] = fe.FileEntityProperties + } + if fe.Kind != "" { + objectMap["kind"] = fe.Kind + } + return json.Marshal(objectMap) +} + +// AsURLEntity is the BasicEntity implementation for FileEntity. +func (fe FileEntity) AsURLEntity() (*URLEntity, bool) { + return nil, false +} + +// AsSubmissionMailEntity is the BasicEntity implementation for FileEntity. +func (fe FileEntity) AsSubmissionMailEntity() (*SubmissionMailEntity, bool) { + return nil, false +} + +// AsSecurityGroupEntity is the BasicEntity implementation for FileEntity. +func (fe FileEntity) AsSecurityGroupEntity() (*SecurityGroupEntity, bool) { + return nil, false +} + +// AsSecurityAlert is the BasicEntity implementation for FileEntity. +func (fe FileEntity) AsSecurityAlert() (*SecurityAlert, bool) { + return nil, false +} + +// AsRegistryValueEntity is the BasicEntity implementation for FileEntity. +func (fe FileEntity) AsRegistryValueEntity() (*RegistryValueEntity, bool) { + return nil, false +} + +// AsRegistryKeyEntity is the BasicEntity implementation for FileEntity. +func (fe FileEntity) AsRegistryKeyEntity() (*RegistryKeyEntity, bool) { + return nil, false +} + +// AsProcessEntity is the BasicEntity implementation for FileEntity. +func (fe FileEntity) AsProcessEntity() (*ProcessEntity, bool) { + return nil, false +} + +// AsMalwareEntity is the BasicEntity implementation for FileEntity. +func (fe FileEntity) AsMalwareEntity() (*MalwareEntity, bool) { + return nil, false +} + +// AsMailMessageEntity is the BasicEntity implementation for FileEntity. +func (fe FileEntity) AsMailMessageEntity() (*MailMessageEntity, bool) { + return nil, false +} + +// AsMailClusterEntity is the BasicEntity implementation for FileEntity. +func (fe FileEntity) AsMailClusterEntity() (*MailClusterEntity, bool) { + return nil, false +} + +// AsMailboxEntity is the BasicEntity implementation for FileEntity. +func (fe FileEntity) AsMailboxEntity() (*MailboxEntity, bool) { + return nil, false +} + +// AsIPEntity is the BasicEntity implementation for FileEntity. +func (fe FileEntity) AsIPEntity() (*IPEntity, bool) { + return nil, false +} + +// AsIoTDeviceEntity is the BasicEntity implementation for FileEntity. +func (fe FileEntity) AsIoTDeviceEntity() (*IoTDeviceEntity, bool) { + return nil, false +} + +// AsHuntingBookmark is the BasicEntity implementation for FileEntity. +func (fe FileEntity) AsHuntingBookmark() (*HuntingBookmark, bool) { + return nil, false +} + +// AsHostEntity is the BasicEntity implementation for FileEntity. +func (fe FileEntity) AsHostEntity() (*HostEntity, bool) { + return nil, false +} + +// AsFileHashEntity is the BasicEntity implementation for FileEntity. +func (fe FileEntity) AsFileHashEntity() (*FileHashEntity, bool) { + return nil, false +} + +// AsFileEntity is the BasicEntity implementation for FileEntity. +func (fe FileEntity) AsFileEntity() (*FileEntity, bool) { + return &fe, true +} + +// AsDNSEntity is the BasicEntity implementation for FileEntity. +func (fe FileEntity) AsDNSEntity() (*DNSEntity, bool) { + return nil, false +} + +// AsCloudApplicationEntity is the BasicEntity implementation for FileEntity. +func (fe FileEntity) AsCloudApplicationEntity() (*CloudApplicationEntity, bool) { + return nil, false +} + +// AsAzureResourceEntity is the BasicEntity implementation for FileEntity. +func (fe FileEntity) AsAzureResourceEntity() (*AzureResourceEntity, bool) { + return nil, false +} + +// AsAccountEntity is the BasicEntity implementation for FileEntity. +func (fe FileEntity) AsAccountEntity() (*AccountEntity, bool) { + return nil, false +} + +// AsEntity is the BasicEntity implementation for FileEntity. +func (fe FileEntity) AsEntity() (*Entity, bool) { + return nil, false +} + +// AsBasicEntity is the BasicEntity implementation for FileEntity. +func (fe FileEntity) AsBasicEntity() (BasicEntity, bool) { + return &fe, true +} + +// UnmarshalJSON is the custom unmarshaler for FileEntity struct. +func (fe *FileEntity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var fileEntityProperties FileEntityProperties + err = json.Unmarshal(*v, &fileEntityProperties) + if err != nil { + return err + } + fe.FileEntityProperties = &fileEntityProperties + } + case "kind": + if v != nil { + var kind KindBasicEntity + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + fe.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + fe.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + fe.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + fe.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + fe.SystemData = &systemData + } + } + } + + return nil +} + +// FileEntityProperties file entity property bag. +type FileEntityProperties struct { + // Directory - READ-ONLY; The full path to the file. + Directory *string `json:"directory,omitempty"` + // FileHashEntityIds - READ-ONLY; The file hash entity identifiers associated with this file + FileHashEntityIds *[]string `json:"fileHashEntityIds,omitempty"` + // FileName - READ-ONLY; The file name without path (some alerts might not include path). + FileName *string `json:"fileName,omitempty"` + // HostEntityID - READ-ONLY; The Host entity id which the file belongs to + HostEntityID *string `json:"hostEntityId,omitempty"` + // AdditionalData - READ-ONLY; A bag of custom fields that should be part of the entity and will be presented to the user. + AdditionalData map[string]interface{} `json:"additionalData"` + // FriendlyName - READ-ONLY; The graph item display name which is a short humanly readable description of the graph item instance. This property is optional and might be system generated. + FriendlyName *string `json:"friendlyName,omitempty"` +} + +// MarshalJSON is the custom marshaler for FileEntityProperties. +func (fep FileEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// FileHashEntity represents a file hash entity. +type FileHashEntity struct { + // FileHashEntityProperties - FileHash entity properties + *FileHashEntityProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicEntityKindEntity', 'KindBasicEntityKindURL', 'KindBasicEntityKindSubmissionMail', 'KindBasicEntityKindSecurityGroup', 'KindBasicEntityKindSecurityAlert', 'KindBasicEntityKindRegistryValue', 'KindBasicEntityKindRegistryKey', 'KindBasicEntityKindProcess', 'KindBasicEntityKindMalware', 'KindBasicEntityKindMailMessage', 'KindBasicEntityKindMailCluster', 'KindBasicEntityKindMailbox', 'KindBasicEntityKindIP', 'KindBasicEntityKindIoTDevice', 'KindBasicEntityKindBookmark', 'KindBasicEntityKindHost', 'KindBasicEntityKindFileHash', 'KindBasicEntityKindFile', 'KindBasicEntityKindDNSResolution', 'KindBasicEntityKindCloudApplication', 'KindBasicEntityKindAzureResource', 'KindBasicEntityKindAccount' + Kind KindBasicEntity `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for FileHashEntity. +func (fhe FileHashEntity) MarshalJSON() ([]byte, error) { + fhe.Kind = KindBasicEntityKindFileHash + objectMap := make(map[string]interface{}) + if fhe.FileHashEntityProperties != nil { + objectMap["properties"] = fhe.FileHashEntityProperties + } + if fhe.Kind != "" { + objectMap["kind"] = fhe.Kind + } + return json.Marshal(objectMap) +} + +// AsURLEntity is the BasicEntity implementation for FileHashEntity. +func (fhe FileHashEntity) AsURLEntity() (*URLEntity, bool) { + return nil, false +} + +// AsSubmissionMailEntity is the BasicEntity implementation for FileHashEntity. +func (fhe FileHashEntity) AsSubmissionMailEntity() (*SubmissionMailEntity, bool) { + return nil, false +} + +// AsSecurityGroupEntity is the BasicEntity implementation for FileHashEntity. +func (fhe FileHashEntity) AsSecurityGroupEntity() (*SecurityGroupEntity, bool) { + return nil, false +} + +// AsSecurityAlert is the BasicEntity implementation for FileHashEntity. +func (fhe FileHashEntity) AsSecurityAlert() (*SecurityAlert, bool) { + return nil, false +} + +// AsRegistryValueEntity is the BasicEntity implementation for FileHashEntity. +func (fhe FileHashEntity) AsRegistryValueEntity() (*RegistryValueEntity, bool) { + return nil, false +} + +// AsRegistryKeyEntity is the BasicEntity implementation for FileHashEntity. +func (fhe FileHashEntity) AsRegistryKeyEntity() (*RegistryKeyEntity, bool) { + return nil, false +} + +// AsProcessEntity is the BasicEntity implementation for FileHashEntity. +func (fhe FileHashEntity) AsProcessEntity() (*ProcessEntity, bool) { + return nil, false +} + +// AsMalwareEntity is the BasicEntity implementation for FileHashEntity. +func (fhe FileHashEntity) AsMalwareEntity() (*MalwareEntity, bool) { + return nil, false +} + +// AsMailMessageEntity is the BasicEntity implementation for FileHashEntity. +func (fhe FileHashEntity) AsMailMessageEntity() (*MailMessageEntity, bool) { + return nil, false +} + +// AsMailClusterEntity is the BasicEntity implementation for FileHashEntity. +func (fhe FileHashEntity) AsMailClusterEntity() (*MailClusterEntity, bool) { + return nil, false +} + +// AsMailboxEntity is the BasicEntity implementation for FileHashEntity. +func (fhe FileHashEntity) AsMailboxEntity() (*MailboxEntity, bool) { + return nil, false +} + +// AsIPEntity is the BasicEntity implementation for FileHashEntity. +func (fhe FileHashEntity) AsIPEntity() (*IPEntity, bool) { + return nil, false +} + +// AsIoTDeviceEntity is the BasicEntity implementation for FileHashEntity. +func (fhe FileHashEntity) AsIoTDeviceEntity() (*IoTDeviceEntity, bool) { + return nil, false +} + +// AsHuntingBookmark is the BasicEntity implementation for FileHashEntity. +func (fhe FileHashEntity) AsHuntingBookmark() (*HuntingBookmark, bool) { + return nil, false +} + +// AsHostEntity is the BasicEntity implementation for FileHashEntity. +func (fhe FileHashEntity) AsHostEntity() (*HostEntity, bool) { + return nil, false +} + +// AsFileHashEntity is the BasicEntity implementation for FileHashEntity. +func (fhe FileHashEntity) AsFileHashEntity() (*FileHashEntity, bool) { + return &fhe, true +} + +// AsFileEntity is the BasicEntity implementation for FileHashEntity. +func (fhe FileHashEntity) AsFileEntity() (*FileEntity, bool) { + return nil, false +} + +// AsDNSEntity is the BasicEntity implementation for FileHashEntity. +func (fhe FileHashEntity) AsDNSEntity() (*DNSEntity, bool) { + return nil, false +} + +// AsCloudApplicationEntity is the BasicEntity implementation for FileHashEntity. +func (fhe FileHashEntity) AsCloudApplicationEntity() (*CloudApplicationEntity, bool) { + return nil, false +} + +// AsAzureResourceEntity is the BasicEntity implementation for FileHashEntity. +func (fhe FileHashEntity) AsAzureResourceEntity() (*AzureResourceEntity, bool) { + return nil, false +} + +// AsAccountEntity is the BasicEntity implementation for FileHashEntity. +func (fhe FileHashEntity) AsAccountEntity() (*AccountEntity, bool) { + return nil, false +} + +// AsEntity is the BasicEntity implementation for FileHashEntity. +func (fhe FileHashEntity) AsEntity() (*Entity, bool) { + return nil, false +} + +// AsBasicEntity is the BasicEntity implementation for FileHashEntity. +func (fhe FileHashEntity) AsBasicEntity() (BasicEntity, bool) { + return &fhe, true +} + +// UnmarshalJSON is the custom unmarshaler for FileHashEntity struct. +func (fhe *FileHashEntity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var fileHashEntityProperties FileHashEntityProperties + err = json.Unmarshal(*v, &fileHashEntityProperties) + if err != nil { + return err + } + fhe.FileHashEntityProperties = &fileHashEntityProperties + } + case "kind": + if v != nil { + var kind KindBasicEntity + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + fhe.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + fhe.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + fhe.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + fhe.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + fhe.SystemData = &systemData + } + } + } + + return nil +} + +// FileHashEntityProperties fileHash entity property bag. +type FileHashEntityProperties struct { + // Algorithm - READ-ONLY; The hash algorithm type. Possible values include: 'FileHashAlgorithmUnknown', 'FileHashAlgorithmMD5', 'FileHashAlgorithmSHA1', 'FileHashAlgorithmSHA256', 'FileHashAlgorithmSHA256AC' + Algorithm FileHashAlgorithm `json:"algorithm,omitempty"` + // HashValue - READ-ONLY; The file hash value. + HashValue *string `json:"hashValue,omitempty"` + // AdditionalData - READ-ONLY; A bag of custom fields that should be part of the entity and will be presented to the user. + AdditionalData map[string]interface{} `json:"additionalData"` + // FriendlyName - READ-ONLY; The graph item display name which is a short humanly readable description of the graph item instance. This property is optional and might be system generated. + FriendlyName *string `json:"friendlyName,omitempty"` +} + +// MarshalJSON is the custom marshaler for FileHashEntityProperties. +func (fhep FileHashEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// FusionAlertRule represents Fusion alert rule. +type FusionAlertRule struct { + // FusionAlertRuleProperties - Fusion alert rule properties + *FusionAlertRuleProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicAlertRuleKindAlertRule', 'KindBasicAlertRuleKindMLBehaviorAnalytics', 'KindBasicAlertRuleKindFusion', 'KindBasicAlertRuleKindThreatIntelligence', 'KindBasicAlertRuleKindMicrosoftSecurityIncidentCreation', 'KindBasicAlertRuleKindScheduled', 'KindBasicAlertRuleKindNRT' + Kind KindBasicAlertRule `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for FusionAlertRule. +func (far FusionAlertRule) MarshalJSON() ([]byte, error) { + far.Kind = KindBasicAlertRuleKindFusion + objectMap := make(map[string]interface{}) + if far.FusionAlertRuleProperties != nil { + objectMap["properties"] = far.FusionAlertRuleProperties + } + if far.Kind != "" { + objectMap["kind"] = far.Kind + } + if far.Etag != nil { + objectMap["etag"] = far.Etag + } + return json.Marshal(objectMap) +} + +// AsMLBehaviorAnalyticsAlertRule is the BasicAlertRule implementation for FusionAlertRule. +func (far FusionAlertRule) AsMLBehaviorAnalyticsAlertRule() (*MLBehaviorAnalyticsAlertRule, bool) { + return nil, false +} + +// AsFusionAlertRule is the BasicAlertRule implementation for FusionAlertRule. +func (far FusionAlertRule) AsFusionAlertRule() (*FusionAlertRule, bool) { + return &far, true +} + +// AsThreatIntelligenceAlertRule is the BasicAlertRule implementation for FusionAlertRule. +func (far FusionAlertRule) AsThreatIntelligenceAlertRule() (*ThreatIntelligenceAlertRule, bool) { + return nil, false +} + +// AsMicrosoftSecurityIncidentCreationAlertRule is the BasicAlertRule implementation for FusionAlertRule. +func (far FusionAlertRule) AsMicrosoftSecurityIncidentCreationAlertRule() (*MicrosoftSecurityIncidentCreationAlertRule, bool) { + return nil, false +} + +// AsScheduledAlertRule is the BasicAlertRule implementation for FusionAlertRule. +func (far FusionAlertRule) AsScheduledAlertRule() (*ScheduledAlertRule, bool) { + return nil, false +} + +// AsNrtAlertRule is the BasicAlertRule implementation for FusionAlertRule. +func (far FusionAlertRule) AsNrtAlertRule() (*NrtAlertRule, bool) { + return nil, false +} + +// AsAlertRule is the BasicAlertRule implementation for FusionAlertRule. +func (far FusionAlertRule) AsAlertRule() (*AlertRule, bool) { + return nil, false +} + +// AsBasicAlertRule is the BasicAlertRule implementation for FusionAlertRule. +func (far FusionAlertRule) AsBasicAlertRule() (BasicAlertRule, bool) { + return &far, true +} + +// UnmarshalJSON is the custom unmarshaler for FusionAlertRule struct. +func (far *FusionAlertRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var fusionAlertRuleProperties FusionAlertRuleProperties + err = json.Unmarshal(*v, &fusionAlertRuleProperties) + if err != nil { + return err + } + far.FusionAlertRuleProperties = &fusionAlertRuleProperties + } + case "kind": + if v != nil { + var kind KindBasicAlertRule + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + far.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + far.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + far.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + far.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + far.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + far.SystemData = &systemData + } + } + } + + return nil +} + +// FusionAlertRuleProperties fusion alert rule base property bag. +type FusionAlertRuleProperties struct { + // AlertRuleTemplateName - The Name of the alert rule template used to create this rule. + AlertRuleTemplateName *string `json:"alertRuleTemplateName,omitempty"` + // Description - READ-ONLY; The description of the alert rule. + Description *string `json:"description,omitempty"` + // DisplayName - READ-ONLY; The display name for alerts created by this alert rule. + DisplayName *string `json:"displayName,omitempty"` + // Enabled - Determines whether this alert rule is enabled or disabled. + Enabled *bool `json:"enabled,omitempty"` + // SourceSettings - Configuration for all supported source signals in fusion detection. + SourceSettings *[]FusionSourceSettings `json:"sourceSettings,omitempty"` + // ScenarioExclusionPatterns - Configuration to exclude scenarios in fusion detection. + ScenarioExclusionPatterns *[]FusionScenarioExclusionPattern `json:"scenarioExclusionPatterns,omitempty"` + // LastModifiedUtc - READ-ONLY; The last time that this alert has been modified. + LastModifiedUtc *date.Time `json:"lastModifiedUtc,omitempty"` + // Severity - READ-ONLY; The severity for alerts created by this alert rule. Possible values include: 'AlertSeverityHigh', 'AlertSeverityMedium', 'AlertSeverityLow', 'AlertSeverityInformational' + Severity AlertSeverity `json:"severity,omitempty"` + // Tactics - READ-ONLY; The tactics of the alert rule + Tactics *[]AttackTactic `json:"tactics,omitempty"` + // Techniques - READ-ONLY; The techniques of the alert rule + Techniques *[]string `json:"techniques,omitempty"` +} + +// MarshalJSON is the custom marshaler for FusionAlertRuleProperties. +func (farp FusionAlertRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if farp.AlertRuleTemplateName != nil { + objectMap["alertRuleTemplateName"] = farp.AlertRuleTemplateName + } + if farp.Enabled != nil { + objectMap["enabled"] = farp.Enabled + } + if farp.SourceSettings != nil { + objectMap["sourceSettings"] = farp.SourceSettings + } + if farp.ScenarioExclusionPatterns != nil { + objectMap["scenarioExclusionPatterns"] = farp.ScenarioExclusionPatterns + } + return json.Marshal(objectMap) +} + +// FusionAlertRuleTemplate represents Fusion alert rule template. +type FusionAlertRuleTemplate struct { + // FusionAlertRuleTemplateProperties - Fusion alert rule template properties + *FusionAlertRuleTemplateProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicAlertRuleTemplateKindAlertRuleTemplate', 'KindBasicAlertRuleTemplateKindMLBehaviorAnalytics', 'KindBasicAlertRuleTemplateKindFusion', 'KindBasicAlertRuleTemplateKindThreatIntelligence', 'KindBasicAlertRuleTemplateKindMicrosoftSecurityIncidentCreation', 'KindBasicAlertRuleTemplateKindScheduled', 'KindBasicAlertRuleTemplateKindNRT' + Kind KindBasicAlertRuleTemplate `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for FusionAlertRuleTemplate. +func (fart FusionAlertRuleTemplate) MarshalJSON() ([]byte, error) { + fart.Kind = KindBasicAlertRuleTemplateKindFusion + objectMap := make(map[string]interface{}) + if fart.FusionAlertRuleTemplateProperties != nil { + objectMap["properties"] = fart.FusionAlertRuleTemplateProperties + } + if fart.Kind != "" { + objectMap["kind"] = fart.Kind + } + return json.Marshal(objectMap) +} + +// AsMLBehaviorAnalyticsAlertRuleTemplate is the BasicAlertRuleTemplate implementation for FusionAlertRuleTemplate. +func (fart FusionAlertRuleTemplate) AsMLBehaviorAnalyticsAlertRuleTemplate() (*MLBehaviorAnalyticsAlertRuleTemplate, bool) { + return nil, false +} + +// AsFusionAlertRuleTemplate is the BasicAlertRuleTemplate implementation for FusionAlertRuleTemplate. +func (fart FusionAlertRuleTemplate) AsFusionAlertRuleTemplate() (*FusionAlertRuleTemplate, bool) { + return &fart, true +} + +// AsThreatIntelligenceAlertRuleTemplate is the BasicAlertRuleTemplate implementation for FusionAlertRuleTemplate. +func (fart FusionAlertRuleTemplate) AsThreatIntelligenceAlertRuleTemplate() (*ThreatIntelligenceAlertRuleTemplate, bool) { + return nil, false +} + +// AsMicrosoftSecurityIncidentCreationAlertRuleTemplate is the BasicAlertRuleTemplate implementation for FusionAlertRuleTemplate. +func (fart FusionAlertRuleTemplate) AsMicrosoftSecurityIncidentCreationAlertRuleTemplate() (*MicrosoftSecurityIncidentCreationAlertRuleTemplate, bool) { + return nil, false +} + +// AsScheduledAlertRuleTemplate is the BasicAlertRuleTemplate implementation for FusionAlertRuleTemplate. +func (fart FusionAlertRuleTemplate) AsScheduledAlertRuleTemplate() (*ScheduledAlertRuleTemplate, bool) { + return nil, false +} + +// AsNrtAlertRuleTemplate is the BasicAlertRuleTemplate implementation for FusionAlertRuleTemplate. +func (fart FusionAlertRuleTemplate) AsNrtAlertRuleTemplate() (*NrtAlertRuleTemplate, bool) { + return nil, false +} + +// AsAlertRuleTemplate is the BasicAlertRuleTemplate implementation for FusionAlertRuleTemplate. +func (fart FusionAlertRuleTemplate) AsAlertRuleTemplate() (*AlertRuleTemplate, bool) { + return nil, false +} + +// AsBasicAlertRuleTemplate is the BasicAlertRuleTemplate implementation for FusionAlertRuleTemplate. +func (fart FusionAlertRuleTemplate) AsBasicAlertRuleTemplate() (BasicAlertRuleTemplate, bool) { + return &fart, true +} + +// UnmarshalJSON is the custom unmarshaler for FusionAlertRuleTemplate struct. +func (fart *FusionAlertRuleTemplate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var fusionAlertRuleTemplateProperties FusionAlertRuleTemplateProperties + err = json.Unmarshal(*v, &fusionAlertRuleTemplateProperties) + if err != nil { + return err + } + fart.FusionAlertRuleTemplateProperties = &fusionAlertRuleTemplateProperties + } + case "kind": + if v != nil { + var kind KindBasicAlertRuleTemplate + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + fart.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + fart.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + fart.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + fart.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + fart.SystemData = &systemData + } + } + } + + return nil +} + +// FusionAlertRuleTemplateProperties fusion alert rule template properties +type FusionAlertRuleTemplateProperties struct { + // AlertRulesCreatedByTemplateCount - the number of alert rules that were created by this template + AlertRulesCreatedByTemplateCount *int32 `json:"alertRulesCreatedByTemplateCount,omitempty"` + // CreatedDateUTC - READ-ONLY; The time that this alert rule template has been added. + CreatedDateUTC *date.Time `json:"createdDateUTC,omitempty"` + // LastUpdatedDateUTC - READ-ONLY; The time that this alert rule template was last updated. + LastUpdatedDateUTC *date.Time `json:"lastUpdatedDateUTC,omitempty"` + // Description - The description of the alert rule template. + Description *string `json:"description,omitempty"` + // DisplayName - The display name for alert rule template. + DisplayName *string `json:"displayName,omitempty"` + // RequiredDataConnectors - The required data connectors for this template + RequiredDataConnectors *[]AlertRuleTemplateDataSource `json:"requiredDataConnectors,omitempty"` + // Status - The alert rule template status. Possible values include: 'TemplateStatusInstalled', 'TemplateStatusAvailable', 'TemplateStatusNotAvailable' + Status TemplateStatus `json:"status,omitempty"` + // Severity - The severity for alerts created by this alert rule. Possible values include: 'AlertSeverityHigh', 'AlertSeverityMedium', 'AlertSeverityLow', 'AlertSeverityInformational' + Severity AlertSeverity `json:"severity,omitempty"` + // Tactics - The tactics of the alert rule template + Tactics *[]AttackTactic `json:"tactics,omitempty"` + // Techniques - The techniques of the alert rule + Techniques *[]string `json:"techniques,omitempty"` + // SourceSettings - All supported source signal configurations consumed in fusion detection. + SourceSettings *[]FusionTemplateSourceSetting `json:"sourceSettings,omitempty"` +} + +// MarshalJSON is the custom marshaler for FusionAlertRuleTemplateProperties. +func (fartp FusionAlertRuleTemplateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fartp.AlertRulesCreatedByTemplateCount != nil { + objectMap["alertRulesCreatedByTemplateCount"] = fartp.AlertRulesCreatedByTemplateCount + } + if fartp.Description != nil { + objectMap["description"] = fartp.Description + } + if fartp.DisplayName != nil { + objectMap["displayName"] = fartp.DisplayName + } + if fartp.RequiredDataConnectors != nil { + objectMap["requiredDataConnectors"] = fartp.RequiredDataConnectors + } + if fartp.Status != "" { + objectMap["status"] = fartp.Status + } + if fartp.Severity != "" { + objectMap["severity"] = fartp.Severity + } + if fartp.Tactics != nil { + objectMap["tactics"] = fartp.Tactics + } + if fartp.Techniques != nil { + objectMap["techniques"] = fartp.Techniques + } + if fartp.SourceSettings != nil { + objectMap["sourceSettings"] = fartp.SourceSettings + } + return json.Marshal(objectMap) +} + +// FusionScenarioExclusionPattern represents a Fusion scenario exclusion patterns in Fusion detection. +type FusionScenarioExclusionPattern struct { + // ExclusionPattern - Scenario exclusion pattern. + ExclusionPattern *string `json:"exclusionPattern,omitempty"` + // DateAddedInUTC - DateTime when scenario exclusion pattern is added in UTC. + DateAddedInUTC *string `json:"dateAddedInUTC,omitempty"` +} + +// FusionSourceSettings represents a supported source signal configuration in Fusion detection. +type FusionSourceSettings struct { + // Enabled - Determines whether this source signal is enabled or disabled in Fusion detection. + Enabled *bool `json:"enabled,omitempty"` + // SourceName - Name of the Fusion source signal. Refer to Fusion alert rule template for supported values. + SourceName *string `json:"sourceName,omitempty"` + // SourceSubTypes - Configuration for all source subtypes under this source signal consumed in fusion detection. + SourceSubTypes *[]FusionSourceSubTypeSetting `json:"sourceSubTypes,omitempty"` +} + +// FusionSourceSubTypeSetting represents a supported source subtype configuration under a source signal in +// Fusion detection. +type FusionSourceSubTypeSetting struct { + // Enabled - Determines whether this source subtype under source signal is enabled or disabled in Fusion detection. + Enabled *bool `json:"enabled,omitempty"` + // SourceSubTypeName - The Name of the source subtype under a given source signal in Fusion detection. Refer to Fusion alert rule template for supported values. + SourceSubTypeName *string `json:"sourceSubTypeName,omitempty"` + // SourceSubTypeDisplayName - READ-ONLY; The display name of source subtype under a source signal consumed in Fusion detection. + SourceSubTypeDisplayName *string `json:"sourceSubTypeDisplayName,omitempty"` + // SeverityFilters - Severity configuration for a source subtype consumed in fusion detection. + SeverityFilters *FusionSubTypeSeverityFilter `json:"severityFilters,omitempty"` +} + +// MarshalJSON is the custom marshaler for FusionSourceSubTypeSetting. +func (fssts FusionSourceSubTypeSetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fssts.Enabled != nil { + objectMap["enabled"] = fssts.Enabled + } + if fssts.SourceSubTypeName != nil { + objectMap["sourceSubTypeName"] = fssts.SourceSubTypeName + } + if fssts.SeverityFilters != nil { + objectMap["severityFilters"] = fssts.SeverityFilters + } + return json.Marshal(objectMap) +} + +// FusionSubTypeSeverityFilter represents severity configuration for a source subtype consumed in Fusion +// detection. +type FusionSubTypeSeverityFilter struct { + // IsSupported - READ-ONLY; Determines whether this source subtype supports severity configuration or not. + IsSupported *bool `json:"isSupported,omitempty"` + // Filters - Individual Severity configuration settings for a given source subtype consumed in Fusion detection. + Filters *[]FusionSubTypeSeverityFiltersItem `json:"filters,omitempty"` +} + +// MarshalJSON is the custom marshaler for FusionSubTypeSeverityFilter. +func (fstsf FusionSubTypeSeverityFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fstsf.Filters != nil { + objectMap["filters"] = fstsf.Filters + } + return json.Marshal(objectMap) +} + +// FusionSubTypeSeverityFiltersItem represents a Severity filter setting for a given source subtype +// consumed in Fusion detection. +type FusionSubTypeSeverityFiltersItem struct { + // Severity - The Severity for a given source subtype consumed in Fusion detection. Possible values include: 'AlertSeverityHigh', 'AlertSeverityMedium', 'AlertSeverityLow', 'AlertSeverityInformational' + Severity AlertSeverity `json:"severity,omitempty"` + // Enabled - Determines whether this severity is enabled or disabled for this source subtype consumed in Fusion detection. + Enabled *bool `json:"enabled,omitempty"` +} + +// FusionTemplateSourceSetting represents a source signal consumed in Fusion detection. +type FusionTemplateSourceSetting struct { + // SourceName - The name of a source signal consumed in Fusion detection. + SourceName *string `json:"sourceName,omitempty"` + // SourceSubTypes - All supported source subtypes under this source signal consumed in fusion detection. + SourceSubTypes *[]FusionTemplateSourceSubType `json:"sourceSubTypes,omitempty"` +} + +// FusionTemplateSourceSubType represents a source subtype under a source signal consumed in Fusion +// detection. +type FusionTemplateSourceSubType struct { + // SourceSubTypeName - The name of source subtype under a source signal consumed in Fusion detection. + SourceSubTypeName *string `json:"sourceSubTypeName,omitempty"` + // SourceSubTypeDisplayName - READ-ONLY; The display name of source subtype under a source signal consumed in Fusion detection. + SourceSubTypeDisplayName *string `json:"sourceSubTypeDisplayName,omitempty"` + // SeverityFilter - Severity configuration available for a source subtype consumed in fusion detection. + SeverityFilter *FusionTemplateSubTypeSeverityFilter `json:"severityFilter,omitempty"` +} + +// MarshalJSON is the custom marshaler for FusionTemplateSourceSubType. +func (ftsst FusionTemplateSourceSubType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ftsst.SourceSubTypeName != nil { + objectMap["sourceSubTypeName"] = ftsst.SourceSubTypeName + } + if ftsst.SeverityFilter != nil { + objectMap["severityFilter"] = ftsst.SeverityFilter + } + return json.Marshal(objectMap) +} + +// FusionTemplateSubTypeSeverityFilter represents severity configurations available for a source subtype +// consumed in Fusion detection. +type FusionTemplateSubTypeSeverityFilter struct { + // IsSupported - Determines whether severity configuration is supported for this source subtype consumed in Fusion detection. + IsSupported *bool `json:"isSupported,omitempty"` + // SeverityFilters - List of all supported severities for this source subtype consumed in Fusion detection. + SeverityFilters *[]AlertSeverity `json:"severityFilters,omitempty"` +} + +// GeoLocation the geo-location context attached to the ip entity +type GeoLocation struct { + // Asn - READ-ONLY; Autonomous System Number + Asn *int32 `json:"asn,omitempty"` + // City - READ-ONLY; City name + City *string `json:"city,omitempty"` + // CountryCode - READ-ONLY; The country code according to ISO 3166 format + CountryCode *string `json:"countryCode,omitempty"` + // CountryName - READ-ONLY; Country name according to ISO 3166 Alpha 2: the lowercase of the English Short Name + CountryName *string `json:"countryName,omitempty"` + // Latitude - READ-ONLY; The longitude of the identified location, expressed as a floating point number with range of -180 to 180, with positive numbers representing East and negative numbers representing West. Latitude and longitude are derived from the city or postal code. + Latitude *float64 `json:"latitude,omitempty"` + // Longitude - READ-ONLY; The latitude of the identified location, expressed as a floating point number with range of - 90 to 90, with positive numbers representing North and negative numbers representing South. Latitude and longitude are derived from the city or postal code. + Longitude *float64 `json:"longitude,omitempty"` + // State - READ-ONLY; State name + State *string `json:"state,omitempty"` +} + +// MarshalJSON is the custom marshaler for GeoLocation. +func (gl GeoLocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// GetInsightsError getInsights Query Errors. +type GetInsightsError struct { + // Kind - the query kind + Kind *string `json:"kind,omitempty"` + // QueryID - the query id + QueryID *string `json:"queryId,omitempty"` + // ErrorMessage - the error message + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +// GetInsightsResultsMetadata get Insights result metadata. +type GetInsightsResultsMetadata struct { + // TotalCount - the total items found for the insights request + TotalCount *int32 `json:"totalCount,omitempty"` + // Errors - information about the failed queries + Errors *[]GetInsightsError `json:"errors,omitempty"` +} + +// GetQueriesResponse retrieve queries for entity result operation response. +type GetQueriesResponse struct { + autorest.Response `json:"-"` + // Value - The query result values. + Value *[]BasicEntityQueryItem `json:"value,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for GetQueriesResponse struct. +func (gqr *GetQueriesResponse) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "value": + if v != nil { + value, err := unmarshalBasicEntityQueryItemArray(*v) + if err != nil { + return err + } + gqr.Value = &value + } + } + } + + return nil +} + +// GitHubResourceInfo resources created in GitHub repository. +type GitHubResourceInfo struct { + // AppInstallationID - GitHub application installation id. + AppInstallationID *string `json:"appInstallationId,omitempty"` +} + +// GraphQueries the graph query to show the current data status +type GraphQueries struct { + // MetricName - the metric that the query is checking + MetricName *string `json:"metricName,omitempty"` + // Legend - The legend for the graph + Legend *string `json:"legend,omitempty"` + // BaseQuery - The base query for the graph + BaseQuery *string `json:"baseQuery,omitempty"` +} + +// GroupingConfiguration grouping configuration property bag. +type GroupingConfiguration struct { + // Enabled - Grouping enabled + Enabled *bool `json:"enabled,omitempty"` + // ReopenClosedIncident - Re-open closed matching incidents + ReopenClosedIncident *bool `json:"reopenClosedIncident,omitempty"` + // LookbackDuration - Limit the group to alerts created within the lookback duration (in ISO 8601 duration format) + LookbackDuration *string `json:"lookbackDuration,omitempty"` + // MatchingMethod - Grouping matching method. When method is Selected at least one of groupByEntities, groupByAlertDetails, groupByCustomDetails must be provided and not empty. Possible values include: 'MatchingMethodAllEntities', 'MatchingMethodAnyAlert', 'MatchingMethodSelected' + MatchingMethod MatchingMethod `json:"matchingMethod,omitempty"` + // GroupByEntities - A list of entity types to group by (when matchingMethod is Selected). Only entities defined in the current alert rule may be used. + GroupByEntities *[]EntityMappingType `json:"groupByEntities,omitempty"` + // GroupByAlertDetails - A list of alert details to group by (when matchingMethod is Selected) + GroupByAlertDetails *[]AlertDetail `json:"groupByAlertDetails,omitempty"` + // GroupByCustomDetails - A list of custom details keys to group by (when matchingMethod is Selected). Only keys defined in the current alert rule may be used. + GroupByCustomDetails *[]string `json:"groupByCustomDetails,omitempty"` +} + +// HostEntity represents a host entity. +type HostEntity struct { + // HostEntityProperties - Host entity properties + *HostEntityProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicEntityKindEntity', 'KindBasicEntityKindURL', 'KindBasicEntityKindSubmissionMail', 'KindBasicEntityKindSecurityGroup', 'KindBasicEntityKindSecurityAlert', 'KindBasicEntityKindRegistryValue', 'KindBasicEntityKindRegistryKey', 'KindBasicEntityKindProcess', 'KindBasicEntityKindMalware', 'KindBasicEntityKindMailMessage', 'KindBasicEntityKindMailCluster', 'KindBasicEntityKindMailbox', 'KindBasicEntityKindIP', 'KindBasicEntityKindIoTDevice', 'KindBasicEntityKindBookmark', 'KindBasicEntityKindHost', 'KindBasicEntityKindFileHash', 'KindBasicEntityKindFile', 'KindBasicEntityKindDNSResolution', 'KindBasicEntityKindCloudApplication', 'KindBasicEntityKindAzureResource', 'KindBasicEntityKindAccount' + Kind KindBasicEntity `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for HostEntity. +func (he HostEntity) MarshalJSON() ([]byte, error) { + he.Kind = KindBasicEntityKindHost + objectMap := make(map[string]interface{}) + if he.HostEntityProperties != nil { + objectMap["properties"] = he.HostEntityProperties + } + if he.Kind != "" { + objectMap["kind"] = he.Kind + } + return json.Marshal(objectMap) +} + +// AsURLEntity is the BasicEntity implementation for HostEntity. +func (he HostEntity) AsURLEntity() (*URLEntity, bool) { + return nil, false +} + +// AsSubmissionMailEntity is the BasicEntity implementation for HostEntity. +func (he HostEntity) AsSubmissionMailEntity() (*SubmissionMailEntity, bool) { + return nil, false +} + +// AsSecurityGroupEntity is the BasicEntity implementation for HostEntity. +func (he HostEntity) AsSecurityGroupEntity() (*SecurityGroupEntity, bool) { + return nil, false +} + +// AsSecurityAlert is the BasicEntity implementation for HostEntity. +func (he HostEntity) AsSecurityAlert() (*SecurityAlert, bool) { + return nil, false +} + +// AsRegistryValueEntity is the BasicEntity implementation for HostEntity. +func (he HostEntity) AsRegistryValueEntity() (*RegistryValueEntity, bool) { + return nil, false +} + +// AsRegistryKeyEntity is the BasicEntity implementation for HostEntity. +func (he HostEntity) AsRegistryKeyEntity() (*RegistryKeyEntity, bool) { + return nil, false +} + +// AsProcessEntity is the BasicEntity implementation for HostEntity. +func (he HostEntity) AsProcessEntity() (*ProcessEntity, bool) { + return nil, false +} + +// AsMalwareEntity is the BasicEntity implementation for HostEntity. +func (he HostEntity) AsMalwareEntity() (*MalwareEntity, bool) { + return nil, false +} + +// AsMailMessageEntity is the BasicEntity implementation for HostEntity. +func (he HostEntity) AsMailMessageEntity() (*MailMessageEntity, bool) { + return nil, false +} + +// AsMailClusterEntity is the BasicEntity implementation for HostEntity. +func (he HostEntity) AsMailClusterEntity() (*MailClusterEntity, bool) { + return nil, false +} + +// AsMailboxEntity is the BasicEntity implementation for HostEntity. +func (he HostEntity) AsMailboxEntity() (*MailboxEntity, bool) { + return nil, false +} + +// AsIPEntity is the BasicEntity implementation for HostEntity. +func (he HostEntity) AsIPEntity() (*IPEntity, bool) { + return nil, false +} + +// AsIoTDeviceEntity is the BasicEntity implementation for HostEntity. +func (he HostEntity) AsIoTDeviceEntity() (*IoTDeviceEntity, bool) { + return nil, false +} + +// AsHuntingBookmark is the BasicEntity implementation for HostEntity. +func (he HostEntity) AsHuntingBookmark() (*HuntingBookmark, bool) { + return nil, false +} + +// AsHostEntity is the BasicEntity implementation for HostEntity. +func (he HostEntity) AsHostEntity() (*HostEntity, bool) { + return &he, true +} + +// AsFileHashEntity is the BasicEntity implementation for HostEntity. +func (he HostEntity) AsFileHashEntity() (*FileHashEntity, bool) { + return nil, false +} + +// AsFileEntity is the BasicEntity implementation for HostEntity. +func (he HostEntity) AsFileEntity() (*FileEntity, bool) { + return nil, false +} + +// AsDNSEntity is the BasicEntity implementation for HostEntity. +func (he HostEntity) AsDNSEntity() (*DNSEntity, bool) { + return nil, false +} + +// AsCloudApplicationEntity is the BasicEntity implementation for HostEntity. +func (he HostEntity) AsCloudApplicationEntity() (*CloudApplicationEntity, bool) { + return nil, false +} + +// AsAzureResourceEntity is the BasicEntity implementation for HostEntity. +func (he HostEntity) AsAzureResourceEntity() (*AzureResourceEntity, bool) { + return nil, false +} + +// AsAccountEntity is the BasicEntity implementation for HostEntity. +func (he HostEntity) AsAccountEntity() (*AccountEntity, bool) { + return nil, false +} + +// AsEntity is the BasicEntity implementation for HostEntity. +func (he HostEntity) AsEntity() (*Entity, bool) { + return nil, false +} + +// AsBasicEntity is the BasicEntity implementation for HostEntity. +func (he HostEntity) AsBasicEntity() (BasicEntity, bool) { + return &he, true +} + +// UnmarshalJSON is the custom unmarshaler for HostEntity struct. +func (he *HostEntity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var hostEntityProperties HostEntityProperties + err = json.Unmarshal(*v, &hostEntityProperties) + if err != nil { + return err + } + he.HostEntityProperties = &hostEntityProperties + } + case "kind": + if v != nil { + var kind KindBasicEntity + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + he.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + he.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + he.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + he.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + he.SystemData = &systemData + } + } + } + + return nil +} + +// HostEntityProperties host entity property bag. +type HostEntityProperties struct { + // AzureID - READ-ONLY; The azure resource id of the VM. + AzureID *string `json:"azureID,omitempty"` + // DNSDomain - READ-ONLY; The DNS domain that this host belongs to. Should contain the compete DNS suffix for the domain + DNSDomain *string `json:"dnsDomain,omitempty"` + // HostName - READ-ONLY; The hostname without the domain suffix. + HostName *string `json:"hostName,omitempty"` + // IsDomainJoined - READ-ONLY; Determines whether this host belongs to a domain. + IsDomainJoined *bool `json:"isDomainJoined,omitempty"` + // NetBiosName - READ-ONLY; The host name (pre-windows2000). + NetBiosName *string `json:"netBiosName,omitempty"` + // NtDomain - READ-ONLY; The NT domain that this host belongs to. + NtDomain *string `json:"ntDomain,omitempty"` + // OmsAgentID - READ-ONLY; The OMS agent id, if the host has OMS agent installed. + OmsAgentID *string `json:"omsAgentID,omitempty"` + // OsFamily - The operating system type. Possible values include: 'OSFamilyLinux', 'OSFamilyWindows', 'OSFamilyAndroid', 'OSFamilyIOS', 'OSFamilyUnknown' + OsFamily OSFamily `json:"osFamily,omitempty"` + // OsVersion - READ-ONLY; A free text representation of the operating system. This field is meant to hold specific versions the are more fine grained than OSFamily or future values not supported by OSFamily enumeration + OsVersion *string `json:"osVersion,omitempty"` + // AdditionalData - READ-ONLY; A bag of custom fields that should be part of the entity and will be presented to the user. + AdditionalData map[string]interface{} `json:"additionalData"` + // FriendlyName - READ-ONLY; The graph item display name which is a short humanly readable description of the graph item instance. This property is optional and might be system generated. + FriendlyName *string `json:"friendlyName,omitempty"` +} + +// MarshalJSON is the custom marshaler for HostEntityProperties. +func (hep HostEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hep.OsFamily != "" { + objectMap["osFamily"] = hep.OsFamily + } + return json.Marshal(objectMap) +} + +// HuntingBookmark represents a Hunting bookmark entity. +type HuntingBookmark struct { + // HuntingBookmarkProperties - HuntingBookmark entity properties + *HuntingBookmarkProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicEntityKindEntity', 'KindBasicEntityKindURL', 'KindBasicEntityKindSubmissionMail', 'KindBasicEntityKindSecurityGroup', 'KindBasicEntityKindSecurityAlert', 'KindBasicEntityKindRegistryValue', 'KindBasicEntityKindRegistryKey', 'KindBasicEntityKindProcess', 'KindBasicEntityKindMalware', 'KindBasicEntityKindMailMessage', 'KindBasicEntityKindMailCluster', 'KindBasicEntityKindMailbox', 'KindBasicEntityKindIP', 'KindBasicEntityKindIoTDevice', 'KindBasicEntityKindBookmark', 'KindBasicEntityKindHost', 'KindBasicEntityKindFileHash', 'KindBasicEntityKindFile', 'KindBasicEntityKindDNSResolution', 'KindBasicEntityKindCloudApplication', 'KindBasicEntityKindAzureResource', 'KindBasicEntityKindAccount' + Kind KindBasicEntity `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for HuntingBookmark. +func (hb HuntingBookmark) MarshalJSON() ([]byte, error) { + hb.Kind = KindBasicEntityKindBookmark + objectMap := make(map[string]interface{}) + if hb.HuntingBookmarkProperties != nil { + objectMap["properties"] = hb.HuntingBookmarkProperties + } + if hb.Kind != "" { + objectMap["kind"] = hb.Kind + } + return json.Marshal(objectMap) +} + +// AsURLEntity is the BasicEntity implementation for HuntingBookmark. +func (hb HuntingBookmark) AsURLEntity() (*URLEntity, bool) { + return nil, false +} + +// AsSubmissionMailEntity is the BasicEntity implementation for HuntingBookmark. +func (hb HuntingBookmark) AsSubmissionMailEntity() (*SubmissionMailEntity, bool) { + return nil, false +} + +// AsSecurityGroupEntity is the BasicEntity implementation for HuntingBookmark. +func (hb HuntingBookmark) AsSecurityGroupEntity() (*SecurityGroupEntity, bool) { + return nil, false +} + +// AsSecurityAlert is the BasicEntity implementation for HuntingBookmark. +func (hb HuntingBookmark) AsSecurityAlert() (*SecurityAlert, bool) { + return nil, false +} + +// AsRegistryValueEntity is the BasicEntity implementation for HuntingBookmark. +func (hb HuntingBookmark) AsRegistryValueEntity() (*RegistryValueEntity, bool) { + return nil, false +} + +// AsRegistryKeyEntity is the BasicEntity implementation for HuntingBookmark. +func (hb HuntingBookmark) AsRegistryKeyEntity() (*RegistryKeyEntity, bool) { + return nil, false +} + +// AsProcessEntity is the BasicEntity implementation for HuntingBookmark. +func (hb HuntingBookmark) AsProcessEntity() (*ProcessEntity, bool) { + return nil, false +} + +// AsMalwareEntity is the BasicEntity implementation for HuntingBookmark. +func (hb HuntingBookmark) AsMalwareEntity() (*MalwareEntity, bool) { + return nil, false +} + +// AsMailMessageEntity is the BasicEntity implementation for HuntingBookmark. +func (hb HuntingBookmark) AsMailMessageEntity() (*MailMessageEntity, bool) { + return nil, false +} + +// AsMailClusterEntity is the BasicEntity implementation for HuntingBookmark. +func (hb HuntingBookmark) AsMailClusterEntity() (*MailClusterEntity, bool) { + return nil, false +} + +// AsMailboxEntity is the BasicEntity implementation for HuntingBookmark. +func (hb HuntingBookmark) AsMailboxEntity() (*MailboxEntity, bool) { + return nil, false +} + +// AsIPEntity is the BasicEntity implementation for HuntingBookmark. +func (hb HuntingBookmark) AsIPEntity() (*IPEntity, bool) { + return nil, false +} + +// AsIoTDeviceEntity is the BasicEntity implementation for HuntingBookmark. +func (hb HuntingBookmark) AsIoTDeviceEntity() (*IoTDeviceEntity, bool) { + return nil, false +} + +// AsHuntingBookmark is the BasicEntity implementation for HuntingBookmark. +func (hb HuntingBookmark) AsHuntingBookmark() (*HuntingBookmark, bool) { + return &hb, true +} + +// AsHostEntity is the BasicEntity implementation for HuntingBookmark. +func (hb HuntingBookmark) AsHostEntity() (*HostEntity, bool) { + return nil, false +} + +// AsFileHashEntity is the BasicEntity implementation for HuntingBookmark. +func (hb HuntingBookmark) AsFileHashEntity() (*FileHashEntity, bool) { + return nil, false +} + +// AsFileEntity is the BasicEntity implementation for HuntingBookmark. +func (hb HuntingBookmark) AsFileEntity() (*FileEntity, bool) { + return nil, false +} + +// AsDNSEntity is the BasicEntity implementation for HuntingBookmark. +func (hb HuntingBookmark) AsDNSEntity() (*DNSEntity, bool) { + return nil, false +} + +// AsCloudApplicationEntity is the BasicEntity implementation for HuntingBookmark. +func (hb HuntingBookmark) AsCloudApplicationEntity() (*CloudApplicationEntity, bool) { + return nil, false +} + +// AsAzureResourceEntity is the BasicEntity implementation for HuntingBookmark. +func (hb HuntingBookmark) AsAzureResourceEntity() (*AzureResourceEntity, bool) { + return nil, false +} + +// AsAccountEntity is the BasicEntity implementation for HuntingBookmark. +func (hb HuntingBookmark) AsAccountEntity() (*AccountEntity, bool) { + return nil, false +} + +// AsEntity is the BasicEntity implementation for HuntingBookmark. +func (hb HuntingBookmark) AsEntity() (*Entity, bool) { + return nil, false +} + +// AsBasicEntity is the BasicEntity implementation for HuntingBookmark. +func (hb HuntingBookmark) AsBasicEntity() (BasicEntity, bool) { + return &hb, true +} + +// UnmarshalJSON is the custom unmarshaler for HuntingBookmark struct. +func (hb *HuntingBookmark) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var huntingBookmarkProperties HuntingBookmarkProperties + err = json.Unmarshal(*v, &huntingBookmarkProperties) + if err != nil { + return err + } + hb.HuntingBookmarkProperties = &huntingBookmarkProperties + } + case "kind": + if v != nil { + var kind KindBasicEntity + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + hb.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + hb.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + hb.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + hb.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + hb.SystemData = &systemData + } + } + } + + return nil +} + +// HuntingBookmarkProperties describes bookmark properties +type HuntingBookmarkProperties struct { + // Created - The time the bookmark was created + Created *date.Time `json:"created,omitempty"` + // CreatedBy - Describes a user that created the bookmark + CreatedBy *UserInfo `json:"createdBy,omitempty"` + // DisplayName - The display name of the bookmark + DisplayName *string `json:"displayName,omitempty"` + // EventTime - The time of the event + EventTime *date.Time `json:"eventTime,omitempty"` + // Labels - List of labels relevant to this bookmark + Labels *[]string `json:"labels,omitempty"` + // Notes - The notes of the bookmark + Notes *string `json:"notes,omitempty"` + // Query - The query of the bookmark. + Query *string `json:"query,omitempty"` + // QueryResult - The query result of the bookmark. + QueryResult *string `json:"queryResult,omitempty"` + // Updated - The last time the bookmark was updated + Updated *date.Time `json:"updated,omitempty"` + // UpdatedBy - Describes a user that updated the bookmark + UpdatedBy *UserInfo `json:"updatedBy,omitempty"` + // IncidentInfo - Describes an incident that relates to bookmark + IncidentInfo *IncidentInfo `json:"incidentInfo,omitempty"` + // AdditionalData - READ-ONLY; A bag of custom fields that should be part of the entity and will be presented to the user. + AdditionalData map[string]interface{} `json:"additionalData"` + // FriendlyName - READ-ONLY; The graph item display name which is a short humanly readable description of the graph item instance. This property is optional and might be system generated. + FriendlyName *string `json:"friendlyName,omitempty"` +} + +// MarshalJSON is the custom marshaler for HuntingBookmarkProperties. +func (hbp HuntingBookmarkProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hbp.Created != nil { + objectMap["created"] = hbp.Created + } + if hbp.CreatedBy != nil { + objectMap["createdBy"] = hbp.CreatedBy + } + if hbp.DisplayName != nil { + objectMap["displayName"] = hbp.DisplayName + } + if hbp.EventTime != nil { + objectMap["eventTime"] = hbp.EventTime + } + if hbp.Labels != nil { + objectMap["labels"] = hbp.Labels + } + if hbp.Notes != nil { + objectMap["notes"] = hbp.Notes + } + if hbp.Query != nil { + objectMap["query"] = hbp.Query + } + if hbp.QueryResult != nil { + objectMap["queryResult"] = hbp.QueryResult + } + if hbp.Updated != nil { + objectMap["updated"] = hbp.Updated + } + if hbp.UpdatedBy != nil { + objectMap["updatedBy"] = hbp.UpdatedBy + } + if hbp.IncidentInfo != nil { + objectMap["incidentInfo"] = hbp.IncidentInfo + } + return json.Marshal(objectMap) +} + +// Incident represents an incident in Azure Security Insights. +type Incident struct { + autorest.Response `json:"-"` + // IncidentProperties - Incident properties + *IncidentProperties `json:"properties,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Incident. +func (i Incident) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if i.IncidentProperties != nil { + objectMap["properties"] = i.IncidentProperties + } + if i.Etag != nil { + objectMap["etag"] = i.Etag + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Incident struct. +func (i *Incident) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var incidentProperties IncidentProperties + err = json.Unmarshal(*v, &incidentProperties) + if err != nil { + return err + } + i.IncidentProperties = &incidentProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + i.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + i.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + i.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + i.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + i.SystemData = &systemData + } + } + } + + return nil +} + +// IncidentAdditionalData incident additional data property bag. +type IncidentAdditionalData struct { + // AlertsCount - READ-ONLY; The number of alerts in the incident + AlertsCount *int32 `json:"alertsCount,omitempty"` + // BookmarksCount - READ-ONLY; The number of bookmarks in the incident + BookmarksCount *int32 `json:"bookmarksCount,omitempty"` + // CommentsCount - READ-ONLY; The number of comments in the incident + CommentsCount *int32 `json:"commentsCount,omitempty"` + // AlertProductNames - READ-ONLY; List of product names of alerts in the incident + AlertProductNames *[]string `json:"alertProductNames,omitempty"` + // ProviderIncidentURL - READ-ONLY; The provider incident url to the incident in Microsoft 365 Defender portal + ProviderIncidentURL *string `json:"providerIncidentUrl,omitempty"` + // Tactics - READ-ONLY; The tactics associated with incident + Tactics *[]AttackTactic `json:"tactics,omitempty"` + // Techniques - READ-ONLY; The techniques associated with incident's tactics' + Techniques *[]string `json:"techniques,omitempty"` +} + +// MarshalJSON is the custom marshaler for IncidentAdditionalData. +func (iad IncidentAdditionalData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// IncidentAlertList list of incident alerts. +type IncidentAlertList struct { + autorest.Response `json:"-"` + // Value - Array of incident alerts. + Value *[]SecurityAlert `json:"value,omitempty"` +} + +// IncidentBookmarkList list of incident bookmarks. +type IncidentBookmarkList struct { + autorest.Response `json:"-"` + // Value - Array of incident bookmarks. + Value *[]HuntingBookmark `json:"value,omitempty"` +} + +// IncidentComment represents an incident comment +type IncidentComment struct { + autorest.Response `json:"-"` + // IncidentCommentProperties - Incident comment properties + *IncidentCommentProperties `json:"properties,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for IncidentComment. +func (ic IncidentComment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ic.IncidentCommentProperties != nil { + objectMap["properties"] = ic.IncidentCommentProperties + } + if ic.Etag != nil { + objectMap["etag"] = ic.Etag + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for IncidentComment struct. +func (ic *IncidentComment) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var incidentCommentProperties IncidentCommentProperties + err = json.Unmarshal(*v, &incidentCommentProperties) + if err != nil { + return err + } + ic.IncidentCommentProperties = &incidentCommentProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ic.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ic.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ic.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ic.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + ic.SystemData = &systemData + } + } + } + + return nil +} + +// IncidentCommentList list of incident comments. +type IncidentCommentList struct { + autorest.Response `json:"-"` + // NextLink - READ-ONLY; URL to fetch the next set of comments. + NextLink *string `json:"nextLink,omitempty"` + // Value - Array of comments. + Value *[]IncidentComment `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for IncidentCommentList. +func (icl IncidentCommentList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if icl.Value != nil { + objectMap["value"] = icl.Value + } + return json.Marshal(objectMap) +} + +// IncidentCommentListIterator provides access to a complete listing of IncidentComment values. +type IncidentCommentListIterator struct { + i int + page IncidentCommentListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *IncidentCommentListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IncidentCommentListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *IncidentCommentListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter IncidentCommentListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter IncidentCommentListIterator) Response() IncidentCommentList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter IncidentCommentListIterator) Value() IncidentComment { + if !iter.page.NotDone() { + return IncidentComment{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the IncidentCommentListIterator type. +func NewIncidentCommentListIterator(page IncidentCommentListPage) IncidentCommentListIterator { + return IncidentCommentListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (icl IncidentCommentList) IsEmpty() bool { + return icl.Value == nil || len(*icl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (icl IncidentCommentList) hasNextLink() bool { + return icl.NextLink != nil && len(*icl.NextLink) != 0 +} + +// incidentCommentListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (icl IncidentCommentList) incidentCommentListPreparer(ctx context.Context) (*http.Request, error) { + if !icl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(icl.NextLink))) +} + +// IncidentCommentListPage contains a page of IncidentComment values. +type IncidentCommentListPage struct { + fn func(context.Context, IncidentCommentList) (IncidentCommentList, error) + icl IncidentCommentList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *IncidentCommentListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IncidentCommentListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.icl) + if err != nil { + return err + } + page.icl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *IncidentCommentListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page IncidentCommentListPage) NotDone() bool { + return !page.icl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page IncidentCommentListPage) Response() IncidentCommentList { + return page.icl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page IncidentCommentListPage) Values() []IncidentComment { + if page.icl.IsEmpty() { + return nil + } + return *page.icl.Value +} + +// Creates a new instance of the IncidentCommentListPage type. +func NewIncidentCommentListPage(cur IncidentCommentList, getNextPage func(context.Context, IncidentCommentList) (IncidentCommentList, error)) IncidentCommentListPage { + return IncidentCommentListPage{ + fn: getNextPage, + icl: cur, + } +} + +// IncidentCommentProperties incident comment property bag. +type IncidentCommentProperties struct { + // CreatedTimeUtc - READ-ONLY; The time the comment was created + CreatedTimeUtc *date.Time `json:"createdTimeUtc,omitempty"` + // LastModifiedTimeUtc - READ-ONLY; The time the comment was updated + LastModifiedTimeUtc *date.Time `json:"lastModifiedTimeUtc,omitempty"` + // Message - The comment message + Message *string `json:"message,omitempty"` + // Author - READ-ONLY; Describes the client that created the comment + Author *ClientInfo `json:"author,omitempty"` +} + +// MarshalJSON is the custom marshaler for IncidentCommentProperties. +func (icp IncidentCommentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if icp.Message != nil { + objectMap["message"] = icp.Message + } + return json.Marshal(objectMap) +} + +// IncidentConfiguration incident Configuration property bag. +type IncidentConfiguration struct { + // CreateIncident - Create incidents from alerts triggered by this analytics rule + CreateIncident *bool `json:"createIncident,omitempty"` + // GroupingConfiguration - Set how the alerts that are triggered by this analytics rule, are grouped into incidents + GroupingConfiguration *GroupingConfiguration `json:"groupingConfiguration,omitempty"` +} + +// IncidentEntitiesResponse the incident related entities response. +type IncidentEntitiesResponse struct { + autorest.Response `json:"-"` + // Entities - Array of the incident related entities. + Entities *[]BasicEntity `json:"entities,omitempty"` + // MetaData - The metadata from the incident related entities results. + MetaData *[]IncidentEntitiesResultsMetadata `json:"metaData,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for IncidentEntitiesResponse struct. +func (ier *IncidentEntitiesResponse) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "entities": + if v != nil { + entities, err := unmarshalBasicEntityArray(*v) + if err != nil { + return err + } + ier.Entities = &entities + } + case "metaData": + if v != nil { + var metaData []IncidentEntitiesResultsMetadata + err = json.Unmarshal(*v, &metaData) + if err != nil { + return err + } + ier.MetaData = &metaData + } + } + } + + return nil +} + +// IncidentEntitiesResultsMetadata information of a specific aggregation in the incident related entities +// result. +type IncidentEntitiesResultsMetadata struct { + // Count - Total number of aggregations of the given kind in the incident related entities result. + Count *int32 `json:"count,omitempty"` + // EntityKind - The kind of the aggregated entity. Possible values include: 'EntityKindAccount', 'EntityKindHost', 'EntityKindFile', 'EntityKindAzureResource', 'EntityKindCloudApplication', 'EntityKindDNSResolution', 'EntityKindFileHash', 'EntityKindIP', 'EntityKindMalware', 'EntityKindProcess', 'EntityKindRegistryKey', 'EntityKindRegistryValue', 'EntityKindSecurityGroup', 'EntityKindURL', 'EntityKindIoTDevice', 'EntityKindSecurityAlert', 'EntityKindBookmark', 'EntityKindMailCluster', 'EntityKindMailMessage', 'EntityKindMailbox', 'EntityKindSubmissionMail' + EntityKind EntityKind `json:"entityKind,omitempty"` +} + +// IncidentInfo describes related incident information for the bookmark +type IncidentInfo struct { + // IncidentID - Incident Id + IncidentID *string `json:"incidentId,omitempty"` + // Severity - The severity of the incident. Possible values include: 'IncidentSeverityHigh', 'IncidentSeverityMedium', 'IncidentSeverityLow', 'IncidentSeverityInformational' + Severity IncidentSeverity `json:"severity,omitempty"` + // Title - The title of the incident + Title *string `json:"title,omitempty"` + // RelationName - Relation Name + RelationName *string `json:"relationName,omitempty"` +} + +// IncidentLabel represents an incident label +type IncidentLabel struct { + // LabelName - The name of the label + LabelName *string `json:"labelName,omitempty"` + // LabelType - Possible values include: 'IncidentLabelTypeUser', 'IncidentLabelTypeAutoAssigned' + LabelType IncidentLabelType `json:"labelType,omitempty"` +} + +// IncidentList list all the incidents. +type IncidentList struct { + autorest.Response `json:"-"` + // NextLink - READ-ONLY; URL to fetch the next set of incidents. + NextLink *string `json:"nextLink,omitempty"` + // Value - Array of incidents. + Value *[]Incident `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for IncidentList. +func (il IncidentList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if il.Value != nil { + objectMap["value"] = il.Value + } + return json.Marshal(objectMap) +} + +// IncidentListIterator provides access to a complete listing of Incident values. +type IncidentListIterator struct { + i int + page IncidentListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *IncidentListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IncidentListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *IncidentListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter IncidentListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter IncidentListIterator) Response() IncidentList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter IncidentListIterator) Value() Incident { + if !iter.page.NotDone() { + return Incident{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the IncidentListIterator type. +func NewIncidentListIterator(page IncidentListPage) IncidentListIterator { + return IncidentListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (il IncidentList) IsEmpty() bool { + return il.Value == nil || len(*il.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (il IncidentList) hasNextLink() bool { + return il.NextLink != nil && len(*il.NextLink) != 0 +} + +// incidentListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (il IncidentList) incidentListPreparer(ctx context.Context) (*http.Request, error) { + if !il.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(il.NextLink))) +} + +// IncidentListPage contains a page of Incident values. +type IncidentListPage struct { + fn func(context.Context, IncidentList) (IncidentList, error) + il IncidentList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *IncidentListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IncidentListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.il) + if err != nil { + return err + } + page.il = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *IncidentListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page IncidentListPage) NotDone() bool { + return !page.il.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page IncidentListPage) Response() IncidentList { + return page.il +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page IncidentListPage) Values() []Incident { + if page.il.IsEmpty() { + return nil + } + return *page.il.Value +} + +// Creates a new instance of the IncidentListPage type. +func NewIncidentListPage(cur IncidentList, getNextPage func(context.Context, IncidentList) (IncidentList, error)) IncidentListPage { + return IncidentListPage{ + fn: getNextPage, + il: cur, + } +} + +// IncidentOwnerInfo information on the user an incident is assigned to +type IncidentOwnerInfo struct { + // Email - The email of the user the incident is assigned to. + Email *string `json:"email,omitempty"` + // AssignedTo - The name of the user the incident is assigned to. + AssignedTo *string `json:"assignedTo,omitempty"` + // ObjectID - The object id of the user the incident is assigned to. + ObjectID *uuid.UUID `json:"objectId,omitempty"` + // UserPrincipalName - The user principal name of the user the incident is assigned to. + UserPrincipalName *string `json:"userPrincipalName,omitempty"` + // OwnerType - READ-ONLY; The type of the owner the incident is assigned to. Possible values include: 'OwnerTypeUnknown', 'OwnerTypeUser', 'OwnerTypeGroup' + OwnerType OwnerType `json:"ownerType,omitempty"` +} + +// MarshalJSON is the custom marshaler for IncidentOwnerInfo. +func (ioi IncidentOwnerInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ioi.Email != nil { + objectMap["email"] = ioi.Email + } + if ioi.AssignedTo != nil { + objectMap["assignedTo"] = ioi.AssignedTo + } + if ioi.ObjectID != nil { + objectMap["objectId"] = ioi.ObjectID + } + if ioi.UserPrincipalName != nil { + objectMap["userPrincipalName"] = ioi.UserPrincipalName + } + return json.Marshal(objectMap) +} + +// IncidentProperties describes incident properties +type IncidentProperties struct { + // AdditionalData - READ-ONLY; Additional data on the incident + AdditionalData *IncidentAdditionalData `json:"additionalData,omitempty"` + // Classification - The reason the incident was closed. Possible values include: 'IncidentClassificationUndetermined', 'IncidentClassificationTruePositive', 'IncidentClassificationBenignPositive', 'IncidentClassificationFalsePositive' + Classification IncidentClassification `json:"classification,omitempty"` + // ClassificationComment - Describes the reason the incident was closed + ClassificationComment *string `json:"classificationComment,omitempty"` + // ClassificationReason - The classification reason the incident was closed with. Possible values include: 'IncidentClassificationReasonSuspiciousActivity', 'IncidentClassificationReasonSuspiciousButExpected', 'IncidentClassificationReasonIncorrectAlertLogic', 'IncidentClassificationReasonInaccurateData' + ClassificationReason IncidentClassificationReason `json:"classificationReason,omitempty"` + // CreatedTimeUtc - READ-ONLY; The time the incident was created + CreatedTimeUtc *date.Time `json:"createdTimeUtc,omitempty"` + // Description - The description of the incident + Description *string `json:"description,omitempty"` + // FirstActivityTimeUtc - The time of the first activity in the incident + FirstActivityTimeUtc *date.Time `json:"firstActivityTimeUtc,omitempty"` + // IncidentURL - READ-ONLY; The deep-link url to the incident in Azure portal + IncidentURL *string `json:"incidentUrl,omitempty"` + // IncidentNumber - READ-ONLY; A sequential number + IncidentNumber *int32 `json:"incidentNumber,omitempty"` + // Labels - List of labels relevant to this incident + Labels *[]IncidentLabel `json:"labels,omitempty"` + // ProviderName - The name of the source provider that generated the incident + ProviderName *string `json:"providerName,omitempty"` + // ProviderIncidentID - The incident ID assigned by the incident provider + ProviderIncidentID *string `json:"providerIncidentId,omitempty"` + // LastActivityTimeUtc - The time of the last activity in the incident + LastActivityTimeUtc *date.Time `json:"lastActivityTimeUtc,omitempty"` + // LastModifiedTimeUtc - READ-ONLY; The last time the incident was updated + LastModifiedTimeUtc *date.Time `json:"lastModifiedTimeUtc,omitempty"` + // Owner - Describes a user that the incident is assigned to + Owner *IncidentOwnerInfo `json:"owner,omitempty"` + // RelatedAnalyticRuleIds - READ-ONLY; List of resource ids of Analytic rules related to the incident + RelatedAnalyticRuleIds *[]string `json:"relatedAnalyticRuleIds,omitempty"` + // Severity - The severity of the incident. Possible values include: 'IncidentSeverityHigh', 'IncidentSeverityMedium', 'IncidentSeverityLow', 'IncidentSeverityInformational' + Severity IncidentSeverity `json:"severity,omitempty"` + // Status - The status of the incident. Possible values include: 'IncidentStatusNew', 'IncidentStatusActive', 'IncidentStatusClosed' + Status IncidentStatus `json:"status,omitempty"` + // TeamInformation - Describes a team for the incident + TeamInformation *TeamInformation `json:"teamInformation,omitempty"` + // Title - The title of the incident + Title *string `json:"title,omitempty"` +} + +// MarshalJSON is the custom marshaler for IncidentProperties. +func (IP IncidentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if IP.Classification != "" { + objectMap["classification"] = IP.Classification + } + if IP.ClassificationComment != nil { + objectMap["classificationComment"] = IP.ClassificationComment + } + if IP.ClassificationReason != "" { + objectMap["classificationReason"] = IP.ClassificationReason + } + if IP.Description != nil { + objectMap["description"] = IP.Description + } + if IP.FirstActivityTimeUtc != nil { + objectMap["firstActivityTimeUtc"] = IP.FirstActivityTimeUtc + } + if IP.Labels != nil { + objectMap["labels"] = IP.Labels + } + if IP.ProviderName != nil { + objectMap["providerName"] = IP.ProviderName + } + if IP.ProviderIncidentID != nil { + objectMap["providerIncidentId"] = IP.ProviderIncidentID + } + if IP.LastActivityTimeUtc != nil { + objectMap["lastActivityTimeUtc"] = IP.LastActivityTimeUtc + } + if IP.Owner != nil { + objectMap["owner"] = IP.Owner + } + if IP.Severity != "" { + objectMap["severity"] = IP.Severity + } + if IP.Status != "" { + objectMap["status"] = IP.Status + } + if IP.TeamInformation != nil { + objectMap["teamInformation"] = IP.TeamInformation + } + if IP.Title != nil { + objectMap["title"] = IP.Title + } + return json.Marshal(objectMap) +} + +// IncidentPropertiesAction ... +type IncidentPropertiesAction struct { + // Severity - Possible values include: 'IncidentSeverityHigh', 'IncidentSeverityMedium', 'IncidentSeverityLow', 'IncidentSeverityInformational' + Severity IncidentSeverity `json:"severity,omitempty"` + // Status - Possible values include: 'IncidentStatusNew', 'IncidentStatusActive', 'IncidentStatusClosed' + Status IncidentStatus `json:"status,omitempty"` + // Classification - Possible values include: 'IncidentClassificationUndetermined', 'IncidentClassificationTruePositive', 'IncidentClassificationBenignPositive', 'IncidentClassificationFalsePositive' + Classification IncidentClassification `json:"classification,omitempty"` + // ClassificationReason - Possible values include: 'IncidentClassificationReasonSuspiciousActivity', 'IncidentClassificationReasonSuspiciousButExpected', 'IncidentClassificationReasonIncorrectAlertLogic', 'IncidentClassificationReasonInaccurateData' + ClassificationReason IncidentClassificationReason `json:"classificationReason,omitempty"` + // ClassificationComment - Describes the reason the incident was closed + ClassificationComment *string `json:"classificationComment,omitempty"` + Owner *IncidentOwnerInfo `json:"owner,omitempty"` + // Labels - List of labels to add to the incident + Labels *[]IncidentLabel `json:"labels,omitempty"` +} + +// InsightQueryItem represents Insight Query. +type InsightQueryItem struct { + // Properties - Properties bag for InsightQueryItem + Properties *InsightQueryItemProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Query Template ARM ID + ID *string `json:"id,omitempty"` + // Name - Query Template ARM Name + Name *string `json:"name,omitempty"` + // Type - ARM Type + Type *string `json:"type,omitempty"` + // Kind - Possible values include: 'KindBasicEntityQueryItemKindEntityQueryItem', 'KindBasicEntityQueryItemKindInsight' + Kind KindBasicEntityQueryItem `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for InsightQueryItem. +func (iqi InsightQueryItem) MarshalJSON() ([]byte, error) { + iqi.Kind = KindBasicEntityQueryItemKindInsight + objectMap := make(map[string]interface{}) + if iqi.Properties != nil { + objectMap["properties"] = iqi.Properties + } + if iqi.Name != nil { + objectMap["name"] = iqi.Name + } + if iqi.Type != nil { + objectMap["type"] = iqi.Type + } + if iqi.Kind != "" { + objectMap["kind"] = iqi.Kind + } + return json.Marshal(objectMap) +} + +// AsInsightQueryItem is the BasicEntityQueryItem implementation for InsightQueryItem. +func (iqi InsightQueryItem) AsInsightQueryItem() (*InsightQueryItem, bool) { + return &iqi, true +} + +// AsEntityQueryItem is the BasicEntityQueryItem implementation for InsightQueryItem. +func (iqi InsightQueryItem) AsEntityQueryItem() (*EntityQueryItem, bool) { + return nil, false +} + +// AsBasicEntityQueryItem is the BasicEntityQueryItem implementation for InsightQueryItem. +func (iqi InsightQueryItem) AsBasicEntityQueryItem() (BasicEntityQueryItem, bool) { + return &iqi, true +} + +// InsightQueryItemProperties represents Insight Query. +type InsightQueryItemProperties struct { + // DisplayName - The insight display name. + DisplayName *string `json:"displayName,omitempty"` + // Description - The insight description. + Description *string `json:"description,omitempty"` + // BaseQuery - The base query of the insight. + BaseQuery *string `json:"baseQuery,omitempty"` + // TableQuery - The insight table query. + TableQuery *InsightQueryItemPropertiesTableQuery `json:"tableQuery,omitempty"` + // ChartQuery - The insight chart query. + ChartQuery interface{} `json:"chartQuery,omitempty"` + // AdditionalQuery - The activity query definitions. + AdditionalQuery *InsightQueryItemPropertiesAdditionalQuery `json:"additionalQuery,omitempty"` + // DefaultTimeRange - The insight chart query. + DefaultTimeRange *InsightQueryItemPropertiesDefaultTimeRange `json:"defaultTimeRange,omitempty"` + // ReferenceTimeRange - The insight chart query. + ReferenceTimeRange *InsightQueryItemPropertiesReferenceTimeRange `json:"referenceTimeRange,omitempty"` + // DataTypes - Data types for template + DataTypes *[]EntityQueryItemPropertiesDataTypesItem `json:"dataTypes,omitempty"` + // InputEntityType - The type of the entity. Possible values include: 'EntityTypeAccount', 'EntityTypeHost', 'EntityTypeFile', 'EntityTypeAzureResource', 'EntityTypeCloudApplication', 'EntityTypeDNS', 'EntityTypeFileHash', 'EntityTypeIP', 'EntityTypeMalware', 'EntityTypeProcess', 'EntityTypeRegistryKey', 'EntityTypeRegistryValue', 'EntityTypeSecurityGroup', 'EntityTypeURL', 'EntityTypeIoTDevice', 'EntityTypeSecurityAlert', 'EntityTypeHuntingBookmark', 'EntityTypeMailCluster', 'EntityTypeMailMessage', 'EntityTypeMailbox', 'EntityTypeSubmissionMail' + InputEntityType EntityType `json:"inputEntityType,omitempty"` + // RequiredInputFieldsSets - Data types for template + RequiredInputFieldsSets *[][]string `json:"requiredInputFieldsSets,omitempty"` + // EntitiesFilter - The query applied only to entities matching to all filters + EntitiesFilter interface{} `json:"entitiesFilter,omitempty"` +} + +// InsightQueryItemPropertiesAdditionalQuery the activity query definitions. +type InsightQueryItemPropertiesAdditionalQuery struct { + // Query - The insight query. + Query *string `json:"query,omitempty"` + // Text - The insight text. + Text *string `json:"text,omitempty"` +} + +// InsightQueryItemPropertiesDefaultTimeRange the insight chart query. +type InsightQueryItemPropertiesDefaultTimeRange struct { + // BeforeRange - The padding for the start time of the query. + BeforeRange *string `json:"beforeRange,omitempty"` + // AfterRange - The padding for the end time of the query. + AfterRange *string `json:"afterRange,omitempty"` +} + +// InsightQueryItemPropertiesReferenceTimeRange the insight chart query. +type InsightQueryItemPropertiesReferenceTimeRange struct { + // BeforeRange - Additional query time for looking back. + BeforeRange *string `json:"beforeRange,omitempty"` +} + +// InsightQueryItemPropertiesTableQuery the insight table query. +type InsightQueryItemPropertiesTableQuery struct { + // ColumnsDefinitions - List of insight column definitions. + ColumnsDefinitions *[]InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem `json:"columnsDefinitions,omitempty"` + // QueriesDefinitions - List of insight queries definitions. + QueriesDefinitions *[]InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem `json:"queriesDefinitions,omitempty"` +} + +// InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem ... +type InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem struct { + // Header - Insight column header. + Header *string `json:"header,omitempty"` + // OutputType - Insights Column type. Possible values include: 'OutputTypeNumber', 'OutputTypeString', 'OutputTypeDate', 'OutputTypeEntity' + OutputType OutputType `json:"outputType,omitempty"` + // SupportDeepLink - Is query supports deep-link. + SupportDeepLink *bool `json:"supportDeepLink,omitempty"` +} + +// InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem ... +type InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem struct { + // Filter - Insight column header. + Filter *string `json:"filter,omitempty"` + // Summarize - Insight column header. + Summarize *string `json:"summarize,omitempty"` + // Project - Insight column header. + Project *string `json:"project,omitempty"` + // LinkColumnsDefinitions - Insight column header. + LinkColumnsDefinitions *[]InsightQueryItemPropertiesTableQueryQueriesDefinitionsItemLinkColumnsDefinitionsItem `json:"linkColumnsDefinitions,omitempty"` +} + +// InsightQueryItemPropertiesTableQueryQueriesDefinitionsItemLinkColumnsDefinitionsItem ... +type InsightQueryItemPropertiesTableQueryQueriesDefinitionsItemLinkColumnsDefinitionsItem struct { + // ProjectedName - Insight Link Definition Projected Name. + ProjectedName *string `json:"projectedName,omitempty"` + // Query - Insight Link Definition Query. + Query *string `json:"Query,omitempty"` +} + +// InsightsTableResult query results for table insights query. +type InsightsTableResult struct { + // Columns - Columns Metadata of the table + Columns *[]InsightsTableResultColumnsItem `json:"columns,omitempty"` + // Rows - Rows data of the table + Rows *[][]string `json:"rows,omitempty"` +} + +// InsightsTableResultColumnsItem ... +type InsightsTableResultColumnsItem struct { + // Type - the type of the colum + Type *string `json:"type,omitempty"` + // Name - the name of the colum + Name *string `json:"name,omitempty"` +} + +// InstructionSteps instruction steps to enable the connector +type InstructionSteps struct { + // Title - Instruction step title + Title *string `json:"title,omitempty"` + // Description - Instruction step description + Description *string `json:"description,omitempty"` + // Instructions - Instruction step details + Instructions *[]InstructionStepsInstructionsItem `json:"instructions,omitempty"` +} + +// InstructionStepsInstructionsItem ... +type InstructionStepsInstructionsItem struct { + // Parameters - The parameters for the setting + Parameters interface{} `json:"parameters,omitempty"` + // Type - The kind of the setting. Possible values include: 'SettingTypeCopyableLabel', 'SettingTypeInstructionStepsGroup', 'SettingTypeInfoMessage' + Type SettingType `json:"type,omitempty"` +} + +// IoTCheckRequirements represents IoT requirements check request. +type IoTCheckRequirements struct { + // IoTCheckRequirementsProperties - IoT requirements check properties. + *IoTCheckRequirementsProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorsCheckRequirementsKindDataConnectorsCheckRequirements', 'KindBasicDataConnectorsCheckRequirementsKindAzureActiveDirectory', 'KindBasicDataConnectorsCheckRequirementsKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindAzureSecurityCenter', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesS3', 'KindBasicDataConnectorsCheckRequirementsKindDynamics365', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindOfficeATP', 'KindBasicDataConnectorsCheckRequirementsKindOfficeIRM', 'KindBasicDataConnectorsCheckRequirementsKindOffice365Project', 'KindBasicDataConnectorsCheckRequirementsKindOfficePowerBI', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligenceTaxii', 'KindBasicDataConnectorsCheckRequirementsKindIOT' + Kind KindBasicDataConnectorsCheckRequirements `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for IoTCheckRequirements. +func (itcr IoTCheckRequirements) MarshalJSON() ([]byte, error) { + itcr.Kind = KindBasicDataConnectorsCheckRequirementsKindIOT + objectMap := make(map[string]interface{}) + if itcr.IoTCheckRequirementsProperties != nil { + objectMap["properties"] = itcr.IoTCheckRequirementsProperties + } + if itcr.Kind != "" { + objectMap["kind"] = itcr.Kind + } + return json.Marshal(objectMap) +} + +// AsAADCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for IoTCheckRequirements. +func (itcr IoTCheckRequirements) AsAADCheckRequirements() (*AADCheckRequirements, bool) { + return nil, false +} + +// AsAATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for IoTCheckRequirements. +func (itcr IoTCheckRequirements) AsAATPCheckRequirements() (*AATPCheckRequirements, bool) { + return nil, false +} + +// AsASCCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for IoTCheckRequirements. +func (itcr IoTCheckRequirements) AsASCCheckRequirements() (*ASCCheckRequirements, bool) { + return nil, false +} + +// AsAwsCloudTrailCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for IoTCheckRequirements. +func (itcr IoTCheckRequirements) AsAwsCloudTrailCheckRequirements() (*AwsCloudTrailCheckRequirements, bool) { + return nil, false +} + +// AsAwsS3CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for IoTCheckRequirements. +func (itcr IoTCheckRequirements) AsAwsS3CheckRequirements() (*AwsS3CheckRequirements, bool) { + return nil, false +} + +// AsDynamics365CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for IoTCheckRequirements. +func (itcr IoTCheckRequirements) AsDynamics365CheckRequirements() (*Dynamics365CheckRequirements, bool) { + return nil, false +} + +// AsMCASCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for IoTCheckRequirements. +func (itcr IoTCheckRequirements) AsMCASCheckRequirements() (*MCASCheckRequirements, bool) { + return nil, false +} + +// AsMDATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for IoTCheckRequirements. +func (itcr IoTCheckRequirements) AsMDATPCheckRequirements() (*MDATPCheckRequirements, bool) { + return nil, false +} + +// AsMSTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for IoTCheckRequirements. +func (itcr IoTCheckRequirements) AsMSTICheckRequirements() (*MSTICheckRequirements, bool) { + return nil, false +} + +// AsMtpCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for IoTCheckRequirements. +func (itcr IoTCheckRequirements) AsMtpCheckRequirements() (*MtpCheckRequirements, bool) { + return nil, false +} + +// AsOfficeATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for IoTCheckRequirements. +func (itcr IoTCheckRequirements) AsOfficeATPCheckRequirements() (*OfficeATPCheckRequirements, bool) { + return nil, false +} + +// AsOfficeIRMCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for IoTCheckRequirements. +func (itcr IoTCheckRequirements) AsOfficeIRMCheckRequirements() (*OfficeIRMCheckRequirements, bool) { + return nil, false +} + +// AsOffice365ProjectCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for IoTCheckRequirements. +func (itcr IoTCheckRequirements) AsOffice365ProjectCheckRequirements() (*Office365ProjectCheckRequirements, bool) { + return nil, false +} + +// AsOfficePowerBICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for IoTCheckRequirements. +func (itcr IoTCheckRequirements) AsOfficePowerBICheckRequirements() (*OfficePowerBICheckRequirements, bool) { + return nil, false +} + +// AsTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for IoTCheckRequirements. +func (itcr IoTCheckRequirements) AsTICheckRequirements() (*TICheckRequirements, bool) { + return nil, false +} + +// AsTiTaxiiCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for IoTCheckRequirements. +func (itcr IoTCheckRequirements) AsTiTaxiiCheckRequirements() (*TiTaxiiCheckRequirements, bool) { + return nil, false +} + +// AsIoTCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for IoTCheckRequirements. +func (itcr IoTCheckRequirements) AsIoTCheckRequirements() (*IoTCheckRequirements, bool) { + return &itcr, true +} + +// AsDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for IoTCheckRequirements. +func (itcr IoTCheckRequirements) AsDataConnectorsCheckRequirements() (*DataConnectorsCheckRequirements, bool) { + return nil, false +} + +// AsBasicDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for IoTCheckRequirements. +func (itcr IoTCheckRequirements) AsBasicDataConnectorsCheckRequirements() (BasicDataConnectorsCheckRequirements, bool) { + return &itcr, true +} + +// UnmarshalJSON is the custom unmarshaler for IoTCheckRequirements struct. +func (itcr *IoTCheckRequirements) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var ioTCheckRequirementsProperties IoTCheckRequirementsProperties + err = json.Unmarshal(*v, &ioTCheckRequirementsProperties) + if err != nil { + return err + } + itcr.IoTCheckRequirementsProperties = &ioTCheckRequirementsProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnectorsCheckRequirements + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + itcr.Kind = kind + } + } + } + + return nil +} + +// IoTCheckRequirementsProperties ioT requirements check properties. +type IoTCheckRequirementsProperties struct { + // SubscriptionID - The subscription id to connect to, and get the data from. + SubscriptionID *string `json:"subscriptionId,omitempty"` +} + +// IoTDataConnector represents IoT data connector. +type IoTDataConnector struct { + // IoTDataConnectorProperties - IoT data connector properties. + *IoTDataConnectorProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorKindDataConnector', 'KindBasicDataConnectorKindAzureActiveDirectory', 'KindBasicDataConnectorKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorKindMicrosoftThreatProtection', 'KindBasicDataConnectorKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorKindAzureSecurityCenter', 'KindBasicDataConnectorKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorKindAmazonWebServicesS3', 'KindBasicDataConnectorKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorKindDynamics365', 'KindBasicDataConnectorKindOfficeATP', 'KindBasicDataConnectorKindOffice365Project', 'KindBasicDataConnectorKindOfficePowerBI', 'KindBasicDataConnectorKindOfficeIRM', 'KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorKindOffice365', 'KindBasicDataConnectorKindThreatIntelligence', 'KindBasicDataConnectorKindThreatIntelligenceTaxii', 'KindBasicDataConnectorKindIOT', 'KindBasicDataConnectorKindGenericUI', 'KindBasicDataConnectorKindAPIPolling' + Kind KindBasicDataConnector `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for IoTDataConnector. +func (itdc IoTDataConnector) MarshalJSON() ([]byte, error) { + itdc.Kind = KindBasicDataConnectorKindIOT + objectMap := make(map[string]interface{}) + if itdc.IoTDataConnectorProperties != nil { + objectMap["properties"] = itdc.IoTDataConnectorProperties + } + if itdc.Kind != "" { + objectMap["kind"] = itdc.Kind + } + if itdc.Etag != nil { + objectMap["etag"] = itdc.Etag + } + return json.Marshal(objectMap) +} + +// AsAADDataConnector is the BasicDataConnector implementation for IoTDataConnector. +func (itdc IoTDataConnector) AsAADDataConnector() (*AADDataConnector, bool) { + return nil, false +} + +// AsMSTIDataConnector is the BasicDataConnector implementation for IoTDataConnector. +func (itdc IoTDataConnector) AsMSTIDataConnector() (*MSTIDataConnector, bool) { + return nil, false +} + +// AsMTPDataConnector is the BasicDataConnector implementation for IoTDataConnector. +func (itdc IoTDataConnector) AsMTPDataConnector() (*MTPDataConnector, bool) { + return nil, false +} + +// AsAATPDataConnector is the BasicDataConnector implementation for IoTDataConnector. +func (itdc IoTDataConnector) AsAATPDataConnector() (*AATPDataConnector, bool) { + return nil, false +} + +// AsASCDataConnector is the BasicDataConnector implementation for IoTDataConnector. +func (itdc IoTDataConnector) AsASCDataConnector() (*ASCDataConnector, bool) { + return nil, false +} + +// AsAwsCloudTrailDataConnector is the BasicDataConnector implementation for IoTDataConnector. +func (itdc IoTDataConnector) AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) { + return nil, false +} + +// AsAwsS3DataConnector is the BasicDataConnector implementation for IoTDataConnector. +func (itdc IoTDataConnector) AsAwsS3DataConnector() (*AwsS3DataConnector, bool) { + return nil, false +} + +// AsMCASDataConnector is the BasicDataConnector implementation for IoTDataConnector. +func (itdc IoTDataConnector) AsMCASDataConnector() (*MCASDataConnector, bool) { + return nil, false +} + +// AsDynamics365DataConnector is the BasicDataConnector implementation for IoTDataConnector. +func (itdc IoTDataConnector) AsDynamics365DataConnector() (*Dynamics365DataConnector, bool) { + return nil, false +} + +// AsOfficeATPDataConnector is the BasicDataConnector implementation for IoTDataConnector. +func (itdc IoTDataConnector) AsOfficeATPDataConnector() (*OfficeATPDataConnector, bool) { + return nil, false +} + +// AsOffice365ProjectDataConnector is the BasicDataConnector implementation for IoTDataConnector. +func (itdc IoTDataConnector) AsOffice365ProjectDataConnector() (*Office365ProjectDataConnector, bool) { + return nil, false +} + +// AsOfficePowerBIDataConnector is the BasicDataConnector implementation for IoTDataConnector. +func (itdc IoTDataConnector) AsOfficePowerBIDataConnector() (*OfficePowerBIDataConnector, bool) { + return nil, false +} + +// AsOfficeIRMDataConnector is the BasicDataConnector implementation for IoTDataConnector. +func (itdc IoTDataConnector) AsOfficeIRMDataConnector() (*OfficeIRMDataConnector, bool) { + return nil, false +} + +// AsMDATPDataConnector is the BasicDataConnector implementation for IoTDataConnector. +func (itdc IoTDataConnector) AsMDATPDataConnector() (*MDATPDataConnector, bool) { + return nil, false +} + +// AsOfficeDataConnector is the BasicDataConnector implementation for IoTDataConnector. +func (itdc IoTDataConnector) AsOfficeDataConnector() (*OfficeDataConnector, bool) { + return nil, false +} + +// AsTIDataConnector is the BasicDataConnector implementation for IoTDataConnector. +func (itdc IoTDataConnector) AsTIDataConnector() (*TIDataConnector, bool) { + return nil, false +} + +// AsTiTaxiiDataConnector is the BasicDataConnector implementation for IoTDataConnector. +func (itdc IoTDataConnector) AsTiTaxiiDataConnector() (*TiTaxiiDataConnector, bool) { + return nil, false +} + +// AsIoTDataConnector is the BasicDataConnector implementation for IoTDataConnector. +func (itdc IoTDataConnector) AsIoTDataConnector() (*IoTDataConnector, bool) { + return &itdc, true +} + +// AsCodelessUIDataConnector is the BasicDataConnector implementation for IoTDataConnector. +func (itdc IoTDataConnector) AsCodelessUIDataConnector() (*CodelessUIDataConnector, bool) { + return nil, false +} + +// AsCodelessAPIPollingDataConnector is the BasicDataConnector implementation for IoTDataConnector. +func (itdc IoTDataConnector) AsCodelessAPIPollingDataConnector() (*CodelessAPIPollingDataConnector, bool) { + return nil, false +} + +// AsDataConnector is the BasicDataConnector implementation for IoTDataConnector. +func (itdc IoTDataConnector) AsDataConnector() (*DataConnector, bool) { + return nil, false +} + +// AsBasicDataConnector is the BasicDataConnector implementation for IoTDataConnector. +func (itdc IoTDataConnector) AsBasicDataConnector() (BasicDataConnector, bool) { + return &itdc, true +} + +// UnmarshalJSON is the custom unmarshaler for IoTDataConnector struct. +func (itdc *IoTDataConnector) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var ioTDataConnectorProperties IoTDataConnectorProperties + err = json.Unmarshal(*v, &ioTDataConnectorProperties) + if err != nil { + return err + } + itdc.IoTDataConnectorProperties = &ioTDataConnectorProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnector + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + itdc.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + itdc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + itdc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + itdc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + itdc.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + itdc.SystemData = &systemData + } + } + } + + return nil +} + +// IoTDataConnectorProperties ioT data connector properties. +type IoTDataConnectorProperties struct { + // SubscriptionID - The subscription id to connect to, and get the data from. + SubscriptionID *string `json:"subscriptionId,omitempty"` + // DataTypes - The available data types for the connector. + DataTypes *AlertsDataTypeOfDataConnector `json:"dataTypes,omitempty"` +} + +// IoTDeviceEntity represents an IoT device entity. +type IoTDeviceEntity struct { + // IoTDeviceEntityProperties - IoTDevice entity properties + *IoTDeviceEntityProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicEntityKindEntity', 'KindBasicEntityKindURL', 'KindBasicEntityKindSubmissionMail', 'KindBasicEntityKindSecurityGroup', 'KindBasicEntityKindSecurityAlert', 'KindBasicEntityKindRegistryValue', 'KindBasicEntityKindRegistryKey', 'KindBasicEntityKindProcess', 'KindBasicEntityKindMalware', 'KindBasicEntityKindMailMessage', 'KindBasicEntityKindMailCluster', 'KindBasicEntityKindMailbox', 'KindBasicEntityKindIP', 'KindBasicEntityKindIoTDevice', 'KindBasicEntityKindBookmark', 'KindBasicEntityKindHost', 'KindBasicEntityKindFileHash', 'KindBasicEntityKindFile', 'KindBasicEntityKindDNSResolution', 'KindBasicEntityKindCloudApplication', 'KindBasicEntityKindAzureResource', 'KindBasicEntityKindAccount' + Kind KindBasicEntity `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for IoTDeviceEntity. +func (itde IoTDeviceEntity) MarshalJSON() ([]byte, error) { + itde.Kind = KindBasicEntityKindIoTDevice + objectMap := make(map[string]interface{}) + if itde.IoTDeviceEntityProperties != nil { + objectMap["properties"] = itde.IoTDeviceEntityProperties + } + if itde.Kind != "" { + objectMap["kind"] = itde.Kind + } + return json.Marshal(objectMap) +} + +// AsURLEntity is the BasicEntity implementation for IoTDeviceEntity. +func (itde IoTDeviceEntity) AsURLEntity() (*URLEntity, bool) { + return nil, false +} + +// AsSubmissionMailEntity is the BasicEntity implementation for IoTDeviceEntity. +func (itde IoTDeviceEntity) AsSubmissionMailEntity() (*SubmissionMailEntity, bool) { + return nil, false +} + +// AsSecurityGroupEntity is the BasicEntity implementation for IoTDeviceEntity. +func (itde IoTDeviceEntity) AsSecurityGroupEntity() (*SecurityGroupEntity, bool) { + return nil, false +} + +// AsSecurityAlert is the BasicEntity implementation for IoTDeviceEntity. +func (itde IoTDeviceEntity) AsSecurityAlert() (*SecurityAlert, bool) { + return nil, false +} + +// AsRegistryValueEntity is the BasicEntity implementation for IoTDeviceEntity. +func (itde IoTDeviceEntity) AsRegistryValueEntity() (*RegistryValueEntity, bool) { + return nil, false +} + +// AsRegistryKeyEntity is the BasicEntity implementation for IoTDeviceEntity. +func (itde IoTDeviceEntity) AsRegistryKeyEntity() (*RegistryKeyEntity, bool) { + return nil, false +} + +// AsProcessEntity is the BasicEntity implementation for IoTDeviceEntity. +func (itde IoTDeviceEntity) AsProcessEntity() (*ProcessEntity, bool) { + return nil, false +} + +// AsMalwareEntity is the BasicEntity implementation for IoTDeviceEntity. +func (itde IoTDeviceEntity) AsMalwareEntity() (*MalwareEntity, bool) { + return nil, false +} + +// AsMailMessageEntity is the BasicEntity implementation for IoTDeviceEntity. +func (itde IoTDeviceEntity) AsMailMessageEntity() (*MailMessageEntity, bool) { + return nil, false +} + +// AsMailClusterEntity is the BasicEntity implementation for IoTDeviceEntity. +func (itde IoTDeviceEntity) AsMailClusterEntity() (*MailClusterEntity, bool) { + return nil, false +} + +// AsMailboxEntity is the BasicEntity implementation for IoTDeviceEntity. +func (itde IoTDeviceEntity) AsMailboxEntity() (*MailboxEntity, bool) { + return nil, false +} + +// AsIPEntity is the BasicEntity implementation for IoTDeviceEntity. +func (itde IoTDeviceEntity) AsIPEntity() (*IPEntity, bool) { + return nil, false +} + +// AsIoTDeviceEntity is the BasicEntity implementation for IoTDeviceEntity. +func (itde IoTDeviceEntity) AsIoTDeviceEntity() (*IoTDeviceEntity, bool) { + return &itde, true +} + +// AsHuntingBookmark is the BasicEntity implementation for IoTDeviceEntity. +func (itde IoTDeviceEntity) AsHuntingBookmark() (*HuntingBookmark, bool) { + return nil, false +} + +// AsHostEntity is the BasicEntity implementation for IoTDeviceEntity. +func (itde IoTDeviceEntity) AsHostEntity() (*HostEntity, bool) { + return nil, false +} + +// AsFileHashEntity is the BasicEntity implementation for IoTDeviceEntity. +func (itde IoTDeviceEntity) AsFileHashEntity() (*FileHashEntity, bool) { + return nil, false +} + +// AsFileEntity is the BasicEntity implementation for IoTDeviceEntity. +func (itde IoTDeviceEntity) AsFileEntity() (*FileEntity, bool) { + return nil, false +} + +// AsDNSEntity is the BasicEntity implementation for IoTDeviceEntity. +func (itde IoTDeviceEntity) AsDNSEntity() (*DNSEntity, bool) { + return nil, false +} + +// AsCloudApplicationEntity is the BasicEntity implementation for IoTDeviceEntity. +func (itde IoTDeviceEntity) AsCloudApplicationEntity() (*CloudApplicationEntity, bool) { + return nil, false +} + +// AsAzureResourceEntity is the BasicEntity implementation for IoTDeviceEntity. +func (itde IoTDeviceEntity) AsAzureResourceEntity() (*AzureResourceEntity, bool) { + return nil, false +} + +// AsAccountEntity is the BasicEntity implementation for IoTDeviceEntity. +func (itde IoTDeviceEntity) AsAccountEntity() (*AccountEntity, bool) { + return nil, false +} + +// AsEntity is the BasicEntity implementation for IoTDeviceEntity. +func (itde IoTDeviceEntity) AsEntity() (*Entity, bool) { + return nil, false +} + +// AsBasicEntity is the BasicEntity implementation for IoTDeviceEntity. +func (itde IoTDeviceEntity) AsBasicEntity() (BasicEntity, bool) { + return &itde, true +} + +// UnmarshalJSON is the custom unmarshaler for IoTDeviceEntity struct. +func (itde *IoTDeviceEntity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var ioTDeviceEntityProperties IoTDeviceEntityProperties + err = json.Unmarshal(*v, &ioTDeviceEntityProperties) + if err != nil { + return err + } + itde.IoTDeviceEntityProperties = &ioTDeviceEntityProperties + } + case "kind": + if v != nil { + var kind KindBasicEntity + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + itde.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + itde.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + itde.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + itde.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + itde.SystemData = &systemData + } + } + } + + return nil +} + +// IoTDeviceEntityProperties ioTDevice entity property bag. +type IoTDeviceEntityProperties struct { + // DeviceID - READ-ONLY; The ID of the IoT Device in the IoT Hub + DeviceID *string `json:"deviceId,omitempty"` + // DeviceName - READ-ONLY; The friendly name of the device + DeviceName *string `json:"deviceName,omitempty"` + // Source - READ-ONLY; The source of the device + Source *string `json:"source,omitempty"` + // IotSecurityAgentID - READ-ONLY; The ID of the security agent running on the device + IotSecurityAgentID *uuid.UUID `json:"iotSecurityAgentId,omitempty"` + // DeviceType - READ-ONLY; The type of the device + DeviceType *string `json:"deviceType,omitempty"` + // Vendor - READ-ONLY; The vendor of the device + Vendor *string `json:"vendor,omitempty"` + // EdgeID - READ-ONLY; The ID of the edge device + EdgeID *string `json:"edgeId,omitempty"` + // MacAddress - READ-ONLY; The MAC address of the device + MacAddress *string `json:"macAddress,omitempty"` + // Model - READ-ONLY; The model of the device + Model *string `json:"model,omitempty"` + // SerialNumber - READ-ONLY; The serial number of the device + SerialNumber *string `json:"serialNumber,omitempty"` + // FirmwareVersion - READ-ONLY; The firmware version of the device + FirmwareVersion *string `json:"firmwareVersion,omitempty"` + // OperatingSystem - READ-ONLY; The operating system of the device + OperatingSystem *string `json:"operatingSystem,omitempty"` + // IotHubEntityID - READ-ONLY; The AzureResource entity id of the IoT Hub + IotHubEntityID *string `json:"iotHubEntityId,omitempty"` + // HostEntityID - READ-ONLY; The Host entity id of this device + HostEntityID *string `json:"hostEntityId,omitempty"` + // IPAddressEntityID - READ-ONLY; The IP entity if of this device + IPAddressEntityID *string `json:"ipAddressEntityId,omitempty"` + // ThreatIntelligence - READ-ONLY; A list of TI contexts attached to the IoTDevice entity. + ThreatIntelligence *[]ThreatIntelligence `json:"threatIntelligence,omitempty"` + // Protocols - READ-ONLY; A list of protocols of the IoTDevice entity. + Protocols *[]string `json:"protocols,omitempty"` + // AdditionalData - READ-ONLY; A bag of custom fields that should be part of the entity and will be presented to the user. + AdditionalData map[string]interface{} `json:"additionalData"` + // FriendlyName - READ-ONLY; The graph item display name which is a short humanly readable description of the graph item instance. This property is optional and might be system generated. + FriendlyName *string `json:"friendlyName,omitempty"` +} + +// MarshalJSON is the custom marshaler for IoTDeviceEntityProperties. +func (itdep IoTDeviceEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// IPEntity represents an ip entity. +type IPEntity struct { + // IPEntityProperties - Ip entity properties + *IPEntityProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicEntityKindEntity', 'KindBasicEntityKindURL', 'KindBasicEntityKindSubmissionMail', 'KindBasicEntityKindSecurityGroup', 'KindBasicEntityKindSecurityAlert', 'KindBasicEntityKindRegistryValue', 'KindBasicEntityKindRegistryKey', 'KindBasicEntityKindProcess', 'KindBasicEntityKindMalware', 'KindBasicEntityKindMailMessage', 'KindBasicEntityKindMailCluster', 'KindBasicEntityKindMailbox', 'KindBasicEntityKindIP', 'KindBasicEntityKindIoTDevice', 'KindBasicEntityKindBookmark', 'KindBasicEntityKindHost', 'KindBasicEntityKindFileHash', 'KindBasicEntityKindFile', 'KindBasicEntityKindDNSResolution', 'KindBasicEntityKindCloudApplication', 'KindBasicEntityKindAzureResource', 'KindBasicEntityKindAccount' + Kind KindBasicEntity `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for IPEntity. +func (ie IPEntity) MarshalJSON() ([]byte, error) { + ie.Kind = KindBasicEntityKindIP + objectMap := make(map[string]interface{}) + if ie.IPEntityProperties != nil { + objectMap["properties"] = ie.IPEntityProperties + } + if ie.Kind != "" { + objectMap["kind"] = ie.Kind + } + return json.Marshal(objectMap) +} + +// AsURLEntity is the BasicEntity implementation for IPEntity. +func (ie IPEntity) AsURLEntity() (*URLEntity, bool) { + return nil, false +} + +// AsSubmissionMailEntity is the BasicEntity implementation for IPEntity. +func (ie IPEntity) AsSubmissionMailEntity() (*SubmissionMailEntity, bool) { + return nil, false +} + +// AsSecurityGroupEntity is the BasicEntity implementation for IPEntity. +func (ie IPEntity) AsSecurityGroupEntity() (*SecurityGroupEntity, bool) { + return nil, false +} + +// AsSecurityAlert is the BasicEntity implementation for IPEntity. +func (ie IPEntity) AsSecurityAlert() (*SecurityAlert, bool) { + return nil, false +} + +// AsRegistryValueEntity is the BasicEntity implementation for IPEntity. +func (ie IPEntity) AsRegistryValueEntity() (*RegistryValueEntity, bool) { + return nil, false +} + +// AsRegistryKeyEntity is the BasicEntity implementation for IPEntity. +func (ie IPEntity) AsRegistryKeyEntity() (*RegistryKeyEntity, bool) { + return nil, false +} + +// AsProcessEntity is the BasicEntity implementation for IPEntity. +func (ie IPEntity) AsProcessEntity() (*ProcessEntity, bool) { + return nil, false +} + +// AsMalwareEntity is the BasicEntity implementation for IPEntity. +func (ie IPEntity) AsMalwareEntity() (*MalwareEntity, bool) { + return nil, false +} + +// AsMailMessageEntity is the BasicEntity implementation for IPEntity. +func (ie IPEntity) AsMailMessageEntity() (*MailMessageEntity, bool) { + return nil, false +} + +// AsMailClusterEntity is the BasicEntity implementation for IPEntity. +func (ie IPEntity) AsMailClusterEntity() (*MailClusterEntity, bool) { + return nil, false +} + +// AsMailboxEntity is the BasicEntity implementation for IPEntity. +func (ie IPEntity) AsMailboxEntity() (*MailboxEntity, bool) { + return nil, false +} + +// AsIPEntity is the BasicEntity implementation for IPEntity. +func (ie IPEntity) AsIPEntity() (*IPEntity, bool) { + return &ie, true +} + +// AsIoTDeviceEntity is the BasicEntity implementation for IPEntity. +func (ie IPEntity) AsIoTDeviceEntity() (*IoTDeviceEntity, bool) { + return nil, false +} + +// AsHuntingBookmark is the BasicEntity implementation for IPEntity. +func (ie IPEntity) AsHuntingBookmark() (*HuntingBookmark, bool) { + return nil, false +} + +// AsHostEntity is the BasicEntity implementation for IPEntity. +func (ie IPEntity) AsHostEntity() (*HostEntity, bool) { + return nil, false +} + +// AsFileHashEntity is the BasicEntity implementation for IPEntity. +func (ie IPEntity) AsFileHashEntity() (*FileHashEntity, bool) { + return nil, false +} + +// AsFileEntity is the BasicEntity implementation for IPEntity. +func (ie IPEntity) AsFileEntity() (*FileEntity, bool) { + return nil, false +} + +// AsDNSEntity is the BasicEntity implementation for IPEntity. +func (ie IPEntity) AsDNSEntity() (*DNSEntity, bool) { + return nil, false +} + +// AsCloudApplicationEntity is the BasicEntity implementation for IPEntity. +func (ie IPEntity) AsCloudApplicationEntity() (*CloudApplicationEntity, bool) { + return nil, false +} + +// AsAzureResourceEntity is the BasicEntity implementation for IPEntity. +func (ie IPEntity) AsAzureResourceEntity() (*AzureResourceEntity, bool) { + return nil, false +} + +// AsAccountEntity is the BasicEntity implementation for IPEntity. +func (ie IPEntity) AsAccountEntity() (*AccountEntity, bool) { + return nil, false +} + +// AsEntity is the BasicEntity implementation for IPEntity. +func (ie IPEntity) AsEntity() (*Entity, bool) { + return nil, false +} + +// AsBasicEntity is the BasicEntity implementation for IPEntity. +func (ie IPEntity) AsBasicEntity() (BasicEntity, bool) { + return &ie, true +} + +// UnmarshalJSON is the custom unmarshaler for IPEntity struct. +func (ie *IPEntity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var IPEntityProperties IPEntityProperties + err = json.Unmarshal(*v, &IPEntityProperties) + if err != nil { + return err + } + ie.IPEntityProperties = &IPEntityProperties + } + case "kind": + if v != nil { + var kind KindBasicEntity + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ie.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ie.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ie.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ie.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + ie.SystemData = &systemData + } + } + } + + return nil +} + +// IPEntityProperties ip entity property bag. +type IPEntityProperties struct { + // Address - READ-ONLY; The IP address as string, e.g. 127.0.0.1 (either in Ipv4 or Ipv6) + Address *string `json:"address,omitempty"` + // Location - The geo-location context attached to the ip entity + Location *GeoLocation `json:"location,omitempty"` + // ThreatIntelligence - READ-ONLY; A list of TI contexts attached to the ip entity. + ThreatIntelligence *[]ThreatIntelligence `json:"threatIntelligence,omitempty"` + // AdditionalData - READ-ONLY; A bag of custom fields that should be part of the entity and will be presented to the user. + AdditionalData map[string]interface{} `json:"additionalData"` + // FriendlyName - READ-ONLY; The graph item display name which is a short humanly readable description of the graph item instance. This property is optional and might be system generated. + FriendlyName *string `json:"friendlyName,omitempty"` +} + +// MarshalJSON is the custom marshaler for IPEntityProperties. +func (iep IPEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if iep.Location != nil { + objectMap["location"] = iep.Location + } + return json.Marshal(objectMap) +} + +// LastDataReceivedDataType data type for last data received +type LastDataReceivedDataType struct { + // Name - Name of the data type to show in the graph. can be use with {{graphQueriesTableName}} placeholder + Name *string `json:"name,omitempty"` + // LastDataReceivedQuery - Query for indicate last data received + LastDataReceivedQuery *string `json:"lastDataReceivedQuery,omitempty"` +} + +// MailboxEntity represents a mailbox entity. +type MailboxEntity struct { + // MailboxEntityProperties - Mailbox entity properties + *MailboxEntityProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicEntityKindEntity', 'KindBasicEntityKindURL', 'KindBasicEntityKindSubmissionMail', 'KindBasicEntityKindSecurityGroup', 'KindBasicEntityKindSecurityAlert', 'KindBasicEntityKindRegistryValue', 'KindBasicEntityKindRegistryKey', 'KindBasicEntityKindProcess', 'KindBasicEntityKindMalware', 'KindBasicEntityKindMailMessage', 'KindBasicEntityKindMailCluster', 'KindBasicEntityKindMailbox', 'KindBasicEntityKindIP', 'KindBasicEntityKindIoTDevice', 'KindBasicEntityKindBookmark', 'KindBasicEntityKindHost', 'KindBasicEntityKindFileHash', 'KindBasicEntityKindFile', 'KindBasicEntityKindDNSResolution', 'KindBasicEntityKindCloudApplication', 'KindBasicEntityKindAzureResource', 'KindBasicEntityKindAccount' + Kind KindBasicEntity `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for MailboxEntity. +func (me MailboxEntity) MarshalJSON() ([]byte, error) { + me.Kind = KindBasicEntityKindMailbox + objectMap := make(map[string]interface{}) + if me.MailboxEntityProperties != nil { + objectMap["properties"] = me.MailboxEntityProperties + } + if me.Kind != "" { + objectMap["kind"] = me.Kind + } + return json.Marshal(objectMap) +} + +// AsURLEntity is the BasicEntity implementation for MailboxEntity. +func (me MailboxEntity) AsURLEntity() (*URLEntity, bool) { + return nil, false +} + +// AsSubmissionMailEntity is the BasicEntity implementation for MailboxEntity. +func (me MailboxEntity) AsSubmissionMailEntity() (*SubmissionMailEntity, bool) { + return nil, false +} + +// AsSecurityGroupEntity is the BasicEntity implementation for MailboxEntity. +func (me MailboxEntity) AsSecurityGroupEntity() (*SecurityGroupEntity, bool) { + return nil, false +} + +// AsSecurityAlert is the BasicEntity implementation for MailboxEntity. +func (me MailboxEntity) AsSecurityAlert() (*SecurityAlert, bool) { + return nil, false +} + +// AsRegistryValueEntity is the BasicEntity implementation for MailboxEntity. +func (me MailboxEntity) AsRegistryValueEntity() (*RegistryValueEntity, bool) { + return nil, false +} + +// AsRegistryKeyEntity is the BasicEntity implementation for MailboxEntity. +func (me MailboxEntity) AsRegistryKeyEntity() (*RegistryKeyEntity, bool) { + return nil, false +} + +// AsProcessEntity is the BasicEntity implementation for MailboxEntity. +func (me MailboxEntity) AsProcessEntity() (*ProcessEntity, bool) { + return nil, false +} + +// AsMalwareEntity is the BasicEntity implementation for MailboxEntity. +func (me MailboxEntity) AsMalwareEntity() (*MalwareEntity, bool) { + return nil, false +} + +// AsMailMessageEntity is the BasicEntity implementation for MailboxEntity. +func (me MailboxEntity) AsMailMessageEntity() (*MailMessageEntity, bool) { + return nil, false +} + +// AsMailClusterEntity is the BasicEntity implementation for MailboxEntity. +func (me MailboxEntity) AsMailClusterEntity() (*MailClusterEntity, bool) { + return nil, false +} + +// AsMailboxEntity is the BasicEntity implementation for MailboxEntity. +func (me MailboxEntity) AsMailboxEntity() (*MailboxEntity, bool) { + return &me, true +} + +// AsIPEntity is the BasicEntity implementation for MailboxEntity. +func (me MailboxEntity) AsIPEntity() (*IPEntity, bool) { + return nil, false +} + +// AsIoTDeviceEntity is the BasicEntity implementation for MailboxEntity. +func (me MailboxEntity) AsIoTDeviceEntity() (*IoTDeviceEntity, bool) { + return nil, false +} + +// AsHuntingBookmark is the BasicEntity implementation for MailboxEntity. +func (me MailboxEntity) AsHuntingBookmark() (*HuntingBookmark, bool) { + return nil, false +} + +// AsHostEntity is the BasicEntity implementation for MailboxEntity. +func (me MailboxEntity) AsHostEntity() (*HostEntity, bool) { + return nil, false +} + +// AsFileHashEntity is the BasicEntity implementation for MailboxEntity. +func (me MailboxEntity) AsFileHashEntity() (*FileHashEntity, bool) { + return nil, false +} + +// AsFileEntity is the BasicEntity implementation for MailboxEntity. +func (me MailboxEntity) AsFileEntity() (*FileEntity, bool) { + return nil, false +} + +// AsDNSEntity is the BasicEntity implementation for MailboxEntity. +func (me MailboxEntity) AsDNSEntity() (*DNSEntity, bool) { + return nil, false +} + +// AsCloudApplicationEntity is the BasicEntity implementation for MailboxEntity. +func (me MailboxEntity) AsCloudApplicationEntity() (*CloudApplicationEntity, bool) { + return nil, false +} + +// AsAzureResourceEntity is the BasicEntity implementation for MailboxEntity. +func (me MailboxEntity) AsAzureResourceEntity() (*AzureResourceEntity, bool) { + return nil, false +} + +// AsAccountEntity is the BasicEntity implementation for MailboxEntity. +func (me MailboxEntity) AsAccountEntity() (*AccountEntity, bool) { + return nil, false +} + +// AsEntity is the BasicEntity implementation for MailboxEntity. +func (me MailboxEntity) AsEntity() (*Entity, bool) { + return nil, false +} + +// AsBasicEntity is the BasicEntity implementation for MailboxEntity. +func (me MailboxEntity) AsBasicEntity() (BasicEntity, bool) { + return &me, true +} + +// UnmarshalJSON is the custom unmarshaler for MailboxEntity struct. +func (me *MailboxEntity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var mailboxEntityProperties MailboxEntityProperties + err = json.Unmarshal(*v, &mailboxEntityProperties) + if err != nil { + return err + } + me.MailboxEntityProperties = &mailboxEntityProperties + } + case "kind": + if v != nil { + var kind KindBasicEntity + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + me.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + me.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + me.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + me.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + me.SystemData = &systemData + } + } + } + + return nil +} + +// MailboxEntityProperties mailbox entity property bag. +type MailboxEntityProperties struct { + // MailboxPrimaryAddress - READ-ONLY; The mailbox's primary address + MailboxPrimaryAddress *string `json:"mailboxPrimaryAddress,omitempty"` + // DisplayName - READ-ONLY; The mailbox's display name + DisplayName *string `json:"displayName,omitempty"` + // Upn - READ-ONLY; The mailbox's UPN + Upn *string `json:"upn,omitempty"` + // ExternalDirectoryObjectID - READ-ONLY; The AzureAD identifier of mailbox. Similar to AadUserId in account entity but this property is specific to mailbox object on office side + ExternalDirectoryObjectID *uuid.UUID `json:"externalDirectoryObjectId,omitempty"` + // AdditionalData - READ-ONLY; A bag of custom fields that should be part of the entity and will be presented to the user. + AdditionalData map[string]interface{} `json:"additionalData"` + // FriendlyName - READ-ONLY; The graph item display name which is a short humanly readable description of the graph item instance. This property is optional and might be system generated. + FriendlyName *string `json:"friendlyName,omitempty"` +} + +// MarshalJSON is the custom marshaler for MailboxEntityProperties. +func (mep MailboxEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// MailClusterEntity represents a mail cluster entity. +type MailClusterEntity struct { + // MailClusterEntityProperties - Mail cluster entity properties + *MailClusterEntityProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicEntityKindEntity', 'KindBasicEntityKindURL', 'KindBasicEntityKindSubmissionMail', 'KindBasicEntityKindSecurityGroup', 'KindBasicEntityKindSecurityAlert', 'KindBasicEntityKindRegistryValue', 'KindBasicEntityKindRegistryKey', 'KindBasicEntityKindProcess', 'KindBasicEntityKindMalware', 'KindBasicEntityKindMailMessage', 'KindBasicEntityKindMailCluster', 'KindBasicEntityKindMailbox', 'KindBasicEntityKindIP', 'KindBasicEntityKindIoTDevice', 'KindBasicEntityKindBookmark', 'KindBasicEntityKindHost', 'KindBasicEntityKindFileHash', 'KindBasicEntityKindFile', 'KindBasicEntityKindDNSResolution', 'KindBasicEntityKindCloudApplication', 'KindBasicEntityKindAzureResource', 'KindBasicEntityKindAccount' + Kind KindBasicEntity `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for MailClusterEntity. +func (mce MailClusterEntity) MarshalJSON() ([]byte, error) { + mce.Kind = KindBasicEntityKindMailCluster + objectMap := make(map[string]interface{}) + if mce.MailClusterEntityProperties != nil { + objectMap["properties"] = mce.MailClusterEntityProperties + } + if mce.Kind != "" { + objectMap["kind"] = mce.Kind + } + return json.Marshal(objectMap) +} + +// AsURLEntity is the BasicEntity implementation for MailClusterEntity. +func (mce MailClusterEntity) AsURLEntity() (*URLEntity, bool) { + return nil, false +} + +// AsSubmissionMailEntity is the BasicEntity implementation for MailClusterEntity. +func (mce MailClusterEntity) AsSubmissionMailEntity() (*SubmissionMailEntity, bool) { + return nil, false +} + +// AsSecurityGroupEntity is the BasicEntity implementation for MailClusterEntity. +func (mce MailClusterEntity) AsSecurityGroupEntity() (*SecurityGroupEntity, bool) { + return nil, false +} + +// AsSecurityAlert is the BasicEntity implementation for MailClusterEntity. +func (mce MailClusterEntity) AsSecurityAlert() (*SecurityAlert, bool) { + return nil, false +} + +// AsRegistryValueEntity is the BasicEntity implementation for MailClusterEntity. +func (mce MailClusterEntity) AsRegistryValueEntity() (*RegistryValueEntity, bool) { + return nil, false +} + +// AsRegistryKeyEntity is the BasicEntity implementation for MailClusterEntity. +func (mce MailClusterEntity) AsRegistryKeyEntity() (*RegistryKeyEntity, bool) { + return nil, false +} + +// AsProcessEntity is the BasicEntity implementation for MailClusterEntity. +func (mce MailClusterEntity) AsProcessEntity() (*ProcessEntity, bool) { + return nil, false +} + +// AsMalwareEntity is the BasicEntity implementation for MailClusterEntity. +func (mce MailClusterEntity) AsMalwareEntity() (*MalwareEntity, bool) { + return nil, false +} + +// AsMailMessageEntity is the BasicEntity implementation for MailClusterEntity. +func (mce MailClusterEntity) AsMailMessageEntity() (*MailMessageEntity, bool) { + return nil, false +} + +// AsMailClusterEntity is the BasicEntity implementation for MailClusterEntity. +func (mce MailClusterEntity) AsMailClusterEntity() (*MailClusterEntity, bool) { + return &mce, true +} + +// AsMailboxEntity is the BasicEntity implementation for MailClusterEntity. +func (mce MailClusterEntity) AsMailboxEntity() (*MailboxEntity, bool) { + return nil, false +} + +// AsIPEntity is the BasicEntity implementation for MailClusterEntity. +func (mce MailClusterEntity) AsIPEntity() (*IPEntity, bool) { + return nil, false +} + +// AsIoTDeviceEntity is the BasicEntity implementation for MailClusterEntity. +func (mce MailClusterEntity) AsIoTDeviceEntity() (*IoTDeviceEntity, bool) { + return nil, false +} + +// AsHuntingBookmark is the BasicEntity implementation for MailClusterEntity. +func (mce MailClusterEntity) AsHuntingBookmark() (*HuntingBookmark, bool) { + return nil, false +} + +// AsHostEntity is the BasicEntity implementation for MailClusterEntity. +func (mce MailClusterEntity) AsHostEntity() (*HostEntity, bool) { + return nil, false +} + +// AsFileHashEntity is the BasicEntity implementation for MailClusterEntity. +func (mce MailClusterEntity) AsFileHashEntity() (*FileHashEntity, bool) { + return nil, false +} + +// AsFileEntity is the BasicEntity implementation for MailClusterEntity. +func (mce MailClusterEntity) AsFileEntity() (*FileEntity, bool) { + return nil, false +} + +// AsDNSEntity is the BasicEntity implementation for MailClusterEntity. +func (mce MailClusterEntity) AsDNSEntity() (*DNSEntity, bool) { + return nil, false +} + +// AsCloudApplicationEntity is the BasicEntity implementation for MailClusterEntity. +func (mce MailClusterEntity) AsCloudApplicationEntity() (*CloudApplicationEntity, bool) { + return nil, false +} + +// AsAzureResourceEntity is the BasicEntity implementation for MailClusterEntity. +func (mce MailClusterEntity) AsAzureResourceEntity() (*AzureResourceEntity, bool) { + return nil, false +} + +// AsAccountEntity is the BasicEntity implementation for MailClusterEntity. +func (mce MailClusterEntity) AsAccountEntity() (*AccountEntity, bool) { + return nil, false +} + +// AsEntity is the BasicEntity implementation for MailClusterEntity. +func (mce MailClusterEntity) AsEntity() (*Entity, bool) { + return nil, false +} + +// AsBasicEntity is the BasicEntity implementation for MailClusterEntity. +func (mce MailClusterEntity) AsBasicEntity() (BasicEntity, bool) { + return &mce, true +} + +// UnmarshalJSON is the custom unmarshaler for MailClusterEntity struct. +func (mce *MailClusterEntity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var mailClusterEntityProperties MailClusterEntityProperties + err = json.Unmarshal(*v, &mailClusterEntityProperties) + if err != nil { + return err + } + mce.MailClusterEntityProperties = &mailClusterEntityProperties + } + case "kind": + if v != nil { + var kind KindBasicEntity + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + mce.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mce.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mce.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mce.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mce.SystemData = &systemData + } + } + } + + return nil +} + +// MailClusterEntityProperties mail cluster entity property bag. +type MailClusterEntityProperties struct { + // NetworkMessageIds - READ-ONLY; The mail message IDs that are part of the mail cluster + NetworkMessageIds *[]string `json:"networkMessageIds,omitempty"` + // CountByDeliveryStatus - READ-ONLY; Count of mail messages by DeliveryStatus string representation + CountByDeliveryStatus interface{} `json:"countByDeliveryStatus,omitempty"` + // CountByThreatType - READ-ONLY; Count of mail messages by ThreatType string representation + CountByThreatType interface{} `json:"countByThreatType,omitempty"` + // CountByProtectionStatus - READ-ONLY; Count of mail messages by ProtectionStatus string representation + CountByProtectionStatus interface{} `json:"countByProtectionStatus,omitempty"` + // Threats - READ-ONLY; The threats of mail messages that are part of the mail cluster + Threats *[]string `json:"threats,omitempty"` + // Query - READ-ONLY; The query that was used to identify the messages of the mail cluster + Query *string `json:"query,omitempty"` + // QueryTime - READ-ONLY; The query time + QueryTime *date.Time `json:"queryTime,omitempty"` + // MailCount - READ-ONLY; The number of mail messages that are part of the mail cluster + MailCount *int32 `json:"mailCount,omitempty"` + // IsVolumeAnomaly - READ-ONLY; Is this a volume anomaly mail cluster + IsVolumeAnomaly *bool `json:"isVolumeAnomaly,omitempty"` + // Source - READ-ONLY; The source of the mail cluster (default is 'O365 ATP') + Source *string `json:"source,omitempty"` + // ClusterSourceIdentifier - READ-ONLY; The id of the cluster source + ClusterSourceIdentifier *string `json:"clusterSourceIdentifier,omitempty"` + // ClusterSourceType - READ-ONLY; The type of the cluster source + ClusterSourceType *string `json:"clusterSourceType,omitempty"` + // ClusterQueryStartTime - READ-ONLY; The cluster query start time + ClusterQueryStartTime *date.Time `json:"clusterQueryStartTime,omitempty"` + // ClusterQueryEndTime - READ-ONLY; The cluster query end time + ClusterQueryEndTime *date.Time `json:"clusterQueryEndTime,omitempty"` + // ClusterGroup - READ-ONLY; The cluster group + ClusterGroup *string `json:"clusterGroup,omitempty"` + // AdditionalData - READ-ONLY; A bag of custom fields that should be part of the entity and will be presented to the user. + AdditionalData map[string]interface{} `json:"additionalData"` + // FriendlyName - READ-ONLY; The graph item display name which is a short humanly readable description of the graph item instance. This property is optional and might be system generated. + FriendlyName *string `json:"friendlyName,omitempty"` +} + +// MarshalJSON is the custom marshaler for MailClusterEntityProperties. +func (mcep MailClusterEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// MailMessageEntity represents a mail message entity. +type MailMessageEntity struct { + // MailMessageEntityProperties - Mail message entity properties + *MailMessageEntityProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicEntityKindEntity', 'KindBasicEntityKindURL', 'KindBasicEntityKindSubmissionMail', 'KindBasicEntityKindSecurityGroup', 'KindBasicEntityKindSecurityAlert', 'KindBasicEntityKindRegistryValue', 'KindBasicEntityKindRegistryKey', 'KindBasicEntityKindProcess', 'KindBasicEntityKindMalware', 'KindBasicEntityKindMailMessage', 'KindBasicEntityKindMailCluster', 'KindBasicEntityKindMailbox', 'KindBasicEntityKindIP', 'KindBasicEntityKindIoTDevice', 'KindBasicEntityKindBookmark', 'KindBasicEntityKindHost', 'KindBasicEntityKindFileHash', 'KindBasicEntityKindFile', 'KindBasicEntityKindDNSResolution', 'KindBasicEntityKindCloudApplication', 'KindBasicEntityKindAzureResource', 'KindBasicEntityKindAccount' + Kind KindBasicEntity `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for MailMessageEntity. +func (mme MailMessageEntity) MarshalJSON() ([]byte, error) { + mme.Kind = KindBasicEntityKindMailMessage + objectMap := make(map[string]interface{}) + if mme.MailMessageEntityProperties != nil { + objectMap["properties"] = mme.MailMessageEntityProperties + } + if mme.Kind != "" { + objectMap["kind"] = mme.Kind + } + return json.Marshal(objectMap) +} + +// AsURLEntity is the BasicEntity implementation for MailMessageEntity. +func (mme MailMessageEntity) AsURLEntity() (*URLEntity, bool) { + return nil, false +} + +// AsSubmissionMailEntity is the BasicEntity implementation for MailMessageEntity. +func (mme MailMessageEntity) AsSubmissionMailEntity() (*SubmissionMailEntity, bool) { + return nil, false +} + +// AsSecurityGroupEntity is the BasicEntity implementation for MailMessageEntity. +func (mme MailMessageEntity) AsSecurityGroupEntity() (*SecurityGroupEntity, bool) { + return nil, false +} + +// AsSecurityAlert is the BasicEntity implementation for MailMessageEntity. +func (mme MailMessageEntity) AsSecurityAlert() (*SecurityAlert, bool) { + return nil, false +} + +// AsRegistryValueEntity is the BasicEntity implementation for MailMessageEntity. +func (mme MailMessageEntity) AsRegistryValueEntity() (*RegistryValueEntity, bool) { + return nil, false +} + +// AsRegistryKeyEntity is the BasicEntity implementation for MailMessageEntity. +func (mme MailMessageEntity) AsRegistryKeyEntity() (*RegistryKeyEntity, bool) { + return nil, false +} + +// AsProcessEntity is the BasicEntity implementation for MailMessageEntity. +func (mme MailMessageEntity) AsProcessEntity() (*ProcessEntity, bool) { + return nil, false +} + +// AsMalwareEntity is the BasicEntity implementation for MailMessageEntity. +func (mme MailMessageEntity) AsMalwareEntity() (*MalwareEntity, bool) { + return nil, false +} + +// AsMailMessageEntity is the BasicEntity implementation for MailMessageEntity. +func (mme MailMessageEntity) AsMailMessageEntity() (*MailMessageEntity, bool) { + return &mme, true +} + +// AsMailClusterEntity is the BasicEntity implementation for MailMessageEntity. +func (mme MailMessageEntity) AsMailClusterEntity() (*MailClusterEntity, bool) { + return nil, false +} + +// AsMailboxEntity is the BasicEntity implementation for MailMessageEntity. +func (mme MailMessageEntity) AsMailboxEntity() (*MailboxEntity, bool) { + return nil, false +} + +// AsIPEntity is the BasicEntity implementation for MailMessageEntity. +func (mme MailMessageEntity) AsIPEntity() (*IPEntity, bool) { + return nil, false +} + +// AsIoTDeviceEntity is the BasicEntity implementation for MailMessageEntity. +func (mme MailMessageEntity) AsIoTDeviceEntity() (*IoTDeviceEntity, bool) { + return nil, false +} + +// AsHuntingBookmark is the BasicEntity implementation for MailMessageEntity. +func (mme MailMessageEntity) AsHuntingBookmark() (*HuntingBookmark, bool) { + return nil, false +} + +// AsHostEntity is the BasicEntity implementation for MailMessageEntity. +func (mme MailMessageEntity) AsHostEntity() (*HostEntity, bool) { + return nil, false +} + +// AsFileHashEntity is the BasicEntity implementation for MailMessageEntity. +func (mme MailMessageEntity) AsFileHashEntity() (*FileHashEntity, bool) { + return nil, false +} + +// AsFileEntity is the BasicEntity implementation for MailMessageEntity. +func (mme MailMessageEntity) AsFileEntity() (*FileEntity, bool) { + return nil, false +} + +// AsDNSEntity is the BasicEntity implementation for MailMessageEntity. +func (mme MailMessageEntity) AsDNSEntity() (*DNSEntity, bool) { + return nil, false +} + +// AsCloudApplicationEntity is the BasicEntity implementation for MailMessageEntity. +func (mme MailMessageEntity) AsCloudApplicationEntity() (*CloudApplicationEntity, bool) { + return nil, false +} + +// AsAzureResourceEntity is the BasicEntity implementation for MailMessageEntity. +func (mme MailMessageEntity) AsAzureResourceEntity() (*AzureResourceEntity, bool) { + return nil, false +} + +// AsAccountEntity is the BasicEntity implementation for MailMessageEntity. +func (mme MailMessageEntity) AsAccountEntity() (*AccountEntity, bool) { + return nil, false +} + +// AsEntity is the BasicEntity implementation for MailMessageEntity. +func (mme MailMessageEntity) AsEntity() (*Entity, bool) { + return nil, false +} + +// AsBasicEntity is the BasicEntity implementation for MailMessageEntity. +func (mme MailMessageEntity) AsBasicEntity() (BasicEntity, bool) { + return &mme, true +} + +// UnmarshalJSON is the custom unmarshaler for MailMessageEntity struct. +func (mme *MailMessageEntity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var mailMessageEntityProperties MailMessageEntityProperties + err = json.Unmarshal(*v, &mailMessageEntityProperties) + if err != nil { + return err + } + mme.MailMessageEntityProperties = &mailMessageEntityProperties + } + case "kind": + if v != nil { + var kind KindBasicEntity + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + mme.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mme.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mme.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mme.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mme.SystemData = &systemData + } + } + } + + return nil +} + +// MailMessageEntityProperties mail message entity property bag. +type MailMessageEntityProperties struct { + // FileEntityIds - READ-ONLY; The File entity ids of this mail message's attachments + FileEntityIds *[]string `json:"fileEntityIds,omitempty"` + // Recipient - READ-ONLY; The recipient of this mail message. Note that in case of multiple recipients the mail message is forked and each copy has one recipient + Recipient *string `json:"recipient,omitempty"` + // Urls - READ-ONLY; The Urls contained in this mail message + Urls *[]string `json:"urls,omitempty"` + // Threats - READ-ONLY; The threats of this mail message + Threats *[]string `json:"threats,omitempty"` + // P1Sender - READ-ONLY; The p1 sender's email address + P1Sender *string `json:"p1Sender,omitempty"` + // P1SenderDisplayName - READ-ONLY; The p1 sender's display name + P1SenderDisplayName *string `json:"p1SenderDisplayName,omitempty"` + // P1SenderDomain - READ-ONLY; The p1 sender's domain + P1SenderDomain *string `json:"p1SenderDomain,omitempty"` + // SenderIP - READ-ONLY; The sender's IP address + SenderIP *string `json:"senderIP,omitempty"` + // P2Sender - READ-ONLY; The p2 sender's email address + P2Sender *string `json:"p2Sender,omitempty"` + // P2SenderDisplayName - READ-ONLY; The p2 sender's display name + P2SenderDisplayName *string `json:"p2SenderDisplayName,omitempty"` + // P2SenderDomain - READ-ONLY; The p2 sender's domain + P2SenderDomain *string `json:"p2SenderDomain,omitempty"` + // ReceiveDate - READ-ONLY; The receive date of this message + ReceiveDate *date.Time `json:"receiveDate,omitempty"` + // NetworkMessageID - READ-ONLY; The network message id of this mail message + NetworkMessageID *uuid.UUID `json:"networkMessageId,omitempty"` + // InternetMessageID - READ-ONLY; The internet message id of this mail message + InternetMessageID *string `json:"internetMessageId,omitempty"` + // Subject - READ-ONLY; The subject of this mail message + Subject *string `json:"subject,omitempty"` + // Language - READ-ONLY; The language of this mail message + Language *string `json:"language,omitempty"` + // ThreatDetectionMethods - READ-ONLY; The threat detection methods + ThreatDetectionMethods *[]string `json:"threatDetectionMethods,omitempty"` + // BodyFingerprintBin1 - The bodyFingerprintBin1 + BodyFingerprintBin1 *int32 `json:"bodyFingerprintBin1,omitempty"` + // BodyFingerprintBin2 - The bodyFingerprintBin2 + BodyFingerprintBin2 *int32 `json:"bodyFingerprintBin2,omitempty"` + // BodyFingerprintBin3 - The bodyFingerprintBin3 + BodyFingerprintBin3 *int32 `json:"bodyFingerprintBin3,omitempty"` + // BodyFingerprintBin4 - The bodyFingerprintBin4 + BodyFingerprintBin4 *int32 `json:"bodyFingerprintBin4,omitempty"` + // BodyFingerprintBin5 - The bodyFingerprintBin5 + BodyFingerprintBin5 *int32 `json:"bodyFingerprintBin5,omitempty"` + // AntispamDirection - The directionality of this mail message. Possible values include: 'AntispamMailDirectionUnknown', 'AntispamMailDirectionInbound', 'AntispamMailDirectionOutbound', 'AntispamMailDirectionIntraorg' + AntispamDirection AntispamMailDirection `json:"antispamDirection,omitempty"` + // DeliveryAction - The delivery action of this mail message like Delivered, Blocked, Replaced etc. Possible values include: 'DeliveryActionUnknown', 'DeliveryActionDeliveredAsSpam', 'DeliveryActionDelivered', 'DeliveryActionBlocked', 'DeliveryActionReplaced' + DeliveryAction DeliveryAction `json:"deliveryAction,omitempty"` + // DeliveryLocation - The delivery location of this mail message like Inbox, JunkFolder etc. Possible values include: 'DeliveryLocationUnknown', 'DeliveryLocationInbox', 'DeliveryLocationJunkFolder', 'DeliveryLocationDeletedFolder', 'DeliveryLocationQuarantine', 'DeliveryLocationExternal', 'DeliveryLocationFailed', 'DeliveryLocationDropped', 'DeliveryLocationForwarded' + DeliveryLocation DeliveryLocation `json:"deliveryLocation,omitempty"` + // AdditionalData - READ-ONLY; A bag of custom fields that should be part of the entity and will be presented to the user. + AdditionalData map[string]interface{} `json:"additionalData"` + // FriendlyName - READ-ONLY; The graph item display name which is a short humanly readable description of the graph item instance. This property is optional and might be system generated. + FriendlyName *string `json:"friendlyName,omitempty"` +} + +// MarshalJSON is the custom marshaler for MailMessageEntityProperties. +func (mmep MailMessageEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mmep.BodyFingerprintBin1 != nil { + objectMap["bodyFingerprintBin1"] = mmep.BodyFingerprintBin1 + } + if mmep.BodyFingerprintBin2 != nil { + objectMap["bodyFingerprintBin2"] = mmep.BodyFingerprintBin2 + } + if mmep.BodyFingerprintBin3 != nil { + objectMap["bodyFingerprintBin3"] = mmep.BodyFingerprintBin3 + } + if mmep.BodyFingerprintBin4 != nil { + objectMap["bodyFingerprintBin4"] = mmep.BodyFingerprintBin4 + } + if mmep.BodyFingerprintBin5 != nil { + objectMap["bodyFingerprintBin5"] = mmep.BodyFingerprintBin5 + } + if mmep.AntispamDirection != "" { + objectMap["antispamDirection"] = mmep.AntispamDirection + } + if mmep.DeliveryAction != "" { + objectMap["deliveryAction"] = mmep.DeliveryAction + } + if mmep.DeliveryLocation != "" { + objectMap["deliveryLocation"] = mmep.DeliveryLocation + } + return json.Marshal(objectMap) +} + +// MalwareEntity represents a malware entity. +type MalwareEntity struct { + // MalwareEntityProperties - File entity properties + *MalwareEntityProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicEntityKindEntity', 'KindBasicEntityKindURL', 'KindBasicEntityKindSubmissionMail', 'KindBasicEntityKindSecurityGroup', 'KindBasicEntityKindSecurityAlert', 'KindBasicEntityKindRegistryValue', 'KindBasicEntityKindRegistryKey', 'KindBasicEntityKindProcess', 'KindBasicEntityKindMalware', 'KindBasicEntityKindMailMessage', 'KindBasicEntityKindMailCluster', 'KindBasicEntityKindMailbox', 'KindBasicEntityKindIP', 'KindBasicEntityKindIoTDevice', 'KindBasicEntityKindBookmark', 'KindBasicEntityKindHost', 'KindBasicEntityKindFileHash', 'KindBasicEntityKindFile', 'KindBasicEntityKindDNSResolution', 'KindBasicEntityKindCloudApplication', 'KindBasicEntityKindAzureResource', 'KindBasicEntityKindAccount' + Kind KindBasicEntity `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for MalwareEntity. +func (me MalwareEntity) MarshalJSON() ([]byte, error) { + me.Kind = KindBasicEntityKindMalware + objectMap := make(map[string]interface{}) + if me.MalwareEntityProperties != nil { + objectMap["properties"] = me.MalwareEntityProperties + } + if me.Kind != "" { + objectMap["kind"] = me.Kind + } + return json.Marshal(objectMap) +} + +// AsURLEntity is the BasicEntity implementation for MalwareEntity. +func (me MalwareEntity) AsURLEntity() (*URLEntity, bool) { + return nil, false +} + +// AsSubmissionMailEntity is the BasicEntity implementation for MalwareEntity. +func (me MalwareEntity) AsSubmissionMailEntity() (*SubmissionMailEntity, bool) { + return nil, false +} + +// AsSecurityGroupEntity is the BasicEntity implementation for MalwareEntity. +func (me MalwareEntity) AsSecurityGroupEntity() (*SecurityGroupEntity, bool) { + return nil, false +} + +// AsSecurityAlert is the BasicEntity implementation for MalwareEntity. +func (me MalwareEntity) AsSecurityAlert() (*SecurityAlert, bool) { + return nil, false +} + +// AsRegistryValueEntity is the BasicEntity implementation for MalwareEntity. +func (me MalwareEntity) AsRegistryValueEntity() (*RegistryValueEntity, bool) { + return nil, false +} + +// AsRegistryKeyEntity is the BasicEntity implementation for MalwareEntity. +func (me MalwareEntity) AsRegistryKeyEntity() (*RegistryKeyEntity, bool) { + return nil, false +} + +// AsProcessEntity is the BasicEntity implementation for MalwareEntity. +func (me MalwareEntity) AsProcessEntity() (*ProcessEntity, bool) { + return nil, false +} + +// AsMalwareEntity is the BasicEntity implementation for MalwareEntity. +func (me MalwareEntity) AsMalwareEntity() (*MalwareEntity, bool) { + return &me, true +} + +// AsMailMessageEntity is the BasicEntity implementation for MalwareEntity. +func (me MalwareEntity) AsMailMessageEntity() (*MailMessageEntity, bool) { + return nil, false +} + +// AsMailClusterEntity is the BasicEntity implementation for MalwareEntity. +func (me MalwareEntity) AsMailClusterEntity() (*MailClusterEntity, bool) { + return nil, false +} + +// AsMailboxEntity is the BasicEntity implementation for MalwareEntity. +func (me MalwareEntity) AsMailboxEntity() (*MailboxEntity, bool) { + return nil, false +} + +// AsIPEntity is the BasicEntity implementation for MalwareEntity. +func (me MalwareEntity) AsIPEntity() (*IPEntity, bool) { + return nil, false +} + +// AsIoTDeviceEntity is the BasicEntity implementation for MalwareEntity. +func (me MalwareEntity) AsIoTDeviceEntity() (*IoTDeviceEntity, bool) { + return nil, false +} + +// AsHuntingBookmark is the BasicEntity implementation for MalwareEntity. +func (me MalwareEntity) AsHuntingBookmark() (*HuntingBookmark, bool) { + return nil, false +} + +// AsHostEntity is the BasicEntity implementation for MalwareEntity. +func (me MalwareEntity) AsHostEntity() (*HostEntity, bool) { + return nil, false +} + +// AsFileHashEntity is the BasicEntity implementation for MalwareEntity. +func (me MalwareEntity) AsFileHashEntity() (*FileHashEntity, bool) { + return nil, false +} + +// AsFileEntity is the BasicEntity implementation for MalwareEntity. +func (me MalwareEntity) AsFileEntity() (*FileEntity, bool) { + return nil, false +} + +// AsDNSEntity is the BasicEntity implementation for MalwareEntity. +func (me MalwareEntity) AsDNSEntity() (*DNSEntity, bool) { + return nil, false +} + +// AsCloudApplicationEntity is the BasicEntity implementation for MalwareEntity. +func (me MalwareEntity) AsCloudApplicationEntity() (*CloudApplicationEntity, bool) { + return nil, false +} + +// AsAzureResourceEntity is the BasicEntity implementation for MalwareEntity. +func (me MalwareEntity) AsAzureResourceEntity() (*AzureResourceEntity, bool) { + return nil, false +} + +// AsAccountEntity is the BasicEntity implementation for MalwareEntity. +func (me MalwareEntity) AsAccountEntity() (*AccountEntity, bool) { + return nil, false +} + +// AsEntity is the BasicEntity implementation for MalwareEntity. +func (me MalwareEntity) AsEntity() (*Entity, bool) { + return nil, false +} + +// AsBasicEntity is the BasicEntity implementation for MalwareEntity. +func (me MalwareEntity) AsBasicEntity() (BasicEntity, bool) { + return &me, true +} + +// UnmarshalJSON is the custom unmarshaler for MalwareEntity struct. +func (me *MalwareEntity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var malwareEntityProperties MalwareEntityProperties + err = json.Unmarshal(*v, &malwareEntityProperties) + if err != nil { + return err + } + me.MalwareEntityProperties = &malwareEntityProperties + } + case "kind": + if v != nil { + var kind KindBasicEntity + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + me.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + me.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + me.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + me.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + me.SystemData = &systemData + } + } + } + + return nil +} + +// MalwareEntityProperties malware entity property bag. +type MalwareEntityProperties struct { + // Category - READ-ONLY; The malware category by the vendor, e.g. Trojan + Category *string `json:"category,omitempty"` + // FileEntityIds - READ-ONLY; List of linked file entity identifiers on which the malware was found + FileEntityIds *[]string `json:"fileEntityIds,omitempty"` + // MalwareName - READ-ONLY; The malware name by the vendor, e.g. Win32/Toga!rfn + MalwareName *string `json:"malwareName,omitempty"` + // ProcessEntityIds - READ-ONLY; List of linked process entity identifiers on which the malware was found. + ProcessEntityIds *[]string `json:"processEntityIds,omitempty"` + // AdditionalData - READ-ONLY; A bag of custom fields that should be part of the entity and will be presented to the user. + AdditionalData map[string]interface{} `json:"additionalData"` + // FriendlyName - READ-ONLY; The graph item display name which is a short humanly readable description of the graph item instance. This property is optional and might be system generated. + FriendlyName *string `json:"friendlyName,omitempty"` +} + +// MarshalJSON is the custom marshaler for MalwareEntityProperties. +func (mep MalwareEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ManualTriggerRequestBody ... +type ManualTriggerRequestBody struct { + TenantID *uuid.UUID `json:"tenantId,omitempty"` + LogicAppsResourceID *string `json:"logicAppsResourceId,omitempty"` +} + +// MCASCheckRequirements represents MCAS (Microsoft Cloud App Security) requirements check request. +type MCASCheckRequirements struct { + // MCASCheckRequirementsProperties - MCAS (Microsoft Cloud App Security) requirements check properties. + *MCASCheckRequirementsProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorsCheckRequirementsKindDataConnectorsCheckRequirements', 'KindBasicDataConnectorsCheckRequirementsKindAzureActiveDirectory', 'KindBasicDataConnectorsCheckRequirementsKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindAzureSecurityCenter', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesS3', 'KindBasicDataConnectorsCheckRequirementsKindDynamics365', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindOfficeATP', 'KindBasicDataConnectorsCheckRequirementsKindOfficeIRM', 'KindBasicDataConnectorsCheckRequirementsKindOffice365Project', 'KindBasicDataConnectorsCheckRequirementsKindOfficePowerBI', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligenceTaxii', 'KindBasicDataConnectorsCheckRequirementsKindIOT' + Kind KindBasicDataConnectorsCheckRequirements `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for MCASCheckRequirements. +func (mcr MCASCheckRequirements) MarshalJSON() ([]byte, error) { + mcr.Kind = KindBasicDataConnectorsCheckRequirementsKindMicrosoftCloudAppSecurity + objectMap := make(map[string]interface{}) + if mcr.MCASCheckRequirementsProperties != nil { + objectMap["properties"] = mcr.MCASCheckRequirementsProperties + } + if mcr.Kind != "" { + objectMap["kind"] = mcr.Kind + } + return json.Marshal(objectMap) +} + +// AsAADCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MCASCheckRequirements. +func (mcr MCASCheckRequirements) AsAADCheckRequirements() (*AADCheckRequirements, bool) { + return nil, false +} + +// AsAATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MCASCheckRequirements. +func (mcr MCASCheckRequirements) AsAATPCheckRequirements() (*AATPCheckRequirements, bool) { + return nil, false +} + +// AsASCCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MCASCheckRequirements. +func (mcr MCASCheckRequirements) AsASCCheckRequirements() (*ASCCheckRequirements, bool) { + return nil, false +} + +// AsAwsCloudTrailCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MCASCheckRequirements. +func (mcr MCASCheckRequirements) AsAwsCloudTrailCheckRequirements() (*AwsCloudTrailCheckRequirements, bool) { + return nil, false +} + +// AsAwsS3CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MCASCheckRequirements. +func (mcr MCASCheckRequirements) AsAwsS3CheckRequirements() (*AwsS3CheckRequirements, bool) { + return nil, false +} + +// AsDynamics365CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MCASCheckRequirements. +func (mcr MCASCheckRequirements) AsDynamics365CheckRequirements() (*Dynamics365CheckRequirements, bool) { + return nil, false +} + +// AsMCASCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MCASCheckRequirements. +func (mcr MCASCheckRequirements) AsMCASCheckRequirements() (*MCASCheckRequirements, bool) { + return &mcr, true +} + +// AsMDATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MCASCheckRequirements. +func (mcr MCASCheckRequirements) AsMDATPCheckRequirements() (*MDATPCheckRequirements, bool) { + return nil, false +} + +// AsMSTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MCASCheckRequirements. +func (mcr MCASCheckRequirements) AsMSTICheckRequirements() (*MSTICheckRequirements, bool) { + return nil, false +} + +// AsMtpCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MCASCheckRequirements. +func (mcr MCASCheckRequirements) AsMtpCheckRequirements() (*MtpCheckRequirements, bool) { + return nil, false +} + +// AsOfficeATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MCASCheckRequirements. +func (mcr MCASCheckRequirements) AsOfficeATPCheckRequirements() (*OfficeATPCheckRequirements, bool) { + return nil, false +} + +// AsOfficeIRMCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MCASCheckRequirements. +func (mcr MCASCheckRequirements) AsOfficeIRMCheckRequirements() (*OfficeIRMCheckRequirements, bool) { + return nil, false +} + +// AsOffice365ProjectCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MCASCheckRequirements. +func (mcr MCASCheckRequirements) AsOffice365ProjectCheckRequirements() (*Office365ProjectCheckRequirements, bool) { + return nil, false +} + +// AsOfficePowerBICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MCASCheckRequirements. +func (mcr MCASCheckRequirements) AsOfficePowerBICheckRequirements() (*OfficePowerBICheckRequirements, bool) { + return nil, false +} + +// AsTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MCASCheckRequirements. +func (mcr MCASCheckRequirements) AsTICheckRequirements() (*TICheckRequirements, bool) { + return nil, false +} + +// AsTiTaxiiCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MCASCheckRequirements. +func (mcr MCASCheckRequirements) AsTiTaxiiCheckRequirements() (*TiTaxiiCheckRequirements, bool) { + return nil, false +} + +// AsIoTCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MCASCheckRequirements. +func (mcr MCASCheckRequirements) AsIoTCheckRequirements() (*IoTCheckRequirements, bool) { + return nil, false +} + +// AsDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MCASCheckRequirements. +func (mcr MCASCheckRequirements) AsDataConnectorsCheckRequirements() (*DataConnectorsCheckRequirements, bool) { + return nil, false +} + +// AsBasicDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MCASCheckRequirements. +func (mcr MCASCheckRequirements) AsBasicDataConnectorsCheckRequirements() (BasicDataConnectorsCheckRequirements, bool) { + return &mcr, true +} + +// UnmarshalJSON is the custom unmarshaler for MCASCheckRequirements struct. +func (mcr *MCASCheckRequirements) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var mCASCheckRequirementsProperties MCASCheckRequirementsProperties + err = json.Unmarshal(*v, &mCASCheckRequirementsProperties) + if err != nil { + return err + } + mcr.MCASCheckRequirementsProperties = &mCASCheckRequirementsProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnectorsCheckRequirements + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + mcr.Kind = kind + } + } + } + + return nil +} + +// MCASCheckRequirementsProperties MCAS (Microsoft Cloud App Security) requirements check properties. +type MCASCheckRequirementsProperties struct { + // TenantID - The tenant id to connect to, and get the data from. + TenantID *string `json:"tenantId,omitempty"` +} + +// MCASDataConnector represents MCAS (Microsoft Cloud App Security) data connector. +type MCASDataConnector struct { + // MCASDataConnectorProperties - MCAS (Microsoft Cloud App Security) data connector properties. + *MCASDataConnectorProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorKindDataConnector', 'KindBasicDataConnectorKindAzureActiveDirectory', 'KindBasicDataConnectorKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorKindMicrosoftThreatProtection', 'KindBasicDataConnectorKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorKindAzureSecurityCenter', 'KindBasicDataConnectorKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorKindAmazonWebServicesS3', 'KindBasicDataConnectorKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorKindDynamics365', 'KindBasicDataConnectorKindOfficeATP', 'KindBasicDataConnectorKindOffice365Project', 'KindBasicDataConnectorKindOfficePowerBI', 'KindBasicDataConnectorKindOfficeIRM', 'KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorKindOffice365', 'KindBasicDataConnectorKindThreatIntelligence', 'KindBasicDataConnectorKindThreatIntelligenceTaxii', 'KindBasicDataConnectorKindIOT', 'KindBasicDataConnectorKindGenericUI', 'KindBasicDataConnectorKindAPIPolling' + Kind KindBasicDataConnector `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for MCASDataConnector. +func (mdc MCASDataConnector) MarshalJSON() ([]byte, error) { + mdc.Kind = KindBasicDataConnectorKindMicrosoftCloudAppSecurity + objectMap := make(map[string]interface{}) + if mdc.MCASDataConnectorProperties != nil { + objectMap["properties"] = mdc.MCASDataConnectorProperties + } + if mdc.Kind != "" { + objectMap["kind"] = mdc.Kind + } + if mdc.Etag != nil { + objectMap["etag"] = mdc.Etag + } + return json.Marshal(objectMap) +} + +// AsAADDataConnector is the BasicDataConnector implementation for MCASDataConnector. +func (mdc MCASDataConnector) AsAADDataConnector() (*AADDataConnector, bool) { + return nil, false +} + +// AsMSTIDataConnector is the BasicDataConnector implementation for MCASDataConnector. +func (mdc MCASDataConnector) AsMSTIDataConnector() (*MSTIDataConnector, bool) { + return nil, false +} + +// AsMTPDataConnector is the BasicDataConnector implementation for MCASDataConnector. +func (mdc MCASDataConnector) AsMTPDataConnector() (*MTPDataConnector, bool) { + return nil, false +} + +// AsAATPDataConnector is the BasicDataConnector implementation for MCASDataConnector. +func (mdc MCASDataConnector) AsAATPDataConnector() (*AATPDataConnector, bool) { + return nil, false +} + +// AsASCDataConnector is the BasicDataConnector implementation for MCASDataConnector. +func (mdc MCASDataConnector) AsASCDataConnector() (*ASCDataConnector, bool) { + return nil, false +} + +// AsAwsCloudTrailDataConnector is the BasicDataConnector implementation for MCASDataConnector. +func (mdc MCASDataConnector) AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) { + return nil, false +} + +// AsAwsS3DataConnector is the BasicDataConnector implementation for MCASDataConnector. +func (mdc MCASDataConnector) AsAwsS3DataConnector() (*AwsS3DataConnector, bool) { + return nil, false +} + +// AsMCASDataConnector is the BasicDataConnector implementation for MCASDataConnector. +func (mdc MCASDataConnector) AsMCASDataConnector() (*MCASDataConnector, bool) { + return &mdc, true +} + +// AsDynamics365DataConnector is the BasicDataConnector implementation for MCASDataConnector. +func (mdc MCASDataConnector) AsDynamics365DataConnector() (*Dynamics365DataConnector, bool) { + return nil, false +} + +// AsOfficeATPDataConnector is the BasicDataConnector implementation for MCASDataConnector. +func (mdc MCASDataConnector) AsOfficeATPDataConnector() (*OfficeATPDataConnector, bool) { + return nil, false +} + +// AsOffice365ProjectDataConnector is the BasicDataConnector implementation for MCASDataConnector. +func (mdc MCASDataConnector) AsOffice365ProjectDataConnector() (*Office365ProjectDataConnector, bool) { + return nil, false +} + +// AsOfficePowerBIDataConnector is the BasicDataConnector implementation for MCASDataConnector. +func (mdc MCASDataConnector) AsOfficePowerBIDataConnector() (*OfficePowerBIDataConnector, bool) { + return nil, false +} + +// AsOfficeIRMDataConnector is the BasicDataConnector implementation for MCASDataConnector. +func (mdc MCASDataConnector) AsOfficeIRMDataConnector() (*OfficeIRMDataConnector, bool) { + return nil, false +} + +// AsMDATPDataConnector is the BasicDataConnector implementation for MCASDataConnector. +func (mdc MCASDataConnector) AsMDATPDataConnector() (*MDATPDataConnector, bool) { + return nil, false +} + +// AsOfficeDataConnector is the BasicDataConnector implementation for MCASDataConnector. +func (mdc MCASDataConnector) AsOfficeDataConnector() (*OfficeDataConnector, bool) { + return nil, false +} + +// AsTIDataConnector is the BasicDataConnector implementation for MCASDataConnector. +func (mdc MCASDataConnector) AsTIDataConnector() (*TIDataConnector, bool) { + return nil, false +} + +// AsTiTaxiiDataConnector is the BasicDataConnector implementation for MCASDataConnector. +func (mdc MCASDataConnector) AsTiTaxiiDataConnector() (*TiTaxiiDataConnector, bool) { + return nil, false +} + +// AsIoTDataConnector is the BasicDataConnector implementation for MCASDataConnector. +func (mdc MCASDataConnector) AsIoTDataConnector() (*IoTDataConnector, bool) { + return nil, false +} + +// AsCodelessUIDataConnector is the BasicDataConnector implementation for MCASDataConnector. +func (mdc MCASDataConnector) AsCodelessUIDataConnector() (*CodelessUIDataConnector, bool) { + return nil, false +} + +// AsCodelessAPIPollingDataConnector is the BasicDataConnector implementation for MCASDataConnector. +func (mdc MCASDataConnector) AsCodelessAPIPollingDataConnector() (*CodelessAPIPollingDataConnector, bool) { + return nil, false +} + +// AsDataConnector is the BasicDataConnector implementation for MCASDataConnector. +func (mdc MCASDataConnector) AsDataConnector() (*DataConnector, bool) { + return nil, false +} + +// AsBasicDataConnector is the BasicDataConnector implementation for MCASDataConnector. +func (mdc MCASDataConnector) AsBasicDataConnector() (BasicDataConnector, bool) { + return &mdc, true +} + +// UnmarshalJSON is the custom unmarshaler for MCASDataConnector struct. +func (mdc *MCASDataConnector) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var mCASDataConnectorProperties MCASDataConnectorProperties + err = json.Unmarshal(*v, &mCASDataConnectorProperties) + if err != nil { + return err + } + mdc.MCASDataConnectorProperties = &mCASDataConnectorProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnector + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + mdc.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + mdc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mdc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mdc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mdc.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mdc.SystemData = &systemData + } + } + } + + return nil +} + +// MCASDataConnectorDataTypes the available data types for MCAS (Microsoft Cloud App Security) data +// connector. +type MCASDataConnectorDataTypes struct { + // DiscoveryLogs - Discovery log data type connection. + DiscoveryLogs *DataConnectorDataTypeCommon `json:"discoveryLogs,omitempty"` + // Alerts - Alerts data type connection. + Alerts *DataConnectorDataTypeCommon `json:"alerts,omitempty"` +} + +// MCASDataConnectorProperties MCAS (Microsoft Cloud App Security) data connector properties. +type MCASDataConnectorProperties struct { + // DataTypes - The available data types for the connector. + DataTypes *MCASDataConnectorDataTypes `json:"dataTypes,omitempty"` + // TenantID - The tenant id to connect to, and get the data from. + TenantID *string `json:"tenantId,omitempty"` +} + +// MDATPCheckRequirements represents MDATP (Microsoft Defender Advanced Threat Protection) requirements +// check request. +type MDATPCheckRequirements struct { + // MDATPCheckRequirementsProperties - MDATP (Microsoft Defender Advanced Threat Protection) requirements check properties. + *MDATPCheckRequirementsProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorsCheckRequirementsKindDataConnectorsCheckRequirements', 'KindBasicDataConnectorsCheckRequirementsKindAzureActiveDirectory', 'KindBasicDataConnectorsCheckRequirementsKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindAzureSecurityCenter', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesS3', 'KindBasicDataConnectorsCheckRequirementsKindDynamics365', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindOfficeATP', 'KindBasicDataConnectorsCheckRequirementsKindOfficeIRM', 'KindBasicDataConnectorsCheckRequirementsKindOffice365Project', 'KindBasicDataConnectorsCheckRequirementsKindOfficePowerBI', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligenceTaxii', 'KindBasicDataConnectorsCheckRequirementsKindIOT' + Kind KindBasicDataConnectorsCheckRequirements `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for MDATPCheckRequirements. +func (mcr MDATPCheckRequirements) MarshalJSON() ([]byte, error) { + mcr.Kind = KindBasicDataConnectorsCheckRequirementsKindMicrosoftDefenderAdvancedThreatProtection + objectMap := make(map[string]interface{}) + if mcr.MDATPCheckRequirementsProperties != nil { + objectMap["properties"] = mcr.MDATPCheckRequirementsProperties + } + if mcr.Kind != "" { + objectMap["kind"] = mcr.Kind + } + return json.Marshal(objectMap) +} + +// AsAADCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MDATPCheckRequirements. +func (mcr MDATPCheckRequirements) AsAADCheckRequirements() (*AADCheckRequirements, bool) { + return nil, false +} + +// AsAATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MDATPCheckRequirements. +func (mcr MDATPCheckRequirements) AsAATPCheckRequirements() (*AATPCheckRequirements, bool) { + return nil, false +} + +// AsASCCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MDATPCheckRequirements. +func (mcr MDATPCheckRequirements) AsASCCheckRequirements() (*ASCCheckRequirements, bool) { + return nil, false +} + +// AsAwsCloudTrailCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MDATPCheckRequirements. +func (mcr MDATPCheckRequirements) AsAwsCloudTrailCheckRequirements() (*AwsCloudTrailCheckRequirements, bool) { + return nil, false +} + +// AsAwsS3CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MDATPCheckRequirements. +func (mcr MDATPCheckRequirements) AsAwsS3CheckRequirements() (*AwsS3CheckRequirements, bool) { + return nil, false +} + +// AsDynamics365CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MDATPCheckRequirements. +func (mcr MDATPCheckRequirements) AsDynamics365CheckRequirements() (*Dynamics365CheckRequirements, bool) { + return nil, false +} + +// AsMCASCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MDATPCheckRequirements. +func (mcr MDATPCheckRequirements) AsMCASCheckRequirements() (*MCASCheckRequirements, bool) { + return nil, false +} + +// AsMDATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MDATPCheckRequirements. +func (mcr MDATPCheckRequirements) AsMDATPCheckRequirements() (*MDATPCheckRequirements, bool) { + return &mcr, true +} + +// AsMSTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MDATPCheckRequirements. +func (mcr MDATPCheckRequirements) AsMSTICheckRequirements() (*MSTICheckRequirements, bool) { + return nil, false +} + +// AsMtpCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MDATPCheckRequirements. +func (mcr MDATPCheckRequirements) AsMtpCheckRequirements() (*MtpCheckRequirements, bool) { + return nil, false +} + +// AsOfficeATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MDATPCheckRequirements. +func (mcr MDATPCheckRequirements) AsOfficeATPCheckRequirements() (*OfficeATPCheckRequirements, bool) { + return nil, false +} + +// AsOfficeIRMCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MDATPCheckRequirements. +func (mcr MDATPCheckRequirements) AsOfficeIRMCheckRequirements() (*OfficeIRMCheckRequirements, bool) { + return nil, false +} + +// AsOffice365ProjectCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MDATPCheckRequirements. +func (mcr MDATPCheckRequirements) AsOffice365ProjectCheckRequirements() (*Office365ProjectCheckRequirements, bool) { + return nil, false +} + +// AsOfficePowerBICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MDATPCheckRequirements. +func (mcr MDATPCheckRequirements) AsOfficePowerBICheckRequirements() (*OfficePowerBICheckRequirements, bool) { + return nil, false +} + +// AsTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MDATPCheckRequirements. +func (mcr MDATPCheckRequirements) AsTICheckRequirements() (*TICheckRequirements, bool) { + return nil, false +} + +// AsTiTaxiiCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MDATPCheckRequirements. +func (mcr MDATPCheckRequirements) AsTiTaxiiCheckRequirements() (*TiTaxiiCheckRequirements, bool) { + return nil, false +} + +// AsIoTCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MDATPCheckRequirements. +func (mcr MDATPCheckRequirements) AsIoTCheckRequirements() (*IoTCheckRequirements, bool) { + return nil, false +} + +// AsDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MDATPCheckRequirements. +func (mcr MDATPCheckRequirements) AsDataConnectorsCheckRequirements() (*DataConnectorsCheckRequirements, bool) { + return nil, false +} + +// AsBasicDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MDATPCheckRequirements. +func (mcr MDATPCheckRequirements) AsBasicDataConnectorsCheckRequirements() (BasicDataConnectorsCheckRequirements, bool) { + return &mcr, true +} + +// UnmarshalJSON is the custom unmarshaler for MDATPCheckRequirements struct. +func (mcr *MDATPCheckRequirements) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var mDATPCheckRequirementsProperties MDATPCheckRequirementsProperties + err = json.Unmarshal(*v, &mDATPCheckRequirementsProperties) + if err != nil { + return err + } + mcr.MDATPCheckRequirementsProperties = &mDATPCheckRequirementsProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnectorsCheckRequirements + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + mcr.Kind = kind + } + } + } + + return nil +} + +// MDATPCheckRequirementsProperties MDATP (Microsoft Defender Advanced Threat Protection) requirements +// check properties. +type MDATPCheckRequirementsProperties struct { + // TenantID - The tenant id to connect to, and get the data from. + TenantID *string `json:"tenantId,omitempty"` +} + +// MDATPDataConnector represents MDATP (Microsoft Defender Advanced Threat Protection) data connector. +type MDATPDataConnector struct { + // MDATPDataConnectorProperties - MDATP (Microsoft Defender Advanced Threat Protection) data connector properties. + *MDATPDataConnectorProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorKindDataConnector', 'KindBasicDataConnectorKindAzureActiveDirectory', 'KindBasicDataConnectorKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorKindMicrosoftThreatProtection', 'KindBasicDataConnectorKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorKindAzureSecurityCenter', 'KindBasicDataConnectorKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorKindAmazonWebServicesS3', 'KindBasicDataConnectorKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorKindDynamics365', 'KindBasicDataConnectorKindOfficeATP', 'KindBasicDataConnectorKindOffice365Project', 'KindBasicDataConnectorKindOfficePowerBI', 'KindBasicDataConnectorKindOfficeIRM', 'KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorKindOffice365', 'KindBasicDataConnectorKindThreatIntelligence', 'KindBasicDataConnectorKindThreatIntelligenceTaxii', 'KindBasicDataConnectorKindIOT', 'KindBasicDataConnectorKindGenericUI', 'KindBasicDataConnectorKindAPIPolling' + Kind KindBasicDataConnector `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for MDATPDataConnector. +func (mdc MDATPDataConnector) MarshalJSON() ([]byte, error) { + mdc.Kind = KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection + objectMap := make(map[string]interface{}) + if mdc.MDATPDataConnectorProperties != nil { + objectMap["properties"] = mdc.MDATPDataConnectorProperties + } + if mdc.Kind != "" { + objectMap["kind"] = mdc.Kind + } + if mdc.Etag != nil { + objectMap["etag"] = mdc.Etag + } + return json.Marshal(objectMap) +} + +// AsAADDataConnector is the BasicDataConnector implementation for MDATPDataConnector. +func (mdc MDATPDataConnector) AsAADDataConnector() (*AADDataConnector, bool) { + return nil, false +} + +// AsMSTIDataConnector is the BasicDataConnector implementation for MDATPDataConnector. +func (mdc MDATPDataConnector) AsMSTIDataConnector() (*MSTIDataConnector, bool) { + return nil, false +} + +// AsMTPDataConnector is the BasicDataConnector implementation for MDATPDataConnector. +func (mdc MDATPDataConnector) AsMTPDataConnector() (*MTPDataConnector, bool) { + return nil, false +} + +// AsAATPDataConnector is the BasicDataConnector implementation for MDATPDataConnector. +func (mdc MDATPDataConnector) AsAATPDataConnector() (*AATPDataConnector, bool) { + return nil, false +} + +// AsASCDataConnector is the BasicDataConnector implementation for MDATPDataConnector. +func (mdc MDATPDataConnector) AsASCDataConnector() (*ASCDataConnector, bool) { + return nil, false +} + +// AsAwsCloudTrailDataConnector is the BasicDataConnector implementation for MDATPDataConnector. +func (mdc MDATPDataConnector) AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) { + return nil, false +} + +// AsAwsS3DataConnector is the BasicDataConnector implementation for MDATPDataConnector. +func (mdc MDATPDataConnector) AsAwsS3DataConnector() (*AwsS3DataConnector, bool) { + return nil, false +} + +// AsMCASDataConnector is the BasicDataConnector implementation for MDATPDataConnector. +func (mdc MDATPDataConnector) AsMCASDataConnector() (*MCASDataConnector, bool) { + return nil, false +} + +// AsDynamics365DataConnector is the BasicDataConnector implementation for MDATPDataConnector. +func (mdc MDATPDataConnector) AsDynamics365DataConnector() (*Dynamics365DataConnector, bool) { + return nil, false +} + +// AsOfficeATPDataConnector is the BasicDataConnector implementation for MDATPDataConnector. +func (mdc MDATPDataConnector) AsOfficeATPDataConnector() (*OfficeATPDataConnector, bool) { + return nil, false +} + +// AsOffice365ProjectDataConnector is the BasicDataConnector implementation for MDATPDataConnector. +func (mdc MDATPDataConnector) AsOffice365ProjectDataConnector() (*Office365ProjectDataConnector, bool) { + return nil, false +} + +// AsOfficePowerBIDataConnector is the BasicDataConnector implementation for MDATPDataConnector. +func (mdc MDATPDataConnector) AsOfficePowerBIDataConnector() (*OfficePowerBIDataConnector, bool) { + return nil, false +} + +// AsOfficeIRMDataConnector is the BasicDataConnector implementation for MDATPDataConnector. +func (mdc MDATPDataConnector) AsOfficeIRMDataConnector() (*OfficeIRMDataConnector, bool) { + return nil, false +} + +// AsMDATPDataConnector is the BasicDataConnector implementation for MDATPDataConnector. +func (mdc MDATPDataConnector) AsMDATPDataConnector() (*MDATPDataConnector, bool) { + return &mdc, true +} + +// AsOfficeDataConnector is the BasicDataConnector implementation for MDATPDataConnector. +func (mdc MDATPDataConnector) AsOfficeDataConnector() (*OfficeDataConnector, bool) { + return nil, false +} + +// AsTIDataConnector is the BasicDataConnector implementation for MDATPDataConnector. +func (mdc MDATPDataConnector) AsTIDataConnector() (*TIDataConnector, bool) { + return nil, false +} + +// AsTiTaxiiDataConnector is the BasicDataConnector implementation for MDATPDataConnector. +func (mdc MDATPDataConnector) AsTiTaxiiDataConnector() (*TiTaxiiDataConnector, bool) { + return nil, false +} + +// AsIoTDataConnector is the BasicDataConnector implementation for MDATPDataConnector. +func (mdc MDATPDataConnector) AsIoTDataConnector() (*IoTDataConnector, bool) { + return nil, false +} + +// AsCodelessUIDataConnector is the BasicDataConnector implementation for MDATPDataConnector. +func (mdc MDATPDataConnector) AsCodelessUIDataConnector() (*CodelessUIDataConnector, bool) { + return nil, false +} + +// AsCodelessAPIPollingDataConnector is the BasicDataConnector implementation for MDATPDataConnector. +func (mdc MDATPDataConnector) AsCodelessAPIPollingDataConnector() (*CodelessAPIPollingDataConnector, bool) { + return nil, false +} + +// AsDataConnector is the BasicDataConnector implementation for MDATPDataConnector. +func (mdc MDATPDataConnector) AsDataConnector() (*DataConnector, bool) { + return nil, false +} + +// AsBasicDataConnector is the BasicDataConnector implementation for MDATPDataConnector. +func (mdc MDATPDataConnector) AsBasicDataConnector() (BasicDataConnector, bool) { + return &mdc, true +} + +// UnmarshalJSON is the custom unmarshaler for MDATPDataConnector struct. +func (mdc *MDATPDataConnector) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var mDATPDataConnectorProperties MDATPDataConnectorProperties + err = json.Unmarshal(*v, &mDATPDataConnectorProperties) + if err != nil { + return err + } + mdc.MDATPDataConnectorProperties = &mDATPDataConnectorProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnector + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + mdc.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + mdc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mdc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mdc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mdc.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mdc.SystemData = &systemData + } + } + } + + return nil +} + +// MDATPDataConnectorProperties MDATP (Microsoft Defender Advanced Threat Protection) data connector +// properties. +type MDATPDataConnectorProperties struct { + // TenantID - The tenant id to connect to, and get the data from. + TenantID *string `json:"tenantId,omitempty"` + // DataTypes - The available data types for the connector. + DataTypes *AlertsDataTypeOfDataConnector `json:"dataTypes,omitempty"` +} + +// MetadataAuthor publisher or creator of the content item. +type MetadataAuthor struct { + // Name - Name of the author. Company or person. + Name *string `json:"name,omitempty"` + // Email - Email of author contact + Email *string `json:"email,omitempty"` + // Link - Link for author/vendor page + Link *string `json:"link,omitempty"` +} + +// MetadataCategories ies for the solution content item +type MetadataCategories struct { + // Domains - domain for the solution content item + Domains *[]string `json:"domains,omitempty"` + // Verticals - Industry verticals for the solution content item + Verticals *[]string `json:"verticals,omitempty"` +} + +// MetadataDependencies dependencies for the content item, what other content items it requires to work. +// Can describe more complex dependencies using a recursive/nested structure. For a single dependency an +// id/kind/version can be supplied or operator/criteria for complex dependencies. +type MetadataDependencies struct { + // ContentID - Id of the content item we depend on + ContentID *string `json:"contentId,omitempty"` + // Kind - Type of the content item we depend on. Possible values include: 'KindDataConnector', 'KindDataType', 'KindWorkbook', 'KindWorkbookTemplate', 'KindPlaybook', 'KindPlaybookTemplate', 'KindAnalyticsRuleTemplate', 'KindAnalyticsRule', 'KindHuntingQuery', 'KindInvestigationQuery', 'KindParser', 'KindWatchlist', 'KindWatchlistTemplate', 'KindSolution', 'KindAzureFunction', 'KindLogicAppsCustomConnector', 'KindAutomationRule' + Kind Kind `json:"kind,omitempty"` + // Version - Version of the the content item we depend on. Can be blank, * or missing to indicate any version fulfills the dependency. If version does not match our defined numeric format then an exact match is required. + Version *string `json:"version,omitempty"` + // Name - Name of the content item + Name *string `json:"name,omitempty"` + // Operator - Operator used for list of dependencies in criteria array. Possible values include: 'OperatorAND', 'OperatorOR' + Operator Operator `json:"operator,omitempty"` + // Criteria - This is the list of dependencies we must fulfill, according to the AND/OR operator + Criteria *[]MetadataDependencies `json:"criteria,omitempty"` +} + +// MetadataList list of all the metadata. +type MetadataList struct { + autorest.Response `json:"-"` + // Value - Array of metadata. + Value *[]MetadataModel `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to fetch the next page of metadata. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for MetadataList. +func (ml MetadataList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ml.Value != nil { + objectMap["value"] = ml.Value + } + return json.Marshal(objectMap) +} + +// MetadataListIterator provides access to a complete listing of MetadataModel values. +type MetadataListIterator struct { + i int + page MetadataListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *MetadataListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MetadataListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *MetadataListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter MetadataListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter MetadataListIterator) Response() MetadataList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter MetadataListIterator) Value() MetadataModel { + if !iter.page.NotDone() { + return MetadataModel{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the MetadataListIterator type. +func NewMetadataListIterator(page MetadataListPage) MetadataListIterator { + return MetadataListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ml MetadataList) IsEmpty() bool { + return ml.Value == nil || len(*ml.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ml MetadataList) hasNextLink() bool { + return ml.NextLink != nil && len(*ml.NextLink) != 0 +} + +// metadataListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ml MetadataList) metadataListPreparer(ctx context.Context) (*http.Request, error) { + if !ml.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ml.NextLink))) +} + +// MetadataListPage contains a page of MetadataModel values. +type MetadataListPage struct { + fn func(context.Context, MetadataList) (MetadataList, error) + ml MetadataList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *MetadataListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MetadataListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ml) + if err != nil { + return err + } + page.ml = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *MetadataListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page MetadataListPage) NotDone() bool { + return !page.ml.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page MetadataListPage) Response() MetadataList { + return page.ml +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page MetadataListPage) Values() []MetadataModel { + if page.ml.IsEmpty() { + return nil + } + return *page.ml.Value +} + +// Creates a new instance of the MetadataListPage type. +func NewMetadataListPage(cur MetadataList, getNextPage func(context.Context, MetadataList) (MetadataList, error)) MetadataListPage { + return MetadataListPage{ + fn: getNextPage, + ml: cur, + } +} + +// MetadataModel metadata resource definition. +type MetadataModel struct { + autorest.Response `json:"-"` + // MetadataProperties - Metadata properties + *MetadataProperties `json:"properties,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for MetadataModel. +func (mm MetadataModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mm.MetadataProperties != nil { + objectMap["properties"] = mm.MetadataProperties + } + if mm.Etag != nil { + objectMap["etag"] = mm.Etag + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MetadataModel struct. +func (mm *MetadataModel) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var metadataProperties MetadataProperties + err = json.Unmarshal(*v, &metadataProperties) + if err != nil { + return err + } + mm.MetadataProperties = &metadataProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + mm.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mm.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mm.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mm.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mm.SystemData = &systemData + } + } + } + + return nil +} + +// MetadataPatch metadata patch request body. +type MetadataPatch struct { + // MetadataPropertiesPatch - Metadata patch request body + *MetadataPropertiesPatch `json:"properties,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for MetadataPatch. +func (mp MetadataPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mp.MetadataPropertiesPatch != nil { + objectMap["properties"] = mp.MetadataPropertiesPatch + } + if mp.Etag != nil { + objectMap["etag"] = mp.Etag + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MetadataPatch struct. +func (mp *MetadataPatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var metadataPropertiesPatch MetadataPropertiesPatch + err = json.Unmarshal(*v, &metadataPropertiesPatch) + if err != nil { + return err + } + mp.MetadataPropertiesPatch = &metadataPropertiesPatch + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + mp.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mp.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mp.SystemData = &systemData + } + } + } + + return nil +} + +// MetadataProperties metadata property bag. +type MetadataProperties struct { + // ContentID - Static ID for the content. Used to identify dependencies and content from solutions or community. Hard-coded/static for out of the box content and solutions. Dynamic for user-created. This is the resource name + ContentID *string `json:"contentId,omitempty"` + // ParentID - Full parent resource ID of the content item the metadata is for. This is the full resource ID including the scope (subscription and resource group) + ParentID *string `json:"parentId,omitempty"` + // Version - Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, 1.0.0.0), following ARM template best practices. Can also be any string, but then we cannot guarantee any version checks + Version *string `json:"version,omitempty"` + // Kind - The kind of content the metadata is for. Possible values include: 'KindDataConnector', 'KindDataType', 'KindWorkbook', 'KindWorkbookTemplate', 'KindPlaybook', 'KindPlaybookTemplate', 'KindAnalyticsRuleTemplate', 'KindAnalyticsRule', 'KindHuntingQuery', 'KindInvestigationQuery', 'KindParser', 'KindWatchlist', 'KindWatchlistTemplate', 'KindSolution', 'KindAzureFunction', 'KindLogicAppsCustomConnector', 'KindAutomationRule' + Kind Kind `json:"kind,omitempty"` + // Source - Source of the content. This is where/how it was created. + Source *MetadataSource `json:"source,omitempty"` + // Author - The creator of the content item. + Author *MetadataAuthor `json:"author,omitempty"` + // Support - Support information for the metadata - type, name, contact information + Support *MetadataSupport `json:"support,omitempty"` + // Dependencies - Dependencies for the content item, what other content items it requires to work. Can describe more complex dependencies using a recursive/nested structure. For a single dependency an id/kind/version can be supplied or operator/criteria for complex formats. + Dependencies *MetadataDependencies `json:"dependencies,omitempty"` + // Categories - Categories for the solution content item + Categories *MetadataCategories `json:"categories,omitempty"` + // Providers - Providers for the solution content item + Providers *[]string `json:"providers,omitempty"` + // FirstPublishDate - first publish date solution content item + FirstPublishDate *date.Date `json:"firstPublishDate,omitempty"` + // LastPublishDate - last publish date for the solution content item + LastPublishDate *date.Date `json:"lastPublishDate,omitempty"` + // CustomVersion - The custom version of the content. A optional free text + CustomVersion *string `json:"customVersion,omitempty"` + // ContentSchemaVersion - Schema version of the content. Can be used to distinguish between different flow based on the schema version + ContentSchemaVersion *string `json:"contentSchemaVersion,omitempty"` + // Icon - the icon identifier. this id can later be fetched from the solution template + Icon *string `json:"icon,omitempty"` + // ThreatAnalysisTactics - the tactics the resource covers + ThreatAnalysisTactics *[]string `json:"threatAnalysisTactics,omitempty"` + // ThreatAnalysisTechniques - the techniques the resource covers, these have to be aligned with the tactics being used + ThreatAnalysisTechniques *[]string `json:"threatAnalysisTechniques,omitempty"` + // PreviewImages - preview image file names. These will be taken from the solution artifacts + PreviewImages *[]string `json:"previewImages,omitempty"` + // PreviewImagesDark - preview image file names. These will be taken from the solution artifacts. used for dark theme support + PreviewImagesDark *[]string `json:"previewImagesDark,omitempty"` +} + +// MetadataPropertiesPatch metadata property bag for patch requests. This is the same as the +// MetadataProperties, but with nothing required +type MetadataPropertiesPatch struct { + // ContentID - Static ID for the content. Used to identify dependencies and content from solutions or community. Hard-coded/static for out of the box content and solutions. Dynamic for user-created. This is the resource name + ContentID *string `json:"contentId,omitempty"` + // ParentID - Full parent resource ID of the content item the metadata is for. This is the full resource ID including the scope (subscription and resource group) + ParentID *string `json:"parentId,omitempty"` + // Version - Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, 1.0.0.0), following ARM template best practices. Can also be any string, but then we cannot guarantee any version checks + Version *string `json:"version,omitempty"` + // Kind - The kind of content the metadata is for. Possible values include: 'KindDataConnector', 'KindDataType', 'KindWorkbook', 'KindWorkbookTemplate', 'KindPlaybook', 'KindPlaybookTemplate', 'KindAnalyticsRuleTemplate', 'KindAnalyticsRule', 'KindHuntingQuery', 'KindInvestigationQuery', 'KindParser', 'KindWatchlist', 'KindWatchlistTemplate', 'KindSolution', 'KindAzureFunction', 'KindLogicAppsCustomConnector', 'KindAutomationRule' + Kind Kind `json:"kind,omitempty"` + // Source - Source of the content. This is where/how it was created. + Source *MetadataSource `json:"source,omitempty"` + // Author - The creator of the content item. + Author *MetadataAuthor `json:"author,omitempty"` + // Support - Support information for the metadata - type, name, contact information + Support *MetadataSupport `json:"support,omitempty"` + // Dependencies - Dependencies for the content item, what other content items it requires to work. Can describe more complex dependencies using a recursive/nested structure. For a single dependency an id/kind/version can be supplied or operator/criteria for complex formats. + Dependencies *MetadataDependencies `json:"dependencies,omitempty"` + // Categories - Categories for the solution content item + Categories *MetadataCategories `json:"categories,omitempty"` + // Providers - Providers for the solution content item + Providers *[]string `json:"providers,omitempty"` + // FirstPublishDate - first publish date solution content item + FirstPublishDate *date.Date `json:"firstPublishDate,omitempty"` + // LastPublishDate - last publish date for the solution content item + LastPublishDate *date.Date `json:"lastPublishDate,omitempty"` + // CustomVersion - The custom version of the content. A optional free text + CustomVersion *string `json:"customVersion,omitempty"` + // ContentSchemaVersion - Schema version of the content. Can be used to distinguish between different flow based on the schema version + ContentSchemaVersion *string `json:"contentSchemaVersion,omitempty"` + // Icon - the icon identifier. this id can later be fetched from the solution template + Icon *string `json:"icon,omitempty"` + // ThreatAnalysisTactics - the tactics the resource covers + ThreatAnalysisTactics *[]string `json:"threatAnalysisTactics,omitempty"` + // ThreatAnalysisTechniques - the techniques the resource covers, these have to be aligned with the tactics being used + ThreatAnalysisTechniques *[]string `json:"threatAnalysisTechniques,omitempty"` + // PreviewImages - preview image file names. These will be taken from the solution artifacts + PreviewImages *[]string `json:"previewImages,omitempty"` + // PreviewImagesDark - preview image file names. These will be taken from the solution artifacts. used for dark theme support + PreviewImagesDark *[]string `json:"previewImagesDark,omitempty"` +} + +// MetadataSource the original source of the content item, where it comes from. +type MetadataSource struct { + // Kind - Source type of the content. Possible values include: 'SourceKindLocalWorkspace', 'SourceKindCommunity', 'SourceKindSolution', 'SourceKindSourceRepository' + Kind SourceKind `json:"kind,omitempty"` + // Name - Name of the content source. The repo name, solution name, LA workspace name etc. + Name *string `json:"name,omitempty"` + // SourceID - ID of the content source. The solution ID, workspace ID, etc + SourceID *string `json:"sourceId,omitempty"` +} + +// MetadataSupport support information for the content item. +type MetadataSupport struct { + // Tier - Type of support for content item. Possible values include: 'SupportTierMicrosoft', 'SupportTierPartner', 'SupportTierCommunity' + Tier SupportTier `json:"tier,omitempty"` + // Name - Name of the support contact. Company or person. + Name *string `json:"name,omitempty"` + // Email - Email of support contact + Email *string `json:"email,omitempty"` + // Link - Link for support help, like to support page to open a ticket etc. + Link *string `json:"link,omitempty"` +} + +// MicrosoftSecurityIncidentCreationAlertRule represents MicrosoftSecurityIncidentCreation rule. +type MicrosoftSecurityIncidentCreationAlertRule struct { + // MicrosoftSecurityIncidentCreationAlertRuleProperties - MicrosoftSecurityIncidentCreation rule properties + *MicrosoftSecurityIncidentCreationAlertRuleProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicAlertRuleKindAlertRule', 'KindBasicAlertRuleKindMLBehaviorAnalytics', 'KindBasicAlertRuleKindFusion', 'KindBasicAlertRuleKindThreatIntelligence', 'KindBasicAlertRuleKindMicrosoftSecurityIncidentCreation', 'KindBasicAlertRuleKindScheduled', 'KindBasicAlertRuleKindNRT' + Kind KindBasicAlertRule `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for MicrosoftSecurityIncidentCreationAlertRule. +func (msicar MicrosoftSecurityIncidentCreationAlertRule) MarshalJSON() ([]byte, error) { + msicar.Kind = KindBasicAlertRuleKindMicrosoftSecurityIncidentCreation + objectMap := make(map[string]interface{}) + if msicar.MicrosoftSecurityIncidentCreationAlertRuleProperties != nil { + objectMap["properties"] = msicar.MicrosoftSecurityIncidentCreationAlertRuleProperties + } + if msicar.Kind != "" { + objectMap["kind"] = msicar.Kind + } + if msicar.Etag != nil { + objectMap["etag"] = msicar.Etag + } + return json.Marshal(objectMap) +} + +// AsMLBehaviorAnalyticsAlertRule is the BasicAlertRule implementation for MicrosoftSecurityIncidentCreationAlertRule. +func (msicar MicrosoftSecurityIncidentCreationAlertRule) AsMLBehaviorAnalyticsAlertRule() (*MLBehaviorAnalyticsAlertRule, bool) { + return nil, false +} + +// AsFusionAlertRule is the BasicAlertRule implementation for MicrosoftSecurityIncidentCreationAlertRule. +func (msicar MicrosoftSecurityIncidentCreationAlertRule) AsFusionAlertRule() (*FusionAlertRule, bool) { + return nil, false +} + +// AsThreatIntelligenceAlertRule is the BasicAlertRule implementation for MicrosoftSecurityIncidentCreationAlertRule. +func (msicar MicrosoftSecurityIncidentCreationAlertRule) AsThreatIntelligenceAlertRule() (*ThreatIntelligenceAlertRule, bool) { + return nil, false +} + +// AsMicrosoftSecurityIncidentCreationAlertRule is the BasicAlertRule implementation for MicrosoftSecurityIncidentCreationAlertRule. +func (msicar MicrosoftSecurityIncidentCreationAlertRule) AsMicrosoftSecurityIncidentCreationAlertRule() (*MicrosoftSecurityIncidentCreationAlertRule, bool) { + return &msicar, true +} + +// AsScheduledAlertRule is the BasicAlertRule implementation for MicrosoftSecurityIncidentCreationAlertRule. +func (msicar MicrosoftSecurityIncidentCreationAlertRule) AsScheduledAlertRule() (*ScheduledAlertRule, bool) { + return nil, false +} + +// AsNrtAlertRule is the BasicAlertRule implementation for MicrosoftSecurityIncidentCreationAlertRule. +func (msicar MicrosoftSecurityIncidentCreationAlertRule) AsNrtAlertRule() (*NrtAlertRule, bool) { + return nil, false +} + +// AsAlertRule is the BasicAlertRule implementation for MicrosoftSecurityIncidentCreationAlertRule. +func (msicar MicrosoftSecurityIncidentCreationAlertRule) AsAlertRule() (*AlertRule, bool) { + return nil, false +} + +// AsBasicAlertRule is the BasicAlertRule implementation for MicrosoftSecurityIncidentCreationAlertRule. +func (msicar MicrosoftSecurityIncidentCreationAlertRule) AsBasicAlertRule() (BasicAlertRule, bool) { + return &msicar, true +} + +// UnmarshalJSON is the custom unmarshaler for MicrosoftSecurityIncidentCreationAlertRule struct. +func (msicar *MicrosoftSecurityIncidentCreationAlertRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var microsoftSecurityIncidentCreationAlertRuleProperties MicrosoftSecurityIncidentCreationAlertRuleProperties + err = json.Unmarshal(*v, µsoftSecurityIncidentCreationAlertRuleProperties) + if err != nil { + return err + } + msicar.MicrosoftSecurityIncidentCreationAlertRuleProperties = µsoftSecurityIncidentCreationAlertRuleProperties + } + case "kind": + if v != nil { + var kind KindBasicAlertRule + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + msicar.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + msicar.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + msicar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + msicar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + msicar.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + msicar.SystemData = &systemData + } + } + } + + return nil +} + +// MicrosoftSecurityIncidentCreationAlertRuleCommonProperties microsoftSecurityIncidentCreation rule common +// property bag. +type MicrosoftSecurityIncidentCreationAlertRuleCommonProperties struct { + // DisplayNamesFilter - the alerts' displayNames on which the cases will be generated + DisplayNamesFilter *[]string `json:"displayNamesFilter,omitempty"` + // DisplayNamesExcludeFilter - the alerts' displayNames on which the cases will not be generated + DisplayNamesExcludeFilter *[]string `json:"displayNamesExcludeFilter,omitempty"` + // ProductFilter - The alerts' productName on which the cases will be generated. Possible values include: 'MicrosoftSecurityProductNameMicrosoftCloudAppSecurity', 'MicrosoftSecurityProductNameAzureSecurityCenter', 'MicrosoftSecurityProductNameAzureAdvancedThreatProtection', 'MicrosoftSecurityProductNameAzureActiveDirectoryIdentityProtection', 'MicrosoftSecurityProductNameAzureSecurityCenterforIoT', 'MicrosoftSecurityProductNameOffice365AdvancedThreatProtection', 'MicrosoftSecurityProductNameMicrosoftDefenderAdvancedThreatProtection' + ProductFilter MicrosoftSecurityProductName `json:"productFilter,omitempty"` + // SeveritiesFilter - the alerts' severities on which the cases will be generated + SeveritiesFilter *[]AlertSeverity `json:"severitiesFilter,omitempty"` +} + +// MicrosoftSecurityIncidentCreationAlertRuleProperties microsoftSecurityIncidentCreation rule property +// bag. +type MicrosoftSecurityIncidentCreationAlertRuleProperties struct { + // AlertRuleTemplateName - The Name of the alert rule template used to create this rule. + AlertRuleTemplateName *string `json:"alertRuleTemplateName,omitempty"` + // Description - The description of the alert rule. + Description *string `json:"description,omitempty"` + // DisplayName - The display name for alerts created by this alert rule. + DisplayName *string `json:"displayName,omitempty"` + // Enabled - Determines whether this alert rule is enabled or disabled. + Enabled *bool `json:"enabled,omitempty"` + // LastModifiedUtc - READ-ONLY; The last time that this alert has been modified. + LastModifiedUtc *date.Time `json:"lastModifiedUtc,omitempty"` + // DisplayNamesFilter - the alerts' displayNames on which the cases will be generated + DisplayNamesFilter *[]string `json:"displayNamesFilter,omitempty"` + // DisplayNamesExcludeFilter - the alerts' displayNames on which the cases will not be generated + DisplayNamesExcludeFilter *[]string `json:"displayNamesExcludeFilter,omitempty"` + // ProductFilter - The alerts' productName on which the cases will be generated. Possible values include: 'MicrosoftSecurityProductNameMicrosoftCloudAppSecurity', 'MicrosoftSecurityProductNameAzureSecurityCenter', 'MicrosoftSecurityProductNameAzureAdvancedThreatProtection', 'MicrosoftSecurityProductNameAzureActiveDirectoryIdentityProtection', 'MicrosoftSecurityProductNameAzureSecurityCenterforIoT', 'MicrosoftSecurityProductNameOffice365AdvancedThreatProtection', 'MicrosoftSecurityProductNameMicrosoftDefenderAdvancedThreatProtection' + ProductFilter MicrosoftSecurityProductName `json:"productFilter,omitempty"` + // SeveritiesFilter - the alerts' severities on which the cases will be generated + SeveritiesFilter *[]AlertSeverity `json:"severitiesFilter,omitempty"` +} + +// MarshalJSON is the custom marshaler for MicrosoftSecurityIncidentCreationAlertRuleProperties. +func (msicarp MicrosoftSecurityIncidentCreationAlertRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if msicarp.AlertRuleTemplateName != nil { + objectMap["alertRuleTemplateName"] = msicarp.AlertRuleTemplateName + } + if msicarp.Description != nil { + objectMap["description"] = msicarp.Description + } + if msicarp.DisplayName != nil { + objectMap["displayName"] = msicarp.DisplayName + } + if msicarp.Enabled != nil { + objectMap["enabled"] = msicarp.Enabled + } + if msicarp.DisplayNamesFilter != nil { + objectMap["displayNamesFilter"] = msicarp.DisplayNamesFilter + } + if msicarp.DisplayNamesExcludeFilter != nil { + objectMap["displayNamesExcludeFilter"] = msicarp.DisplayNamesExcludeFilter + } + if msicarp.ProductFilter != "" { + objectMap["productFilter"] = msicarp.ProductFilter + } + if msicarp.SeveritiesFilter != nil { + objectMap["severitiesFilter"] = msicarp.SeveritiesFilter + } + return json.Marshal(objectMap) +} + +// MicrosoftSecurityIncidentCreationAlertRuleTemplate represents MicrosoftSecurityIncidentCreation rule +// template. +type MicrosoftSecurityIncidentCreationAlertRuleTemplate struct { + // MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties - MicrosoftSecurityIncidentCreation rule template properties + *MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicAlertRuleTemplateKindAlertRuleTemplate', 'KindBasicAlertRuleTemplateKindMLBehaviorAnalytics', 'KindBasicAlertRuleTemplateKindFusion', 'KindBasicAlertRuleTemplateKindThreatIntelligence', 'KindBasicAlertRuleTemplateKindMicrosoftSecurityIncidentCreation', 'KindBasicAlertRuleTemplateKindScheduled', 'KindBasicAlertRuleTemplateKindNRT' + Kind KindBasicAlertRuleTemplate `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for MicrosoftSecurityIncidentCreationAlertRuleTemplate. +func (msicart MicrosoftSecurityIncidentCreationAlertRuleTemplate) MarshalJSON() ([]byte, error) { + msicart.Kind = KindBasicAlertRuleTemplateKindMicrosoftSecurityIncidentCreation + objectMap := make(map[string]interface{}) + if msicart.MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties != nil { + objectMap["properties"] = msicart.MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties + } + if msicart.Kind != "" { + objectMap["kind"] = msicart.Kind + } + return json.Marshal(objectMap) +} + +// AsMLBehaviorAnalyticsAlertRuleTemplate is the BasicAlertRuleTemplate implementation for MicrosoftSecurityIncidentCreationAlertRuleTemplate. +func (msicart MicrosoftSecurityIncidentCreationAlertRuleTemplate) AsMLBehaviorAnalyticsAlertRuleTemplate() (*MLBehaviorAnalyticsAlertRuleTemplate, bool) { + return nil, false +} + +// AsFusionAlertRuleTemplate is the BasicAlertRuleTemplate implementation for MicrosoftSecurityIncidentCreationAlertRuleTemplate. +func (msicart MicrosoftSecurityIncidentCreationAlertRuleTemplate) AsFusionAlertRuleTemplate() (*FusionAlertRuleTemplate, bool) { + return nil, false +} + +// AsThreatIntelligenceAlertRuleTemplate is the BasicAlertRuleTemplate implementation for MicrosoftSecurityIncidentCreationAlertRuleTemplate. +func (msicart MicrosoftSecurityIncidentCreationAlertRuleTemplate) AsThreatIntelligenceAlertRuleTemplate() (*ThreatIntelligenceAlertRuleTemplate, bool) { + return nil, false +} + +// AsMicrosoftSecurityIncidentCreationAlertRuleTemplate is the BasicAlertRuleTemplate implementation for MicrosoftSecurityIncidentCreationAlertRuleTemplate. +func (msicart MicrosoftSecurityIncidentCreationAlertRuleTemplate) AsMicrosoftSecurityIncidentCreationAlertRuleTemplate() (*MicrosoftSecurityIncidentCreationAlertRuleTemplate, bool) { + return &msicart, true +} + +// AsScheduledAlertRuleTemplate is the BasicAlertRuleTemplate implementation for MicrosoftSecurityIncidentCreationAlertRuleTemplate. +func (msicart MicrosoftSecurityIncidentCreationAlertRuleTemplate) AsScheduledAlertRuleTemplate() (*ScheduledAlertRuleTemplate, bool) { + return nil, false +} + +// AsNrtAlertRuleTemplate is the BasicAlertRuleTemplate implementation for MicrosoftSecurityIncidentCreationAlertRuleTemplate. +func (msicart MicrosoftSecurityIncidentCreationAlertRuleTemplate) AsNrtAlertRuleTemplate() (*NrtAlertRuleTemplate, bool) { + return nil, false +} + +// AsAlertRuleTemplate is the BasicAlertRuleTemplate implementation for MicrosoftSecurityIncidentCreationAlertRuleTemplate. +func (msicart MicrosoftSecurityIncidentCreationAlertRuleTemplate) AsAlertRuleTemplate() (*AlertRuleTemplate, bool) { + return nil, false +} + +// AsBasicAlertRuleTemplate is the BasicAlertRuleTemplate implementation for MicrosoftSecurityIncidentCreationAlertRuleTemplate. +func (msicart MicrosoftSecurityIncidentCreationAlertRuleTemplate) AsBasicAlertRuleTemplate() (BasicAlertRuleTemplate, bool) { + return &msicart, true +} + +// UnmarshalJSON is the custom unmarshaler for MicrosoftSecurityIncidentCreationAlertRuleTemplate struct. +func (msicart *MicrosoftSecurityIncidentCreationAlertRuleTemplate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var microsoftSecurityIncidentCreationAlertRuleTemplateProperties MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties + err = json.Unmarshal(*v, µsoftSecurityIncidentCreationAlertRuleTemplateProperties) + if err != nil { + return err + } + msicart.MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties = µsoftSecurityIncidentCreationAlertRuleTemplateProperties + } + case "kind": + if v != nil { + var kind KindBasicAlertRuleTemplate + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + msicart.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + msicart.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + msicart.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + msicart.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + msicart.SystemData = &systemData + } + } + } + + return nil +} + +// MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties microsoftSecurityIncidentCreation rule +// template properties +type MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties struct { + // DisplayNamesFilter - the alerts' displayNames on which the cases will be generated + DisplayNamesFilter *[]string `json:"displayNamesFilter,omitempty"` + // DisplayNamesExcludeFilter - the alerts' displayNames on which the cases will not be generated + DisplayNamesExcludeFilter *[]string `json:"displayNamesExcludeFilter,omitempty"` + // ProductFilter - The alerts' productName on which the cases will be generated. Possible values include: 'MicrosoftSecurityProductNameMicrosoftCloudAppSecurity', 'MicrosoftSecurityProductNameAzureSecurityCenter', 'MicrosoftSecurityProductNameAzureAdvancedThreatProtection', 'MicrosoftSecurityProductNameAzureActiveDirectoryIdentityProtection', 'MicrosoftSecurityProductNameAzureSecurityCenterforIoT', 'MicrosoftSecurityProductNameOffice365AdvancedThreatProtection', 'MicrosoftSecurityProductNameMicrosoftDefenderAdvancedThreatProtection' + ProductFilter MicrosoftSecurityProductName `json:"productFilter,omitempty"` + // SeveritiesFilter - the alerts' severities on which the cases will be generated + SeveritiesFilter *[]AlertSeverity `json:"severitiesFilter,omitempty"` + // AlertRulesCreatedByTemplateCount - the number of alert rules that were created by this template + AlertRulesCreatedByTemplateCount *int32 `json:"alertRulesCreatedByTemplateCount,omitempty"` + // LastUpdatedDateUTC - READ-ONLY; The last time that this alert rule template has been updated. + LastUpdatedDateUTC *date.Time `json:"lastUpdatedDateUTC,omitempty"` + // CreatedDateUTC - READ-ONLY; The time that this alert rule template has been added. + CreatedDateUTC *date.Time `json:"createdDateUTC,omitempty"` + // Description - The description of the alert rule template. + Description *string `json:"description,omitempty"` + // DisplayName - The display name for alert rule template. + DisplayName *string `json:"displayName,omitempty"` + // RequiredDataConnectors - The required data sources for this template + RequiredDataConnectors *[]AlertRuleTemplateDataSource `json:"requiredDataConnectors,omitempty"` + // Status - The alert rule template status. Possible values include: 'TemplateStatusInstalled', 'TemplateStatusAvailable', 'TemplateStatusNotAvailable' + Status TemplateStatus `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties. +func (msicartp MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if msicartp.DisplayNamesFilter != nil { + objectMap["displayNamesFilter"] = msicartp.DisplayNamesFilter + } + if msicartp.DisplayNamesExcludeFilter != nil { + objectMap["displayNamesExcludeFilter"] = msicartp.DisplayNamesExcludeFilter + } + if msicartp.ProductFilter != "" { + objectMap["productFilter"] = msicartp.ProductFilter + } + if msicartp.SeveritiesFilter != nil { + objectMap["severitiesFilter"] = msicartp.SeveritiesFilter + } + if msicartp.AlertRulesCreatedByTemplateCount != nil { + objectMap["alertRulesCreatedByTemplateCount"] = msicartp.AlertRulesCreatedByTemplateCount + } + if msicartp.Description != nil { + objectMap["description"] = msicartp.Description + } + if msicartp.DisplayName != nil { + objectMap["displayName"] = msicartp.DisplayName + } + if msicartp.RequiredDataConnectors != nil { + objectMap["requiredDataConnectors"] = msicartp.RequiredDataConnectors + } + if msicartp.Status != "" { + objectMap["status"] = msicartp.Status + } + return json.Marshal(objectMap) +} + +// MLBehaviorAnalyticsAlertRule represents MLBehaviorAnalytics alert rule. +type MLBehaviorAnalyticsAlertRule struct { + // MLBehaviorAnalyticsAlertRuleProperties - MLBehaviorAnalytics alert rule properties + *MLBehaviorAnalyticsAlertRuleProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicAlertRuleKindAlertRule', 'KindBasicAlertRuleKindMLBehaviorAnalytics', 'KindBasicAlertRuleKindFusion', 'KindBasicAlertRuleKindThreatIntelligence', 'KindBasicAlertRuleKindMicrosoftSecurityIncidentCreation', 'KindBasicAlertRuleKindScheduled', 'KindBasicAlertRuleKindNRT' + Kind KindBasicAlertRule `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for MLBehaviorAnalyticsAlertRule. +func (mbaar MLBehaviorAnalyticsAlertRule) MarshalJSON() ([]byte, error) { + mbaar.Kind = KindBasicAlertRuleKindMLBehaviorAnalytics + objectMap := make(map[string]interface{}) + if mbaar.MLBehaviorAnalyticsAlertRuleProperties != nil { + objectMap["properties"] = mbaar.MLBehaviorAnalyticsAlertRuleProperties + } + if mbaar.Kind != "" { + objectMap["kind"] = mbaar.Kind + } + if mbaar.Etag != nil { + objectMap["etag"] = mbaar.Etag + } + return json.Marshal(objectMap) +} + +// AsMLBehaviorAnalyticsAlertRule is the BasicAlertRule implementation for MLBehaviorAnalyticsAlertRule. +func (mbaar MLBehaviorAnalyticsAlertRule) AsMLBehaviorAnalyticsAlertRule() (*MLBehaviorAnalyticsAlertRule, bool) { + return &mbaar, true +} + +// AsFusionAlertRule is the BasicAlertRule implementation for MLBehaviorAnalyticsAlertRule. +func (mbaar MLBehaviorAnalyticsAlertRule) AsFusionAlertRule() (*FusionAlertRule, bool) { + return nil, false +} + +// AsThreatIntelligenceAlertRule is the BasicAlertRule implementation for MLBehaviorAnalyticsAlertRule. +func (mbaar MLBehaviorAnalyticsAlertRule) AsThreatIntelligenceAlertRule() (*ThreatIntelligenceAlertRule, bool) { + return nil, false +} + +// AsMicrosoftSecurityIncidentCreationAlertRule is the BasicAlertRule implementation for MLBehaviorAnalyticsAlertRule. +func (mbaar MLBehaviorAnalyticsAlertRule) AsMicrosoftSecurityIncidentCreationAlertRule() (*MicrosoftSecurityIncidentCreationAlertRule, bool) { + return nil, false +} + +// AsScheduledAlertRule is the BasicAlertRule implementation for MLBehaviorAnalyticsAlertRule. +func (mbaar MLBehaviorAnalyticsAlertRule) AsScheduledAlertRule() (*ScheduledAlertRule, bool) { + return nil, false +} + +// AsNrtAlertRule is the BasicAlertRule implementation for MLBehaviorAnalyticsAlertRule. +func (mbaar MLBehaviorAnalyticsAlertRule) AsNrtAlertRule() (*NrtAlertRule, bool) { + return nil, false +} + +// AsAlertRule is the BasicAlertRule implementation for MLBehaviorAnalyticsAlertRule. +func (mbaar MLBehaviorAnalyticsAlertRule) AsAlertRule() (*AlertRule, bool) { + return nil, false +} + +// AsBasicAlertRule is the BasicAlertRule implementation for MLBehaviorAnalyticsAlertRule. +func (mbaar MLBehaviorAnalyticsAlertRule) AsBasicAlertRule() (BasicAlertRule, bool) { + return &mbaar, true +} + +// UnmarshalJSON is the custom unmarshaler for MLBehaviorAnalyticsAlertRule struct. +func (mbaar *MLBehaviorAnalyticsAlertRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var mLBehaviorAnalyticsAlertRuleProperties MLBehaviorAnalyticsAlertRuleProperties + err = json.Unmarshal(*v, &mLBehaviorAnalyticsAlertRuleProperties) + if err != nil { + return err + } + mbaar.MLBehaviorAnalyticsAlertRuleProperties = &mLBehaviorAnalyticsAlertRuleProperties + } + case "kind": + if v != nil { + var kind KindBasicAlertRule + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + mbaar.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + mbaar.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mbaar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mbaar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mbaar.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mbaar.SystemData = &systemData + } + } + } + + return nil +} + +// MLBehaviorAnalyticsAlertRuleProperties mLBehaviorAnalytics alert rule base property bag. +type MLBehaviorAnalyticsAlertRuleProperties struct { + // AlertRuleTemplateName - The Name of the alert rule template used to create this rule. + AlertRuleTemplateName *string `json:"alertRuleTemplateName,omitempty"` + // Description - READ-ONLY; The description of the alert rule. + Description *string `json:"description,omitempty"` + // DisplayName - READ-ONLY; The display name for alerts created by this alert rule. + DisplayName *string `json:"displayName,omitempty"` + // Enabled - Determines whether this alert rule is enabled or disabled. + Enabled *bool `json:"enabled,omitempty"` + // LastModifiedUtc - READ-ONLY; The last time that this alert rule has been modified. + LastModifiedUtc *date.Time `json:"lastModifiedUtc,omitempty"` + // Severity - READ-ONLY; The severity for alerts created by this alert rule. Possible values include: 'AlertSeverityHigh', 'AlertSeverityMedium', 'AlertSeverityLow', 'AlertSeverityInformational' + Severity AlertSeverity `json:"severity,omitempty"` + // Tactics - READ-ONLY; The tactics of the alert rule + Tactics *[]AttackTactic `json:"tactics,omitempty"` + // Techniques - READ-ONLY; The techniques of the alert rule + Techniques *[]string `json:"techniques,omitempty"` +} + +// MarshalJSON is the custom marshaler for MLBehaviorAnalyticsAlertRuleProperties. +func (mbaarp MLBehaviorAnalyticsAlertRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mbaarp.AlertRuleTemplateName != nil { + objectMap["alertRuleTemplateName"] = mbaarp.AlertRuleTemplateName + } + if mbaarp.Enabled != nil { + objectMap["enabled"] = mbaarp.Enabled + } + return json.Marshal(objectMap) +} + +// MLBehaviorAnalyticsAlertRuleTemplate represents MLBehaviorAnalytics alert rule template. +type MLBehaviorAnalyticsAlertRuleTemplate struct { + // MLBehaviorAnalyticsAlertRuleTemplateProperties - MLBehaviorAnalytics alert rule template properties. + *MLBehaviorAnalyticsAlertRuleTemplateProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicAlertRuleTemplateKindAlertRuleTemplate', 'KindBasicAlertRuleTemplateKindMLBehaviorAnalytics', 'KindBasicAlertRuleTemplateKindFusion', 'KindBasicAlertRuleTemplateKindThreatIntelligence', 'KindBasicAlertRuleTemplateKindMicrosoftSecurityIncidentCreation', 'KindBasicAlertRuleTemplateKindScheduled', 'KindBasicAlertRuleTemplateKindNRT' + Kind KindBasicAlertRuleTemplate `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for MLBehaviorAnalyticsAlertRuleTemplate. +func (mbaart MLBehaviorAnalyticsAlertRuleTemplate) MarshalJSON() ([]byte, error) { + mbaart.Kind = KindBasicAlertRuleTemplateKindMLBehaviorAnalytics + objectMap := make(map[string]interface{}) + if mbaart.MLBehaviorAnalyticsAlertRuleTemplateProperties != nil { + objectMap["properties"] = mbaart.MLBehaviorAnalyticsAlertRuleTemplateProperties + } + if mbaart.Kind != "" { + objectMap["kind"] = mbaart.Kind + } + return json.Marshal(objectMap) +} + +// AsMLBehaviorAnalyticsAlertRuleTemplate is the BasicAlertRuleTemplate implementation for MLBehaviorAnalyticsAlertRuleTemplate. +func (mbaart MLBehaviorAnalyticsAlertRuleTemplate) AsMLBehaviorAnalyticsAlertRuleTemplate() (*MLBehaviorAnalyticsAlertRuleTemplate, bool) { + return &mbaart, true +} + +// AsFusionAlertRuleTemplate is the BasicAlertRuleTemplate implementation for MLBehaviorAnalyticsAlertRuleTemplate. +func (mbaart MLBehaviorAnalyticsAlertRuleTemplate) AsFusionAlertRuleTemplate() (*FusionAlertRuleTemplate, bool) { + return nil, false +} + +// AsThreatIntelligenceAlertRuleTemplate is the BasicAlertRuleTemplate implementation for MLBehaviorAnalyticsAlertRuleTemplate. +func (mbaart MLBehaviorAnalyticsAlertRuleTemplate) AsThreatIntelligenceAlertRuleTemplate() (*ThreatIntelligenceAlertRuleTemplate, bool) { + return nil, false +} + +// AsMicrosoftSecurityIncidentCreationAlertRuleTemplate is the BasicAlertRuleTemplate implementation for MLBehaviorAnalyticsAlertRuleTemplate. +func (mbaart MLBehaviorAnalyticsAlertRuleTemplate) AsMicrosoftSecurityIncidentCreationAlertRuleTemplate() (*MicrosoftSecurityIncidentCreationAlertRuleTemplate, bool) { + return nil, false +} + +// AsScheduledAlertRuleTemplate is the BasicAlertRuleTemplate implementation for MLBehaviorAnalyticsAlertRuleTemplate. +func (mbaart MLBehaviorAnalyticsAlertRuleTemplate) AsScheduledAlertRuleTemplate() (*ScheduledAlertRuleTemplate, bool) { + return nil, false +} + +// AsNrtAlertRuleTemplate is the BasicAlertRuleTemplate implementation for MLBehaviorAnalyticsAlertRuleTemplate. +func (mbaart MLBehaviorAnalyticsAlertRuleTemplate) AsNrtAlertRuleTemplate() (*NrtAlertRuleTemplate, bool) { + return nil, false +} + +// AsAlertRuleTemplate is the BasicAlertRuleTemplate implementation for MLBehaviorAnalyticsAlertRuleTemplate. +func (mbaart MLBehaviorAnalyticsAlertRuleTemplate) AsAlertRuleTemplate() (*AlertRuleTemplate, bool) { + return nil, false +} + +// AsBasicAlertRuleTemplate is the BasicAlertRuleTemplate implementation for MLBehaviorAnalyticsAlertRuleTemplate. +func (mbaart MLBehaviorAnalyticsAlertRuleTemplate) AsBasicAlertRuleTemplate() (BasicAlertRuleTemplate, bool) { + return &mbaart, true +} + +// UnmarshalJSON is the custom unmarshaler for MLBehaviorAnalyticsAlertRuleTemplate struct. +func (mbaart *MLBehaviorAnalyticsAlertRuleTemplate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var mLBehaviorAnalyticsAlertRuleTemplateProperties MLBehaviorAnalyticsAlertRuleTemplateProperties + err = json.Unmarshal(*v, &mLBehaviorAnalyticsAlertRuleTemplateProperties) + if err != nil { + return err + } + mbaart.MLBehaviorAnalyticsAlertRuleTemplateProperties = &mLBehaviorAnalyticsAlertRuleTemplateProperties + } + case "kind": + if v != nil { + var kind KindBasicAlertRuleTemplate + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + mbaart.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mbaart.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mbaart.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mbaart.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mbaart.SystemData = &systemData + } + } + } + + return nil +} + +// MLBehaviorAnalyticsAlertRuleTemplateProperties mLBehaviorAnalytics alert rule template properties. +type MLBehaviorAnalyticsAlertRuleTemplateProperties struct { + // Severity - The severity for alerts created by this alert rule. Possible values include: 'AlertSeverityHigh', 'AlertSeverityMedium', 'AlertSeverityLow', 'AlertSeverityInformational' + Severity AlertSeverity `json:"severity,omitempty"` + // Tactics - The tactics of the alert rule + Tactics *[]AttackTactic `json:"tactics,omitempty"` + // Techniques - The techniques of the alert rule + Techniques *[]string `json:"techniques,omitempty"` + // AlertRulesCreatedByTemplateCount - the number of alert rules that were created by this template + AlertRulesCreatedByTemplateCount *int32 `json:"alertRulesCreatedByTemplateCount,omitempty"` + // LastUpdatedDateUTC - READ-ONLY; The last time that this alert rule template has been updated. + LastUpdatedDateUTC *date.Time `json:"lastUpdatedDateUTC,omitempty"` + // CreatedDateUTC - READ-ONLY; The time that this alert rule template has been added. + CreatedDateUTC *date.Time `json:"createdDateUTC,omitempty"` + // Description - The description of the alert rule template. + Description *string `json:"description,omitempty"` + // DisplayName - The display name for alert rule template. + DisplayName *string `json:"displayName,omitempty"` + // RequiredDataConnectors - The required data sources for this template + RequiredDataConnectors *[]AlertRuleTemplateDataSource `json:"requiredDataConnectors,omitempty"` + // Status - The alert rule template status. Possible values include: 'TemplateStatusInstalled', 'TemplateStatusAvailable', 'TemplateStatusNotAvailable' + Status TemplateStatus `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for MLBehaviorAnalyticsAlertRuleTemplateProperties. +func (mbaart MLBehaviorAnalyticsAlertRuleTemplateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mbaart.Severity != "" { + objectMap["severity"] = mbaart.Severity + } + if mbaart.Tactics != nil { + objectMap["tactics"] = mbaart.Tactics + } + if mbaart.Techniques != nil { + objectMap["techniques"] = mbaart.Techniques + } + if mbaart.AlertRulesCreatedByTemplateCount != nil { + objectMap["alertRulesCreatedByTemplateCount"] = mbaart.AlertRulesCreatedByTemplateCount + } + if mbaart.Description != nil { + objectMap["description"] = mbaart.Description + } + if mbaart.DisplayName != nil { + objectMap["displayName"] = mbaart.DisplayName + } + if mbaart.RequiredDataConnectors != nil { + objectMap["requiredDataConnectors"] = mbaart.RequiredDataConnectors + } + if mbaart.Status != "" { + objectMap["status"] = mbaart.Status + } + return json.Marshal(objectMap) +} + +// MSTICheckRequirements represents Microsoft Threat Intelligence requirements check request. +type MSTICheckRequirements struct { + // MSTICheckRequirementsProperties - Microsoft Threat Intelligence requirements check properties. + *MSTICheckRequirementsProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorsCheckRequirementsKindDataConnectorsCheckRequirements', 'KindBasicDataConnectorsCheckRequirementsKindAzureActiveDirectory', 'KindBasicDataConnectorsCheckRequirementsKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindAzureSecurityCenter', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesS3', 'KindBasicDataConnectorsCheckRequirementsKindDynamics365', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindOfficeATP', 'KindBasicDataConnectorsCheckRequirementsKindOfficeIRM', 'KindBasicDataConnectorsCheckRequirementsKindOffice365Project', 'KindBasicDataConnectorsCheckRequirementsKindOfficePowerBI', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligenceTaxii', 'KindBasicDataConnectorsCheckRequirementsKindIOT' + Kind KindBasicDataConnectorsCheckRequirements `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for MSTICheckRequirements. +func (mcr MSTICheckRequirements) MarshalJSON() ([]byte, error) { + mcr.Kind = KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatIntelligence + objectMap := make(map[string]interface{}) + if mcr.MSTICheckRequirementsProperties != nil { + objectMap["properties"] = mcr.MSTICheckRequirementsProperties + } + if mcr.Kind != "" { + objectMap["kind"] = mcr.Kind + } + return json.Marshal(objectMap) +} + +// AsAADCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MSTICheckRequirements. +func (mcr MSTICheckRequirements) AsAADCheckRequirements() (*AADCheckRequirements, bool) { + return nil, false +} + +// AsAATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MSTICheckRequirements. +func (mcr MSTICheckRequirements) AsAATPCheckRequirements() (*AATPCheckRequirements, bool) { + return nil, false +} + +// AsASCCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MSTICheckRequirements. +func (mcr MSTICheckRequirements) AsASCCheckRequirements() (*ASCCheckRequirements, bool) { + return nil, false +} + +// AsAwsCloudTrailCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MSTICheckRequirements. +func (mcr MSTICheckRequirements) AsAwsCloudTrailCheckRequirements() (*AwsCloudTrailCheckRequirements, bool) { + return nil, false +} + +// AsAwsS3CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MSTICheckRequirements. +func (mcr MSTICheckRequirements) AsAwsS3CheckRequirements() (*AwsS3CheckRequirements, bool) { + return nil, false +} + +// AsDynamics365CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MSTICheckRequirements. +func (mcr MSTICheckRequirements) AsDynamics365CheckRequirements() (*Dynamics365CheckRequirements, bool) { + return nil, false +} + +// AsMCASCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MSTICheckRequirements. +func (mcr MSTICheckRequirements) AsMCASCheckRequirements() (*MCASCheckRequirements, bool) { + return nil, false +} + +// AsMDATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MSTICheckRequirements. +func (mcr MSTICheckRequirements) AsMDATPCheckRequirements() (*MDATPCheckRequirements, bool) { + return nil, false +} + +// AsMSTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MSTICheckRequirements. +func (mcr MSTICheckRequirements) AsMSTICheckRequirements() (*MSTICheckRequirements, bool) { + return &mcr, true +} + +// AsMtpCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MSTICheckRequirements. +func (mcr MSTICheckRequirements) AsMtpCheckRequirements() (*MtpCheckRequirements, bool) { + return nil, false +} + +// AsOfficeATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MSTICheckRequirements. +func (mcr MSTICheckRequirements) AsOfficeATPCheckRequirements() (*OfficeATPCheckRequirements, bool) { + return nil, false +} + +// AsOfficeIRMCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MSTICheckRequirements. +func (mcr MSTICheckRequirements) AsOfficeIRMCheckRequirements() (*OfficeIRMCheckRequirements, bool) { + return nil, false +} + +// AsOffice365ProjectCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MSTICheckRequirements. +func (mcr MSTICheckRequirements) AsOffice365ProjectCheckRequirements() (*Office365ProjectCheckRequirements, bool) { + return nil, false +} + +// AsOfficePowerBICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MSTICheckRequirements. +func (mcr MSTICheckRequirements) AsOfficePowerBICheckRequirements() (*OfficePowerBICheckRequirements, bool) { + return nil, false +} + +// AsTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MSTICheckRequirements. +func (mcr MSTICheckRequirements) AsTICheckRequirements() (*TICheckRequirements, bool) { + return nil, false +} + +// AsTiTaxiiCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MSTICheckRequirements. +func (mcr MSTICheckRequirements) AsTiTaxiiCheckRequirements() (*TiTaxiiCheckRequirements, bool) { + return nil, false +} + +// AsIoTCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MSTICheckRequirements. +func (mcr MSTICheckRequirements) AsIoTCheckRequirements() (*IoTCheckRequirements, bool) { + return nil, false +} + +// AsDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MSTICheckRequirements. +func (mcr MSTICheckRequirements) AsDataConnectorsCheckRequirements() (*DataConnectorsCheckRequirements, bool) { + return nil, false +} + +// AsBasicDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MSTICheckRequirements. +func (mcr MSTICheckRequirements) AsBasicDataConnectorsCheckRequirements() (BasicDataConnectorsCheckRequirements, bool) { + return &mcr, true +} + +// UnmarshalJSON is the custom unmarshaler for MSTICheckRequirements struct. +func (mcr *MSTICheckRequirements) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var mSTICheckRequirementsProperties MSTICheckRequirementsProperties + err = json.Unmarshal(*v, &mSTICheckRequirementsProperties) + if err != nil { + return err + } + mcr.MSTICheckRequirementsProperties = &mSTICheckRequirementsProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnectorsCheckRequirements + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + mcr.Kind = kind + } + } + } + + return nil +} + +// MSTICheckRequirementsProperties microsoft Threat Intelligence requirements check properties. +type MSTICheckRequirementsProperties struct { + // TenantID - The tenant id to connect to, and get the data from. + TenantID *string `json:"tenantId,omitempty"` +} + +// MSTIDataConnector represents Microsoft Threat Intelligence data connector. +type MSTIDataConnector struct { + // MSTIDataConnectorProperties - Microsoft Threat Intelligence data connector properties. + *MSTIDataConnectorProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorKindDataConnector', 'KindBasicDataConnectorKindAzureActiveDirectory', 'KindBasicDataConnectorKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorKindMicrosoftThreatProtection', 'KindBasicDataConnectorKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorKindAzureSecurityCenter', 'KindBasicDataConnectorKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorKindAmazonWebServicesS3', 'KindBasicDataConnectorKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorKindDynamics365', 'KindBasicDataConnectorKindOfficeATP', 'KindBasicDataConnectorKindOffice365Project', 'KindBasicDataConnectorKindOfficePowerBI', 'KindBasicDataConnectorKindOfficeIRM', 'KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorKindOffice365', 'KindBasicDataConnectorKindThreatIntelligence', 'KindBasicDataConnectorKindThreatIntelligenceTaxii', 'KindBasicDataConnectorKindIOT', 'KindBasicDataConnectorKindGenericUI', 'KindBasicDataConnectorKindAPIPolling' + Kind KindBasicDataConnector `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for MSTIDataConnector. +func (mdc MSTIDataConnector) MarshalJSON() ([]byte, error) { + mdc.Kind = KindBasicDataConnectorKindMicrosoftThreatIntelligence + objectMap := make(map[string]interface{}) + if mdc.MSTIDataConnectorProperties != nil { + objectMap["properties"] = mdc.MSTIDataConnectorProperties + } + if mdc.Kind != "" { + objectMap["kind"] = mdc.Kind + } + if mdc.Etag != nil { + objectMap["etag"] = mdc.Etag + } + return json.Marshal(objectMap) +} + +// AsAADDataConnector is the BasicDataConnector implementation for MSTIDataConnector. +func (mdc MSTIDataConnector) AsAADDataConnector() (*AADDataConnector, bool) { + return nil, false +} + +// AsMSTIDataConnector is the BasicDataConnector implementation for MSTIDataConnector. +func (mdc MSTIDataConnector) AsMSTIDataConnector() (*MSTIDataConnector, bool) { + return &mdc, true +} + +// AsMTPDataConnector is the BasicDataConnector implementation for MSTIDataConnector. +func (mdc MSTIDataConnector) AsMTPDataConnector() (*MTPDataConnector, bool) { + return nil, false +} + +// AsAATPDataConnector is the BasicDataConnector implementation for MSTIDataConnector. +func (mdc MSTIDataConnector) AsAATPDataConnector() (*AATPDataConnector, bool) { + return nil, false +} + +// AsASCDataConnector is the BasicDataConnector implementation for MSTIDataConnector. +func (mdc MSTIDataConnector) AsASCDataConnector() (*ASCDataConnector, bool) { + return nil, false +} + +// AsAwsCloudTrailDataConnector is the BasicDataConnector implementation for MSTIDataConnector. +func (mdc MSTIDataConnector) AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) { + return nil, false +} + +// AsAwsS3DataConnector is the BasicDataConnector implementation for MSTIDataConnector. +func (mdc MSTIDataConnector) AsAwsS3DataConnector() (*AwsS3DataConnector, bool) { + return nil, false +} + +// AsMCASDataConnector is the BasicDataConnector implementation for MSTIDataConnector. +func (mdc MSTIDataConnector) AsMCASDataConnector() (*MCASDataConnector, bool) { + return nil, false +} + +// AsDynamics365DataConnector is the BasicDataConnector implementation for MSTIDataConnector. +func (mdc MSTIDataConnector) AsDynamics365DataConnector() (*Dynamics365DataConnector, bool) { + return nil, false +} + +// AsOfficeATPDataConnector is the BasicDataConnector implementation for MSTIDataConnector. +func (mdc MSTIDataConnector) AsOfficeATPDataConnector() (*OfficeATPDataConnector, bool) { + return nil, false +} + +// AsOffice365ProjectDataConnector is the BasicDataConnector implementation for MSTIDataConnector. +func (mdc MSTIDataConnector) AsOffice365ProjectDataConnector() (*Office365ProjectDataConnector, bool) { + return nil, false +} + +// AsOfficePowerBIDataConnector is the BasicDataConnector implementation for MSTIDataConnector. +func (mdc MSTIDataConnector) AsOfficePowerBIDataConnector() (*OfficePowerBIDataConnector, bool) { + return nil, false +} + +// AsOfficeIRMDataConnector is the BasicDataConnector implementation for MSTIDataConnector. +func (mdc MSTIDataConnector) AsOfficeIRMDataConnector() (*OfficeIRMDataConnector, bool) { + return nil, false +} + +// AsMDATPDataConnector is the BasicDataConnector implementation for MSTIDataConnector. +func (mdc MSTIDataConnector) AsMDATPDataConnector() (*MDATPDataConnector, bool) { + return nil, false +} + +// AsOfficeDataConnector is the BasicDataConnector implementation for MSTIDataConnector. +func (mdc MSTIDataConnector) AsOfficeDataConnector() (*OfficeDataConnector, bool) { + return nil, false +} + +// AsTIDataConnector is the BasicDataConnector implementation for MSTIDataConnector. +func (mdc MSTIDataConnector) AsTIDataConnector() (*TIDataConnector, bool) { + return nil, false +} + +// AsTiTaxiiDataConnector is the BasicDataConnector implementation for MSTIDataConnector. +func (mdc MSTIDataConnector) AsTiTaxiiDataConnector() (*TiTaxiiDataConnector, bool) { + return nil, false +} + +// AsIoTDataConnector is the BasicDataConnector implementation for MSTIDataConnector. +func (mdc MSTIDataConnector) AsIoTDataConnector() (*IoTDataConnector, bool) { + return nil, false +} + +// AsCodelessUIDataConnector is the BasicDataConnector implementation for MSTIDataConnector. +func (mdc MSTIDataConnector) AsCodelessUIDataConnector() (*CodelessUIDataConnector, bool) { + return nil, false +} + +// AsCodelessAPIPollingDataConnector is the BasicDataConnector implementation for MSTIDataConnector. +func (mdc MSTIDataConnector) AsCodelessAPIPollingDataConnector() (*CodelessAPIPollingDataConnector, bool) { + return nil, false +} + +// AsDataConnector is the BasicDataConnector implementation for MSTIDataConnector. +func (mdc MSTIDataConnector) AsDataConnector() (*DataConnector, bool) { + return nil, false +} + +// AsBasicDataConnector is the BasicDataConnector implementation for MSTIDataConnector. +func (mdc MSTIDataConnector) AsBasicDataConnector() (BasicDataConnector, bool) { + return &mdc, true +} + +// UnmarshalJSON is the custom unmarshaler for MSTIDataConnector struct. +func (mdc *MSTIDataConnector) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var mSTIDataConnectorProperties MSTIDataConnectorProperties + err = json.Unmarshal(*v, &mSTIDataConnectorProperties) + if err != nil { + return err + } + mdc.MSTIDataConnectorProperties = &mSTIDataConnectorProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnector + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + mdc.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + mdc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mdc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mdc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mdc.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mdc.SystemData = &systemData + } + } + } + + return nil +} + +// MSTIDataConnectorDataTypes the available data types for Microsoft Threat Intelligence Platforms data +// connector. +type MSTIDataConnectorDataTypes struct { + // BingSafetyPhishingURL - Data type for Microsoft Threat Intelligence Platforms data connector. + BingSafetyPhishingURL *MSTIDataConnectorDataTypesBingSafetyPhishingURL `json:"bingSafetyPhishingURL,omitempty"` + // MicrosoftEmergingThreatFeed - Data type for Microsoft Threat Intelligence Platforms data connector. + MicrosoftEmergingThreatFeed *MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed `json:"microsoftEmergingThreatFeed,omitempty"` +} + +// MSTIDataConnectorDataTypesBingSafetyPhishingURL data type for Microsoft Threat Intelligence Platforms +// data connector. +type MSTIDataConnectorDataTypesBingSafetyPhishingURL struct { + // LookbackPeriod - lookback period + LookbackPeriod *string `json:"lookbackPeriod,omitempty"` + // State - Describe whether this data type connection is enabled or not. Possible values include: 'DataTypeStateEnabled', 'DataTypeStateDisabled' + State DataTypeState `json:"state,omitempty"` +} + +// MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed data type for Microsoft Threat Intelligence +// Platforms data connector. +type MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed struct { + // LookbackPeriod - lookback period + LookbackPeriod *string `json:"lookbackPeriod,omitempty"` + // State - Describe whether this data type connection is enabled or not. Possible values include: 'DataTypeStateEnabled', 'DataTypeStateDisabled' + State DataTypeState `json:"state,omitempty"` +} + +// MSTIDataConnectorProperties microsoft Threat Intelligence data connector properties. +type MSTIDataConnectorProperties struct { + // DataTypes - The available data types for the connector. + DataTypes *MSTIDataConnectorDataTypes `json:"dataTypes,omitempty"` + // TenantID - The tenant id to connect to, and get the data from. + TenantID *string `json:"tenantId,omitempty"` +} + +// MtpCheckRequirements represents MTP (Microsoft Threat Protection) requirements check request. +type MtpCheckRequirements struct { + // MTPCheckRequirementsProperties - MTP (Microsoft Threat Protection) requirements check properties. + *MTPCheckRequirementsProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorsCheckRequirementsKindDataConnectorsCheckRequirements', 'KindBasicDataConnectorsCheckRequirementsKindAzureActiveDirectory', 'KindBasicDataConnectorsCheckRequirementsKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindAzureSecurityCenter', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesS3', 'KindBasicDataConnectorsCheckRequirementsKindDynamics365', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindOfficeATP', 'KindBasicDataConnectorsCheckRequirementsKindOfficeIRM', 'KindBasicDataConnectorsCheckRequirementsKindOffice365Project', 'KindBasicDataConnectorsCheckRequirementsKindOfficePowerBI', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligenceTaxii', 'KindBasicDataConnectorsCheckRequirementsKindIOT' + Kind KindBasicDataConnectorsCheckRequirements `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for MtpCheckRequirements. +func (mcr MtpCheckRequirements) MarshalJSON() ([]byte, error) { + mcr.Kind = KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatProtection + objectMap := make(map[string]interface{}) + if mcr.MTPCheckRequirementsProperties != nil { + objectMap["properties"] = mcr.MTPCheckRequirementsProperties + } + if mcr.Kind != "" { + objectMap["kind"] = mcr.Kind + } + return json.Marshal(objectMap) +} + +// AsAADCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MtpCheckRequirements. +func (mcr MtpCheckRequirements) AsAADCheckRequirements() (*AADCheckRequirements, bool) { + return nil, false +} + +// AsAATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MtpCheckRequirements. +func (mcr MtpCheckRequirements) AsAATPCheckRequirements() (*AATPCheckRequirements, bool) { + return nil, false +} + +// AsASCCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MtpCheckRequirements. +func (mcr MtpCheckRequirements) AsASCCheckRequirements() (*ASCCheckRequirements, bool) { + return nil, false +} + +// AsAwsCloudTrailCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MtpCheckRequirements. +func (mcr MtpCheckRequirements) AsAwsCloudTrailCheckRequirements() (*AwsCloudTrailCheckRequirements, bool) { + return nil, false +} + +// AsAwsS3CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MtpCheckRequirements. +func (mcr MtpCheckRequirements) AsAwsS3CheckRequirements() (*AwsS3CheckRequirements, bool) { + return nil, false +} + +// AsDynamics365CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MtpCheckRequirements. +func (mcr MtpCheckRequirements) AsDynamics365CheckRequirements() (*Dynamics365CheckRequirements, bool) { + return nil, false +} + +// AsMCASCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MtpCheckRequirements. +func (mcr MtpCheckRequirements) AsMCASCheckRequirements() (*MCASCheckRequirements, bool) { + return nil, false +} + +// AsMDATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MtpCheckRequirements. +func (mcr MtpCheckRequirements) AsMDATPCheckRequirements() (*MDATPCheckRequirements, bool) { + return nil, false +} + +// AsMSTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MtpCheckRequirements. +func (mcr MtpCheckRequirements) AsMSTICheckRequirements() (*MSTICheckRequirements, bool) { + return nil, false +} + +// AsMtpCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MtpCheckRequirements. +func (mcr MtpCheckRequirements) AsMtpCheckRequirements() (*MtpCheckRequirements, bool) { + return &mcr, true +} + +// AsOfficeATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MtpCheckRequirements. +func (mcr MtpCheckRequirements) AsOfficeATPCheckRequirements() (*OfficeATPCheckRequirements, bool) { + return nil, false +} + +// AsOfficeIRMCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MtpCheckRequirements. +func (mcr MtpCheckRequirements) AsOfficeIRMCheckRequirements() (*OfficeIRMCheckRequirements, bool) { + return nil, false +} + +// AsOffice365ProjectCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MtpCheckRequirements. +func (mcr MtpCheckRequirements) AsOffice365ProjectCheckRequirements() (*Office365ProjectCheckRequirements, bool) { + return nil, false +} + +// AsOfficePowerBICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MtpCheckRequirements. +func (mcr MtpCheckRequirements) AsOfficePowerBICheckRequirements() (*OfficePowerBICheckRequirements, bool) { + return nil, false +} + +// AsTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MtpCheckRequirements. +func (mcr MtpCheckRequirements) AsTICheckRequirements() (*TICheckRequirements, bool) { + return nil, false +} + +// AsTiTaxiiCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MtpCheckRequirements. +func (mcr MtpCheckRequirements) AsTiTaxiiCheckRequirements() (*TiTaxiiCheckRequirements, bool) { + return nil, false +} + +// AsIoTCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MtpCheckRequirements. +func (mcr MtpCheckRequirements) AsIoTCheckRequirements() (*IoTCheckRequirements, bool) { + return nil, false +} + +// AsDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MtpCheckRequirements. +func (mcr MtpCheckRequirements) AsDataConnectorsCheckRequirements() (*DataConnectorsCheckRequirements, bool) { + return nil, false +} + +// AsBasicDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for MtpCheckRequirements. +func (mcr MtpCheckRequirements) AsBasicDataConnectorsCheckRequirements() (BasicDataConnectorsCheckRequirements, bool) { + return &mcr, true +} + +// UnmarshalJSON is the custom unmarshaler for MtpCheckRequirements struct. +func (mcr *MtpCheckRequirements) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var mTPCheckRequirementsProperties MTPCheckRequirementsProperties + err = json.Unmarshal(*v, &mTPCheckRequirementsProperties) + if err != nil { + return err + } + mcr.MTPCheckRequirementsProperties = &mTPCheckRequirementsProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnectorsCheckRequirements + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + mcr.Kind = kind + } + } + } + + return nil +} + +// MTPCheckRequirementsProperties MTP (Microsoft Threat Protection) requirements check properties. +type MTPCheckRequirementsProperties struct { + // TenantID - The tenant id to connect to, and get the data from. + TenantID *string `json:"tenantId,omitempty"` +} + +// MTPDataConnector represents MTP (Microsoft Threat Protection) data connector. +type MTPDataConnector struct { + // MTPDataConnectorProperties - MTP (Microsoft Threat Protection) data connector properties. + *MTPDataConnectorProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorKindDataConnector', 'KindBasicDataConnectorKindAzureActiveDirectory', 'KindBasicDataConnectorKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorKindMicrosoftThreatProtection', 'KindBasicDataConnectorKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorKindAzureSecurityCenter', 'KindBasicDataConnectorKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorKindAmazonWebServicesS3', 'KindBasicDataConnectorKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorKindDynamics365', 'KindBasicDataConnectorKindOfficeATP', 'KindBasicDataConnectorKindOffice365Project', 'KindBasicDataConnectorKindOfficePowerBI', 'KindBasicDataConnectorKindOfficeIRM', 'KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorKindOffice365', 'KindBasicDataConnectorKindThreatIntelligence', 'KindBasicDataConnectorKindThreatIntelligenceTaxii', 'KindBasicDataConnectorKindIOT', 'KindBasicDataConnectorKindGenericUI', 'KindBasicDataConnectorKindAPIPolling' + Kind KindBasicDataConnector `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for MTPDataConnector. +func (mdc MTPDataConnector) MarshalJSON() ([]byte, error) { + mdc.Kind = KindBasicDataConnectorKindMicrosoftThreatProtection + objectMap := make(map[string]interface{}) + if mdc.MTPDataConnectorProperties != nil { + objectMap["properties"] = mdc.MTPDataConnectorProperties + } + if mdc.Kind != "" { + objectMap["kind"] = mdc.Kind + } + if mdc.Etag != nil { + objectMap["etag"] = mdc.Etag + } + return json.Marshal(objectMap) +} + +// AsAADDataConnector is the BasicDataConnector implementation for MTPDataConnector. +func (mdc MTPDataConnector) AsAADDataConnector() (*AADDataConnector, bool) { + return nil, false +} + +// AsMSTIDataConnector is the BasicDataConnector implementation for MTPDataConnector. +func (mdc MTPDataConnector) AsMSTIDataConnector() (*MSTIDataConnector, bool) { + return nil, false +} + +// AsMTPDataConnector is the BasicDataConnector implementation for MTPDataConnector. +func (mdc MTPDataConnector) AsMTPDataConnector() (*MTPDataConnector, bool) { + return &mdc, true +} + +// AsAATPDataConnector is the BasicDataConnector implementation for MTPDataConnector. +func (mdc MTPDataConnector) AsAATPDataConnector() (*AATPDataConnector, bool) { + return nil, false +} + +// AsASCDataConnector is the BasicDataConnector implementation for MTPDataConnector. +func (mdc MTPDataConnector) AsASCDataConnector() (*ASCDataConnector, bool) { + return nil, false +} + +// AsAwsCloudTrailDataConnector is the BasicDataConnector implementation for MTPDataConnector. +func (mdc MTPDataConnector) AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) { + return nil, false +} + +// AsAwsS3DataConnector is the BasicDataConnector implementation for MTPDataConnector. +func (mdc MTPDataConnector) AsAwsS3DataConnector() (*AwsS3DataConnector, bool) { + return nil, false +} + +// AsMCASDataConnector is the BasicDataConnector implementation for MTPDataConnector. +func (mdc MTPDataConnector) AsMCASDataConnector() (*MCASDataConnector, bool) { + return nil, false +} + +// AsDynamics365DataConnector is the BasicDataConnector implementation for MTPDataConnector. +func (mdc MTPDataConnector) AsDynamics365DataConnector() (*Dynamics365DataConnector, bool) { + return nil, false +} + +// AsOfficeATPDataConnector is the BasicDataConnector implementation for MTPDataConnector. +func (mdc MTPDataConnector) AsOfficeATPDataConnector() (*OfficeATPDataConnector, bool) { + return nil, false +} + +// AsOffice365ProjectDataConnector is the BasicDataConnector implementation for MTPDataConnector. +func (mdc MTPDataConnector) AsOffice365ProjectDataConnector() (*Office365ProjectDataConnector, bool) { + return nil, false +} + +// AsOfficePowerBIDataConnector is the BasicDataConnector implementation for MTPDataConnector. +func (mdc MTPDataConnector) AsOfficePowerBIDataConnector() (*OfficePowerBIDataConnector, bool) { + return nil, false +} + +// AsOfficeIRMDataConnector is the BasicDataConnector implementation for MTPDataConnector. +func (mdc MTPDataConnector) AsOfficeIRMDataConnector() (*OfficeIRMDataConnector, bool) { + return nil, false +} + +// AsMDATPDataConnector is the BasicDataConnector implementation for MTPDataConnector. +func (mdc MTPDataConnector) AsMDATPDataConnector() (*MDATPDataConnector, bool) { + return nil, false +} + +// AsOfficeDataConnector is the BasicDataConnector implementation for MTPDataConnector. +func (mdc MTPDataConnector) AsOfficeDataConnector() (*OfficeDataConnector, bool) { + return nil, false +} + +// AsTIDataConnector is the BasicDataConnector implementation for MTPDataConnector. +func (mdc MTPDataConnector) AsTIDataConnector() (*TIDataConnector, bool) { + return nil, false +} + +// AsTiTaxiiDataConnector is the BasicDataConnector implementation for MTPDataConnector. +func (mdc MTPDataConnector) AsTiTaxiiDataConnector() (*TiTaxiiDataConnector, bool) { + return nil, false +} + +// AsIoTDataConnector is the BasicDataConnector implementation for MTPDataConnector. +func (mdc MTPDataConnector) AsIoTDataConnector() (*IoTDataConnector, bool) { + return nil, false +} + +// AsCodelessUIDataConnector is the BasicDataConnector implementation for MTPDataConnector. +func (mdc MTPDataConnector) AsCodelessUIDataConnector() (*CodelessUIDataConnector, bool) { + return nil, false +} + +// AsCodelessAPIPollingDataConnector is the BasicDataConnector implementation for MTPDataConnector. +func (mdc MTPDataConnector) AsCodelessAPIPollingDataConnector() (*CodelessAPIPollingDataConnector, bool) { + return nil, false +} + +// AsDataConnector is the BasicDataConnector implementation for MTPDataConnector. +func (mdc MTPDataConnector) AsDataConnector() (*DataConnector, bool) { + return nil, false +} + +// AsBasicDataConnector is the BasicDataConnector implementation for MTPDataConnector. +func (mdc MTPDataConnector) AsBasicDataConnector() (BasicDataConnector, bool) { + return &mdc, true +} + +// UnmarshalJSON is the custom unmarshaler for MTPDataConnector struct. +func (mdc *MTPDataConnector) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var mTPDataConnectorProperties MTPDataConnectorProperties + err = json.Unmarshal(*v, &mTPDataConnectorProperties) + if err != nil { + return err + } + mdc.MTPDataConnectorProperties = &mTPDataConnectorProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnector + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + mdc.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + mdc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mdc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mdc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mdc.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mdc.SystemData = &systemData + } + } + } + + return nil +} + +// MTPDataConnectorDataTypes the available data types for Microsoft Threat Protection Platforms data +// connector. +type MTPDataConnectorDataTypes struct { + // Incidents - Data type for Microsoft Threat Protection Platforms data connector. + Incidents *MTPDataConnectorDataTypesIncidents `json:"incidents,omitempty"` +} + +// MTPDataConnectorDataTypesIncidents data type for Microsoft Threat Protection Platforms data connector. +type MTPDataConnectorDataTypesIncidents struct { + // State - Describe whether this data type connection is enabled or not. Possible values include: 'DataTypeStateEnabled', 'DataTypeStateDisabled' + State DataTypeState `json:"state,omitempty"` +} + +// MTPDataConnectorProperties MTP (Microsoft Threat Protection) data connector properties. +type MTPDataConnectorProperties struct { + // DataTypes - The available data types for the connector. + DataTypes *MTPDataConnectorDataTypes `json:"dataTypes,omitempty"` + // TenantID - The tenant id to connect to, and get the data from. + TenantID *string `json:"tenantId,omitempty"` +} + +// NrtAlertRule represents NRT alert rule. +type NrtAlertRule struct { + // NrtAlertRuleProperties - NRT alert rule properties + *NrtAlertRuleProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicAlertRuleKindAlertRule', 'KindBasicAlertRuleKindMLBehaviorAnalytics', 'KindBasicAlertRuleKindFusion', 'KindBasicAlertRuleKindThreatIntelligence', 'KindBasicAlertRuleKindMicrosoftSecurityIncidentCreation', 'KindBasicAlertRuleKindScheduled', 'KindBasicAlertRuleKindNRT' + Kind KindBasicAlertRule `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for NrtAlertRule. +func (nar NrtAlertRule) MarshalJSON() ([]byte, error) { + nar.Kind = KindBasicAlertRuleKindNRT + objectMap := make(map[string]interface{}) + if nar.NrtAlertRuleProperties != nil { + objectMap["properties"] = nar.NrtAlertRuleProperties + } + if nar.Kind != "" { + objectMap["kind"] = nar.Kind + } + if nar.Etag != nil { + objectMap["etag"] = nar.Etag + } + return json.Marshal(objectMap) +} + +// AsMLBehaviorAnalyticsAlertRule is the BasicAlertRule implementation for NrtAlertRule. +func (nar NrtAlertRule) AsMLBehaviorAnalyticsAlertRule() (*MLBehaviorAnalyticsAlertRule, bool) { + return nil, false +} + +// AsFusionAlertRule is the BasicAlertRule implementation for NrtAlertRule. +func (nar NrtAlertRule) AsFusionAlertRule() (*FusionAlertRule, bool) { + return nil, false +} + +// AsThreatIntelligenceAlertRule is the BasicAlertRule implementation for NrtAlertRule. +func (nar NrtAlertRule) AsThreatIntelligenceAlertRule() (*ThreatIntelligenceAlertRule, bool) { + return nil, false +} + +// AsMicrosoftSecurityIncidentCreationAlertRule is the BasicAlertRule implementation for NrtAlertRule. +func (nar NrtAlertRule) AsMicrosoftSecurityIncidentCreationAlertRule() (*MicrosoftSecurityIncidentCreationAlertRule, bool) { + return nil, false +} + +// AsScheduledAlertRule is the BasicAlertRule implementation for NrtAlertRule. +func (nar NrtAlertRule) AsScheduledAlertRule() (*ScheduledAlertRule, bool) { + return nil, false +} + +// AsNrtAlertRule is the BasicAlertRule implementation for NrtAlertRule. +func (nar NrtAlertRule) AsNrtAlertRule() (*NrtAlertRule, bool) { + return &nar, true +} + +// AsAlertRule is the BasicAlertRule implementation for NrtAlertRule. +func (nar NrtAlertRule) AsAlertRule() (*AlertRule, bool) { + return nil, false +} + +// AsBasicAlertRule is the BasicAlertRule implementation for NrtAlertRule. +func (nar NrtAlertRule) AsBasicAlertRule() (BasicAlertRule, bool) { + return &nar, true +} + +// UnmarshalJSON is the custom unmarshaler for NrtAlertRule struct. +func (nar *NrtAlertRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var nrtAlertRuleProperties NrtAlertRuleProperties + err = json.Unmarshal(*v, &nrtAlertRuleProperties) + if err != nil { + return err + } + nar.NrtAlertRuleProperties = &nrtAlertRuleProperties + } + case "kind": + if v != nil { + var kind KindBasicAlertRule + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + nar.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + nar.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + nar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + nar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + nar.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + nar.SystemData = &systemData + } + } + } + + return nil +} + +// NrtAlertRuleProperties nrt alert rule base property bag. +type NrtAlertRuleProperties struct { + // AlertRuleTemplateName - The Name of the alert rule template used to create this rule. + AlertRuleTemplateName *string `json:"alertRuleTemplateName,omitempty"` + // TemplateVersion - The version of the alert rule template used to create this rule - in format , where all are numbers, for example 0 <1.0.2> + TemplateVersion *string `json:"templateVersion,omitempty"` + // Description - The description of the alert rule. + Description *string `json:"description,omitempty"` + // Query - The query that creates alerts for this rule. + Query *string `json:"query,omitempty"` + // Tactics - The tactics of the alert rule + Tactics *[]AttackTactic `json:"tactics,omitempty"` + // Techniques - The techniques of the alert rule + Techniques *[]string `json:"techniques,omitempty"` + // DisplayName - The display name for alerts created by this alert rule. + DisplayName *string `json:"displayName,omitempty"` + // Enabled - Determines whether this alert rule is enabled or disabled. + Enabled *bool `json:"enabled,omitempty"` + // LastModifiedUtc - READ-ONLY; The last time that this alert rule has been modified. + LastModifiedUtc *date.Time `json:"lastModifiedUtc,omitempty"` + // SuppressionDuration - The suppression (in ISO 8601 duration format) to wait since last time this alert rule been triggered. + SuppressionDuration *string `json:"suppressionDuration,omitempty"` + // SuppressionEnabled - Determines whether the suppression for this alert rule is enabled or disabled. + SuppressionEnabled *bool `json:"suppressionEnabled,omitempty"` + // Severity - The severity for alerts created by this alert rule. Possible values include: 'AlertSeverityHigh', 'AlertSeverityMedium', 'AlertSeverityLow', 'AlertSeverityInformational' + Severity AlertSeverity `json:"severity,omitempty"` + // IncidentConfiguration - The settings of the incidents that created from alerts triggered by this analytics rule + IncidentConfiguration *IncidentConfiguration `json:"incidentConfiguration,omitempty"` + // CustomDetails - Dictionary of string key-value pairs of columns to be attached to the alert + CustomDetails map[string]*string `json:"customDetails"` + // EntityMappings - Array of the entity mappings of the alert rule + EntityMappings *[]EntityMapping `json:"entityMappings,omitempty"` + // AlertDetailsOverride - The alert details override settings + AlertDetailsOverride *AlertDetailsOverride `json:"alertDetailsOverride,omitempty"` +} + +// MarshalJSON is the custom marshaler for NrtAlertRuleProperties. +func (narp NrtAlertRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if narp.AlertRuleTemplateName != nil { + objectMap["alertRuleTemplateName"] = narp.AlertRuleTemplateName + } + if narp.TemplateVersion != nil { + objectMap["templateVersion"] = narp.TemplateVersion + } + if narp.Description != nil { + objectMap["description"] = narp.Description + } + if narp.Query != nil { + objectMap["query"] = narp.Query + } + if narp.Tactics != nil { + objectMap["tactics"] = narp.Tactics + } + if narp.Techniques != nil { + objectMap["techniques"] = narp.Techniques + } + if narp.DisplayName != nil { + objectMap["displayName"] = narp.DisplayName + } + if narp.Enabled != nil { + objectMap["enabled"] = narp.Enabled + } + if narp.SuppressionDuration != nil { + objectMap["suppressionDuration"] = narp.SuppressionDuration + } + if narp.SuppressionEnabled != nil { + objectMap["suppressionEnabled"] = narp.SuppressionEnabled + } + if narp.Severity != "" { + objectMap["severity"] = narp.Severity + } + if narp.IncidentConfiguration != nil { + objectMap["incidentConfiguration"] = narp.IncidentConfiguration + } + if narp.CustomDetails != nil { + objectMap["customDetails"] = narp.CustomDetails + } + if narp.EntityMappings != nil { + objectMap["entityMappings"] = narp.EntityMappings + } + if narp.AlertDetailsOverride != nil { + objectMap["alertDetailsOverride"] = narp.AlertDetailsOverride + } + return json.Marshal(objectMap) +} + +// NrtAlertRuleTemplate represents NRT alert rule template. +type NrtAlertRuleTemplate struct { + // NrtAlertRuleTemplateProperties - NRT alert rule template properties + *NrtAlertRuleTemplateProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicAlertRuleTemplateKindAlertRuleTemplate', 'KindBasicAlertRuleTemplateKindMLBehaviorAnalytics', 'KindBasicAlertRuleTemplateKindFusion', 'KindBasicAlertRuleTemplateKindThreatIntelligence', 'KindBasicAlertRuleTemplateKindMicrosoftSecurityIncidentCreation', 'KindBasicAlertRuleTemplateKindScheduled', 'KindBasicAlertRuleTemplateKindNRT' + Kind KindBasicAlertRuleTemplate `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for NrtAlertRuleTemplate. +func (nart NrtAlertRuleTemplate) MarshalJSON() ([]byte, error) { + nart.Kind = KindBasicAlertRuleTemplateKindNRT + objectMap := make(map[string]interface{}) + if nart.NrtAlertRuleTemplateProperties != nil { + objectMap["properties"] = nart.NrtAlertRuleTemplateProperties + } + if nart.Kind != "" { + objectMap["kind"] = nart.Kind + } + return json.Marshal(objectMap) +} + +// AsMLBehaviorAnalyticsAlertRuleTemplate is the BasicAlertRuleTemplate implementation for NrtAlertRuleTemplate. +func (nart NrtAlertRuleTemplate) AsMLBehaviorAnalyticsAlertRuleTemplate() (*MLBehaviorAnalyticsAlertRuleTemplate, bool) { + return nil, false +} + +// AsFusionAlertRuleTemplate is the BasicAlertRuleTemplate implementation for NrtAlertRuleTemplate. +func (nart NrtAlertRuleTemplate) AsFusionAlertRuleTemplate() (*FusionAlertRuleTemplate, bool) { + return nil, false +} + +// AsThreatIntelligenceAlertRuleTemplate is the BasicAlertRuleTemplate implementation for NrtAlertRuleTemplate. +func (nart NrtAlertRuleTemplate) AsThreatIntelligenceAlertRuleTemplate() (*ThreatIntelligenceAlertRuleTemplate, bool) { + return nil, false +} + +// AsMicrosoftSecurityIncidentCreationAlertRuleTemplate is the BasicAlertRuleTemplate implementation for NrtAlertRuleTemplate. +func (nart NrtAlertRuleTemplate) AsMicrosoftSecurityIncidentCreationAlertRuleTemplate() (*MicrosoftSecurityIncidentCreationAlertRuleTemplate, bool) { + return nil, false +} + +// AsScheduledAlertRuleTemplate is the BasicAlertRuleTemplate implementation for NrtAlertRuleTemplate. +func (nart NrtAlertRuleTemplate) AsScheduledAlertRuleTemplate() (*ScheduledAlertRuleTemplate, bool) { + return nil, false +} + +// AsNrtAlertRuleTemplate is the BasicAlertRuleTemplate implementation for NrtAlertRuleTemplate. +func (nart NrtAlertRuleTemplate) AsNrtAlertRuleTemplate() (*NrtAlertRuleTemplate, bool) { + return &nart, true +} + +// AsAlertRuleTemplate is the BasicAlertRuleTemplate implementation for NrtAlertRuleTemplate. +func (nart NrtAlertRuleTemplate) AsAlertRuleTemplate() (*AlertRuleTemplate, bool) { + return nil, false +} + +// AsBasicAlertRuleTemplate is the BasicAlertRuleTemplate implementation for NrtAlertRuleTemplate. +func (nart NrtAlertRuleTemplate) AsBasicAlertRuleTemplate() (BasicAlertRuleTemplate, bool) { + return &nart, true +} + +// UnmarshalJSON is the custom unmarshaler for NrtAlertRuleTemplate struct. +func (nart *NrtAlertRuleTemplate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var nrtAlertRuleTemplateProperties NrtAlertRuleTemplateProperties + err = json.Unmarshal(*v, &nrtAlertRuleTemplateProperties) + if err != nil { + return err + } + nart.NrtAlertRuleTemplateProperties = &nrtAlertRuleTemplateProperties + } + case "kind": + if v != nil { + var kind KindBasicAlertRuleTemplate + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + nart.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + nart.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + nart.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + nart.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + nart.SystemData = &systemData + } + } + } + + return nil +} + +// NrtAlertRuleTemplateProperties NRT alert rule template properties +type NrtAlertRuleTemplateProperties struct { + // Tactics - The tactics of the alert rule + Tactics *[]AttackTactic `json:"tactics,omitempty"` + // Techniques - The techniques of the alert rule + Techniques *[]string `json:"techniques,omitempty"` + // Query - The query that creates alerts for this rule. + Query *string `json:"query,omitempty"` + // Severity - The severity for alerts created by this alert rule. Possible values include: 'AlertSeverityHigh', 'AlertSeverityMedium', 'AlertSeverityLow', 'AlertSeverityInformational' + Severity AlertSeverity `json:"severity,omitempty"` + // Version - The version of this template - in format , where all are numbers. For example <1.0.2>. + Version *string `json:"version,omitempty"` + // CustomDetails - Dictionary of string key-value pairs of columns to be attached to the alert + CustomDetails map[string]*string `json:"customDetails"` + // EntityMappings - Array of the entity mappings of the alert rule + EntityMappings *[]EntityMapping `json:"entityMappings,omitempty"` + // AlertDetailsOverride - The alert details override settings + AlertDetailsOverride *AlertDetailsOverride `json:"alertDetailsOverride,omitempty"` +} + +// MarshalJSON is the custom marshaler for NrtAlertRuleTemplateProperties. +func (nart NrtAlertRuleTemplateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if nart.Tactics != nil { + objectMap["tactics"] = nart.Tactics + } + if nart.Techniques != nil { + objectMap["techniques"] = nart.Techniques + } + if nart.Query != nil { + objectMap["query"] = nart.Query + } + if nart.Severity != "" { + objectMap["severity"] = nart.Severity + } + if nart.Version != nil { + objectMap["version"] = nart.Version + } + if nart.CustomDetails != nil { + objectMap["customDetails"] = nart.CustomDetails + } + if nart.EntityMappings != nil { + objectMap["entityMappings"] = nart.EntityMappings + } + if nart.AlertDetailsOverride != nil { + objectMap["alertDetailsOverride"] = nart.AlertDetailsOverride + } + return json.Marshal(objectMap) +} + +// Office365ProjectCheckRequirements represents Office365 Project requirements check request. +type Office365ProjectCheckRequirements struct { + // Office365ProjectCheckRequirementsProperties - Office365 Project requirements check properties. + *Office365ProjectCheckRequirementsProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorsCheckRequirementsKindDataConnectorsCheckRequirements', 'KindBasicDataConnectorsCheckRequirementsKindAzureActiveDirectory', 'KindBasicDataConnectorsCheckRequirementsKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindAzureSecurityCenter', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesS3', 'KindBasicDataConnectorsCheckRequirementsKindDynamics365', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindOfficeATP', 'KindBasicDataConnectorsCheckRequirementsKindOfficeIRM', 'KindBasicDataConnectorsCheckRequirementsKindOffice365Project', 'KindBasicDataConnectorsCheckRequirementsKindOfficePowerBI', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligenceTaxii', 'KindBasicDataConnectorsCheckRequirementsKindIOT' + Kind KindBasicDataConnectorsCheckRequirements `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for Office365ProjectCheckRequirements. +func (o3pcr Office365ProjectCheckRequirements) MarshalJSON() ([]byte, error) { + o3pcr.Kind = KindBasicDataConnectorsCheckRequirementsKindOffice365Project + objectMap := make(map[string]interface{}) + if o3pcr.Office365ProjectCheckRequirementsProperties != nil { + objectMap["properties"] = o3pcr.Office365ProjectCheckRequirementsProperties + } + if o3pcr.Kind != "" { + objectMap["kind"] = o3pcr.Kind + } + return json.Marshal(objectMap) +} + +// AsAADCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Office365ProjectCheckRequirements. +func (o3pcr Office365ProjectCheckRequirements) AsAADCheckRequirements() (*AADCheckRequirements, bool) { + return nil, false +} + +// AsAATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Office365ProjectCheckRequirements. +func (o3pcr Office365ProjectCheckRequirements) AsAATPCheckRequirements() (*AATPCheckRequirements, bool) { + return nil, false +} + +// AsASCCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Office365ProjectCheckRequirements. +func (o3pcr Office365ProjectCheckRequirements) AsASCCheckRequirements() (*ASCCheckRequirements, bool) { + return nil, false +} + +// AsAwsCloudTrailCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Office365ProjectCheckRequirements. +func (o3pcr Office365ProjectCheckRequirements) AsAwsCloudTrailCheckRequirements() (*AwsCloudTrailCheckRequirements, bool) { + return nil, false +} + +// AsAwsS3CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Office365ProjectCheckRequirements. +func (o3pcr Office365ProjectCheckRequirements) AsAwsS3CheckRequirements() (*AwsS3CheckRequirements, bool) { + return nil, false +} + +// AsDynamics365CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Office365ProjectCheckRequirements. +func (o3pcr Office365ProjectCheckRequirements) AsDynamics365CheckRequirements() (*Dynamics365CheckRequirements, bool) { + return nil, false +} + +// AsMCASCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Office365ProjectCheckRequirements. +func (o3pcr Office365ProjectCheckRequirements) AsMCASCheckRequirements() (*MCASCheckRequirements, bool) { + return nil, false +} + +// AsMDATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Office365ProjectCheckRequirements. +func (o3pcr Office365ProjectCheckRequirements) AsMDATPCheckRequirements() (*MDATPCheckRequirements, bool) { + return nil, false +} + +// AsMSTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Office365ProjectCheckRequirements. +func (o3pcr Office365ProjectCheckRequirements) AsMSTICheckRequirements() (*MSTICheckRequirements, bool) { + return nil, false +} + +// AsMtpCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Office365ProjectCheckRequirements. +func (o3pcr Office365ProjectCheckRequirements) AsMtpCheckRequirements() (*MtpCheckRequirements, bool) { + return nil, false +} + +// AsOfficeATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Office365ProjectCheckRequirements. +func (o3pcr Office365ProjectCheckRequirements) AsOfficeATPCheckRequirements() (*OfficeATPCheckRequirements, bool) { + return nil, false +} + +// AsOfficeIRMCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Office365ProjectCheckRequirements. +func (o3pcr Office365ProjectCheckRequirements) AsOfficeIRMCheckRequirements() (*OfficeIRMCheckRequirements, bool) { + return nil, false +} + +// AsOffice365ProjectCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Office365ProjectCheckRequirements. +func (o3pcr Office365ProjectCheckRequirements) AsOffice365ProjectCheckRequirements() (*Office365ProjectCheckRequirements, bool) { + return &o3pcr, true +} + +// AsOfficePowerBICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Office365ProjectCheckRequirements. +func (o3pcr Office365ProjectCheckRequirements) AsOfficePowerBICheckRequirements() (*OfficePowerBICheckRequirements, bool) { + return nil, false +} + +// AsTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Office365ProjectCheckRequirements. +func (o3pcr Office365ProjectCheckRequirements) AsTICheckRequirements() (*TICheckRequirements, bool) { + return nil, false +} + +// AsTiTaxiiCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Office365ProjectCheckRequirements. +func (o3pcr Office365ProjectCheckRequirements) AsTiTaxiiCheckRequirements() (*TiTaxiiCheckRequirements, bool) { + return nil, false +} + +// AsIoTCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Office365ProjectCheckRequirements. +func (o3pcr Office365ProjectCheckRequirements) AsIoTCheckRequirements() (*IoTCheckRequirements, bool) { + return nil, false +} + +// AsDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Office365ProjectCheckRequirements. +func (o3pcr Office365ProjectCheckRequirements) AsDataConnectorsCheckRequirements() (*DataConnectorsCheckRequirements, bool) { + return nil, false +} + +// AsBasicDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for Office365ProjectCheckRequirements. +func (o3pcr Office365ProjectCheckRequirements) AsBasicDataConnectorsCheckRequirements() (BasicDataConnectorsCheckRequirements, bool) { + return &o3pcr, true +} + +// UnmarshalJSON is the custom unmarshaler for Office365ProjectCheckRequirements struct. +func (o3pcr *Office365ProjectCheckRequirements) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var office365ProjectCheckRequirementsProperties Office365ProjectCheckRequirementsProperties + err = json.Unmarshal(*v, &office365ProjectCheckRequirementsProperties) + if err != nil { + return err + } + o3pcr.Office365ProjectCheckRequirementsProperties = &office365ProjectCheckRequirementsProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnectorsCheckRequirements + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + o3pcr.Kind = kind + } + } + } + + return nil +} + +// Office365ProjectCheckRequirementsProperties office365 Project requirements check properties. +type Office365ProjectCheckRequirementsProperties struct { + // TenantID - The tenant id to connect to, and get the data from. + TenantID *string `json:"tenantId,omitempty"` +} + +// Office365ProjectConnectorDataTypes the available data types for Office Microsoft Project data connector. +type Office365ProjectConnectorDataTypes struct { + // Logs - Logs data type. + Logs *Office365ProjectConnectorDataTypesLogs `json:"logs,omitempty"` +} + +// Office365ProjectConnectorDataTypesLogs logs data type. +type Office365ProjectConnectorDataTypesLogs struct { + // State - Describe whether this data type connection is enabled or not. Possible values include: 'DataTypeStateEnabled', 'DataTypeStateDisabled' + State DataTypeState `json:"state,omitempty"` +} + +// Office365ProjectDataConnector represents Office Microsoft Project data connector. +type Office365ProjectDataConnector struct { + // Office365ProjectDataConnectorProperties - Office Microsoft Project data connector properties. + *Office365ProjectDataConnectorProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorKindDataConnector', 'KindBasicDataConnectorKindAzureActiveDirectory', 'KindBasicDataConnectorKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorKindMicrosoftThreatProtection', 'KindBasicDataConnectorKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorKindAzureSecurityCenter', 'KindBasicDataConnectorKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorKindAmazonWebServicesS3', 'KindBasicDataConnectorKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorKindDynamics365', 'KindBasicDataConnectorKindOfficeATP', 'KindBasicDataConnectorKindOffice365Project', 'KindBasicDataConnectorKindOfficePowerBI', 'KindBasicDataConnectorKindOfficeIRM', 'KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorKindOffice365', 'KindBasicDataConnectorKindThreatIntelligence', 'KindBasicDataConnectorKindThreatIntelligenceTaxii', 'KindBasicDataConnectorKindIOT', 'KindBasicDataConnectorKindGenericUI', 'KindBasicDataConnectorKindAPIPolling' + Kind KindBasicDataConnector `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Office365ProjectDataConnector. +func (o3pdc Office365ProjectDataConnector) MarshalJSON() ([]byte, error) { + o3pdc.Kind = KindBasicDataConnectorKindOffice365Project + objectMap := make(map[string]interface{}) + if o3pdc.Office365ProjectDataConnectorProperties != nil { + objectMap["properties"] = o3pdc.Office365ProjectDataConnectorProperties + } + if o3pdc.Kind != "" { + objectMap["kind"] = o3pdc.Kind + } + if o3pdc.Etag != nil { + objectMap["etag"] = o3pdc.Etag + } + return json.Marshal(objectMap) +} + +// AsAADDataConnector is the BasicDataConnector implementation for Office365ProjectDataConnector. +func (o3pdc Office365ProjectDataConnector) AsAADDataConnector() (*AADDataConnector, bool) { + return nil, false +} + +// AsMSTIDataConnector is the BasicDataConnector implementation for Office365ProjectDataConnector. +func (o3pdc Office365ProjectDataConnector) AsMSTIDataConnector() (*MSTIDataConnector, bool) { + return nil, false +} + +// AsMTPDataConnector is the BasicDataConnector implementation for Office365ProjectDataConnector. +func (o3pdc Office365ProjectDataConnector) AsMTPDataConnector() (*MTPDataConnector, bool) { + return nil, false +} + +// AsAATPDataConnector is the BasicDataConnector implementation for Office365ProjectDataConnector. +func (o3pdc Office365ProjectDataConnector) AsAATPDataConnector() (*AATPDataConnector, bool) { + return nil, false +} + +// AsASCDataConnector is the BasicDataConnector implementation for Office365ProjectDataConnector. +func (o3pdc Office365ProjectDataConnector) AsASCDataConnector() (*ASCDataConnector, bool) { + return nil, false +} + +// AsAwsCloudTrailDataConnector is the BasicDataConnector implementation for Office365ProjectDataConnector. +func (o3pdc Office365ProjectDataConnector) AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) { + return nil, false +} + +// AsAwsS3DataConnector is the BasicDataConnector implementation for Office365ProjectDataConnector. +func (o3pdc Office365ProjectDataConnector) AsAwsS3DataConnector() (*AwsS3DataConnector, bool) { + return nil, false +} + +// AsMCASDataConnector is the BasicDataConnector implementation for Office365ProjectDataConnector. +func (o3pdc Office365ProjectDataConnector) AsMCASDataConnector() (*MCASDataConnector, bool) { + return nil, false +} + +// AsDynamics365DataConnector is the BasicDataConnector implementation for Office365ProjectDataConnector. +func (o3pdc Office365ProjectDataConnector) AsDynamics365DataConnector() (*Dynamics365DataConnector, bool) { + return nil, false +} + +// AsOfficeATPDataConnector is the BasicDataConnector implementation for Office365ProjectDataConnector. +func (o3pdc Office365ProjectDataConnector) AsOfficeATPDataConnector() (*OfficeATPDataConnector, bool) { + return nil, false +} + +// AsOffice365ProjectDataConnector is the BasicDataConnector implementation for Office365ProjectDataConnector. +func (o3pdc Office365ProjectDataConnector) AsOffice365ProjectDataConnector() (*Office365ProjectDataConnector, bool) { + return &o3pdc, true +} + +// AsOfficePowerBIDataConnector is the BasicDataConnector implementation for Office365ProjectDataConnector. +func (o3pdc Office365ProjectDataConnector) AsOfficePowerBIDataConnector() (*OfficePowerBIDataConnector, bool) { + return nil, false +} + +// AsOfficeIRMDataConnector is the BasicDataConnector implementation for Office365ProjectDataConnector. +func (o3pdc Office365ProjectDataConnector) AsOfficeIRMDataConnector() (*OfficeIRMDataConnector, bool) { + return nil, false +} + +// AsMDATPDataConnector is the BasicDataConnector implementation for Office365ProjectDataConnector. +func (o3pdc Office365ProjectDataConnector) AsMDATPDataConnector() (*MDATPDataConnector, bool) { + return nil, false +} + +// AsOfficeDataConnector is the BasicDataConnector implementation for Office365ProjectDataConnector. +func (o3pdc Office365ProjectDataConnector) AsOfficeDataConnector() (*OfficeDataConnector, bool) { + return nil, false +} + +// AsTIDataConnector is the BasicDataConnector implementation for Office365ProjectDataConnector. +func (o3pdc Office365ProjectDataConnector) AsTIDataConnector() (*TIDataConnector, bool) { + return nil, false +} + +// AsTiTaxiiDataConnector is the BasicDataConnector implementation for Office365ProjectDataConnector. +func (o3pdc Office365ProjectDataConnector) AsTiTaxiiDataConnector() (*TiTaxiiDataConnector, bool) { + return nil, false +} + +// AsIoTDataConnector is the BasicDataConnector implementation for Office365ProjectDataConnector. +func (o3pdc Office365ProjectDataConnector) AsIoTDataConnector() (*IoTDataConnector, bool) { + return nil, false +} + +// AsCodelessUIDataConnector is the BasicDataConnector implementation for Office365ProjectDataConnector. +func (o3pdc Office365ProjectDataConnector) AsCodelessUIDataConnector() (*CodelessUIDataConnector, bool) { + return nil, false +} + +// AsCodelessAPIPollingDataConnector is the BasicDataConnector implementation for Office365ProjectDataConnector. +func (o3pdc Office365ProjectDataConnector) AsCodelessAPIPollingDataConnector() (*CodelessAPIPollingDataConnector, bool) { + return nil, false +} + +// AsDataConnector is the BasicDataConnector implementation for Office365ProjectDataConnector. +func (o3pdc Office365ProjectDataConnector) AsDataConnector() (*DataConnector, bool) { + return nil, false +} + +// AsBasicDataConnector is the BasicDataConnector implementation for Office365ProjectDataConnector. +func (o3pdc Office365ProjectDataConnector) AsBasicDataConnector() (BasicDataConnector, bool) { + return &o3pdc, true +} + +// UnmarshalJSON is the custom unmarshaler for Office365ProjectDataConnector struct. +func (o3pdc *Office365ProjectDataConnector) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var office365ProjectDataConnectorProperties Office365ProjectDataConnectorProperties + err = json.Unmarshal(*v, &office365ProjectDataConnectorProperties) + if err != nil { + return err + } + o3pdc.Office365ProjectDataConnectorProperties = &office365ProjectDataConnectorProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnector + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + o3pdc.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + o3pdc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + o3pdc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + o3pdc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + o3pdc.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + o3pdc.SystemData = &systemData + } + } + } + + return nil +} + +// Office365ProjectDataConnectorProperties office Microsoft Project data connector properties. +type Office365ProjectDataConnectorProperties struct { + // DataTypes - The available data types for the connector. + DataTypes *Office365ProjectConnectorDataTypes `json:"dataTypes,omitempty"` + // TenantID - The tenant id to connect to, and get the data from. + TenantID *string `json:"tenantId,omitempty"` +} + +// OfficeATPCheckRequirements represents OfficeATP (Office 365 Advanced Threat Protection) requirements +// check request. +type OfficeATPCheckRequirements struct { + // OfficeATPCheckRequirementsProperties - OfficeATP (Office 365 Advanced Threat Protection) requirements check properties. + *OfficeATPCheckRequirementsProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorsCheckRequirementsKindDataConnectorsCheckRequirements', 'KindBasicDataConnectorsCheckRequirementsKindAzureActiveDirectory', 'KindBasicDataConnectorsCheckRequirementsKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindAzureSecurityCenter', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesS3', 'KindBasicDataConnectorsCheckRequirementsKindDynamics365', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindOfficeATP', 'KindBasicDataConnectorsCheckRequirementsKindOfficeIRM', 'KindBasicDataConnectorsCheckRequirementsKindOffice365Project', 'KindBasicDataConnectorsCheckRequirementsKindOfficePowerBI', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligenceTaxii', 'KindBasicDataConnectorsCheckRequirementsKindIOT' + Kind KindBasicDataConnectorsCheckRequirements `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for OfficeATPCheckRequirements. +func (oacr OfficeATPCheckRequirements) MarshalJSON() ([]byte, error) { + oacr.Kind = KindBasicDataConnectorsCheckRequirementsKindOfficeATP + objectMap := make(map[string]interface{}) + if oacr.OfficeATPCheckRequirementsProperties != nil { + objectMap["properties"] = oacr.OfficeATPCheckRequirementsProperties + } + if oacr.Kind != "" { + objectMap["kind"] = oacr.Kind + } + return json.Marshal(objectMap) +} + +// AsAADCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeATPCheckRequirements. +func (oacr OfficeATPCheckRequirements) AsAADCheckRequirements() (*AADCheckRequirements, bool) { + return nil, false +} + +// AsAATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeATPCheckRequirements. +func (oacr OfficeATPCheckRequirements) AsAATPCheckRequirements() (*AATPCheckRequirements, bool) { + return nil, false +} + +// AsASCCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeATPCheckRequirements. +func (oacr OfficeATPCheckRequirements) AsASCCheckRequirements() (*ASCCheckRequirements, bool) { + return nil, false +} + +// AsAwsCloudTrailCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeATPCheckRequirements. +func (oacr OfficeATPCheckRequirements) AsAwsCloudTrailCheckRequirements() (*AwsCloudTrailCheckRequirements, bool) { + return nil, false +} + +// AsAwsS3CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeATPCheckRequirements. +func (oacr OfficeATPCheckRequirements) AsAwsS3CheckRequirements() (*AwsS3CheckRequirements, bool) { + return nil, false +} + +// AsDynamics365CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeATPCheckRequirements. +func (oacr OfficeATPCheckRequirements) AsDynamics365CheckRequirements() (*Dynamics365CheckRequirements, bool) { + return nil, false +} + +// AsMCASCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeATPCheckRequirements. +func (oacr OfficeATPCheckRequirements) AsMCASCheckRequirements() (*MCASCheckRequirements, bool) { + return nil, false +} + +// AsMDATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeATPCheckRequirements. +func (oacr OfficeATPCheckRequirements) AsMDATPCheckRequirements() (*MDATPCheckRequirements, bool) { + return nil, false +} + +// AsMSTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeATPCheckRequirements. +func (oacr OfficeATPCheckRequirements) AsMSTICheckRequirements() (*MSTICheckRequirements, bool) { + return nil, false +} + +// AsMtpCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeATPCheckRequirements. +func (oacr OfficeATPCheckRequirements) AsMtpCheckRequirements() (*MtpCheckRequirements, bool) { + return nil, false +} + +// AsOfficeATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeATPCheckRequirements. +func (oacr OfficeATPCheckRequirements) AsOfficeATPCheckRequirements() (*OfficeATPCheckRequirements, bool) { + return &oacr, true +} + +// AsOfficeIRMCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeATPCheckRequirements. +func (oacr OfficeATPCheckRequirements) AsOfficeIRMCheckRequirements() (*OfficeIRMCheckRequirements, bool) { + return nil, false +} + +// AsOffice365ProjectCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeATPCheckRequirements. +func (oacr OfficeATPCheckRequirements) AsOffice365ProjectCheckRequirements() (*Office365ProjectCheckRequirements, bool) { + return nil, false +} + +// AsOfficePowerBICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeATPCheckRequirements. +func (oacr OfficeATPCheckRequirements) AsOfficePowerBICheckRequirements() (*OfficePowerBICheckRequirements, bool) { + return nil, false +} + +// AsTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeATPCheckRequirements. +func (oacr OfficeATPCheckRequirements) AsTICheckRequirements() (*TICheckRequirements, bool) { + return nil, false +} + +// AsTiTaxiiCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeATPCheckRequirements. +func (oacr OfficeATPCheckRequirements) AsTiTaxiiCheckRequirements() (*TiTaxiiCheckRequirements, bool) { + return nil, false +} + +// AsIoTCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeATPCheckRequirements. +func (oacr OfficeATPCheckRequirements) AsIoTCheckRequirements() (*IoTCheckRequirements, bool) { + return nil, false +} + +// AsDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeATPCheckRequirements. +func (oacr OfficeATPCheckRequirements) AsDataConnectorsCheckRequirements() (*DataConnectorsCheckRequirements, bool) { + return nil, false +} + +// AsBasicDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeATPCheckRequirements. +func (oacr OfficeATPCheckRequirements) AsBasicDataConnectorsCheckRequirements() (BasicDataConnectorsCheckRequirements, bool) { + return &oacr, true +} + +// UnmarshalJSON is the custom unmarshaler for OfficeATPCheckRequirements struct. +func (oacr *OfficeATPCheckRequirements) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var officeATPCheckRequirementsProperties OfficeATPCheckRequirementsProperties + err = json.Unmarshal(*v, &officeATPCheckRequirementsProperties) + if err != nil { + return err + } + oacr.OfficeATPCheckRequirementsProperties = &officeATPCheckRequirementsProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnectorsCheckRequirements + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + oacr.Kind = kind + } + } + } + + return nil +} + +// OfficeATPCheckRequirementsProperties officeATP (Office 365 Advanced Threat Protection) requirements +// check properties. +type OfficeATPCheckRequirementsProperties struct { + // TenantID - The tenant id to connect to, and get the data from. + TenantID *string `json:"tenantId,omitempty"` +} + +// OfficeATPDataConnector represents OfficeATP (Office 365 Advanced Threat Protection) data connector. +type OfficeATPDataConnector struct { + // OfficeATPDataConnectorProperties - OfficeATP (Office 365 Advanced Threat Protection) data connector properties. + *OfficeATPDataConnectorProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorKindDataConnector', 'KindBasicDataConnectorKindAzureActiveDirectory', 'KindBasicDataConnectorKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorKindMicrosoftThreatProtection', 'KindBasicDataConnectorKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorKindAzureSecurityCenter', 'KindBasicDataConnectorKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorKindAmazonWebServicesS3', 'KindBasicDataConnectorKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorKindDynamics365', 'KindBasicDataConnectorKindOfficeATP', 'KindBasicDataConnectorKindOffice365Project', 'KindBasicDataConnectorKindOfficePowerBI', 'KindBasicDataConnectorKindOfficeIRM', 'KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorKindOffice365', 'KindBasicDataConnectorKindThreatIntelligence', 'KindBasicDataConnectorKindThreatIntelligenceTaxii', 'KindBasicDataConnectorKindIOT', 'KindBasicDataConnectorKindGenericUI', 'KindBasicDataConnectorKindAPIPolling' + Kind KindBasicDataConnector `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for OfficeATPDataConnector. +func (oadc OfficeATPDataConnector) MarshalJSON() ([]byte, error) { + oadc.Kind = KindBasicDataConnectorKindOfficeATP + objectMap := make(map[string]interface{}) + if oadc.OfficeATPDataConnectorProperties != nil { + objectMap["properties"] = oadc.OfficeATPDataConnectorProperties + } + if oadc.Kind != "" { + objectMap["kind"] = oadc.Kind + } + if oadc.Etag != nil { + objectMap["etag"] = oadc.Etag + } + return json.Marshal(objectMap) +} + +// AsAADDataConnector is the BasicDataConnector implementation for OfficeATPDataConnector. +func (oadc OfficeATPDataConnector) AsAADDataConnector() (*AADDataConnector, bool) { + return nil, false +} + +// AsMSTIDataConnector is the BasicDataConnector implementation for OfficeATPDataConnector. +func (oadc OfficeATPDataConnector) AsMSTIDataConnector() (*MSTIDataConnector, bool) { + return nil, false +} + +// AsMTPDataConnector is the BasicDataConnector implementation for OfficeATPDataConnector. +func (oadc OfficeATPDataConnector) AsMTPDataConnector() (*MTPDataConnector, bool) { + return nil, false +} + +// AsAATPDataConnector is the BasicDataConnector implementation for OfficeATPDataConnector. +func (oadc OfficeATPDataConnector) AsAATPDataConnector() (*AATPDataConnector, bool) { + return nil, false +} + +// AsASCDataConnector is the BasicDataConnector implementation for OfficeATPDataConnector. +func (oadc OfficeATPDataConnector) AsASCDataConnector() (*ASCDataConnector, bool) { + return nil, false +} + +// AsAwsCloudTrailDataConnector is the BasicDataConnector implementation for OfficeATPDataConnector. +func (oadc OfficeATPDataConnector) AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) { + return nil, false +} + +// AsAwsS3DataConnector is the BasicDataConnector implementation for OfficeATPDataConnector. +func (oadc OfficeATPDataConnector) AsAwsS3DataConnector() (*AwsS3DataConnector, bool) { + return nil, false +} + +// AsMCASDataConnector is the BasicDataConnector implementation for OfficeATPDataConnector. +func (oadc OfficeATPDataConnector) AsMCASDataConnector() (*MCASDataConnector, bool) { + return nil, false +} + +// AsDynamics365DataConnector is the BasicDataConnector implementation for OfficeATPDataConnector. +func (oadc OfficeATPDataConnector) AsDynamics365DataConnector() (*Dynamics365DataConnector, bool) { + return nil, false +} + +// AsOfficeATPDataConnector is the BasicDataConnector implementation for OfficeATPDataConnector. +func (oadc OfficeATPDataConnector) AsOfficeATPDataConnector() (*OfficeATPDataConnector, bool) { + return &oadc, true +} + +// AsOffice365ProjectDataConnector is the BasicDataConnector implementation for OfficeATPDataConnector. +func (oadc OfficeATPDataConnector) AsOffice365ProjectDataConnector() (*Office365ProjectDataConnector, bool) { + return nil, false +} + +// AsOfficePowerBIDataConnector is the BasicDataConnector implementation for OfficeATPDataConnector. +func (oadc OfficeATPDataConnector) AsOfficePowerBIDataConnector() (*OfficePowerBIDataConnector, bool) { + return nil, false +} + +// AsOfficeIRMDataConnector is the BasicDataConnector implementation for OfficeATPDataConnector. +func (oadc OfficeATPDataConnector) AsOfficeIRMDataConnector() (*OfficeIRMDataConnector, bool) { + return nil, false +} + +// AsMDATPDataConnector is the BasicDataConnector implementation for OfficeATPDataConnector. +func (oadc OfficeATPDataConnector) AsMDATPDataConnector() (*MDATPDataConnector, bool) { + return nil, false +} + +// AsOfficeDataConnector is the BasicDataConnector implementation for OfficeATPDataConnector. +func (oadc OfficeATPDataConnector) AsOfficeDataConnector() (*OfficeDataConnector, bool) { + return nil, false +} + +// AsTIDataConnector is the BasicDataConnector implementation for OfficeATPDataConnector. +func (oadc OfficeATPDataConnector) AsTIDataConnector() (*TIDataConnector, bool) { + return nil, false +} + +// AsTiTaxiiDataConnector is the BasicDataConnector implementation for OfficeATPDataConnector. +func (oadc OfficeATPDataConnector) AsTiTaxiiDataConnector() (*TiTaxiiDataConnector, bool) { + return nil, false +} + +// AsIoTDataConnector is the BasicDataConnector implementation for OfficeATPDataConnector. +func (oadc OfficeATPDataConnector) AsIoTDataConnector() (*IoTDataConnector, bool) { + return nil, false +} + +// AsCodelessUIDataConnector is the BasicDataConnector implementation for OfficeATPDataConnector. +func (oadc OfficeATPDataConnector) AsCodelessUIDataConnector() (*CodelessUIDataConnector, bool) { + return nil, false +} + +// AsCodelessAPIPollingDataConnector is the BasicDataConnector implementation for OfficeATPDataConnector. +func (oadc OfficeATPDataConnector) AsCodelessAPIPollingDataConnector() (*CodelessAPIPollingDataConnector, bool) { + return nil, false +} + +// AsDataConnector is the BasicDataConnector implementation for OfficeATPDataConnector. +func (oadc OfficeATPDataConnector) AsDataConnector() (*DataConnector, bool) { + return nil, false +} + +// AsBasicDataConnector is the BasicDataConnector implementation for OfficeATPDataConnector. +func (oadc OfficeATPDataConnector) AsBasicDataConnector() (BasicDataConnector, bool) { + return &oadc, true +} + +// UnmarshalJSON is the custom unmarshaler for OfficeATPDataConnector struct. +func (oadc *OfficeATPDataConnector) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var officeATPDataConnectorProperties OfficeATPDataConnectorProperties + err = json.Unmarshal(*v, &officeATPDataConnectorProperties) + if err != nil { + return err + } + oadc.OfficeATPDataConnectorProperties = &officeATPDataConnectorProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnector + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + oadc.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + oadc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + oadc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + oadc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + oadc.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + oadc.SystemData = &systemData + } + } + } + + return nil +} + +// OfficeATPDataConnectorProperties officeATP (Office 365 Advanced Threat Protection) data connector +// properties. +type OfficeATPDataConnectorProperties struct { + // TenantID - The tenant id to connect to, and get the data from. + TenantID *string `json:"tenantId,omitempty"` + // DataTypes - The available data types for the connector. + DataTypes *AlertsDataTypeOfDataConnector `json:"dataTypes,omitempty"` +} + +// OfficeConsent consent for Office365 tenant that already made. +type OfficeConsent struct { + autorest.Response `json:"-"` + // OfficeConsentProperties - Office consent properties + *OfficeConsentProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for OfficeConsent. +func (oc OfficeConsent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if oc.OfficeConsentProperties != nil { + objectMap["properties"] = oc.OfficeConsentProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for OfficeConsent struct. +func (oc *OfficeConsent) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var officeConsentProperties OfficeConsentProperties + err = json.Unmarshal(*v, &officeConsentProperties) + if err != nil { + return err + } + oc.OfficeConsentProperties = &officeConsentProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + oc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + oc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + oc.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + oc.SystemData = &systemData + } + } + } + + return nil +} + +// OfficeConsentList list of all the office365 consents. +type OfficeConsentList struct { + autorest.Response `json:"-"` + // NextLink - READ-ONLY; URL to fetch the next set of office consents. + NextLink *string `json:"nextLink,omitempty"` + // Value - Array of the consents. + Value *[]OfficeConsent `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for OfficeConsentList. +func (ocl OfficeConsentList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ocl.Value != nil { + objectMap["value"] = ocl.Value + } + return json.Marshal(objectMap) +} + +// OfficeConsentListIterator provides access to a complete listing of OfficeConsent values. +type OfficeConsentListIterator struct { + i int + page OfficeConsentListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OfficeConsentListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OfficeConsentListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OfficeConsentListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OfficeConsentListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OfficeConsentListIterator) Response() OfficeConsentList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OfficeConsentListIterator) Value() OfficeConsent { + if !iter.page.NotDone() { + return OfficeConsent{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OfficeConsentListIterator type. +func NewOfficeConsentListIterator(page OfficeConsentListPage) OfficeConsentListIterator { + return OfficeConsentListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ocl OfficeConsentList) IsEmpty() bool { + return ocl.Value == nil || len(*ocl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ocl OfficeConsentList) hasNextLink() bool { + return ocl.NextLink != nil && len(*ocl.NextLink) != 0 +} + +// officeConsentListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ocl OfficeConsentList) officeConsentListPreparer(ctx context.Context) (*http.Request, error) { + if !ocl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ocl.NextLink))) +} + +// OfficeConsentListPage contains a page of OfficeConsent values. +type OfficeConsentListPage struct { + fn func(context.Context, OfficeConsentList) (OfficeConsentList, error) + ocl OfficeConsentList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OfficeConsentListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OfficeConsentListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ocl) + if err != nil { + return err + } + page.ocl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OfficeConsentListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OfficeConsentListPage) NotDone() bool { + return !page.ocl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OfficeConsentListPage) Response() OfficeConsentList { + return page.ocl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OfficeConsentListPage) Values() []OfficeConsent { + if page.ocl.IsEmpty() { + return nil + } + return *page.ocl.Value +} + +// Creates a new instance of the OfficeConsentListPage type. +func NewOfficeConsentListPage(cur OfficeConsentList, getNextPage func(context.Context, OfficeConsentList) (OfficeConsentList, error)) OfficeConsentListPage { + return OfficeConsentListPage{ + fn: getNextPage, + ocl: cur, + } +} + +// OfficeConsentProperties consent property bag. +type OfficeConsentProperties struct { + // TenantID - The tenantId of the Office365 with the consent. + TenantID *string `json:"tenantId,omitempty"` + // ConsentID - Help to easily cascade among the data layers. + ConsentID *string `json:"consentId,omitempty"` +} + +// OfficeDataConnector represents office data connector. +type OfficeDataConnector struct { + // OfficeDataConnectorProperties - Office data connector properties. + *OfficeDataConnectorProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorKindDataConnector', 'KindBasicDataConnectorKindAzureActiveDirectory', 'KindBasicDataConnectorKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorKindMicrosoftThreatProtection', 'KindBasicDataConnectorKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorKindAzureSecurityCenter', 'KindBasicDataConnectorKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorKindAmazonWebServicesS3', 'KindBasicDataConnectorKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorKindDynamics365', 'KindBasicDataConnectorKindOfficeATP', 'KindBasicDataConnectorKindOffice365Project', 'KindBasicDataConnectorKindOfficePowerBI', 'KindBasicDataConnectorKindOfficeIRM', 'KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorKindOffice365', 'KindBasicDataConnectorKindThreatIntelligence', 'KindBasicDataConnectorKindThreatIntelligenceTaxii', 'KindBasicDataConnectorKindIOT', 'KindBasicDataConnectorKindGenericUI', 'KindBasicDataConnectorKindAPIPolling' + Kind KindBasicDataConnector `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for OfficeDataConnector. +func (odc OfficeDataConnector) MarshalJSON() ([]byte, error) { + odc.Kind = KindBasicDataConnectorKindOffice365 + objectMap := make(map[string]interface{}) + if odc.OfficeDataConnectorProperties != nil { + objectMap["properties"] = odc.OfficeDataConnectorProperties + } + if odc.Kind != "" { + objectMap["kind"] = odc.Kind + } + if odc.Etag != nil { + objectMap["etag"] = odc.Etag + } + return json.Marshal(objectMap) +} + +// AsAADDataConnector is the BasicDataConnector implementation for OfficeDataConnector. +func (odc OfficeDataConnector) AsAADDataConnector() (*AADDataConnector, bool) { + return nil, false +} + +// AsMSTIDataConnector is the BasicDataConnector implementation for OfficeDataConnector. +func (odc OfficeDataConnector) AsMSTIDataConnector() (*MSTIDataConnector, bool) { + return nil, false +} + +// AsMTPDataConnector is the BasicDataConnector implementation for OfficeDataConnector. +func (odc OfficeDataConnector) AsMTPDataConnector() (*MTPDataConnector, bool) { + return nil, false +} + +// AsAATPDataConnector is the BasicDataConnector implementation for OfficeDataConnector. +func (odc OfficeDataConnector) AsAATPDataConnector() (*AATPDataConnector, bool) { + return nil, false +} + +// AsASCDataConnector is the BasicDataConnector implementation for OfficeDataConnector. +func (odc OfficeDataConnector) AsASCDataConnector() (*ASCDataConnector, bool) { + return nil, false +} + +// AsAwsCloudTrailDataConnector is the BasicDataConnector implementation for OfficeDataConnector. +func (odc OfficeDataConnector) AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) { + return nil, false +} + +// AsAwsS3DataConnector is the BasicDataConnector implementation for OfficeDataConnector. +func (odc OfficeDataConnector) AsAwsS3DataConnector() (*AwsS3DataConnector, bool) { + return nil, false +} + +// AsMCASDataConnector is the BasicDataConnector implementation for OfficeDataConnector. +func (odc OfficeDataConnector) AsMCASDataConnector() (*MCASDataConnector, bool) { + return nil, false +} + +// AsDynamics365DataConnector is the BasicDataConnector implementation for OfficeDataConnector. +func (odc OfficeDataConnector) AsDynamics365DataConnector() (*Dynamics365DataConnector, bool) { + return nil, false +} + +// AsOfficeATPDataConnector is the BasicDataConnector implementation for OfficeDataConnector. +func (odc OfficeDataConnector) AsOfficeATPDataConnector() (*OfficeATPDataConnector, bool) { + return nil, false +} + +// AsOffice365ProjectDataConnector is the BasicDataConnector implementation for OfficeDataConnector. +func (odc OfficeDataConnector) AsOffice365ProjectDataConnector() (*Office365ProjectDataConnector, bool) { + return nil, false +} + +// AsOfficePowerBIDataConnector is the BasicDataConnector implementation for OfficeDataConnector. +func (odc OfficeDataConnector) AsOfficePowerBIDataConnector() (*OfficePowerBIDataConnector, bool) { + return nil, false +} + +// AsOfficeIRMDataConnector is the BasicDataConnector implementation for OfficeDataConnector. +func (odc OfficeDataConnector) AsOfficeIRMDataConnector() (*OfficeIRMDataConnector, bool) { + return nil, false +} + +// AsMDATPDataConnector is the BasicDataConnector implementation for OfficeDataConnector. +func (odc OfficeDataConnector) AsMDATPDataConnector() (*MDATPDataConnector, bool) { + return nil, false +} + +// AsOfficeDataConnector is the BasicDataConnector implementation for OfficeDataConnector. +func (odc OfficeDataConnector) AsOfficeDataConnector() (*OfficeDataConnector, bool) { + return &odc, true +} + +// AsTIDataConnector is the BasicDataConnector implementation for OfficeDataConnector. +func (odc OfficeDataConnector) AsTIDataConnector() (*TIDataConnector, bool) { + return nil, false +} + +// AsTiTaxiiDataConnector is the BasicDataConnector implementation for OfficeDataConnector. +func (odc OfficeDataConnector) AsTiTaxiiDataConnector() (*TiTaxiiDataConnector, bool) { + return nil, false +} + +// AsIoTDataConnector is the BasicDataConnector implementation for OfficeDataConnector. +func (odc OfficeDataConnector) AsIoTDataConnector() (*IoTDataConnector, bool) { + return nil, false +} + +// AsCodelessUIDataConnector is the BasicDataConnector implementation for OfficeDataConnector. +func (odc OfficeDataConnector) AsCodelessUIDataConnector() (*CodelessUIDataConnector, bool) { + return nil, false +} + +// AsCodelessAPIPollingDataConnector is the BasicDataConnector implementation for OfficeDataConnector. +func (odc OfficeDataConnector) AsCodelessAPIPollingDataConnector() (*CodelessAPIPollingDataConnector, bool) { + return nil, false +} + +// AsDataConnector is the BasicDataConnector implementation for OfficeDataConnector. +func (odc OfficeDataConnector) AsDataConnector() (*DataConnector, bool) { + return nil, false +} + +// AsBasicDataConnector is the BasicDataConnector implementation for OfficeDataConnector. +func (odc OfficeDataConnector) AsBasicDataConnector() (BasicDataConnector, bool) { + return &odc, true +} + +// UnmarshalJSON is the custom unmarshaler for OfficeDataConnector struct. +func (odc *OfficeDataConnector) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var officeDataConnectorProperties OfficeDataConnectorProperties + err = json.Unmarshal(*v, &officeDataConnectorProperties) + if err != nil { + return err + } + odc.OfficeDataConnectorProperties = &officeDataConnectorProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnector + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + odc.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + odc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + odc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + odc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + odc.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + odc.SystemData = &systemData + } + } + } + + return nil +} + +// OfficeDataConnectorDataTypes the available data types for office data connector. +type OfficeDataConnectorDataTypes struct { + // Exchange - Exchange data type connection. + Exchange *OfficeDataConnectorDataTypesExchange `json:"exchange,omitempty"` + // SharePoint - SharePoint data type connection. + SharePoint *OfficeDataConnectorDataTypesSharePoint `json:"sharePoint,omitempty"` + // Teams - Teams data type connection. + Teams *OfficeDataConnectorDataTypesTeams `json:"teams,omitempty"` +} + +// OfficeDataConnectorDataTypesExchange exchange data type connection. +type OfficeDataConnectorDataTypesExchange struct { + // State - Describe whether this data type connection is enabled or not. Possible values include: 'DataTypeStateEnabled', 'DataTypeStateDisabled' + State DataTypeState `json:"state,omitempty"` +} + +// OfficeDataConnectorDataTypesSharePoint sharePoint data type connection. +type OfficeDataConnectorDataTypesSharePoint struct { + // State - Describe whether this data type connection is enabled or not. Possible values include: 'DataTypeStateEnabled', 'DataTypeStateDisabled' + State DataTypeState `json:"state,omitempty"` +} + +// OfficeDataConnectorDataTypesTeams teams data type connection. +type OfficeDataConnectorDataTypesTeams struct { + // State - Describe whether this data type connection is enabled or not. Possible values include: 'DataTypeStateEnabled', 'DataTypeStateDisabled' + State DataTypeState `json:"state,omitempty"` +} + +// OfficeDataConnectorProperties office data connector properties. +type OfficeDataConnectorProperties struct { + // DataTypes - The available data types for the connector. + DataTypes *OfficeDataConnectorDataTypes `json:"dataTypes,omitempty"` + // TenantID - The tenant id to connect to, and get the data from. + TenantID *string `json:"tenantId,omitempty"` +} + +// OfficeIRMCheckRequirements represents OfficeIRM (Microsoft Insider Risk Management) requirements check +// request. +type OfficeIRMCheckRequirements struct { + // OfficeIRMCheckRequirementsProperties - OfficeIRM (Microsoft Insider Risk Management) requirements check properties. + *OfficeIRMCheckRequirementsProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorsCheckRequirementsKindDataConnectorsCheckRequirements', 'KindBasicDataConnectorsCheckRequirementsKindAzureActiveDirectory', 'KindBasicDataConnectorsCheckRequirementsKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindAzureSecurityCenter', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesS3', 'KindBasicDataConnectorsCheckRequirementsKindDynamics365', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindOfficeATP', 'KindBasicDataConnectorsCheckRequirementsKindOfficeIRM', 'KindBasicDataConnectorsCheckRequirementsKindOffice365Project', 'KindBasicDataConnectorsCheckRequirementsKindOfficePowerBI', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligenceTaxii', 'KindBasicDataConnectorsCheckRequirementsKindIOT' + Kind KindBasicDataConnectorsCheckRequirements `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for OfficeIRMCheckRequirements. +func (oicr OfficeIRMCheckRequirements) MarshalJSON() ([]byte, error) { + oicr.Kind = KindBasicDataConnectorsCheckRequirementsKindOfficeIRM + objectMap := make(map[string]interface{}) + if oicr.OfficeIRMCheckRequirementsProperties != nil { + objectMap["properties"] = oicr.OfficeIRMCheckRequirementsProperties + } + if oicr.Kind != "" { + objectMap["kind"] = oicr.Kind + } + return json.Marshal(objectMap) +} + +// AsAADCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeIRMCheckRequirements. +func (oicr OfficeIRMCheckRequirements) AsAADCheckRequirements() (*AADCheckRequirements, bool) { + return nil, false +} + +// AsAATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeIRMCheckRequirements. +func (oicr OfficeIRMCheckRequirements) AsAATPCheckRequirements() (*AATPCheckRequirements, bool) { + return nil, false +} + +// AsASCCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeIRMCheckRequirements. +func (oicr OfficeIRMCheckRequirements) AsASCCheckRequirements() (*ASCCheckRequirements, bool) { + return nil, false +} + +// AsAwsCloudTrailCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeIRMCheckRequirements. +func (oicr OfficeIRMCheckRequirements) AsAwsCloudTrailCheckRequirements() (*AwsCloudTrailCheckRequirements, bool) { + return nil, false +} + +// AsAwsS3CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeIRMCheckRequirements. +func (oicr OfficeIRMCheckRequirements) AsAwsS3CheckRequirements() (*AwsS3CheckRequirements, bool) { + return nil, false +} + +// AsDynamics365CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeIRMCheckRequirements. +func (oicr OfficeIRMCheckRequirements) AsDynamics365CheckRequirements() (*Dynamics365CheckRequirements, bool) { + return nil, false +} + +// AsMCASCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeIRMCheckRequirements. +func (oicr OfficeIRMCheckRequirements) AsMCASCheckRequirements() (*MCASCheckRequirements, bool) { + return nil, false +} + +// AsMDATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeIRMCheckRequirements. +func (oicr OfficeIRMCheckRequirements) AsMDATPCheckRequirements() (*MDATPCheckRequirements, bool) { + return nil, false +} + +// AsMSTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeIRMCheckRequirements. +func (oicr OfficeIRMCheckRequirements) AsMSTICheckRequirements() (*MSTICheckRequirements, bool) { + return nil, false +} + +// AsMtpCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeIRMCheckRequirements. +func (oicr OfficeIRMCheckRequirements) AsMtpCheckRequirements() (*MtpCheckRequirements, bool) { + return nil, false +} + +// AsOfficeATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeIRMCheckRequirements. +func (oicr OfficeIRMCheckRequirements) AsOfficeATPCheckRequirements() (*OfficeATPCheckRequirements, bool) { + return nil, false +} + +// AsOfficeIRMCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeIRMCheckRequirements. +func (oicr OfficeIRMCheckRequirements) AsOfficeIRMCheckRequirements() (*OfficeIRMCheckRequirements, bool) { + return &oicr, true +} + +// AsOffice365ProjectCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeIRMCheckRequirements. +func (oicr OfficeIRMCheckRequirements) AsOffice365ProjectCheckRequirements() (*Office365ProjectCheckRequirements, bool) { + return nil, false +} + +// AsOfficePowerBICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeIRMCheckRequirements. +func (oicr OfficeIRMCheckRequirements) AsOfficePowerBICheckRequirements() (*OfficePowerBICheckRequirements, bool) { + return nil, false +} + +// AsTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeIRMCheckRequirements. +func (oicr OfficeIRMCheckRequirements) AsTICheckRequirements() (*TICheckRequirements, bool) { + return nil, false +} + +// AsTiTaxiiCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeIRMCheckRequirements. +func (oicr OfficeIRMCheckRequirements) AsTiTaxiiCheckRequirements() (*TiTaxiiCheckRequirements, bool) { + return nil, false +} + +// AsIoTCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeIRMCheckRequirements. +func (oicr OfficeIRMCheckRequirements) AsIoTCheckRequirements() (*IoTCheckRequirements, bool) { + return nil, false +} + +// AsDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeIRMCheckRequirements. +func (oicr OfficeIRMCheckRequirements) AsDataConnectorsCheckRequirements() (*DataConnectorsCheckRequirements, bool) { + return nil, false +} + +// AsBasicDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficeIRMCheckRequirements. +func (oicr OfficeIRMCheckRequirements) AsBasicDataConnectorsCheckRequirements() (BasicDataConnectorsCheckRequirements, bool) { + return &oicr, true +} + +// UnmarshalJSON is the custom unmarshaler for OfficeIRMCheckRequirements struct. +func (oicr *OfficeIRMCheckRequirements) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var officeIRMCheckRequirementsProperties OfficeIRMCheckRequirementsProperties + err = json.Unmarshal(*v, &officeIRMCheckRequirementsProperties) + if err != nil { + return err + } + oicr.OfficeIRMCheckRequirementsProperties = &officeIRMCheckRequirementsProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnectorsCheckRequirements + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + oicr.Kind = kind + } + } + } + + return nil +} + +// OfficeIRMCheckRequirementsProperties officeIRM (Microsoft Insider Risk Management) requirements check +// properties. +type OfficeIRMCheckRequirementsProperties struct { + // TenantID - The tenant id to connect to, and get the data from. + TenantID *string `json:"tenantId,omitempty"` +} + +// OfficeIRMDataConnector represents OfficeIRM (Microsoft Insider Risk Management) data connector. +type OfficeIRMDataConnector struct { + // OfficeIRMDataConnectorProperties - OfficeIRM (Microsoft Insider Risk Management) data connector properties. + *OfficeIRMDataConnectorProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorKindDataConnector', 'KindBasicDataConnectorKindAzureActiveDirectory', 'KindBasicDataConnectorKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorKindMicrosoftThreatProtection', 'KindBasicDataConnectorKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorKindAzureSecurityCenter', 'KindBasicDataConnectorKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorKindAmazonWebServicesS3', 'KindBasicDataConnectorKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorKindDynamics365', 'KindBasicDataConnectorKindOfficeATP', 'KindBasicDataConnectorKindOffice365Project', 'KindBasicDataConnectorKindOfficePowerBI', 'KindBasicDataConnectorKindOfficeIRM', 'KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorKindOffice365', 'KindBasicDataConnectorKindThreatIntelligence', 'KindBasicDataConnectorKindThreatIntelligenceTaxii', 'KindBasicDataConnectorKindIOT', 'KindBasicDataConnectorKindGenericUI', 'KindBasicDataConnectorKindAPIPolling' + Kind KindBasicDataConnector `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for OfficeIRMDataConnector. +func (oidc OfficeIRMDataConnector) MarshalJSON() ([]byte, error) { + oidc.Kind = KindBasicDataConnectorKindOfficeIRM + objectMap := make(map[string]interface{}) + if oidc.OfficeIRMDataConnectorProperties != nil { + objectMap["properties"] = oidc.OfficeIRMDataConnectorProperties + } + if oidc.Kind != "" { + objectMap["kind"] = oidc.Kind + } + if oidc.Etag != nil { + objectMap["etag"] = oidc.Etag + } + return json.Marshal(objectMap) +} + +// AsAADDataConnector is the BasicDataConnector implementation for OfficeIRMDataConnector. +func (oidc OfficeIRMDataConnector) AsAADDataConnector() (*AADDataConnector, bool) { + return nil, false +} + +// AsMSTIDataConnector is the BasicDataConnector implementation for OfficeIRMDataConnector. +func (oidc OfficeIRMDataConnector) AsMSTIDataConnector() (*MSTIDataConnector, bool) { + return nil, false +} + +// AsMTPDataConnector is the BasicDataConnector implementation for OfficeIRMDataConnector. +func (oidc OfficeIRMDataConnector) AsMTPDataConnector() (*MTPDataConnector, bool) { + return nil, false +} + +// AsAATPDataConnector is the BasicDataConnector implementation for OfficeIRMDataConnector. +func (oidc OfficeIRMDataConnector) AsAATPDataConnector() (*AATPDataConnector, bool) { + return nil, false +} + +// AsASCDataConnector is the BasicDataConnector implementation for OfficeIRMDataConnector. +func (oidc OfficeIRMDataConnector) AsASCDataConnector() (*ASCDataConnector, bool) { + return nil, false +} + +// AsAwsCloudTrailDataConnector is the BasicDataConnector implementation for OfficeIRMDataConnector. +func (oidc OfficeIRMDataConnector) AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) { + return nil, false +} + +// AsAwsS3DataConnector is the BasicDataConnector implementation for OfficeIRMDataConnector. +func (oidc OfficeIRMDataConnector) AsAwsS3DataConnector() (*AwsS3DataConnector, bool) { + return nil, false +} + +// AsMCASDataConnector is the BasicDataConnector implementation for OfficeIRMDataConnector. +func (oidc OfficeIRMDataConnector) AsMCASDataConnector() (*MCASDataConnector, bool) { + return nil, false +} + +// AsDynamics365DataConnector is the BasicDataConnector implementation for OfficeIRMDataConnector. +func (oidc OfficeIRMDataConnector) AsDynamics365DataConnector() (*Dynamics365DataConnector, bool) { + return nil, false +} + +// AsOfficeATPDataConnector is the BasicDataConnector implementation for OfficeIRMDataConnector. +func (oidc OfficeIRMDataConnector) AsOfficeATPDataConnector() (*OfficeATPDataConnector, bool) { + return nil, false +} + +// AsOffice365ProjectDataConnector is the BasicDataConnector implementation for OfficeIRMDataConnector. +func (oidc OfficeIRMDataConnector) AsOffice365ProjectDataConnector() (*Office365ProjectDataConnector, bool) { + return nil, false +} + +// AsOfficePowerBIDataConnector is the BasicDataConnector implementation for OfficeIRMDataConnector. +func (oidc OfficeIRMDataConnector) AsOfficePowerBIDataConnector() (*OfficePowerBIDataConnector, bool) { + return nil, false +} + +// AsOfficeIRMDataConnector is the BasicDataConnector implementation for OfficeIRMDataConnector. +func (oidc OfficeIRMDataConnector) AsOfficeIRMDataConnector() (*OfficeIRMDataConnector, bool) { + return &oidc, true +} + +// AsMDATPDataConnector is the BasicDataConnector implementation for OfficeIRMDataConnector. +func (oidc OfficeIRMDataConnector) AsMDATPDataConnector() (*MDATPDataConnector, bool) { + return nil, false +} + +// AsOfficeDataConnector is the BasicDataConnector implementation for OfficeIRMDataConnector. +func (oidc OfficeIRMDataConnector) AsOfficeDataConnector() (*OfficeDataConnector, bool) { + return nil, false +} + +// AsTIDataConnector is the BasicDataConnector implementation for OfficeIRMDataConnector. +func (oidc OfficeIRMDataConnector) AsTIDataConnector() (*TIDataConnector, bool) { + return nil, false +} + +// AsTiTaxiiDataConnector is the BasicDataConnector implementation for OfficeIRMDataConnector. +func (oidc OfficeIRMDataConnector) AsTiTaxiiDataConnector() (*TiTaxiiDataConnector, bool) { + return nil, false +} + +// AsIoTDataConnector is the BasicDataConnector implementation for OfficeIRMDataConnector. +func (oidc OfficeIRMDataConnector) AsIoTDataConnector() (*IoTDataConnector, bool) { + return nil, false +} + +// AsCodelessUIDataConnector is the BasicDataConnector implementation for OfficeIRMDataConnector. +func (oidc OfficeIRMDataConnector) AsCodelessUIDataConnector() (*CodelessUIDataConnector, bool) { + return nil, false +} + +// AsCodelessAPIPollingDataConnector is the BasicDataConnector implementation for OfficeIRMDataConnector. +func (oidc OfficeIRMDataConnector) AsCodelessAPIPollingDataConnector() (*CodelessAPIPollingDataConnector, bool) { + return nil, false +} + +// AsDataConnector is the BasicDataConnector implementation for OfficeIRMDataConnector. +func (oidc OfficeIRMDataConnector) AsDataConnector() (*DataConnector, bool) { + return nil, false +} + +// AsBasicDataConnector is the BasicDataConnector implementation for OfficeIRMDataConnector. +func (oidc OfficeIRMDataConnector) AsBasicDataConnector() (BasicDataConnector, bool) { + return &oidc, true +} + +// UnmarshalJSON is the custom unmarshaler for OfficeIRMDataConnector struct. +func (oidc *OfficeIRMDataConnector) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var officeIRMDataConnectorProperties OfficeIRMDataConnectorProperties + err = json.Unmarshal(*v, &officeIRMDataConnectorProperties) + if err != nil { + return err + } + oidc.OfficeIRMDataConnectorProperties = &officeIRMDataConnectorProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnector + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + oidc.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + oidc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + oidc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + oidc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + oidc.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + oidc.SystemData = &systemData + } + } + } + + return nil +} + +// OfficeIRMDataConnectorProperties officeIRM (Microsoft Insider Risk Management) data connector +// properties. +type OfficeIRMDataConnectorProperties struct { + // TenantID - The tenant id to connect to, and get the data from. + TenantID *string `json:"tenantId,omitempty"` + // DataTypes - The available data types for the connector. + DataTypes *AlertsDataTypeOfDataConnector `json:"dataTypes,omitempty"` +} + +// OfficePowerBICheckRequirements represents Office PowerBI requirements check request. +type OfficePowerBICheckRequirements struct { + // OfficePowerBICheckRequirementsProperties - Office Power BI requirements check properties. + *OfficePowerBICheckRequirementsProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorsCheckRequirementsKindDataConnectorsCheckRequirements', 'KindBasicDataConnectorsCheckRequirementsKindAzureActiveDirectory', 'KindBasicDataConnectorsCheckRequirementsKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindAzureSecurityCenter', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesS3', 'KindBasicDataConnectorsCheckRequirementsKindDynamics365', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindOfficeATP', 'KindBasicDataConnectorsCheckRequirementsKindOfficeIRM', 'KindBasicDataConnectorsCheckRequirementsKindOffice365Project', 'KindBasicDataConnectorsCheckRequirementsKindOfficePowerBI', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligenceTaxii', 'KindBasicDataConnectorsCheckRequirementsKindIOT' + Kind KindBasicDataConnectorsCheckRequirements `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for OfficePowerBICheckRequirements. +func (opbcr OfficePowerBICheckRequirements) MarshalJSON() ([]byte, error) { + opbcr.Kind = KindBasicDataConnectorsCheckRequirementsKindOfficePowerBI + objectMap := make(map[string]interface{}) + if opbcr.OfficePowerBICheckRequirementsProperties != nil { + objectMap["properties"] = opbcr.OfficePowerBICheckRequirementsProperties + } + if opbcr.Kind != "" { + objectMap["kind"] = opbcr.Kind + } + return json.Marshal(objectMap) +} + +// AsAADCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficePowerBICheckRequirements. +func (opbcr OfficePowerBICheckRequirements) AsAADCheckRequirements() (*AADCheckRequirements, bool) { + return nil, false +} + +// AsAATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficePowerBICheckRequirements. +func (opbcr OfficePowerBICheckRequirements) AsAATPCheckRequirements() (*AATPCheckRequirements, bool) { + return nil, false +} + +// AsASCCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficePowerBICheckRequirements. +func (opbcr OfficePowerBICheckRequirements) AsASCCheckRequirements() (*ASCCheckRequirements, bool) { + return nil, false +} + +// AsAwsCloudTrailCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficePowerBICheckRequirements. +func (opbcr OfficePowerBICheckRequirements) AsAwsCloudTrailCheckRequirements() (*AwsCloudTrailCheckRequirements, bool) { + return nil, false +} + +// AsAwsS3CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficePowerBICheckRequirements. +func (opbcr OfficePowerBICheckRequirements) AsAwsS3CheckRequirements() (*AwsS3CheckRequirements, bool) { + return nil, false +} + +// AsDynamics365CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficePowerBICheckRequirements. +func (opbcr OfficePowerBICheckRequirements) AsDynamics365CheckRequirements() (*Dynamics365CheckRequirements, bool) { + return nil, false +} + +// AsMCASCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficePowerBICheckRequirements. +func (opbcr OfficePowerBICheckRequirements) AsMCASCheckRequirements() (*MCASCheckRequirements, bool) { + return nil, false +} + +// AsMDATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficePowerBICheckRequirements. +func (opbcr OfficePowerBICheckRequirements) AsMDATPCheckRequirements() (*MDATPCheckRequirements, bool) { + return nil, false +} + +// AsMSTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficePowerBICheckRequirements. +func (opbcr OfficePowerBICheckRequirements) AsMSTICheckRequirements() (*MSTICheckRequirements, bool) { + return nil, false +} + +// AsMtpCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficePowerBICheckRequirements. +func (opbcr OfficePowerBICheckRequirements) AsMtpCheckRequirements() (*MtpCheckRequirements, bool) { + return nil, false +} + +// AsOfficeATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficePowerBICheckRequirements. +func (opbcr OfficePowerBICheckRequirements) AsOfficeATPCheckRequirements() (*OfficeATPCheckRequirements, bool) { + return nil, false +} + +// AsOfficeIRMCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficePowerBICheckRequirements. +func (opbcr OfficePowerBICheckRequirements) AsOfficeIRMCheckRequirements() (*OfficeIRMCheckRequirements, bool) { + return nil, false +} + +// AsOffice365ProjectCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficePowerBICheckRequirements. +func (opbcr OfficePowerBICheckRequirements) AsOffice365ProjectCheckRequirements() (*Office365ProjectCheckRequirements, bool) { + return nil, false +} + +// AsOfficePowerBICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficePowerBICheckRequirements. +func (opbcr OfficePowerBICheckRequirements) AsOfficePowerBICheckRequirements() (*OfficePowerBICheckRequirements, bool) { + return &opbcr, true +} + +// AsTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficePowerBICheckRequirements. +func (opbcr OfficePowerBICheckRequirements) AsTICheckRequirements() (*TICheckRequirements, bool) { + return nil, false +} + +// AsTiTaxiiCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficePowerBICheckRequirements. +func (opbcr OfficePowerBICheckRequirements) AsTiTaxiiCheckRequirements() (*TiTaxiiCheckRequirements, bool) { + return nil, false +} + +// AsIoTCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficePowerBICheckRequirements. +func (opbcr OfficePowerBICheckRequirements) AsIoTCheckRequirements() (*IoTCheckRequirements, bool) { + return nil, false +} + +// AsDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficePowerBICheckRequirements. +func (opbcr OfficePowerBICheckRequirements) AsDataConnectorsCheckRequirements() (*DataConnectorsCheckRequirements, bool) { + return nil, false +} + +// AsBasicDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for OfficePowerBICheckRequirements. +func (opbcr OfficePowerBICheckRequirements) AsBasicDataConnectorsCheckRequirements() (BasicDataConnectorsCheckRequirements, bool) { + return &opbcr, true +} + +// UnmarshalJSON is the custom unmarshaler for OfficePowerBICheckRequirements struct. +func (opbcr *OfficePowerBICheckRequirements) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var officePowerBICheckRequirementsProperties OfficePowerBICheckRequirementsProperties + err = json.Unmarshal(*v, &officePowerBICheckRequirementsProperties) + if err != nil { + return err + } + opbcr.OfficePowerBICheckRequirementsProperties = &officePowerBICheckRequirementsProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnectorsCheckRequirements + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + opbcr.Kind = kind + } + } + } + + return nil +} + +// OfficePowerBICheckRequirementsProperties office PowerBI requirements check properties. +type OfficePowerBICheckRequirementsProperties struct { + // TenantID - The tenant id to connect to, and get the data from. + TenantID *string `json:"tenantId,omitempty"` +} + +// OfficePowerBIConnectorDataTypes the available data types for Office Microsoft PowerBI data connector. +type OfficePowerBIConnectorDataTypes struct { + // Logs - Logs data type. + Logs *OfficePowerBIConnectorDataTypesLogs `json:"logs,omitempty"` +} + +// OfficePowerBIConnectorDataTypesLogs logs data type. +type OfficePowerBIConnectorDataTypesLogs struct { + // State - Describe whether this data type connection is enabled or not. Possible values include: 'DataTypeStateEnabled', 'DataTypeStateDisabled' + State DataTypeState `json:"state,omitempty"` +} + +// OfficePowerBIDataConnector represents Office Microsoft PowerBI data connector. +type OfficePowerBIDataConnector struct { + // OfficePowerBIDataConnectorProperties - Office Microsoft PowerBI data connector properties. + *OfficePowerBIDataConnectorProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorKindDataConnector', 'KindBasicDataConnectorKindAzureActiveDirectory', 'KindBasicDataConnectorKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorKindMicrosoftThreatProtection', 'KindBasicDataConnectorKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorKindAzureSecurityCenter', 'KindBasicDataConnectorKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorKindAmazonWebServicesS3', 'KindBasicDataConnectorKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorKindDynamics365', 'KindBasicDataConnectorKindOfficeATP', 'KindBasicDataConnectorKindOffice365Project', 'KindBasicDataConnectorKindOfficePowerBI', 'KindBasicDataConnectorKindOfficeIRM', 'KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorKindOffice365', 'KindBasicDataConnectorKindThreatIntelligence', 'KindBasicDataConnectorKindThreatIntelligenceTaxii', 'KindBasicDataConnectorKindIOT', 'KindBasicDataConnectorKindGenericUI', 'KindBasicDataConnectorKindAPIPolling' + Kind KindBasicDataConnector `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for OfficePowerBIDataConnector. +func (opbdc OfficePowerBIDataConnector) MarshalJSON() ([]byte, error) { + opbdc.Kind = KindBasicDataConnectorKindOfficePowerBI + objectMap := make(map[string]interface{}) + if opbdc.OfficePowerBIDataConnectorProperties != nil { + objectMap["properties"] = opbdc.OfficePowerBIDataConnectorProperties + } + if opbdc.Kind != "" { + objectMap["kind"] = opbdc.Kind + } + if opbdc.Etag != nil { + objectMap["etag"] = opbdc.Etag + } + return json.Marshal(objectMap) +} + +// AsAADDataConnector is the BasicDataConnector implementation for OfficePowerBIDataConnector. +func (opbdc OfficePowerBIDataConnector) AsAADDataConnector() (*AADDataConnector, bool) { + return nil, false +} + +// AsMSTIDataConnector is the BasicDataConnector implementation for OfficePowerBIDataConnector. +func (opbdc OfficePowerBIDataConnector) AsMSTIDataConnector() (*MSTIDataConnector, bool) { + return nil, false +} + +// AsMTPDataConnector is the BasicDataConnector implementation for OfficePowerBIDataConnector. +func (opbdc OfficePowerBIDataConnector) AsMTPDataConnector() (*MTPDataConnector, bool) { + return nil, false +} + +// AsAATPDataConnector is the BasicDataConnector implementation for OfficePowerBIDataConnector. +func (opbdc OfficePowerBIDataConnector) AsAATPDataConnector() (*AATPDataConnector, bool) { + return nil, false +} + +// AsASCDataConnector is the BasicDataConnector implementation for OfficePowerBIDataConnector. +func (opbdc OfficePowerBIDataConnector) AsASCDataConnector() (*ASCDataConnector, bool) { + return nil, false +} + +// AsAwsCloudTrailDataConnector is the BasicDataConnector implementation for OfficePowerBIDataConnector. +func (opbdc OfficePowerBIDataConnector) AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) { + return nil, false +} + +// AsAwsS3DataConnector is the BasicDataConnector implementation for OfficePowerBIDataConnector. +func (opbdc OfficePowerBIDataConnector) AsAwsS3DataConnector() (*AwsS3DataConnector, bool) { + return nil, false +} + +// AsMCASDataConnector is the BasicDataConnector implementation for OfficePowerBIDataConnector. +func (opbdc OfficePowerBIDataConnector) AsMCASDataConnector() (*MCASDataConnector, bool) { + return nil, false +} + +// AsDynamics365DataConnector is the BasicDataConnector implementation for OfficePowerBIDataConnector. +func (opbdc OfficePowerBIDataConnector) AsDynamics365DataConnector() (*Dynamics365DataConnector, bool) { + return nil, false +} + +// AsOfficeATPDataConnector is the BasicDataConnector implementation for OfficePowerBIDataConnector. +func (opbdc OfficePowerBIDataConnector) AsOfficeATPDataConnector() (*OfficeATPDataConnector, bool) { + return nil, false +} + +// AsOffice365ProjectDataConnector is the BasicDataConnector implementation for OfficePowerBIDataConnector. +func (opbdc OfficePowerBIDataConnector) AsOffice365ProjectDataConnector() (*Office365ProjectDataConnector, bool) { + return nil, false +} + +// AsOfficePowerBIDataConnector is the BasicDataConnector implementation for OfficePowerBIDataConnector. +func (opbdc OfficePowerBIDataConnector) AsOfficePowerBIDataConnector() (*OfficePowerBIDataConnector, bool) { + return &opbdc, true +} + +// AsOfficeIRMDataConnector is the BasicDataConnector implementation for OfficePowerBIDataConnector. +func (opbdc OfficePowerBIDataConnector) AsOfficeIRMDataConnector() (*OfficeIRMDataConnector, bool) { + return nil, false +} + +// AsMDATPDataConnector is the BasicDataConnector implementation for OfficePowerBIDataConnector. +func (opbdc OfficePowerBIDataConnector) AsMDATPDataConnector() (*MDATPDataConnector, bool) { + return nil, false +} + +// AsOfficeDataConnector is the BasicDataConnector implementation for OfficePowerBIDataConnector. +func (opbdc OfficePowerBIDataConnector) AsOfficeDataConnector() (*OfficeDataConnector, bool) { + return nil, false +} + +// AsTIDataConnector is the BasicDataConnector implementation for OfficePowerBIDataConnector. +func (opbdc OfficePowerBIDataConnector) AsTIDataConnector() (*TIDataConnector, bool) { + return nil, false +} + +// AsTiTaxiiDataConnector is the BasicDataConnector implementation for OfficePowerBIDataConnector. +func (opbdc OfficePowerBIDataConnector) AsTiTaxiiDataConnector() (*TiTaxiiDataConnector, bool) { + return nil, false +} + +// AsIoTDataConnector is the BasicDataConnector implementation for OfficePowerBIDataConnector. +func (opbdc OfficePowerBIDataConnector) AsIoTDataConnector() (*IoTDataConnector, bool) { + return nil, false +} + +// AsCodelessUIDataConnector is the BasicDataConnector implementation for OfficePowerBIDataConnector. +func (opbdc OfficePowerBIDataConnector) AsCodelessUIDataConnector() (*CodelessUIDataConnector, bool) { + return nil, false +} + +// AsCodelessAPIPollingDataConnector is the BasicDataConnector implementation for OfficePowerBIDataConnector. +func (opbdc OfficePowerBIDataConnector) AsCodelessAPIPollingDataConnector() (*CodelessAPIPollingDataConnector, bool) { + return nil, false +} + +// AsDataConnector is the BasicDataConnector implementation for OfficePowerBIDataConnector. +func (opbdc OfficePowerBIDataConnector) AsDataConnector() (*DataConnector, bool) { + return nil, false +} + +// AsBasicDataConnector is the BasicDataConnector implementation for OfficePowerBIDataConnector. +func (opbdc OfficePowerBIDataConnector) AsBasicDataConnector() (BasicDataConnector, bool) { + return &opbdc, true +} + +// UnmarshalJSON is the custom unmarshaler for OfficePowerBIDataConnector struct. +func (opbdc *OfficePowerBIDataConnector) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var officePowerBIDataConnectorProperties OfficePowerBIDataConnectorProperties + err = json.Unmarshal(*v, &officePowerBIDataConnectorProperties) + if err != nil { + return err + } + opbdc.OfficePowerBIDataConnectorProperties = &officePowerBIDataConnectorProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnector + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + opbdc.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + opbdc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + opbdc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + opbdc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + opbdc.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + opbdc.SystemData = &systemData + } + } + } + + return nil +} + +// OfficePowerBIDataConnectorProperties office Microsoft PowerBI data connector properties. +type OfficePowerBIDataConnectorProperties struct { + // DataTypes - The available data types for the connector. + DataTypes *OfficePowerBIConnectorDataTypes `json:"dataTypes,omitempty"` + // TenantID - The tenant id to connect to, and get the data from. + TenantID *string `json:"tenantId,omitempty"` +} + +// Operation operation provided by provider +type Operation struct { + // Display - Properties of the operation + Display *OperationDisplay `json:"display,omitempty"` + // Name - Name of the operation + Name *string `json:"name,omitempty"` + // Origin - The origin of the operation + Origin *string `json:"origin,omitempty"` + // IsDataAction - Indicates whether the operation is a data action + IsDataAction *bool `json:"isDataAction,omitempty"` +} + +// OperationDisplay properties of the operation +type OperationDisplay struct { + // Description - Description of the operation + Description *string `json:"description,omitempty"` + // Operation - Operation name + Operation *string `json:"operation,omitempty"` + // Provider - Provider name + Provider *string `json:"provider,omitempty"` + // Resource - Resource name + Resource *string `json:"resource,omitempty"` +} + +// OperationsList lists the operations available in the SecurityInsights RP. +type OperationsList struct { + autorest.Response `json:"-"` + // NextLink - READ-ONLY; URL to fetch the next set of operations. + NextLink *string `json:"nextLink,omitempty"` + // Value - Array of operations + Value *[]Operation `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationsList. +func (ol OperationsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ol.Value != nil { + objectMap["value"] = ol.Value + } + return json.Marshal(objectMap) +} + +// OperationsListIterator provides access to a complete listing of Operation values. +type OperationsListIterator struct { + i int + page OperationsListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationsListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationsListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationsListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationsListIterator) Response() OperationsList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationsListIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationsListIterator type. +func NewOperationsListIterator(page OperationsListPage) OperationsListIterator { + return OperationsListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ol OperationsList) IsEmpty() bool { + return ol.Value == nil || len(*ol.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ol OperationsList) hasNextLink() bool { + return ol.NextLink != nil && len(*ol.NextLink) != 0 +} + +// operationsListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ol OperationsList) operationsListPreparer(ctx context.Context) (*http.Request, error) { + if !ol.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ol.NextLink))) +} + +// OperationsListPage contains a page of Operation values. +type OperationsListPage struct { + fn func(context.Context, OperationsList) (OperationsList, error) + ol OperationsList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationsListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ol) + if err != nil { + return err + } + page.ol = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationsListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationsListPage) NotDone() bool { + return !page.ol.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationsListPage) Response() OperationsList { + return page.ol +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationsListPage) Values() []Operation { + if page.ol.IsEmpty() { + return nil + } + return *page.ol.Value +} + +// Creates a new instance of the OperationsListPage type. +func NewOperationsListPage(cur OperationsList, getNextPage func(context.Context, OperationsList) (OperationsList, error)) OperationsListPage { + return OperationsListPage{ + fn: getNextPage, + ol: cur, + } +} + +// Permissions permissions required for the connector +type Permissions struct { + // ResourceProvider - Resource provider permissions required for the connector + ResourceProvider *[]PermissionsResourceProviderItem `json:"resourceProvider,omitempty"` + // Customs - Customs permissions required for the connector + Customs *[]PermissionsCustomsItem `json:"customs,omitempty"` +} + +// PermissionsCustomsItem ... +type PermissionsCustomsItem struct { + // Name - Customs permissions name + Name *string `json:"name,omitempty"` + // Description - Customs permissions description + Description *string `json:"description,omitempty"` +} + +// PermissionsResourceProviderItem ... +type PermissionsResourceProviderItem struct { + // Provider - Provider name. Possible values include: 'ProviderNameMicrosoftOperationalInsightssolutions', 'ProviderNameMicrosoftOperationalInsightsworkspaces', 'ProviderNameMicrosoftOperationalInsightsworkspacesdatasources', 'ProviderNameMicrosoftaadiamdiagnosticSettings', 'ProviderNameMicrosoftOperationalInsightsworkspacessharedKeys', 'ProviderNameMicrosoftAuthorizationpolicyAssignments' + Provider ProviderName `json:"provider,omitempty"` + // PermissionsDisplayText - Permission description text + PermissionsDisplayText *string `json:"permissionsDisplayText,omitempty"` + // ProviderDisplayName - Permission provider display name + ProviderDisplayName *string `json:"providerDisplayName,omitempty"` + // Scope - Permission provider scope. Possible values include: 'PermissionProviderScopeResourceGroup', 'PermissionProviderScopeSubscription', 'PermissionProviderScopeWorkspace' + Scope PermissionProviderScope `json:"scope,omitempty"` + // RequiredPermissions - Required permissions for the connector + RequiredPermissions *RequiredPermissions `json:"requiredPermissions,omitempty"` +} + +// PlaybookActionProperties ... +type PlaybookActionProperties struct { + // LogicAppResourceID - The resource id of the playbook resource + LogicAppResourceID *string `json:"logicAppResourceId,omitempty"` + // TenantID - The tenant id of the playbook resource + TenantID *uuid.UUID `json:"tenantId,omitempty"` +} + +// ProcessEntity represents a process entity. +type ProcessEntity struct { + // ProcessEntityProperties - Process entity properties + *ProcessEntityProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicEntityKindEntity', 'KindBasicEntityKindURL', 'KindBasicEntityKindSubmissionMail', 'KindBasicEntityKindSecurityGroup', 'KindBasicEntityKindSecurityAlert', 'KindBasicEntityKindRegistryValue', 'KindBasicEntityKindRegistryKey', 'KindBasicEntityKindProcess', 'KindBasicEntityKindMalware', 'KindBasicEntityKindMailMessage', 'KindBasicEntityKindMailCluster', 'KindBasicEntityKindMailbox', 'KindBasicEntityKindIP', 'KindBasicEntityKindIoTDevice', 'KindBasicEntityKindBookmark', 'KindBasicEntityKindHost', 'KindBasicEntityKindFileHash', 'KindBasicEntityKindFile', 'KindBasicEntityKindDNSResolution', 'KindBasicEntityKindCloudApplication', 'KindBasicEntityKindAzureResource', 'KindBasicEntityKindAccount' + Kind KindBasicEntity `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProcessEntity. +func (peVar ProcessEntity) MarshalJSON() ([]byte, error) { + peVar.Kind = KindBasicEntityKindProcess + objectMap := make(map[string]interface{}) + if peVar.ProcessEntityProperties != nil { + objectMap["properties"] = peVar.ProcessEntityProperties + } + if peVar.Kind != "" { + objectMap["kind"] = peVar.Kind + } + return json.Marshal(objectMap) +} + +// AsURLEntity is the BasicEntity implementation for ProcessEntity. +func (peVar ProcessEntity) AsURLEntity() (*URLEntity, bool) { + return nil, false +} + +// AsSubmissionMailEntity is the BasicEntity implementation for ProcessEntity. +func (peVar ProcessEntity) AsSubmissionMailEntity() (*SubmissionMailEntity, bool) { + return nil, false +} + +// AsSecurityGroupEntity is the BasicEntity implementation for ProcessEntity. +func (peVar ProcessEntity) AsSecurityGroupEntity() (*SecurityGroupEntity, bool) { + return nil, false +} + +// AsSecurityAlert is the BasicEntity implementation for ProcessEntity. +func (peVar ProcessEntity) AsSecurityAlert() (*SecurityAlert, bool) { + return nil, false +} + +// AsRegistryValueEntity is the BasicEntity implementation for ProcessEntity. +func (peVar ProcessEntity) AsRegistryValueEntity() (*RegistryValueEntity, bool) { + return nil, false +} + +// AsRegistryKeyEntity is the BasicEntity implementation for ProcessEntity. +func (peVar ProcessEntity) AsRegistryKeyEntity() (*RegistryKeyEntity, bool) { + return nil, false +} + +// AsProcessEntity is the BasicEntity implementation for ProcessEntity. +func (peVar ProcessEntity) AsProcessEntity() (*ProcessEntity, bool) { + return &peVar, true +} + +// AsMalwareEntity is the BasicEntity implementation for ProcessEntity. +func (peVar ProcessEntity) AsMalwareEntity() (*MalwareEntity, bool) { + return nil, false +} + +// AsMailMessageEntity is the BasicEntity implementation for ProcessEntity. +func (peVar ProcessEntity) AsMailMessageEntity() (*MailMessageEntity, bool) { + return nil, false +} + +// AsMailClusterEntity is the BasicEntity implementation for ProcessEntity. +func (peVar ProcessEntity) AsMailClusterEntity() (*MailClusterEntity, bool) { + return nil, false +} + +// AsMailboxEntity is the BasicEntity implementation for ProcessEntity. +func (peVar ProcessEntity) AsMailboxEntity() (*MailboxEntity, bool) { + return nil, false +} + +// AsIPEntity is the BasicEntity implementation for ProcessEntity. +func (peVar ProcessEntity) AsIPEntity() (*IPEntity, bool) { + return nil, false +} + +// AsIoTDeviceEntity is the BasicEntity implementation for ProcessEntity. +func (peVar ProcessEntity) AsIoTDeviceEntity() (*IoTDeviceEntity, bool) { + return nil, false +} + +// AsHuntingBookmark is the BasicEntity implementation for ProcessEntity. +func (peVar ProcessEntity) AsHuntingBookmark() (*HuntingBookmark, bool) { + return nil, false +} + +// AsHostEntity is the BasicEntity implementation for ProcessEntity. +func (peVar ProcessEntity) AsHostEntity() (*HostEntity, bool) { + return nil, false +} + +// AsFileHashEntity is the BasicEntity implementation for ProcessEntity. +func (peVar ProcessEntity) AsFileHashEntity() (*FileHashEntity, bool) { + return nil, false +} + +// AsFileEntity is the BasicEntity implementation for ProcessEntity. +func (peVar ProcessEntity) AsFileEntity() (*FileEntity, bool) { + return nil, false +} + +// AsDNSEntity is the BasicEntity implementation for ProcessEntity. +func (peVar ProcessEntity) AsDNSEntity() (*DNSEntity, bool) { + return nil, false +} + +// AsCloudApplicationEntity is the BasicEntity implementation for ProcessEntity. +func (peVar ProcessEntity) AsCloudApplicationEntity() (*CloudApplicationEntity, bool) { + return nil, false +} + +// AsAzureResourceEntity is the BasicEntity implementation for ProcessEntity. +func (peVar ProcessEntity) AsAzureResourceEntity() (*AzureResourceEntity, bool) { + return nil, false +} + +// AsAccountEntity is the BasicEntity implementation for ProcessEntity. +func (peVar ProcessEntity) AsAccountEntity() (*AccountEntity, bool) { + return nil, false +} + +// AsEntity is the BasicEntity implementation for ProcessEntity. +func (peVar ProcessEntity) AsEntity() (*Entity, bool) { + return nil, false +} + +// AsBasicEntity is the BasicEntity implementation for ProcessEntity. +func (peVar ProcessEntity) AsBasicEntity() (BasicEntity, bool) { + return &peVar, true +} + +// UnmarshalJSON is the custom unmarshaler for ProcessEntity struct. +func (peVar *ProcessEntity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var processEntityProperties ProcessEntityProperties + err = json.Unmarshal(*v, &processEntityProperties) + if err != nil { + return err + } + peVar.ProcessEntityProperties = &processEntityProperties + } + case "kind": + if v != nil { + var kind KindBasicEntity + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + peVar.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + peVar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + peVar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + peVar.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + peVar.SystemData = &systemData + } + } + } + + return nil +} + +// ProcessEntityProperties process entity property bag. +type ProcessEntityProperties struct { + // AccountEntityID - READ-ONLY; The account entity id running the processes. + AccountEntityID *string `json:"accountEntityId,omitempty"` + // CommandLine - READ-ONLY; The command line used to create the process + CommandLine *string `json:"commandLine,omitempty"` + // CreationTimeUtc - READ-ONLY; The time when the process started to run + CreationTimeUtc *date.Time `json:"creationTimeUtc,omitempty"` + // ElevationToken - The elevation token associated with the process. Possible values include: 'ElevationTokenDefault', 'ElevationTokenFull', 'ElevationTokenLimited' + ElevationToken ElevationToken `json:"elevationToken,omitempty"` + // HostEntityID - READ-ONLY; The host entity id on which the process was running + HostEntityID *string `json:"hostEntityId,omitempty"` + // HostLogonSessionEntityID - READ-ONLY; The session entity id in which the process was running + HostLogonSessionEntityID *string `json:"hostLogonSessionEntityId,omitempty"` + // ImageFileEntityID - READ-ONLY; Image file entity id + ImageFileEntityID *string `json:"imageFileEntityId,omitempty"` + // ParentProcessEntityID - READ-ONLY; The parent process entity id. + ParentProcessEntityID *string `json:"parentProcessEntityId,omitempty"` + // ProcessID - READ-ONLY; The process ID + ProcessID *string `json:"processId,omitempty"` + // AdditionalData - READ-ONLY; A bag of custom fields that should be part of the entity and will be presented to the user. + AdditionalData map[string]interface{} `json:"additionalData"` + // FriendlyName - READ-ONLY; The graph item display name which is a short humanly readable description of the graph item instance. This property is optional and might be system generated. + FriendlyName *string `json:"friendlyName,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProcessEntityProperties. +func (pep ProcessEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pep.ElevationToken != "" { + objectMap["elevationToken"] = pep.ElevationToken + } + return json.Marshal(objectMap) +} + +// PropertyConditionProperties describes an automation rule condition that evaluates a property's value +type PropertyConditionProperties struct { + ConditionProperties *AutomationRulePropertyValuesCondition `json:"conditionProperties,omitempty"` + // ConditionType - Possible values include: 'ConditionTypeBasicAutomationRuleConditionConditionTypeAutomationRuleCondition', 'ConditionTypeBasicAutomationRuleConditionConditionTypeProperty' + ConditionType ConditionTypeBasicAutomationRuleCondition `json:"conditionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for PropertyConditionProperties. +func (pcp PropertyConditionProperties) MarshalJSON() ([]byte, error) { + pcp.ConditionType = ConditionTypeBasicAutomationRuleConditionConditionTypeProperty + objectMap := make(map[string]interface{}) + if pcp.ConditionProperties != nil { + objectMap["conditionProperties"] = pcp.ConditionProperties + } + if pcp.ConditionType != "" { + objectMap["conditionType"] = pcp.ConditionType + } + return json.Marshal(objectMap) +} + +// AsPropertyConditionProperties is the BasicAutomationRuleCondition implementation for PropertyConditionProperties. +func (pcp PropertyConditionProperties) AsPropertyConditionProperties() (*PropertyConditionProperties, bool) { + return &pcp, true +} + +// AsAutomationRuleCondition is the BasicAutomationRuleCondition implementation for PropertyConditionProperties. +func (pcp PropertyConditionProperties) AsAutomationRuleCondition() (*AutomationRuleCondition, bool) { + return nil, false +} + +// AsBasicAutomationRuleCondition is the BasicAutomationRuleCondition implementation for PropertyConditionProperties. +func (pcp PropertyConditionProperties) AsBasicAutomationRuleCondition() (BasicAutomationRuleCondition, bool) { + return &pcp, true +} + +// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not +// have tags and a location +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// QueryBasedAlertRuleTemplateProperties query based alert rule template base property bag. +type QueryBasedAlertRuleTemplateProperties struct { + // Query - The query that creates alerts for this rule. + Query *string `json:"query,omitempty"` + // Severity - The severity for alerts created by this alert rule. Possible values include: 'AlertSeverityHigh', 'AlertSeverityMedium', 'AlertSeverityLow', 'AlertSeverityInformational' + Severity AlertSeverity `json:"severity,omitempty"` + // Version - The version of this template - in format , where all are numbers. For example <1.0.2>. + Version *string `json:"version,omitempty"` + // CustomDetails - Dictionary of string key-value pairs of columns to be attached to the alert + CustomDetails map[string]*string `json:"customDetails"` + // EntityMappings - Array of the entity mappings of the alert rule + EntityMappings *[]EntityMapping `json:"entityMappings,omitempty"` + // AlertDetailsOverride - The alert details override settings + AlertDetailsOverride *AlertDetailsOverride `json:"alertDetailsOverride,omitempty"` +} + +// MarshalJSON is the custom marshaler for QueryBasedAlertRuleTemplateProperties. +func (qbartp QueryBasedAlertRuleTemplateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if qbartp.Query != nil { + objectMap["query"] = qbartp.Query + } + if qbartp.Severity != "" { + objectMap["severity"] = qbartp.Severity + } + if qbartp.Version != nil { + objectMap["version"] = qbartp.Version + } + if qbartp.CustomDetails != nil { + objectMap["customDetails"] = qbartp.CustomDetails + } + if qbartp.EntityMappings != nil { + objectMap["entityMappings"] = qbartp.EntityMappings + } + if qbartp.AlertDetailsOverride != nil { + objectMap["alertDetailsOverride"] = qbartp.AlertDetailsOverride + } + return json.Marshal(objectMap) +} + +// RegistryKeyEntity represents a registry key entity. +type RegistryKeyEntity struct { + // RegistryKeyEntityProperties - RegistryKey entity properties + *RegistryKeyEntityProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicEntityKindEntity', 'KindBasicEntityKindURL', 'KindBasicEntityKindSubmissionMail', 'KindBasicEntityKindSecurityGroup', 'KindBasicEntityKindSecurityAlert', 'KindBasicEntityKindRegistryValue', 'KindBasicEntityKindRegistryKey', 'KindBasicEntityKindProcess', 'KindBasicEntityKindMalware', 'KindBasicEntityKindMailMessage', 'KindBasicEntityKindMailCluster', 'KindBasicEntityKindMailbox', 'KindBasicEntityKindIP', 'KindBasicEntityKindIoTDevice', 'KindBasicEntityKindBookmark', 'KindBasicEntityKindHost', 'KindBasicEntityKindFileHash', 'KindBasicEntityKindFile', 'KindBasicEntityKindDNSResolution', 'KindBasicEntityKindCloudApplication', 'KindBasicEntityKindAzureResource', 'KindBasicEntityKindAccount' + Kind KindBasicEntity `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for RegistryKeyEntity. +func (rke RegistryKeyEntity) MarshalJSON() ([]byte, error) { + rke.Kind = KindBasicEntityKindRegistryKey + objectMap := make(map[string]interface{}) + if rke.RegistryKeyEntityProperties != nil { + objectMap["properties"] = rke.RegistryKeyEntityProperties + } + if rke.Kind != "" { + objectMap["kind"] = rke.Kind + } + return json.Marshal(objectMap) +} + +// AsURLEntity is the BasicEntity implementation for RegistryKeyEntity. +func (rke RegistryKeyEntity) AsURLEntity() (*URLEntity, bool) { + return nil, false +} + +// AsSubmissionMailEntity is the BasicEntity implementation for RegistryKeyEntity. +func (rke RegistryKeyEntity) AsSubmissionMailEntity() (*SubmissionMailEntity, bool) { + return nil, false +} + +// AsSecurityGroupEntity is the BasicEntity implementation for RegistryKeyEntity. +func (rke RegistryKeyEntity) AsSecurityGroupEntity() (*SecurityGroupEntity, bool) { + return nil, false +} + +// AsSecurityAlert is the BasicEntity implementation for RegistryKeyEntity. +func (rke RegistryKeyEntity) AsSecurityAlert() (*SecurityAlert, bool) { + return nil, false +} + +// AsRegistryValueEntity is the BasicEntity implementation for RegistryKeyEntity. +func (rke RegistryKeyEntity) AsRegistryValueEntity() (*RegistryValueEntity, bool) { + return nil, false +} + +// AsRegistryKeyEntity is the BasicEntity implementation for RegistryKeyEntity. +func (rke RegistryKeyEntity) AsRegistryKeyEntity() (*RegistryKeyEntity, bool) { + return &rke, true +} + +// AsProcessEntity is the BasicEntity implementation for RegistryKeyEntity. +func (rke RegistryKeyEntity) AsProcessEntity() (*ProcessEntity, bool) { + return nil, false +} + +// AsMalwareEntity is the BasicEntity implementation for RegistryKeyEntity. +func (rke RegistryKeyEntity) AsMalwareEntity() (*MalwareEntity, bool) { + return nil, false +} + +// AsMailMessageEntity is the BasicEntity implementation for RegistryKeyEntity. +func (rke RegistryKeyEntity) AsMailMessageEntity() (*MailMessageEntity, bool) { + return nil, false +} + +// AsMailClusterEntity is the BasicEntity implementation for RegistryKeyEntity. +func (rke RegistryKeyEntity) AsMailClusterEntity() (*MailClusterEntity, bool) { + return nil, false +} + +// AsMailboxEntity is the BasicEntity implementation for RegistryKeyEntity. +func (rke RegistryKeyEntity) AsMailboxEntity() (*MailboxEntity, bool) { + return nil, false +} + +// AsIPEntity is the BasicEntity implementation for RegistryKeyEntity. +func (rke RegistryKeyEntity) AsIPEntity() (*IPEntity, bool) { + return nil, false +} + +// AsIoTDeviceEntity is the BasicEntity implementation for RegistryKeyEntity. +func (rke RegistryKeyEntity) AsIoTDeviceEntity() (*IoTDeviceEntity, bool) { + return nil, false +} + +// AsHuntingBookmark is the BasicEntity implementation for RegistryKeyEntity. +func (rke RegistryKeyEntity) AsHuntingBookmark() (*HuntingBookmark, bool) { + return nil, false +} + +// AsHostEntity is the BasicEntity implementation for RegistryKeyEntity. +func (rke RegistryKeyEntity) AsHostEntity() (*HostEntity, bool) { + return nil, false +} + +// AsFileHashEntity is the BasicEntity implementation for RegistryKeyEntity. +func (rke RegistryKeyEntity) AsFileHashEntity() (*FileHashEntity, bool) { + return nil, false +} + +// AsFileEntity is the BasicEntity implementation for RegistryKeyEntity. +func (rke RegistryKeyEntity) AsFileEntity() (*FileEntity, bool) { + return nil, false +} + +// AsDNSEntity is the BasicEntity implementation for RegistryKeyEntity. +func (rke RegistryKeyEntity) AsDNSEntity() (*DNSEntity, bool) { + return nil, false +} + +// AsCloudApplicationEntity is the BasicEntity implementation for RegistryKeyEntity. +func (rke RegistryKeyEntity) AsCloudApplicationEntity() (*CloudApplicationEntity, bool) { + return nil, false +} + +// AsAzureResourceEntity is the BasicEntity implementation for RegistryKeyEntity. +func (rke RegistryKeyEntity) AsAzureResourceEntity() (*AzureResourceEntity, bool) { + return nil, false +} + +// AsAccountEntity is the BasicEntity implementation for RegistryKeyEntity. +func (rke RegistryKeyEntity) AsAccountEntity() (*AccountEntity, bool) { + return nil, false +} + +// AsEntity is the BasicEntity implementation for RegistryKeyEntity. +func (rke RegistryKeyEntity) AsEntity() (*Entity, bool) { + return nil, false +} + +// AsBasicEntity is the BasicEntity implementation for RegistryKeyEntity. +func (rke RegistryKeyEntity) AsBasicEntity() (BasicEntity, bool) { + return &rke, true +} + +// UnmarshalJSON is the custom unmarshaler for RegistryKeyEntity struct. +func (rke *RegistryKeyEntity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var registryKeyEntityProperties RegistryKeyEntityProperties + err = json.Unmarshal(*v, ®istryKeyEntityProperties) + if err != nil { + return err + } + rke.RegistryKeyEntityProperties = ®istryKeyEntityProperties + } + case "kind": + if v != nil { + var kind KindBasicEntity + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + rke.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rke.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rke.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rke.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + rke.SystemData = &systemData + } + } + } + + return nil +} + +// RegistryKeyEntityProperties registryKey entity property bag. +type RegistryKeyEntityProperties struct { + // Hive - READ-ONLY; the hive that holds the registry key. Possible values include: 'RegistryHiveHKEYLOCALMACHINE', 'RegistryHiveHKEYCLASSESROOT', 'RegistryHiveHKEYCURRENTCONFIG', 'RegistryHiveHKEYUSERS', 'RegistryHiveHKEYCURRENTUSERLOCALSETTINGS', 'RegistryHiveHKEYPERFORMANCEDATA', 'RegistryHiveHKEYPERFORMANCENLSTEXT', 'RegistryHiveHKEYPERFORMANCETEXT', 'RegistryHiveHKEYA', 'RegistryHiveHKEYCURRENTUSER' + Hive RegistryHive `json:"hive,omitempty"` + // Key - READ-ONLY; The registry key path. + Key *string `json:"key,omitempty"` + // AdditionalData - READ-ONLY; A bag of custom fields that should be part of the entity and will be presented to the user. + AdditionalData map[string]interface{} `json:"additionalData"` + // FriendlyName - READ-ONLY; The graph item display name which is a short humanly readable description of the graph item instance. This property is optional and might be system generated. + FriendlyName *string `json:"friendlyName,omitempty"` +} + +// MarshalJSON is the custom marshaler for RegistryKeyEntityProperties. +func (rkep RegistryKeyEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// RegistryValueEntity represents a registry value entity. +type RegistryValueEntity struct { + // RegistryValueEntityProperties - RegistryKey entity properties + *RegistryValueEntityProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicEntityKindEntity', 'KindBasicEntityKindURL', 'KindBasicEntityKindSubmissionMail', 'KindBasicEntityKindSecurityGroup', 'KindBasicEntityKindSecurityAlert', 'KindBasicEntityKindRegistryValue', 'KindBasicEntityKindRegistryKey', 'KindBasicEntityKindProcess', 'KindBasicEntityKindMalware', 'KindBasicEntityKindMailMessage', 'KindBasicEntityKindMailCluster', 'KindBasicEntityKindMailbox', 'KindBasicEntityKindIP', 'KindBasicEntityKindIoTDevice', 'KindBasicEntityKindBookmark', 'KindBasicEntityKindHost', 'KindBasicEntityKindFileHash', 'KindBasicEntityKindFile', 'KindBasicEntityKindDNSResolution', 'KindBasicEntityKindCloudApplication', 'KindBasicEntityKindAzureResource', 'KindBasicEntityKindAccount' + Kind KindBasicEntity `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for RegistryValueEntity. +func (rve RegistryValueEntity) MarshalJSON() ([]byte, error) { + rve.Kind = KindBasicEntityKindRegistryValue + objectMap := make(map[string]interface{}) + if rve.RegistryValueEntityProperties != nil { + objectMap["properties"] = rve.RegistryValueEntityProperties + } + if rve.Kind != "" { + objectMap["kind"] = rve.Kind + } + return json.Marshal(objectMap) +} + +// AsURLEntity is the BasicEntity implementation for RegistryValueEntity. +func (rve RegistryValueEntity) AsURLEntity() (*URLEntity, bool) { + return nil, false +} + +// AsSubmissionMailEntity is the BasicEntity implementation for RegistryValueEntity. +func (rve RegistryValueEntity) AsSubmissionMailEntity() (*SubmissionMailEntity, bool) { + return nil, false +} + +// AsSecurityGroupEntity is the BasicEntity implementation for RegistryValueEntity. +func (rve RegistryValueEntity) AsSecurityGroupEntity() (*SecurityGroupEntity, bool) { + return nil, false +} + +// AsSecurityAlert is the BasicEntity implementation for RegistryValueEntity. +func (rve RegistryValueEntity) AsSecurityAlert() (*SecurityAlert, bool) { + return nil, false +} + +// AsRegistryValueEntity is the BasicEntity implementation for RegistryValueEntity. +func (rve RegistryValueEntity) AsRegistryValueEntity() (*RegistryValueEntity, bool) { + return &rve, true +} + +// AsRegistryKeyEntity is the BasicEntity implementation for RegistryValueEntity. +func (rve RegistryValueEntity) AsRegistryKeyEntity() (*RegistryKeyEntity, bool) { + return nil, false +} + +// AsProcessEntity is the BasicEntity implementation for RegistryValueEntity. +func (rve RegistryValueEntity) AsProcessEntity() (*ProcessEntity, bool) { + return nil, false +} + +// AsMalwareEntity is the BasicEntity implementation for RegistryValueEntity. +func (rve RegistryValueEntity) AsMalwareEntity() (*MalwareEntity, bool) { + return nil, false +} + +// AsMailMessageEntity is the BasicEntity implementation for RegistryValueEntity. +func (rve RegistryValueEntity) AsMailMessageEntity() (*MailMessageEntity, bool) { + return nil, false +} + +// AsMailClusterEntity is the BasicEntity implementation for RegistryValueEntity. +func (rve RegistryValueEntity) AsMailClusterEntity() (*MailClusterEntity, bool) { + return nil, false +} + +// AsMailboxEntity is the BasicEntity implementation for RegistryValueEntity. +func (rve RegistryValueEntity) AsMailboxEntity() (*MailboxEntity, bool) { + return nil, false +} + +// AsIPEntity is the BasicEntity implementation for RegistryValueEntity. +func (rve RegistryValueEntity) AsIPEntity() (*IPEntity, bool) { + return nil, false +} + +// AsIoTDeviceEntity is the BasicEntity implementation for RegistryValueEntity. +func (rve RegistryValueEntity) AsIoTDeviceEntity() (*IoTDeviceEntity, bool) { + return nil, false +} + +// AsHuntingBookmark is the BasicEntity implementation for RegistryValueEntity. +func (rve RegistryValueEntity) AsHuntingBookmark() (*HuntingBookmark, bool) { + return nil, false +} + +// AsHostEntity is the BasicEntity implementation for RegistryValueEntity. +func (rve RegistryValueEntity) AsHostEntity() (*HostEntity, bool) { + return nil, false +} + +// AsFileHashEntity is the BasicEntity implementation for RegistryValueEntity. +func (rve RegistryValueEntity) AsFileHashEntity() (*FileHashEntity, bool) { + return nil, false +} + +// AsFileEntity is the BasicEntity implementation for RegistryValueEntity. +func (rve RegistryValueEntity) AsFileEntity() (*FileEntity, bool) { + return nil, false +} + +// AsDNSEntity is the BasicEntity implementation for RegistryValueEntity. +func (rve RegistryValueEntity) AsDNSEntity() (*DNSEntity, bool) { + return nil, false +} + +// AsCloudApplicationEntity is the BasicEntity implementation for RegistryValueEntity. +func (rve RegistryValueEntity) AsCloudApplicationEntity() (*CloudApplicationEntity, bool) { + return nil, false +} + +// AsAzureResourceEntity is the BasicEntity implementation for RegistryValueEntity. +func (rve RegistryValueEntity) AsAzureResourceEntity() (*AzureResourceEntity, bool) { + return nil, false +} + +// AsAccountEntity is the BasicEntity implementation for RegistryValueEntity. +func (rve RegistryValueEntity) AsAccountEntity() (*AccountEntity, bool) { + return nil, false +} + +// AsEntity is the BasicEntity implementation for RegistryValueEntity. +func (rve RegistryValueEntity) AsEntity() (*Entity, bool) { + return nil, false +} + +// AsBasicEntity is the BasicEntity implementation for RegistryValueEntity. +func (rve RegistryValueEntity) AsBasicEntity() (BasicEntity, bool) { + return &rve, true +} + +// UnmarshalJSON is the custom unmarshaler for RegistryValueEntity struct. +func (rve *RegistryValueEntity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var registryValueEntityProperties RegistryValueEntityProperties + err = json.Unmarshal(*v, ®istryValueEntityProperties) + if err != nil { + return err + } + rve.RegistryValueEntityProperties = ®istryValueEntityProperties + } + case "kind": + if v != nil { + var kind KindBasicEntity + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + rve.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rve.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rve.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rve.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + rve.SystemData = &systemData + } + } + } + + return nil +} + +// RegistryValueEntityProperties registryValue entity property bag. +type RegistryValueEntityProperties struct { + // KeyEntityID - READ-ONLY; The registry key entity id. + KeyEntityID *string `json:"keyEntityId,omitempty"` + // ValueData - READ-ONLY; String formatted representation of the value data. + ValueData *string `json:"valueData,omitempty"` + // ValueName - READ-ONLY; The registry value name. + ValueName *string `json:"valueName,omitempty"` + // ValueType - READ-ONLY; Specifies the data types to use when storing values in the registry, or identifies the data type of a value in the registry. Possible values include: 'RegistryValueKindNone', 'RegistryValueKindUnknown', 'RegistryValueKindString', 'RegistryValueKindExpandString', 'RegistryValueKindBinary', 'RegistryValueKindDWord', 'RegistryValueKindMultiString', 'RegistryValueKindQWord' + ValueType RegistryValueKind `json:"valueType,omitempty"` + // AdditionalData - READ-ONLY; A bag of custom fields that should be part of the entity and will be presented to the user. + AdditionalData map[string]interface{} `json:"additionalData"` + // FriendlyName - READ-ONLY; The graph item display name which is a short humanly readable description of the graph item instance. This property is optional and might be system generated. + FriendlyName *string `json:"friendlyName,omitempty"` +} + +// MarshalJSON is the custom marshaler for RegistryValueEntityProperties. +func (rvep RegistryValueEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Relation represents a relation between two resources +type Relation struct { + autorest.Response `json:"-"` + // RelationProperties - Relation properties + *RelationProperties `json:"properties,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Relation. +func (r Relation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.RelationProperties != nil { + objectMap["properties"] = r.RelationProperties + } + if r.Etag != nil { + objectMap["etag"] = r.Etag + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Relation struct. +func (r *Relation) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var relationProperties RelationProperties + err = json.Unmarshal(*v, &relationProperties) + if err != nil { + return err + } + r.RelationProperties = &relationProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + r.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + r.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + r.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + r.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + r.SystemData = &systemData + } + } + } + + return nil +} + +// RelationList list of relations. +type RelationList struct { + autorest.Response `json:"-"` + // NextLink - READ-ONLY; URL to fetch the next set of relations. + NextLink *string `json:"nextLink,omitempty"` + // Value - Array of relations. + Value *[]Relation `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for RelationList. +func (rl RelationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rl.Value != nil { + objectMap["value"] = rl.Value + } + return json.Marshal(objectMap) +} + +// RelationListIterator provides access to a complete listing of Relation values. +type RelationListIterator struct { + i int + page RelationListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RelationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RelationListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RelationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RelationListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RelationListIterator) Response() RelationList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RelationListIterator) Value() Relation { + if !iter.page.NotDone() { + return Relation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RelationListIterator type. +func NewRelationListIterator(page RelationListPage) RelationListIterator { + return RelationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rl RelationList) IsEmpty() bool { + return rl.Value == nil || len(*rl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rl RelationList) hasNextLink() bool { + return rl.NextLink != nil && len(*rl.NextLink) != 0 +} + +// relationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rl RelationList) relationListPreparer(ctx context.Context) (*http.Request, error) { + if !rl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rl.NextLink))) +} + +// RelationListPage contains a page of Relation values. +type RelationListPage struct { + fn func(context.Context, RelationList) (RelationList, error) + rl RelationList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RelationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RelationListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rl) + if err != nil { + return err + } + page.rl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RelationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RelationListPage) NotDone() bool { + return !page.rl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RelationListPage) Response() RelationList { + return page.rl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RelationListPage) Values() []Relation { + if page.rl.IsEmpty() { + return nil + } + return *page.rl.Value +} + +// Creates a new instance of the RelationListPage type. +func NewRelationListPage(cur RelationList, getNextPage func(context.Context, RelationList) (RelationList, error)) RelationListPage { + return RelationListPage{ + fn: getNextPage, + rl: cur, + } +} + +// RelationProperties relation property bag. +type RelationProperties struct { + // RelatedResourceID - The resource ID of the related resource + RelatedResourceID *string `json:"relatedResourceId,omitempty"` + // RelatedResourceName - READ-ONLY; The name of the related resource + RelatedResourceName *string `json:"relatedResourceName,omitempty"` + // RelatedResourceType - READ-ONLY; The resource type of the related resource + RelatedResourceType *string `json:"relatedResourceType,omitempty"` + // RelatedResourceKind - READ-ONLY; The resource kind of the related resource + RelatedResourceKind *string `json:"relatedResourceKind,omitempty"` +} + +// MarshalJSON is the custom marshaler for RelationProperties. +func (rp RelationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rp.RelatedResourceID != nil { + objectMap["relatedResourceId"] = rp.RelatedResourceID + } + return json.Marshal(objectMap) +} + +// Repo represents a repository. +type Repo struct { + // URL - The url to access the repository. + URL *string `json:"url,omitempty"` + // FullName - The name of the repository. + FullName *string `json:"fullName,omitempty"` + // Branches - Array of branches. + Branches *[]string `json:"branches,omitempty"` +} + +// RepoList list all the source controls. +type RepoList struct { + autorest.Response `json:"-"` + // NextLink - READ-ONLY; URL to fetch the next set of repositories. + NextLink *string `json:"nextLink,omitempty"` + // Value - Array of repositories. + Value *[]Repo `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for RepoList. +func (rl RepoList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rl.Value != nil { + objectMap["value"] = rl.Value + } + return json.Marshal(objectMap) +} + +// RepoListIterator provides access to a complete listing of Repo values. +type RepoListIterator struct { + i int + page RepoListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RepoListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RepoListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RepoListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RepoListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RepoListIterator) Response() RepoList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RepoListIterator) Value() Repo { + if !iter.page.NotDone() { + return Repo{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RepoListIterator type. +func NewRepoListIterator(page RepoListPage) RepoListIterator { + return RepoListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rl RepoList) IsEmpty() bool { + return rl.Value == nil || len(*rl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rl RepoList) hasNextLink() bool { + return rl.NextLink != nil && len(*rl.NextLink) != 0 +} + +// repoListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rl RepoList) repoListPreparer(ctx context.Context) (*http.Request, error) { + if !rl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rl.NextLink))) +} + +// RepoListPage contains a page of Repo values. +type RepoListPage struct { + fn func(context.Context, RepoList) (RepoList, error) + rl RepoList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RepoListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RepoListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rl) + if err != nil { + return err + } + page.rl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RepoListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RepoListPage) NotDone() bool { + return !page.rl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RepoListPage) Response() RepoList { + return page.rl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RepoListPage) Values() []Repo { + if page.rl.IsEmpty() { + return nil + } + return *page.rl.Value +} + +// Creates a new instance of the RepoListPage type. +func NewRepoListPage(cur RepoList, getNextPage func(context.Context, RepoList) (RepoList, error)) RepoListPage { + return RepoListPage{ + fn: getNextPage, + rl: cur, + } +} + +// Repository metadata of a repository. +type Repository struct { + // URL - Url of repository. + URL *string `json:"url,omitempty"` + // Branch - Branch name of repository. + Branch *string `json:"branch,omitempty"` + // DisplayURL - Display url of repository. + DisplayURL *string `json:"displayUrl,omitempty"` + // DeploymentLogsURL - Url to access repository action logs. + DeploymentLogsURL *string `json:"deploymentLogsUrl,omitempty"` + // PathMapping - Dictionary of source control content type and path mapping. + PathMapping *[]ContentPathMap `json:"pathMapping,omitempty"` +} + +// RepositoryResourceInfo resources created in user's repository for the source-control. +type RepositoryResourceInfo struct { + // Webhook - The webhook object created for the source-control. + Webhook *Webhook `json:"webhook,omitempty"` + // GitHubResourceInfo - Resources created in GitHub for this source-control. + GitHubResourceInfo *GitHubResourceInfo `json:"gitHubResourceInfo,omitempty"` + // AzureDevOpsResourceInfo - Resources created in Azure DevOps for this source-control. + AzureDevOpsResourceInfo *AzureDevOpsResourceInfo `json:"azureDevOpsResourceInfo,omitempty"` +} + +// RequiredPermissions required permissions for the connector +type RequiredPermissions struct { + // Action - action permission + Action *bool `json:"action,omitempty"` + // Write - write permission + Write *bool `json:"write,omitempty"` + // Read - read permission + Read *bool `json:"read,omitempty"` + // Delete - delete permission + Delete *bool `json:"delete,omitempty"` +} + +// Resource common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceProvider resource provider permissions required for the connector +type ResourceProvider struct { + // Provider - Provider name. Possible values include: 'ProviderNameMicrosoftOperationalInsightssolutions', 'ProviderNameMicrosoftOperationalInsightsworkspaces', 'ProviderNameMicrosoftOperationalInsightsworkspacesdatasources', 'ProviderNameMicrosoftaadiamdiagnosticSettings', 'ProviderNameMicrosoftOperationalInsightsworkspacessharedKeys', 'ProviderNameMicrosoftAuthorizationpolicyAssignments' + Provider ProviderName `json:"provider,omitempty"` + // PermissionsDisplayText - Permission description text + PermissionsDisplayText *string `json:"permissionsDisplayText,omitempty"` + // ProviderDisplayName - Permission provider display name + ProviderDisplayName *string `json:"providerDisplayName,omitempty"` + // Scope - Permission provider scope. Possible values include: 'PermissionProviderScopeResourceGroup', 'PermissionProviderScopeSubscription', 'PermissionProviderScopeWorkspace' + Scope PermissionProviderScope `json:"scope,omitempty"` + // RequiredPermissions - Required permissions for the connector + RequiredPermissions *RequiredPermissions `json:"requiredPermissions,omitempty"` +} + +// ResourceWithEtag an azure resource object with an Etag property +type ResourceWithEtag struct { + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceWithEtag. +func (rwe ResourceWithEtag) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rwe.Etag != nil { + objectMap["etag"] = rwe.Etag + } + return json.Marshal(objectMap) +} + +// SampleQueries the sample queries for the connector +type SampleQueries struct { + // Description - The sample query description + Description *string `json:"description,omitempty"` + // Query - the sample query + Query *string `json:"query,omitempty"` +} + +// ScheduledAlertRule represents scheduled alert rule. +type ScheduledAlertRule struct { + // ScheduledAlertRuleProperties - Scheduled alert rule properties + *ScheduledAlertRuleProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicAlertRuleKindAlertRule', 'KindBasicAlertRuleKindMLBehaviorAnalytics', 'KindBasicAlertRuleKindFusion', 'KindBasicAlertRuleKindThreatIntelligence', 'KindBasicAlertRuleKindMicrosoftSecurityIncidentCreation', 'KindBasicAlertRuleKindScheduled', 'KindBasicAlertRuleKindNRT' + Kind KindBasicAlertRule `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ScheduledAlertRule. +func (sar ScheduledAlertRule) MarshalJSON() ([]byte, error) { + sar.Kind = KindBasicAlertRuleKindScheduled + objectMap := make(map[string]interface{}) + if sar.ScheduledAlertRuleProperties != nil { + objectMap["properties"] = sar.ScheduledAlertRuleProperties + } + if sar.Kind != "" { + objectMap["kind"] = sar.Kind + } + if sar.Etag != nil { + objectMap["etag"] = sar.Etag + } + return json.Marshal(objectMap) +} + +// AsMLBehaviorAnalyticsAlertRule is the BasicAlertRule implementation for ScheduledAlertRule. +func (sar ScheduledAlertRule) AsMLBehaviorAnalyticsAlertRule() (*MLBehaviorAnalyticsAlertRule, bool) { + return nil, false +} + +// AsFusionAlertRule is the BasicAlertRule implementation for ScheduledAlertRule. +func (sar ScheduledAlertRule) AsFusionAlertRule() (*FusionAlertRule, bool) { + return nil, false +} + +// AsThreatIntelligenceAlertRule is the BasicAlertRule implementation for ScheduledAlertRule. +func (sar ScheduledAlertRule) AsThreatIntelligenceAlertRule() (*ThreatIntelligenceAlertRule, bool) { + return nil, false +} + +// AsMicrosoftSecurityIncidentCreationAlertRule is the BasicAlertRule implementation for ScheduledAlertRule. +func (sar ScheduledAlertRule) AsMicrosoftSecurityIncidentCreationAlertRule() (*MicrosoftSecurityIncidentCreationAlertRule, bool) { + return nil, false +} + +// AsScheduledAlertRule is the BasicAlertRule implementation for ScheduledAlertRule. +func (sar ScheduledAlertRule) AsScheduledAlertRule() (*ScheduledAlertRule, bool) { + return &sar, true +} + +// AsNrtAlertRule is the BasicAlertRule implementation for ScheduledAlertRule. +func (sar ScheduledAlertRule) AsNrtAlertRule() (*NrtAlertRule, bool) { + return nil, false +} + +// AsAlertRule is the BasicAlertRule implementation for ScheduledAlertRule. +func (sar ScheduledAlertRule) AsAlertRule() (*AlertRule, bool) { + return nil, false +} + +// AsBasicAlertRule is the BasicAlertRule implementation for ScheduledAlertRule. +func (sar ScheduledAlertRule) AsBasicAlertRule() (BasicAlertRule, bool) { + return &sar, true +} + +// UnmarshalJSON is the custom unmarshaler for ScheduledAlertRule struct. +func (sar *ScheduledAlertRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var scheduledAlertRuleProperties ScheduledAlertRuleProperties + err = json.Unmarshal(*v, &scheduledAlertRuleProperties) + if err != nil { + return err + } + sar.ScheduledAlertRuleProperties = &scheduledAlertRuleProperties + } + case "kind": + if v != nil { + var kind KindBasicAlertRule + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + sar.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + sar.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sar.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + sar.SystemData = &systemData + } + } + } + + return nil +} + +// ScheduledAlertRuleCommonProperties scheduled alert rule template property bag. +type ScheduledAlertRuleCommonProperties struct { + // Query - The query that creates alerts for this rule. + Query *string `json:"query,omitempty"` + // QueryFrequency - The frequency (in ISO 8601 duration format) for this alert rule to run. + QueryFrequency *string `json:"queryFrequency,omitempty"` + // QueryPeriod - The period (in ISO 8601 duration format) that this alert rule looks at. + QueryPeriod *string `json:"queryPeriod,omitempty"` + // Severity - The severity for alerts created by this alert rule. Possible values include: 'AlertSeverityHigh', 'AlertSeverityMedium', 'AlertSeverityLow', 'AlertSeverityInformational' + Severity AlertSeverity `json:"severity,omitempty"` + // TriggerOperator - The operation against the threshold that triggers alert rule. Possible values include: 'TriggerOperatorGreaterThan', 'TriggerOperatorLessThan', 'TriggerOperatorEqual', 'TriggerOperatorNotEqual' + TriggerOperator TriggerOperator `json:"triggerOperator,omitempty"` + // TriggerThreshold - The threshold triggers this alert rule. + TriggerThreshold *int32 `json:"triggerThreshold,omitempty"` + // EventGroupingSettings - The event grouping settings. + EventGroupingSettings *EventGroupingSettings `json:"eventGroupingSettings,omitempty"` + // CustomDetails - Dictionary of string key-value pairs of columns to be attached to the alert + CustomDetails map[string]*string `json:"customDetails"` + // EntityMappings - Array of the entity mappings of the alert rule + EntityMappings *[]EntityMapping `json:"entityMappings,omitempty"` + // AlertDetailsOverride - The alert details override settings + AlertDetailsOverride *AlertDetailsOverride `json:"alertDetailsOverride,omitempty"` +} + +// MarshalJSON is the custom marshaler for ScheduledAlertRuleCommonProperties. +func (sarcp ScheduledAlertRuleCommonProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sarcp.Query != nil { + objectMap["query"] = sarcp.Query + } + if sarcp.QueryFrequency != nil { + objectMap["queryFrequency"] = sarcp.QueryFrequency + } + if sarcp.QueryPeriod != nil { + objectMap["queryPeriod"] = sarcp.QueryPeriod + } + if sarcp.Severity != "" { + objectMap["severity"] = sarcp.Severity + } + if sarcp.TriggerOperator != "" { + objectMap["triggerOperator"] = sarcp.TriggerOperator + } + if sarcp.TriggerThreshold != nil { + objectMap["triggerThreshold"] = sarcp.TriggerThreshold + } + if sarcp.EventGroupingSettings != nil { + objectMap["eventGroupingSettings"] = sarcp.EventGroupingSettings + } + if sarcp.CustomDetails != nil { + objectMap["customDetails"] = sarcp.CustomDetails + } + if sarcp.EntityMappings != nil { + objectMap["entityMappings"] = sarcp.EntityMappings + } + if sarcp.AlertDetailsOverride != nil { + objectMap["alertDetailsOverride"] = sarcp.AlertDetailsOverride + } + return json.Marshal(objectMap) +} + +// ScheduledAlertRuleProperties scheduled alert rule base property bag. +type ScheduledAlertRuleProperties struct { + // AlertRuleTemplateName - The Name of the alert rule template used to create this rule. + AlertRuleTemplateName *string `json:"alertRuleTemplateName,omitempty"` + // TemplateVersion - The version of the alert rule template used to create this rule - in format , where all are numbers, for example 0 <1.0.2> + TemplateVersion *string `json:"templateVersion,omitempty"` + // Description - The description of the alert rule. + Description *string `json:"description,omitempty"` + // DisplayName - The display name for alerts created by this alert rule. + DisplayName *string `json:"displayName,omitempty"` + // Enabled - Determines whether this alert rule is enabled or disabled. + Enabled *bool `json:"enabled,omitempty"` + // LastModifiedUtc - READ-ONLY; The last time that this alert rule has been modified. + LastModifiedUtc *date.Time `json:"lastModifiedUtc,omitempty"` + // SuppressionDuration - The suppression (in ISO 8601 duration format) to wait since last time this alert rule been triggered. + SuppressionDuration *string `json:"suppressionDuration,omitempty"` + // SuppressionEnabled - Determines whether the suppression for this alert rule is enabled or disabled. + SuppressionEnabled *bool `json:"suppressionEnabled,omitempty"` + // Tactics - The tactics of the alert rule + Tactics *[]AttackTactic `json:"tactics,omitempty"` + // Techniques - The techniques of the alert rule + Techniques *[]string `json:"techniques,omitempty"` + // IncidentConfiguration - The settings of the incidents that created from alerts triggered by this analytics rule + IncidentConfiguration *IncidentConfiguration `json:"incidentConfiguration,omitempty"` + // Query - The query that creates alerts for this rule. + Query *string `json:"query,omitempty"` + // QueryFrequency - The frequency (in ISO 8601 duration format) for this alert rule to run. + QueryFrequency *string `json:"queryFrequency,omitempty"` + // QueryPeriod - The period (in ISO 8601 duration format) that this alert rule looks at. + QueryPeriod *string `json:"queryPeriod,omitempty"` + // Severity - The severity for alerts created by this alert rule. Possible values include: 'AlertSeverityHigh', 'AlertSeverityMedium', 'AlertSeverityLow', 'AlertSeverityInformational' + Severity AlertSeverity `json:"severity,omitempty"` + // TriggerOperator - The operation against the threshold that triggers alert rule. Possible values include: 'TriggerOperatorGreaterThan', 'TriggerOperatorLessThan', 'TriggerOperatorEqual', 'TriggerOperatorNotEqual' + TriggerOperator TriggerOperator `json:"triggerOperator,omitempty"` + // TriggerThreshold - The threshold triggers this alert rule. + TriggerThreshold *int32 `json:"triggerThreshold,omitempty"` + // EventGroupingSettings - The event grouping settings. + EventGroupingSettings *EventGroupingSettings `json:"eventGroupingSettings,omitempty"` + // CustomDetails - Dictionary of string key-value pairs of columns to be attached to the alert + CustomDetails map[string]*string `json:"customDetails"` + // EntityMappings - Array of the entity mappings of the alert rule + EntityMappings *[]EntityMapping `json:"entityMappings,omitempty"` + // AlertDetailsOverride - The alert details override settings + AlertDetailsOverride *AlertDetailsOverride `json:"alertDetailsOverride,omitempty"` +} + +// MarshalJSON is the custom marshaler for ScheduledAlertRuleProperties. +func (sarp ScheduledAlertRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sarp.AlertRuleTemplateName != nil { + objectMap["alertRuleTemplateName"] = sarp.AlertRuleTemplateName + } + if sarp.TemplateVersion != nil { + objectMap["templateVersion"] = sarp.TemplateVersion + } + if sarp.Description != nil { + objectMap["description"] = sarp.Description + } + if sarp.DisplayName != nil { + objectMap["displayName"] = sarp.DisplayName + } + if sarp.Enabled != nil { + objectMap["enabled"] = sarp.Enabled + } + if sarp.SuppressionDuration != nil { + objectMap["suppressionDuration"] = sarp.SuppressionDuration + } + if sarp.SuppressionEnabled != nil { + objectMap["suppressionEnabled"] = sarp.SuppressionEnabled + } + if sarp.Tactics != nil { + objectMap["tactics"] = sarp.Tactics + } + if sarp.Techniques != nil { + objectMap["techniques"] = sarp.Techniques + } + if sarp.IncidentConfiguration != nil { + objectMap["incidentConfiguration"] = sarp.IncidentConfiguration + } + if sarp.Query != nil { + objectMap["query"] = sarp.Query + } + if sarp.QueryFrequency != nil { + objectMap["queryFrequency"] = sarp.QueryFrequency + } + if sarp.QueryPeriod != nil { + objectMap["queryPeriod"] = sarp.QueryPeriod + } + if sarp.Severity != "" { + objectMap["severity"] = sarp.Severity + } + if sarp.TriggerOperator != "" { + objectMap["triggerOperator"] = sarp.TriggerOperator + } + if sarp.TriggerThreshold != nil { + objectMap["triggerThreshold"] = sarp.TriggerThreshold + } + if sarp.EventGroupingSettings != nil { + objectMap["eventGroupingSettings"] = sarp.EventGroupingSettings + } + if sarp.CustomDetails != nil { + objectMap["customDetails"] = sarp.CustomDetails + } + if sarp.EntityMappings != nil { + objectMap["entityMappings"] = sarp.EntityMappings + } + if sarp.AlertDetailsOverride != nil { + objectMap["alertDetailsOverride"] = sarp.AlertDetailsOverride + } + return json.Marshal(objectMap) +} + +// ScheduledAlertRuleTemplate represents scheduled alert rule template. +type ScheduledAlertRuleTemplate struct { + // ScheduledAlertRuleTemplateProperties - Scheduled alert rule template properties + *ScheduledAlertRuleTemplateProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicAlertRuleTemplateKindAlertRuleTemplate', 'KindBasicAlertRuleTemplateKindMLBehaviorAnalytics', 'KindBasicAlertRuleTemplateKindFusion', 'KindBasicAlertRuleTemplateKindThreatIntelligence', 'KindBasicAlertRuleTemplateKindMicrosoftSecurityIncidentCreation', 'KindBasicAlertRuleTemplateKindScheduled', 'KindBasicAlertRuleTemplateKindNRT' + Kind KindBasicAlertRuleTemplate `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ScheduledAlertRuleTemplate. +func (sart ScheduledAlertRuleTemplate) MarshalJSON() ([]byte, error) { + sart.Kind = KindBasicAlertRuleTemplateKindScheduled + objectMap := make(map[string]interface{}) + if sart.ScheduledAlertRuleTemplateProperties != nil { + objectMap["properties"] = sart.ScheduledAlertRuleTemplateProperties + } + if sart.Kind != "" { + objectMap["kind"] = sart.Kind + } + return json.Marshal(objectMap) +} + +// AsMLBehaviorAnalyticsAlertRuleTemplate is the BasicAlertRuleTemplate implementation for ScheduledAlertRuleTemplate. +func (sart ScheduledAlertRuleTemplate) AsMLBehaviorAnalyticsAlertRuleTemplate() (*MLBehaviorAnalyticsAlertRuleTemplate, bool) { + return nil, false +} + +// AsFusionAlertRuleTemplate is the BasicAlertRuleTemplate implementation for ScheduledAlertRuleTemplate. +func (sart ScheduledAlertRuleTemplate) AsFusionAlertRuleTemplate() (*FusionAlertRuleTemplate, bool) { + return nil, false +} + +// AsThreatIntelligenceAlertRuleTemplate is the BasicAlertRuleTemplate implementation for ScheduledAlertRuleTemplate. +func (sart ScheduledAlertRuleTemplate) AsThreatIntelligenceAlertRuleTemplate() (*ThreatIntelligenceAlertRuleTemplate, bool) { + return nil, false +} + +// AsMicrosoftSecurityIncidentCreationAlertRuleTemplate is the BasicAlertRuleTemplate implementation for ScheduledAlertRuleTemplate. +func (sart ScheduledAlertRuleTemplate) AsMicrosoftSecurityIncidentCreationAlertRuleTemplate() (*MicrosoftSecurityIncidentCreationAlertRuleTemplate, bool) { + return nil, false +} + +// AsScheduledAlertRuleTemplate is the BasicAlertRuleTemplate implementation for ScheduledAlertRuleTemplate. +func (sart ScheduledAlertRuleTemplate) AsScheduledAlertRuleTemplate() (*ScheduledAlertRuleTemplate, bool) { + return &sart, true +} + +// AsNrtAlertRuleTemplate is the BasicAlertRuleTemplate implementation for ScheduledAlertRuleTemplate. +func (sart ScheduledAlertRuleTemplate) AsNrtAlertRuleTemplate() (*NrtAlertRuleTemplate, bool) { + return nil, false +} + +// AsAlertRuleTemplate is the BasicAlertRuleTemplate implementation for ScheduledAlertRuleTemplate. +func (sart ScheduledAlertRuleTemplate) AsAlertRuleTemplate() (*AlertRuleTemplate, bool) { + return nil, false +} + +// AsBasicAlertRuleTemplate is the BasicAlertRuleTemplate implementation for ScheduledAlertRuleTemplate. +func (sart ScheduledAlertRuleTemplate) AsBasicAlertRuleTemplate() (BasicAlertRuleTemplate, bool) { + return &sart, true +} + +// UnmarshalJSON is the custom unmarshaler for ScheduledAlertRuleTemplate struct. +func (sart *ScheduledAlertRuleTemplate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var scheduledAlertRuleTemplateProperties ScheduledAlertRuleTemplateProperties + err = json.Unmarshal(*v, &scheduledAlertRuleTemplateProperties) + if err != nil { + return err + } + sart.ScheduledAlertRuleTemplateProperties = &scheduledAlertRuleTemplateProperties + } + case "kind": + if v != nil { + var kind KindBasicAlertRuleTemplate + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + sart.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sart.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sart.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sart.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + sart.SystemData = &systemData + } + } + } + + return nil +} + +// ScheduledAlertRuleTemplateProperties scheduled alert rule template properties +type ScheduledAlertRuleTemplateProperties struct { + // AlertRulesCreatedByTemplateCount - the number of alert rules that were created by this template + AlertRulesCreatedByTemplateCount *int32 `json:"alertRulesCreatedByTemplateCount,omitempty"` + // CreatedDateUTC - READ-ONLY; The time that this alert rule template has been added. + CreatedDateUTC *date.Time `json:"createdDateUTC,omitempty"` + // LastUpdatedDateUTC - READ-ONLY; The time that this alert rule template was last updated. + LastUpdatedDateUTC *date.Time `json:"lastUpdatedDateUTC,omitempty"` + // Description - The description of the alert rule template. + Description *string `json:"description,omitempty"` + // DisplayName - The display name for alert rule template. + DisplayName *string `json:"displayName,omitempty"` + // RequiredDataConnectors - The required data connectors for this template + RequiredDataConnectors *[]AlertRuleTemplateDataSource `json:"requiredDataConnectors,omitempty"` + // Status - The alert rule template status. Possible values include: 'TemplateStatusInstalled', 'TemplateStatusAvailable', 'TemplateStatusNotAvailable' + Status TemplateStatus `json:"status,omitempty"` + // Query - The query that creates alerts for this rule. + Query *string `json:"query,omitempty"` + // QueryFrequency - The frequency (in ISO 8601 duration format) for this alert rule to run. + QueryFrequency *string `json:"queryFrequency,omitempty"` + // QueryPeriod - The period (in ISO 8601 duration format) that this alert rule looks at. + QueryPeriod *string `json:"queryPeriod,omitempty"` + // Severity - The severity for alerts created by this alert rule. Possible values include: 'AlertSeverityHigh', 'AlertSeverityMedium', 'AlertSeverityLow', 'AlertSeverityInformational' + Severity AlertSeverity `json:"severity,omitempty"` + // TriggerOperator - The operation against the threshold that triggers alert rule. Possible values include: 'TriggerOperatorGreaterThan', 'TriggerOperatorLessThan', 'TriggerOperatorEqual', 'TriggerOperatorNotEqual' + TriggerOperator TriggerOperator `json:"triggerOperator,omitempty"` + // TriggerThreshold - The threshold triggers this alert rule. + TriggerThreshold *int32 `json:"triggerThreshold,omitempty"` + // Tactics - The tactics of the alert rule template + Tactics *[]AttackTactic `json:"tactics,omitempty"` + // Techniques - The techniques of the alert rule + Techniques *[]string `json:"techniques,omitempty"` + // Version - The version of this template - in format , where all are numbers. For example <1.0.2>. + Version *string `json:"version,omitempty"` + // EventGroupingSettings - The event grouping settings. + EventGroupingSettings *EventGroupingSettings `json:"eventGroupingSettings,omitempty"` + // CustomDetails - Dictionary of string key-value pairs of columns to be attached to the alert + CustomDetails map[string]*string `json:"customDetails"` + // EntityMappings - Array of the entity mappings of the alert rule + EntityMappings *[]EntityMapping `json:"entityMappings,omitempty"` + // AlertDetailsOverride - The alert details override settings + AlertDetailsOverride *AlertDetailsOverride `json:"alertDetailsOverride,omitempty"` +} + +// MarshalJSON is the custom marshaler for ScheduledAlertRuleTemplateProperties. +func (sartp ScheduledAlertRuleTemplateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sartp.AlertRulesCreatedByTemplateCount != nil { + objectMap["alertRulesCreatedByTemplateCount"] = sartp.AlertRulesCreatedByTemplateCount + } + if sartp.Description != nil { + objectMap["description"] = sartp.Description + } + if sartp.DisplayName != nil { + objectMap["displayName"] = sartp.DisplayName + } + if sartp.RequiredDataConnectors != nil { + objectMap["requiredDataConnectors"] = sartp.RequiredDataConnectors + } + if sartp.Status != "" { + objectMap["status"] = sartp.Status + } + if sartp.Query != nil { + objectMap["query"] = sartp.Query + } + if sartp.QueryFrequency != nil { + objectMap["queryFrequency"] = sartp.QueryFrequency + } + if sartp.QueryPeriod != nil { + objectMap["queryPeriod"] = sartp.QueryPeriod + } + if sartp.Severity != "" { + objectMap["severity"] = sartp.Severity + } + if sartp.TriggerOperator != "" { + objectMap["triggerOperator"] = sartp.TriggerOperator + } + if sartp.TriggerThreshold != nil { + objectMap["triggerThreshold"] = sartp.TriggerThreshold + } + if sartp.Tactics != nil { + objectMap["tactics"] = sartp.Tactics + } + if sartp.Techniques != nil { + objectMap["techniques"] = sartp.Techniques + } + if sartp.Version != nil { + objectMap["version"] = sartp.Version + } + if sartp.EventGroupingSettings != nil { + objectMap["eventGroupingSettings"] = sartp.EventGroupingSettings + } + if sartp.CustomDetails != nil { + objectMap["customDetails"] = sartp.CustomDetails + } + if sartp.EntityMappings != nil { + objectMap["entityMappings"] = sartp.EntityMappings + } + if sartp.AlertDetailsOverride != nil { + objectMap["alertDetailsOverride"] = sartp.AlertDetailsOverride + } + return json.Marshal(objectMap) +} + +// SecurityAlert represents a security alert entity. +type SecurityAlert struct { + // SecurityAlertProperties - SecurityAlert entity properties + *SecurityAlertProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicEntityKindEntity', 'KindBasicEntityKindURL', 'KindBasicEntityKindSubmissionMail', 'KindBasicEntityKindSecurityGroup', 'KindBasicEntityKindSecurityAlert', 'KindBasicEntityKindRegistryValue', 'KindBasicEntityKindRegistryKey', 'KindBasicEntityKindProcess', 'KindBasicEntityKindMalware', 'KindBasicEntityKindMailMessage', 'KindBasicEntityKindMailCluster', 'KindBasicEntityKindMailbox', 'KindBasicEntityKindIP', 'KindBasicEntityKindIoTDevice', 'KindBasicEntityKindBookmark', 'KindBasicEntityKindHost', 'KindBasicEntityKindFileHash', 'KindBasicEntityKindFile', 'KindBasicEntityKindDNSResolution', 'KindBasicEntityKindCloudApplication', 'KindBasicEntityKindAzureResource', 'KindBasicEntityKindAccount' + Kind KindBasicEntity `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecurityAlert. +func (sa SecurityAlert) MarshalJSON() ([]byte, error) { + sa.Kind = KindBasicEntityKindSecurityAlert + objectMap := make(map[string]interface{}) + if sa.SecurityAlertProperties != nil { + objectMap["properties"] = sa.SecurityAlertProperties + } + if sa.Kind != "" { + objectMap["kind"] = sa.Kind + } + return json.Marshal(objectMap) +} + +// AsURLEntity is the BasicEntity implementation for SecurityAlert. +func (sa SecurityAlert) AsURLEntity() (*URLEntity, bool) { + return nil, false +} + +// AsSubmissionMailEntity is the BasicEntity implementation for SecurityAlert. +func (sa SecurityAlert) AsSubmissionMailEntity() (*SubmissionMailEntity, bool) { + return nil, false +} + +// AsSecurityGroupEntity is the BasicEntity implementation for SecurityAlert. +func (sa SecurityAlert) AsSecurityGroupEntity() (*SecurityGroupEntity, bool) { + return nil, false +} + +// AsSecurityAlert is the BasicEntity implementation for SecurityAlert. +func (sa SecurityAlert) AsSecurityAlert() (*SecurityAlert, bool) { + return &sa, true +} + +// AsRegistryValueEntity is the BasicEntity implementation for SecurityAlert. +func (sa SecurityAlert) AsRegistryValueEntity() (*RegistryValueEntity, bool) { + return nil, false +} + +// AsRegistryKeyEntity is the BasicEntity implementation for SecurityAlert. +func (sa SecurityAlert) AsRegistryKeyEntity() (*RegistryKeyEntity, bool) { + return nil, false +} + +// AsProcessEntity is the BasicEntity implementation for SecurityAlert. +func (sa SecurityAlert) AsProcessEntity() (*ProcessEntity, bool) { + return nil, false +} + +// AsMalwareEntity is the BasicEntity implementation for SecurityAlert. +func (sa SecurityAlert) AsMalwareEntity() (*MalwareEntity, bool) { + return nil, false +} + +// AsMailMessageEntity is the BasicEntity implementation for SecurityAlert. +func (sa SecurityAlert) AsMailMessageEntity() (*MailMessageEntity, bool) { + return nil, false +} + +// AsMailClusterEntity is the BasicEntity implementation for SecurityAlert. +func (sa SecurityAlert) AsMailClusterEntity() (*MailClusterEntity, bool) { + return nil, false +} + +// AsMailboxEntity is the BasicEntity implementation for SecurityAlert. +func (sa SecurityAlert) AsMailboxEntity() (*MailboxEntity, bool) { + return nil, false +} + +// AsIPEntity is the BasicEntity implementation for SecurityAlert. +func (sa SecurityAlert) AsIPEntity() (*IPEntity, bool) { + return nil, false +} + +// AsIoTDeviceEntity is the BasicEntity implementation for SecurityAlert. +func (sa SecurityAlert) AsIoTDeviceEntity() (*IoTDeviceEntity, bool) { + return nil, false +} + +// AsHuntingBookmark is the BasicEntity implementation for SecurityAlert. +func (sa SecurityAlert) AsHuntingBookmark() (*HuntingBookmark, bool) { + return nil, false +} + +// AsHostEntity is the BasicEntity implementation for SecurityAlert. +func (sa SecurityAlert) AsHostEntity() (*HostEntity, bool) { + return nil, false +} + +// AsFileHashEntity is the BasicEntity implementation for SecurityAlert. +func (sa SecurityAlert) AsFileHashEntity() (*FileHashEntity, bool) { + return nil, false +} + +// AsFileEntity is the BasicEntity implementation for SecurityAlert. +func (sa SecurityAlert) AsFileEntity() (*FileEntity, bool) { + return nil, false +} + +// AsDNSEntity is the BasicEntity implementation for SecurityAlert. +func (sa SecurityAlert) AsDNSEntity() (*DNSEntity, bool) { + return nil, false +} + +// AsCloudApplicationEntity is the BasicEntity implementation for SecurityAlert. +func (sa SecurityAlert) AsCloudApplicationEntity() (*CloudApplicationEntity, bool) { + return nil, false +} + +// AsAzureResourceEntity is the BasicEntity implementation for SecurityAlert. +func (sa SecurityAlert) AsAzureResourceEntity() (*AzureResourceEntity, bool) { + return nil, false +} + +// AsAccountEntity is the BasicEntity implementation for SecurityAlert. +func (sa SecurityAlert) AsAccountEntity() (*AccountEntity, bool) { + return nil, false +} + +// AsEntity is the BasicEntity implementation for SecurityAlert. +func (sa SecurityAlert) AsEntity() (*Entity, bool) { + return nil, false +} + +// AsBasicEntity is the BasicEntity implementation for SecurityAlert. +func (sa SecurityAlert) AsBasicEntity() (BasicEntity, bool) { + return &sa, true +} + +// UnmarshalJSON is the custom unmarshaler for SecurityAlert struct. +func (sa *SecurityAlert) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var securityAlertProperties SecurityAlertProperties + err = json.Unmarshal(*v, &securityAlertProperties) + if err != nil { + return err + } + sa.SecurityAlertProperties = &securityAlertProperties + } + case "kind": + if v != nil { + var kind KindBasicEntity + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + sa.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sa.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sa.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sa.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + sa.SystemData = &systemData + } + } + } + + return nil +} + +// SecurityAlertProperties securityAlert entity property bag. +type SecurityAlertProperties struct { + // AlertDisplayName - READ-ONLY; The display name of the alert. + AlertDisplayName *string `json:"alertDisplayName,omitempty"` + // AlertType - READ-ONLY; The type name of the alert. + AlertType *string `json:"alertType,omitempty"` + // CompromisedEntity - READ-ONLY; Display name of the main entity being reported on. + CompromisedEntity *string `json:"compromisedEntity,omitempty"` + // ConfidenceLevel - READ-ONLY; The confidence level of this alert. Possible values include: 'ConfidenceLevelUnknown', 'ConfidenceLevelLow', 'ConfidenceLevelHigh' + ConfidenceLevel ConfidenceLevel `json:"confidenceLevel,omitempty"` + // ConfidenceReasons - READ-ONLY; The confidence reasons + ConfidenceReasons *[]SecurityAlertPropertiesConfidenceReasonsItem `json:"confidenceReasons,omitempty"` + // ConfidenceScore - READ-ONLY; The confidence score of the alert. + ConfidenceScore *float64 `json:"confidenceScore,omitempty"` + // ConfidenceScoreStatus - READ-ONLY; The confidence score calculation status, i.e. indicating if score calculation is pending for this alert, not applicable or final. Possible values include: 'ConfidenceScoreStatusNotApplicable', 'ConfidenceScoreStatusInProcess', 'ConfidenceScoreStatusNotFinal', 'ConfidenceScoreStatusFinal' + ConfidenceScoreStatus ConfidenceScoreStatus `json:"confidenceScoreStatus,omitempty"` + // Description - READ-ONLY; Alert description. + Description *string `json:"description,omitempty"` + // EndTimeUtc - READ-ONLY; The impact end time of the alert (the time of the last event contributing to the alert). + EndTimeUtc *date.Time `json:"endTimeUtc,omitempty"` + // Intent - READ-ONLY; Holds the alert intent stage(s) mapping for this alert. Possible values include: 'KillChainIntentUnknown', 'KillChainIntentProbing', 'KillChainIntentExploitation', 'KillChainIntentPersistence', 'KillChainIntentPrivilegeEscalation', 'KillChainIntentDefenseEvasion', 'KillChainIntentCredentialAccess', 'KillChainIntentDiscovery', 'KillChainIntentLateralMovement', 'KillChainIntentExecution', 'KillChainIntentCollection', 'KillChainIntentExfiltration', 'KillChainIntentCommandAndControl', 'KillChainIntentImpact' + Intent KillChainIntent `json:"intent,omitempty"` + // ProviderAlertID - READ-ONLY; The identifier of the alert inside the product which generated the alert. + ProviderAlertID *string `json:"providerAlertId,omitempty"` + // ProcessingEndTime - READ-ONLY; The time the alert was made available for consumption. + ProcessingEndTime *date.Time `json:"processingEndTime,omitempty"` + // ProductComponentName - READ-ONLY; The name of a component inside the product which generated the alert. + ProductComponentName *string `json:"productComponentName,omitempty"` + // ProductName - READ-ONLY; The name of the product which published this alert. + ProductName *string `json:"productName,omitempty"` + // ProductVersion - READ-ONLY; The version of the product generating the alert. + ProductVersion *string `json:"productVersion,omitempty"` + // RemediationSteps - READ-ONLY; Manual action items to take to remediate the alert. + RemediationSteps *[]string `json:"remediationSteps,omitempty"` + // Severity - The severity of the alert. Possible values include: 'AlertSeverityHigh', 'AlertSeverityMedium', 'AlertSeverityLow', 'AlertSeverityInformational' + Severity AlertSeverity `json:"severity,omitempty"` + // StartTimeUtc - READ-ONLY; The impact start time of the alert (the time of the first event contributing to the alert). + StartTimeUtc *date.Time `json:"startTimeUtc,omitempty"` + // Status - READ-ONLY; The lifecycle status of the alert. Possible values include: 'AlertStatusUnknown', 'AlertStatusNew', 'AlertStatusResolved', 'AlertStatusDismissed', 'AlertStatusInProgress' + Status AlertStatus `json:"status,omitempty"` + // SystemAlertID - READ-ONLY; Holds the product identifier of the alert for the product. + SystemAlertID *string `json:"systemAlertId,omitempty"` + // Tactics - READ-ONLY; The tactics of the alert + Tactics *[]AttackTactic `json:"tactics,omitempty"` + // TimeGenerated - READ-ONLY; The time the alert was generated. + TimeGenerated *date.Time `json:"timeGenerated,omitempty"` + // VendorName - READ-ONLY; The name of the vendor that raise the alert. + VendorName *string `json:"vendorName,omitempty"` + // AlertLink - READ-ONLY; The uri link of the alert. + AlertLink *string `json:"alertLink,omitempty"` + // ResourceIdentifiers - READ-ONLY; The list of resource identifiers of the alert. + ResourceIdentifiers *[]interface{} `json:"resourceIdentifiers,omitempty"` + // AdditionalData - READ-ONLY; A bag of custom fields that should be part of the entity and will be presented to the user. + AdditionalData map[string]interface{} `json:"additionalData"` + // FriendlyName - READ-ONLY; The graph item display name which is a short humanly readable description of the graph item instance. This property is optional and might be system generated. + FriendlyName *string `json:"friendlyName,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecurityAlertProperties. +func (sap SecurityAlertProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sap.Severity != "" { + objectMap["severity"] = sap.Severity + } + return json.Marshal(objectMap) +} + +// SecurityAlertPropertiesConfidenceReasonsItem confidence reason item +type SecurityAlertPropertiesConfidenceReasonsItem struct { + // Reason - READ-ONLY; The reason's description + Reason *string `json:"reason,omitempty"` + // ReasonType - READ-ONLY; The type (category) of the reason + ReasonType *string `json:"reasonType,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecurityAlertPropertiesConfidenceReasonsItem. +func (sapRi SecurityAlertPropertiesConfidenceReasonsItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SecurityAlertTimelineItem represents security alert timeline item. +type SecurityAlertTimelineItem struct { + // AzureResourceID - The alert azure resource id. + AzureResourceID *string `json:"azureResourceId,omitempty"` + // ProductName - The alert product name. + ProductName *string `json:"productName,omitempty"` + // Description - The alert description. + Description *string `json:"description,omitempty"` + // DisplayName - The alert name. + DisplayName *string `json:"displayName,omitempty"` + // Severity - The alert severity. Possible values include: 'AlertSeverityHigh', 'AlertSeverityMedium', 'AlertSeverityLow', 'AlertSeverityInformational' + Severity AlertSeverity `json:"severity,omitempty"` + // EndTimeUtc - The alert end time. + EndTimeUtc *date.Time `json:"endTimeUtc,omitempty"` + // StartTimeUtc - The alert start time. + StartTimeUtc *date.Time `json:"startTimeUtc,omitempty"` + // TimeGenerated - The alert generated time. + TimeGenerated *date.Time `json:"timeGenerated,omitempty"` + // AlertType - The name of the alert type. + AlertType *string `json:"alertType,omitempty"` + // Kind - Possible values include: 'KindBasicEntityTimelineItemKindEntityTimelineItem', 'KindBasicEntityTimelineItemKindActivity', 'KindBasicEntityTimelineItemKindBookmark', 'KindBasicEntityTimelineItemKindSecurityAlert' + Kind KindBasicEntityTimelineItem `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecurityAlertTimelineItem. +func (sati SecurityAlertTimelineItem) MarshalJSON() ([]byte, error) { + sati.Kind = KindBasicEntityTimelineItemKindSecurityAlert + objectMap := make(map[string]interface{}) + if sati.AzureResourceID != nil { + objectMap["azureResourceId"] = sati.AzureResourceID + } + if sati.ProductName != nil { + objectMap["productName"] = sati.ProductName + } + if sati.Description != nil { + objectMap["description"] = sati.Description + } + if sati.DisplayName != nil { + objectMap["displayName"] = sati.DisplayName + } + if sati.Severity != "" { + objectMap["severity"] = sati.Severity + } + if sati.EndTimeUtc != nil { + objectMap["endTimeUtc"] = sati.EndTimeUtc + } + if sati.StartTimeUtc != nil { + objectMap["startTimeUtc"] = sati.StartTimeUtc + } + if sati.TimeGenerated != nil { + objectMap["timeGenerated"] = sati.TimeGenerated + } + if sati.AlertType != nil { + objectMap["alertType"] = sati.AlertType + } + if sati.Kind != "" { + objectMap["kind"] = sati.Kind + } + return json.Marshal(objectMap) +} + +// AsActivityTimelineItem is the BasicEntityTimelineItem implementation for SecurityAlertTimelineItem. +func (sati SecurityAlertTimelineItem) AsActivityTimelineItem() (*ActivityTimelineItem, bool) { + return nil, false +} + +// AsBookmarkTimelineItem is the BasicEntityTimelineItem implementation for SecurityAlertTimelineItem. +func (sati SecurityAlertTimelineItem) AsBookmarkTimelineItem() (*BookmarkTimelineItem, bool) { + return nil, false +} + +// AsSecurityAlertTimelineItem is the BasicEntityTimelineItem implementation for SecurityAlertTimelineItem. +func (sati SecurityAlertTimelineItem) AsSecurityAlertTimelineItem() (*SecurityAlertTimelineItem, bool) { + return &sati, true +} + +// AsEntityTimelineItem is the BasicEntityTimelineItem implementation for SecurityAlertTimelineItem. +func (sati SecurityAlertTimelineItem) AsEntityTimelineItem() (*EntityTimelineItem, bool) { + return nil, false +} + +// AsBasicEntityTimelineItem is the BasicEntityTimelineItem implementation for SecurityAlertTimelineItem. +func (sati SecurityAlertTimelineItem) AsBasicEntityTimelineItem() (BasicEntityTimelineItem, bool) { + return &sati, true +} + +// SecurityGroupEntity represents a security group entity. +type SecurityGroupEntity struct { + // SecurityGroupEntityProperties - SecurityGroup entity properties + *SecurityGroupEntityProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicEntityKindEntity', 'KindBasicEntityKindURL', 'KindBasicEntityKindSubmissionMail', 'KindBasicEntityKindSecurityGroup', 'KindBasicEntityKindSecurityAlert', 'KindBasicEntityKindRegistryValue', 'KindBasicEntityKindRegistryKey', 'KindBasicEntityKindProcess', 'KindBasicEntityKindMalware', 'KindBasicEntityKindMailMessage', 'KindBasicEntityKindMailCluster', 'KindBasicEntityKindMailbox', 'KindBasicEntityKindIP', 'KindBasicEntityKindIoTDevice', 'KindBasicEntityKindBookmark', 'KindBasicEntityKindHost', 'KindBasicEntityKindFileHash', 'KindBasicEntityKindFile', 'KindBasicEntityKindDNSResolution', 'KindBasicEntityKindCloudApplication', 'KindBasicEntityKindAzureResource', 'KindBasicEntityKindAccount' + Kind KindBasicEntity `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecurityGroupEntity. +func (sge SecurityGroupEntity) MarshalJSON() ([]byte, error) { + sge.Kind = KindBasicEntityKindSecurityGroup + objectMap := make(map[string]interface{}) + if sge.SecurityGroupEntityProperties != nil { + objectMap["properties"] = sge.SecurityGroupEntityProperties + } + if sge.Kind != "" { + objectMap["kind"] = sge.Kind + } + return json.Marshal(objectMap) +} + +// AsURLEntity is the BasicEntity implementation for SecurityGroupEntity. +func (sge SecurityGroupEntity) AsURLEntity() (*URLEntity, bool) { + return nil, false +} + +// AsSubmissionMailEntity is the BasicEntity implementation for SecurityGroupEntity. +func (sge SecurityGroupEntity) AsSubmissionMailEntity() (*SubmissionMailEntity, bool) { + return nil, false +} + +// AsSecurityGroupEntity is the BasicEntity implementation for SecurityGroupEntity. +func (sge SecurityGroupEntity) AsSecurityGroupEntity() (*SecurityGroupEntity, bool) { + return &sge, true +} + +// AsSecurityAlert is the BasicEntity implementation for SecurityGroupEntity. +func (sge SecurityGroupEntity) AsSecurityAlert() (*SecurityAlert, bool) { + return nil, false +} + +// AsRegistryValueEntity is the BasicEntity implementation for SecurityGroupEntity. +func (sge SecurityGroupEntity) AsRegistryValueEntity() (*RegistryValueEntity, bool) { + return nil, false +} + +// AsRegistryKeyEntity is the BasicEntity implementation for SecurityGroupEntity. +func (sge SecurityGroupEntity) AsRegistryKeyEntity() (*RegistryKeyEntity, bool) { + return nil, false +} + +// AsProcessEntity is the BasicEntity implementation for SecurityGroupEntity. +func (sge SecurityGroupEntity) AsProcessEntity() (*ProcessEntity, bool) { + return nil, false +} + +// AsMalwareEntity is the BasicEntity implementation for SecurityGroupEntity. +func (sge SecurityGroupEntity) AsMalwareEntity() (*MalwareEntity, bool) { + return nil, false +} + +// AsMailMessageEntity is the BasicEntity implementation for SecurityGroupEntity. +func (sge SecurityGroupEntity) AsMailMessageEntity() (*MailMessageEntity, bool) { + return nil, false +} + +// AsMailClusterEntity is the BasicEntity implementation for SecurityGroupEntity. +func (sge SecurityGroupEntity) AsMailClusterEntity() (*MailClusterEntity, bool) { + return nil, false +} + +// AsMailboxEntity is the BasicEntity implementation for SecurityGroupEntity. +func (sge SecurityGroupEntity) AsMailboxEntity() (*MailboxEntity, bool) { + return nil, false +} + +// AsIPEntity is the BasicEntity implementation for SecurityGroupEntity. +func (sge SecurityGroupEntity) AsIPEntity() (*IPEntity, bool) { + return nil, false +} + +// AsIoTDeviceEntity is the BasicEntity implementation for SecurityGroupEntity. +func (sge SecurityGroupEntity) AsIoTDeviceEntity() (*IoTDeviceEntity, bool) { + return nil, false +} + +// AsHuntingBookmark is the BasicEntity implementation for SecurityGroupEntity. +func (sge SecurityGroupEntity) AsHuntingBookmark() (*HuntingBookmark, bool) { + return nil, false +} + +// AsHostEntity is the BasicEntity implementation for SecurityGroupEntity. +func (sge SecurityGroupEntity) AsHostEntity() (*HostEntity, bool) { + return nil, false +} + +// AsFileHashEntity is the BasicEntity implementation for SecurityGroupEntity. +func (sge SecurityGroupEntity) AsFileHashEntity() (*FileHashEntity, bool) { + return nil, false +} + +// AsFileEntity is the BasicEntity implementation for SecurityGroupEntity. +func (sge SecurityGroupEntity) AsFileEntity() (*FileEntity, bool) { + return nil, false +} + +// AsDNSEntity is the BasicEntity implementation for SecurityGroupEntity. +func (sge SecurityGroupEntity) AsDNSEntity() (*DNSEntity, bool) { + return nil, false +} + +// AsCloudApplicationEntity is the BasicEntity implementation for SecurityGroupEntity. +func (sge SecurityGroupEntity) AsCloudApplicationEntity() (*CloudApplicationEntity, bool) { + return nil, false +} + +// AsAzureResourceEntity is the BasicEntity implementation for SecurityGroupEntity. +func (sge SecurityGroupEntity) AsAzureResourceEntity() (*AzureResourceEntity, bool) { + return nil, false +} + +// AsAccountEntity is the BasicEntity implementation for SecurityGroupEntity. +func (sge SecurityGroupEntity) AsAccountEntity() (*AccountEntity, bool) { + return nil, false +} + +// AsEntity is the BasicEntity implementation for SecurityGroupEntity. +func (sge SecurityGroupEntity) AsEntity() (*Entity, bool) { + return nil, false +} + +// AsBasicEntity is the BasicEntity implementation for SecurityGroupEntity. +func (sge SecurityGroupEntity) AsBasicEntity() (BasicEntity, bool) { + return &sge, true +} + +// UnmarshalJSON is the custom unmarshaler for SecurityGroupEntity struct. +func (sge *SecurityGroupEntity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var securityGroupEntityProperties SecurityGroupEntityProperties + err = json.Unmarshal(*v, &securityGroupEntityProperties) + if err != nil { + return err + } + sge.SecurityGroupEntityProperties = &securityGroupEntityProperties + } + case "kind": + if v != nil { + var kind KindBasicEntity + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + sge.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sge.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sge.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sge.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + sge.SystemData = &systemData + } + } + } + + return nil +} + +// SecurityGroupEntityProperties securityGroup entity property bag. +type SecurityGroupEntityProperties struct { + // DistinguishedName - READ-ONLY; The group distinguished name + DistinguishedName *string `json:"distinguishedName,omitempty"` + // ObjectGUID - READ-ONLY; A single-value attribute that is the unique identifier for the object, assigned by active directory. + ObjectGUID *uuid.UUID `json:"objectGuid,omitempty"` + // Sid - READ-ONLY; The SID attribute is a single-value attribute that specifies the security identifier (SID) of the group + Sid *string `json:"sid,omitempty"` + // AdditionalData - READ-ONLY; A bag of custom fields that should be part of the entity and will be presented to the user. + AdditionalData map[string]interface{} `json:"additionalData"` + // FriendlyName - READ-ONLY; The graph item display name which is a short humanly readable description of the graph item instance. This property is optional and might be system generated. + FriendlyName *string `json:"friendlyName,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecurityGroupEntityProperties. +func (sgep SecurityGroupEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SentinelOnboardingState sentinel onboarding state +type SentinelOnboardingState struct { + autorest.Response `json:"-"` + // SentinelOnboardingStateProperties - The Sentinel onboarding state object + *SentinelOnboardingStateProperties `json:"properties,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for SentinelOnboardingState. +func (sos SentinelOnboardingState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sos.SentinelOnboardingStateProperties != nil { + objectMap["properties"] = sos.SentinelOnboardingStateProperties + } + if sos.Etag != nil { + objectMap["etag"] = sos.Etag + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SentinelOnboardingState struct. +func (sos *SentinelOnboardingState) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var sentinelOnboardingStateProperties SentinelOnboardingStateProperties + err = json.Unmarshal(*v, &sentinelOnboardingStateProperties) + if err != nil { + return err + } + sos.SentinelOnboardingStateProperties = &sentinelOnboardingStateProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + sos.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sos.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sos.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sos.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + sos.SystemData = &systemData + } + } + } + + return nil +} + +// SentinelOnboardingStateProperties the Sentinel onboarding state properties +type SentinelOnboardingStateProperties struct { + // CustomerManagedKey - Flag that indicates the status of the CMK setting + CustomerManagedKey *bool `json:"customerManagedKey,omitempty"` +} + +// SentinelOnboardingStatesList list of the Sentinel onboarding states +type SentinelOnboardingStatesList struct { + autorest.Response `json:"-"` + // Value - Array of Sentinel onboarding states + Value *[]SentinelOnboardingState `json:"value,omitempty"` +} + +// SetObject ... +type SetObject struct { + autorest.Response `json:"-"` + Value interface{} `json:"value,omitempty"` +} + +// SettingList list of all the settings. +type SettingList struct { + autorest.Response `json:"-"` + // Value - Array of settings. + Value *[]BasicSettings `json:"value,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for SettingList struct. +func (sl *SettingList) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "value": + if v != nil { + value, err := unmarshalBasicSettingsArray(*v) + if err != nil { + return err + } + sl.Value = &value + } + } + } + + return nil +} + +// BasicSettings the Setting. +type BasicSettings interface { + AsAnomalies() (*Anomalies, bool) + AsEyesOn() (*EyesOn, bool) + AsEntityAnalytics() (*EntityAnalytics, bool) + AsUeba() (*Ueba, bool) + AsSettings() (*Settings, bool) +} + +// Settings the Setting. +type Settings struct { + autorest.Response `json:"-"` + // Kind - Possible values include: 'KindBasicSettingsKindSettings', 'KindBasicSettingsKindAnomalies', 'KindBasicSettingsKindEyesOn', 'KindBasicSettingsKindEntityAnalytics', 'KindBasicSettingsKindUeba' + Kind KindBasicSettings `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +func unmarshalBasicSettings(body []byte) (BasicSettings, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["kind"] { + case string(KindBasicSettingsKindAnomalies): + var a Anomalies + err := json.Unmarshal(body, &a) + return a, err + case string(KindBasicSettingsKindEyesOn): + var eo EyesOn + err := json.Unmarshal(body, &eo) + return eo, err + case string(KindBasicSettingsKindEntityAnalytics): + var ea EntityAnalytics + err := json.Unmarshal(body, &ea) + return ea, err + case string(KindBasicSettingsKindUeba): + var u Ueba + err := json.Unmarshal(body, &u) + return u, err + default: + var s Settings + err := json.Unmarshal(body, &s) + return s, err + } +} +func unmarshalBasicSettingsArray(body []byte) ([]BasicSettings, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + sArray := make([]BasicSettings, len(rawMessages)) + + for index, rawMessage := range rawMessages { + s, err := unmarshalBasicSettings(*rawMessage) + if err != nil { + return nil, err + } + sArray[index] = s + } + return sArray, nil +} + +// MarshalJSON is the custom marshaler for Settings. +func (s Settings) MarshalJSON() ([]byte, error) { + s.Kind = KindBasicSettingsKindSettings + objectMap := make(map[string]interface{}) + if s.Kind != "" { + objectMap["kind"] = s.Kind + } + if s.Etag != nil { + objectMap["etag"] = s.Etag + } + return json.Marshal(objectMap) +} + +// AsAnomalies is the BasicSettings implementation for Settings. +func (s Settings) AsAnomalies() (*Anomalies, bool) { + return nil, false +} + +// AsEyesOn is the BasicSettings implementation for Settings. +func (s Settings) AsEyesOn() (*EyesOn, bool) { + return nil, false +} + +// AsEntityAnalytics is the BasicSettings implementation for Settings. +func (s Settings) AsEntityAnalytics() (*EntityAnalytics, bool) { + return nil, false +} + +// AsUeba is the BasicSettings implementation for Settings. +func (s Settings) AsUeba() (*Ueba, bool) { + return nil, false +} + +// AsSettings is the BasicSettings implementation for Settings. +func (s Settings) AsSettings() (*Settings, bool) { + return &s, true +} + +// AsBasicSettings is the BasicSettings implementation for Settings. +func (s Settings) AsBasicSettings() (BasicSettings, bool) { + return &s, true +} + +// SettingsModel ... +type SettingsModel struct { + autorest.Response `json:"-"` + Value BasicSettings `json:"value,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for SettingsModel struct. +func (sm *SettingsModel) UnmarshalJSON(body []byte) error { + s, err := unmarshalBasicSettings(body) + if err != nil { + return err + } + sm.Value = s + + return nil +} + +// Sku the pricing tier of the solution +type Sku struct { + // Name - The kind of the tier. Possible values include: 'SkuKindPerGB', 'SkuKindCapacityReservation' + Name SkuKind `json:"name,omitempty"` + // CapacityReservationLevel - The amount of reservation level + CapacityReservationLevel *int32 `json:"capacityReservationLevel,omitempty"` +} + +// SourceControl represents a SourceControl in Azure Security Insights. +type SourceControl struct { + autorest.Response `json:"-"` + // SourceControlProperties - source control properties + *SourceControlProperties `json:"properties,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceControl. +func (sc SourceControl) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sc.SourceControlProperties != nil { + objectMap["properties"] = sc.SourceControlProperties + } + if sc.Etag != nil { + objectMap["etag"] = sc.Etag + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SourceControl struct. +func (sc *SourceControl) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var sourceControlProperties SourceControlProperties + err = json.Unmarshal(*v, &sourceControlProperties) + if err != nil { + return err + } + sc.SourceControlProperties = &sourceControlProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + sc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sc.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + sc.SystemData = &systemData + } + } + } + + return nil +} + +// SourceControlList list all the source controls. +type SourceControlList struct { + autorest.Response `json:"-"` + // NextLink - READ-ONLY; URL to fetch the next set of source controls. + NextLink *string `json:"nextLink,omitempty"` + // Value - Array of source controls. + Value *[]SourceControl `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceControlList. +func (scl SourceControlList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scl.Value != nil { + objectMap["value"] = scl.Value + } + return json.Marshal(objectMap) +} + +// SourceControlListIterator provides access to a complete listing of SourceControl values. +type SourceControlListIterator struct { + i int + page SourceControlListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SourceControlListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SourceControlListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SourceControlListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SourceControlListIterator) Response() SourceControlList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SourceControlListIterator) Value() SourceControl { + if !iter.page.NotDone() { + return SourceControl{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SourceControlListIterator type. +func NewSourceControlListIterator(page SourceControlListPage) SourceControlListIterator { + return SourceControlListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (scl SourceControlList) IsEmpty() bool { + return scl.Value == nil || len(*scl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (scl SourceControlList) hasNextLink() bool { + return scl.NextLink != nil && len(*scl.NextLink) != 0 +} + +// sourceControlListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (scl SourceControlList) sourceControlListPreparer(ctx context.Context) (*http.Request, error) { + if !scl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(scl.NextLink))) +} + +// SourceControlListPage contains a page of SourceControl values. +type SourceControlListPage struct { + fn func(context.Context, SourceControlList) (SourceControlList, error) + scl SourceControlList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SourceControlListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.scl) + if err != nil { + return err + } + page.scl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SourceControlListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SourceControlListPage) NotDone() bool { + return !page.scl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SourceControlListPage) Response() SourceControlList { + return page.scl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SourceControlListPage) Values() []SourceControl { + if page.scl.IsEmpty() { + return nil + } + return *page.scl.Value +} + +// Creates a new instance of the SourceControlListPage type. +func NewSourceControlListPage(cur SourceControlList, getNextPage func(context.Context, SourceControlList) (SourceControlList, error)) SourceControlListPage { + return SourceControlListPage{ + fn: getNextPage, + scl: cur, + } +} + +// SourceControlProperties describes source control properties +type SourceControlProperties struct { + // ID - The id (a Guid) of the source control + ID *string `json:"id,omitempty"` + // Version - The version number associated with the source control. Possible values include: 'VersionV1', 'VersionV2' + Version Version `json:"version,omitempty"` + // DisplayName - The display name of the source control + DisplayName *string `json:"displayName,omitempty"` + // Description - A description of the source control + Description *string `json:"description,omitempty"` + // RepoType - The repository type of the source control. Possible values include: 'RepoTypeGithub', 'RepoTypeDevOps' + RepoType RepoType `json:"repoType,omitempty"` + // ContentTypes - Array of source control content types. + ContentTypes *[]ContentType `json:"contentTypes,omitempty"` + // Repository - Repository metadata. + Repository *Repository `json:"repository,omitempty"` + // RepositoryResourceInfo - Information regarding the resources created in user's repository. + RepositoryResourceInfo *RepositoryResourceInfo `json:"repositoryResourceInfo,omitempty"` + // LastDeploymentInfo - Information regarding the latest deployment for the source control. + LastDeploymentInfo *DeploymentInfo `json:"lastDeploymentInfo,omitempty"` +} + +// SubmissionMailEntity represents a submission mail entity. +type SubmissionMailEntity struct { + // SubmissionMailEntityProperties - Submission mail entity properties + *SubmissionMailEntityProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicEntityKindEntity', 'KindBasicEntityKindURL', 'KindBasicEntityKindSubmissionMail', 'KindBasicEntityKindSecurityGroup', 'KindBasicEntityKindSecurityAlert', 'KindBasicEntityKindRegistryValue', 'KindBasicEntityKindRegistryKey', 'KindBasicEntityKindProcess', 'KindBasicEntityKindMalware', 'KindBasicEntityKindMailMessage', 'KindBasicEntityKindMailCluster', 'KindBasicEntityKindMailbox', 'KindBasicEntityKindIP', 'KindBasicEntityKindIoTDevice', 'KindBasicEntityKindBookmark', 'KindBasicEntityKindHost', 'KindBasicEntityKindFileHash', 'KindBasicEntityKindFile', 'KindBasicEntityKindDNSResolution', 'KindBasicEntityKindCloudApplication', 'KindBasicEntityKindAzureResource', 'KindBasicEntityKindAccount' + Kind KindBasicEntity `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for SubmissionMailEntity. +func (sme SubmissionMailEntity) MarshalJSON() ([]byte, error) { + sme.Kind = KindBasicEntityKindSubmissionMail + objectMap := make(map[string]interface{}) + if sme.SubmissionMailEntityProperties != nil { + objectMap["properties"] = sme.SubmissionMailEntityProperties + } + if sme.Kind != "" { + objectMap["kind"] = sme.Kind + } + return json.Marshal(objectMap) +} + +// AsURLEntity is the BasicEntity implementation for SubmissionMailEntity. +func (sme SubmissionMailEntity) AsURLEntity() (*URLEntity, bool) { + return nil, false +} + +// AsSubmissionMailEntity is the BasicEntity implementation for SubmissionMailEntity. +func (sme SubmissionMailEntity) AsSubmissionMailEntity() (*SubmissionMailEntity, bool) { + return &sme, true +} + +// AsSecurityGroupEntity is the BasicEntity implementation for SubmissionMailEntity. +func (sme SubmissionMailEntity) AsSecurityGroupEntity() (*SecurityGroupEntity, bool) { + return nil, false +} + +// AsSecurityAlert is the BasicEntity implementation for SubmissionMailEntity. +func (sme SubmissionMailEntity) AsSecurityAlert() (*SecurityAlert, bool) { + return nil, false +} + +// AsRegistryValueEntity is the BasicEntity implementation for SubmissionMailEntity. +func (sme SubmissionMailEntity) AsRegistryValueEntity() (*RegistryValueEntity, bool) { + return nil, false +} + +// AsRegistryKeyEntity is the BasicEntity implementation for SubmissionMailEntity. +func (sme SubmissionMailEntity) AsRegistryKeyEntity() (*RegistryKeyEntity, bool) { + return nil, false +} + +// AsProcessEntity is the BasicEntity implementation for SubmissionMailEntity. +func (sme SubmissionMailEntity) AsProcessEntity() (*ProcessEntity, bool) { + return nil, false +} + +// AsMalwareEntity is the BasicEntity implementation for SubmissionMailEntity. +func (sme SubmissionMailEntity) AsMalwareEntity() (*MalwareEntity, bool) { + return nil, false +} + +// AsMailMessageEntity is the BasicEntity implementation for SubmissionMailEntity. +func (sme SubmissionMailEntity) AsMailMessageEntity() (*MailMessageEntity, bool) { + return nil, false +} + +// AsMailClusterEntity is the BasicEntity implementation for SubmissionMailEntity. +func (sme SubmissionMailEntity) AsMailClusterEntity() (*MailClusterEntity, bool) { + return nil, false +} + +// AsMailboxEntity is the BasicEntity implementation for SubmissionMailEntity. +func (sme SubmissionMailEntity) AsMailboxEntity() (*MailboxEntity, bool) { + return nil, false +} + +// AsIPEntity is the BasicEntity implementation for SubmissionMailEntity. +func (sme SubmissionMailEntity) AsIPEntity() (*IPEntity, bool) { + return nil, false +} + +// AsIoTDeviceEntity is the BasicEntity implementation for SubmissionMailEntity. +func (sme SubmissionMailEntity) AsIoTDeviceEntity() (*IoTDeviceEntity, bool) { + return nil, false +} + +// AsHuntingBookmark is the BasicEntity implementation for SubmissionMailEntity. +func (sme SubmissionMailEntity) AsHuntingBookmark() (*HuntingBookmark, bool) { + return nil, false +} + +// AsHostEntity is the BasicEntity implementation for SubmissionMailEntity. +func (sme SubmissionMailEntity) AsHostEntity() (*HostEntity, bool) { + return nil, false +} + +// AsFileHashEntity is the BasicEntity implementation for SubmissionMailEntity. +func (sme SubmissionMailEntity) AsFileHashEntity() (*FileHashEntity, bool) { + return nil, false +} + +// AsFileEntity is the BasicEntity implementation for SubmissionMailEntity. +func (sme SubmissionMailEntity) AsFileEntity() (*FileEntity, bool) { + return nil, false +} + +// AsDNSEntity is the BasicEntity implementation for SubmissionMailEntity. +func (sme SubmissionMailEntity) AsDNSEntity() (*DNSEntity, bool) { + return nil, false +} + +// AsCloudApplicationEntity is the BasicEntity implementation for SubmissionMailEntity. +func (sme SubmissionMailEntity) AsCloudApplicationEntity() (*CloudApplicationEntity, bool) { + return nil, false +} + +// AsAzureResourceEntity is the BasicEntity implementation for SubmissionMailEntity. +func (sme SubmissionMailEntity) AsAzureResourceEntity() (*AzureResourceEntity, bool) { + return nil, false +} + +// AsAccountEntity is the BasicEntity implementation for SubmissionMailEntity. +func (sme SubmissionMailEntity) AsAccountEntity() (*AccountEntity, bool) { + return nil, false +} + +// AsEntity is the BasicEntity implementation for SubmissionMailEntity. +func (sme SubmissionMailEntity) AsEntity() (*Entity, bool) { + return nil, false +} + +// AsBasicEntity is the BasicEntity implementation for SubmissionMailEntity. +func (sme SubmissionMailEntity) AsBasicEntity() (BasicEntity, bool) { + return &sme, true +} + +// UnmarshalJSON is the custom unmarshaler for SubmissionMailEntity struct. +func (sme *SubmissionMailEntity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var submissionMailEntityProperties SubmissionMailEntityProperties + err = json.Unmarshal(*v, &submissionMailEntityProperties) + if err != nil { + return err + } + sme.SubmissionMailEntityProperties = &submissionMailEntityProperties + } + case "kind": + if v != nil { + var kind KindBasicEntity + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + sme.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sme.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sme.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sme.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + sme.SystemData = &systemData + } + } + } + + return nil +} + +// SubmissionMailEntityProperties submission mail entity property bag. +type SubmissionMailEntityProperties struct { + // NetworkMessageID - READ-ONLY; The network message id of email to which submission belongs + NetworkMessageID *uuid.UUID `json:"networkMessageId,omitempty"` + // SubmissionID - READ-ONLY; The submission id + SubmissionID *uuid.UUID `json:"submissionId,omitempty"` + // Submitter - READ-ONLY; The submitter + Submitter *string `json:"submitter,omitempty"` + // SubmissionDate - READ-ONLY; The submission date + SubmissionDate *date.Time `json:"submissionDate,omitempty"` + // Timestamp - READ-ONLY; The Time stamp when the message is received (Mail) + Timestamp *date.Time `json:"timestamp,omitempty"` + // Recipient - READ-ONLY; The recipient of the mail + Recipient *string `json:"recipient,omitempty"` + // Sender - READ-ONLY; The sender of the mail + Sender *string `json:"sender,omitempty"` + // SenderIP - READ-ONLY; The sender's IP + SenderIP *string `json:"senderIp,omitempty"` + // Subject - READ-ONLY; The subject of submission mail + Subject *string `json:"subject,omitempty"` + // ReportType - READ-ONLY; The submission type for the given instance. This maps to Junk, Phish, Malware or NotJunk. + ReportType *string `json:"reportType,omitempty"` + // AdditionalData - READ-ONLY; A bag of custom fields that should be part of the entity and will be presented to the user. + AdditionalData map[string]interface{} `json:"additionalData"` + // FriendlyName - READ-ONLY; The graph item display name which is a short humanly readable description of the graph item instance. This property is optional and might be system generated. + FriendlyName *string `json:"friendlyName,omitempty"` +} + +// MarshalJSON is the custom marshaler for SubmissionMailEntityProperties. +func (smep SubmissionMailEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TeamInformation describes team information +type TeamInformation struct { + autorest.Response `json:"-"` + // TeamID - READ-ONLY; Team ID + TeamID *string `json:"teamId,omitempty"` + // PrimaryChannelURL - READ-ONLY; The primary channel URL of the team + PrimaryChannelURL *string `json:"primaryChannelUrl,omitempty"` + // TeamCreationTimeUtc - READ-ONLY; The time the team was created + TeamCreationTimeUtc *date.Time `json:"teamCreationTimeUtc,omitempty"` + // Name - READ-ONLY; The name of the team + Name *string `json:"name,omitempty"` + // Description - READ-ONLY; The description of the team + Description *string `json:"description,omitempty"` +} + +// MarshalJSON is the custom marshaler for TeamInformation. +func (ti TeamInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// TeamProperties describes team properties +type TeamProperties struct { + // TeamName - The name of the team + TeamName *string `json:"teamName,omitempty"` + // TeamDescription - The description of the team + TeamDescription *string `json:"teamDescription,omitempty"` + // MemberIds - List of member IDs to add to the team + MemberIds *[]uuid.UUID `json:"memberIds,omitempty"` + // GroupIds - List of group IDs to add their members to the team + GroupIds *[]uuid.UUID `json:"groupIds,omitempty"` +} + +// ThreatIntelligence threatIntelligence property bag. +type ThreatIntelligence struct { + // Confidence - READ-ONLY; Confidence (must be between 0 and 1) + Confidence *float64 `json:"confidence,omitempty"` + // ProviderName - READ-ONLY; Name of the provider from whom this Threat Intelligence information was received + ProviderName *string `json:"providerName,omitempty"` + // ReportLink - READ-ONLY; Report link + ReportLink *string `json:"reportLink,omitempty"` + // ThreatDescription - READ-ONLY; Threat description (free text) + ThreatDescription *string `json:"threatDescription,omitempty"` + // ThreatName - READ-ONLY; Threat name (e.g. "Jedobot malware") + ThreatName *string `json:"threatName,omitempty"` + // ThreatType - READ-ONLY; Threat type (e.g. "Botnet") + ThreatType *string `json:"threatType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ThreatIntelligence. +func (ti ThreatIntelligence) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ThreatIntelligenceAlertRule represents Threat Intelligence alert rule. +type ThreatIntelligenceAlertRule struct { + // ThreatIntelligenceAlertRuleProperties - Threat Intelligence alert rule properties + *ThreatIntelligenceAlertRuleProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicAlertRuleKindAlertRule', 'KindBasicAlertRuleKindMLBehaviorAnalytics', 'KindBasicAlertRuleKindFusion', 'KindBasicAlertRuleKindThreatIntelligence', 'KindBasicAlertRuleKindMicrosoftSecurityIncidentCreation', 'KindBasicAlertRuleKindScheduled', 'KindBasicAlertRuleKindNRT' + Kind KindBasicAlertRule `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ThreatIntelligenceAlertRule. +func (tiar ThreatIntelligenceAlertRule) MarshalJSON() ([]byte, error) { + tiar.Kind = KindBasicAlertRuleKindThreatIntelligence + objectMap := make(map[string]interface{}) + if tiar.ThreatIntelligenceAlertRuleProperties != nil { + objectMap["properties"] = tiar.ThreatIntelligenceAlertRuleProperties + } + if tiar.Kind != "" { + objectMap["kind"] = tiar.Kind + } + if tiar.Etag != nil { + objectMap["etag"] = tiar.Etag + } + return json.Marshal(objectMap) +} + +// AsMLBehaviorAnalyticsAlertRule is the BasicAlertRule implementation for ThreatIntelligenceAlertRule. +func (tiar ThreatIntelligenceAlertRule) AsMLBehaviorAnalyticsAlertRule() (*MLBehaviorAnalyticsAlertRule, bool) { + return nil, false +} + +// AsFusionAlertRule is the BasicAlertRule implementation for ThreatIntelligenceAlertRule. +func (tiar ThreatIntelligenceAlertRule) AsFusionAlertRule() (*FusionAlertRule, bool) { + return nil, false +} + +// AsThreatIntelligenceAlertRule is the BasicAlertRule implementation for ThreatIntelligenceAlertRule. +func (tiar ThreatIntelligenceAlertRule) AsThreatIntelligenceAlertRule() (*ThreatIntelligenceAlertRule, bool) { + return &tiar, true +} + +// AsMicrosoftSecurityIncidentCreationAlertRule is the BasicAlertRule implementation for ThreatIntelligenceAlertRule. +func (tiar ThreatIntelligenceAlertRule) AsMicrosoftSecurityIncidentCreationAlertRule() (*MicrosoftSecurityIncidentCreationAlertRule, bool) { + return nil, false +} + +// AsScheduledAlertRule is the BasicAlertRule implementation for ThreatIntelligenceAlertRule. +func (tiar ThreatIntelligenceAlertRule) AsScheduledAlertRule() (*ScheduledAlertRule, bool) { + return nil, false +} + +// AsNrtAlertRule is the BasicAlertRule implementation for ThreatIntelligenceAlertRule. +func (tiar ThreatIntelligenceAlertRule) AsNrtAlertRule() (*NrtAlertRule, bool) { + return nil, false +} + +// AsAlertRule is the BasicAlertRule implementation for ThreatIntelligenceAlertRule. +func (tiar ThreatIntelligenceAlertRule) AsAlertRule() (*AlertRule, bool) { + return nil, false +} + +// AsBasicAlertRule is the BasicAlertRule implementation for ThreatIntelligenceAlertRule. +func (tiar ThreatIntelligenceAlertRule) AsBasicAlertRule() (BasicAlertRule, bool) { + return &tiar, true +} + +// UnmarshalJSON is the custom unmarshaler for ThreatIntelligenceAlertRule struct. +func (tiar *ThreatIntelligenceAlertRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var threatIntelligenceAlertRuleProperties ThreatIntelligenceAlertRuleProperties + err = json.Unmarshal(*v, &threatIntelligenceAlertRuleProperties) + if err != nil { + return err + } + tiar.ThreatIntelligenceAlertRuleProperties = &threatIntelligenceAlertRuleProperties + } + case "kind": + if v != nil { + var kind KindBasicAlertRule + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + tiar.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + tiar.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + tiar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + tiar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + tiar.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + tiar.SystemData = &systemData + } + } + } + + return nil +} + +// ThreatIntelligenceAlertRuleProperties threat Intelligence alert rule base property bag. +type ThreatIntelligenceAlertRuleProperties struct { + // AlertRuleTemplateName - The Name of the alert rule template used to create this rule. + AlertRuleTemplateName *string `json:"alertRuleTemplateName,omitempty"` + // Description - READ-ONLY; The description of the alert rule. + Description *string `json:"description,omitempty"` + // DisplayName - READ-ONLY; The display name for alerts created by this alert rule. + DisplayName *string `json:"displayName,omitempty"` + // Enabled - Determines whether this alert rule is enabled or disabled. + Enabled *bool `json:"enabled,omitempty"` + // LastModifiedUtc - READ-ONLY; The last time that this alert has been modified. + LastModifiedUtc *date.Time `json:"lastModifiedUtc,omitempty"` + // Severity - READ-ONLY; The severity for alerts created by this alert rule. Possible values include: 'AlertSeverityHigh', 'AlertSeverityMedium', 'AlertSeverityLow', 'AlertSeverityInformational' + Severity AlertSeverity `json:"severity,omitempty"` + // Tactics - READ-ONLY; The tactics of the alert rule + Tactics *[]AttackTactic `json:"tactics,omitempty"` + // Techniques - READ-ONLY; The techniques of the alert rule + Techniques *[]string `json:"techniques,omitempty"` +} + +// MarshalJSON is the custom marshaler for ThreatIntelligenceAlertRuleProperties. +func (tiarp ThreatIntelligenceAlertRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tiarp.AlertRuleTemplateName != nil { + objectMap["alertRuleTemplateName"] = tiarp.AlertRuleTemplateName + } + if tiarp.Enabled != nil { + objectMap["enabled"] = tiarp.Enabled + } + return json.Marshal(objectMap) +} + +// ThreatIntelligenceAlertRuleTemplate represents Threat Intelligence alert rule template. +type ThreatIntelligenceAlertRuleTemplate struct { + // ThreatIntelligenceAlertRuleTemplateProperties - Threat Intelligence alert rule template properties + *ThreatIntelligenceAlertRuleTemplateProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicAlertRuleTemplateKindAlertRuleTemplate', 'KindBasicAlertRuleTemplateKindMLBehaviorAnalytics', 'KindBasicAlertRuleTemplateKindFusion', 'KindBasicAlertRuleTemplateKindThreatIntelligence', 'KindBasicAlertRuleTemplateKindMicrosoftSecurityIncidentCreation', 'KindBasicAlertRuleTemplateKindScheduled', 'KindBasicAlertRuleTemplateKindNRT' + Kind KindBasicAlertRuleTemplate `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ThreatIntelligenceAlertRuleTemplate. +func (tiart ThreatIntelligenceAlertRuleTemplate) MarshalJSON() ([]byte, error) { + tiart.Kind = KindBasicAlertRuleTemplateKindThreatIntelligence + objectMap := make(map[string]interface{}) + if tiart.ThreatIntelligenceAlertRuleTemplateProperties != nil { + objectMap["properties"] = tiart.ThreatIntelligenceAlertRuleTemplateProperties + } + if tiart.Kind != "" { + objectMap["kind"] = tiart.Kind + } + return json.Marshal(objectMap) +} + +// AsMLBehaviorAnalyticsAlertRuleTemplate is the BasicAlertRuleTemplate implementation for ThreatIntelligenceAlertRuleTemplate. +func (tiart ThreatIntelligenceAlertRuleTemplate) AsMLBehaviorAnalyticsAlertRuleTemplate() (*MLBehaviorAnalyticsAlertRuleTemplate, bool) { + return nil, false +} + +// AsFusionAlertRuleTemplate is the BasicAlertRuleTemplate implementation for ThreatIntelligenceAlertRuleTemplate. +func (tiart ThreatIntelligenceAlertRuleTemplate) AsFusionAlertRuleTemplate() (*FusionAlertRuleTemplate, bool) { + return nil, false +} + +// AsThreatIntelligenceAlertRuleTemplate is the BasicAlertRuleTemplate implementation for ThreatIntelligenceAlertRuleTemplate. +func (tiart ThreatIntelligenceAlertRuleTemplate) AsThreatIntelligenceAlertRuleTemplate() (*ThreatIntelligenceAlertRuleTemplate, bool) { + return &tiart, true +} + +// AsMicrosoftSecurityIncidentCreationAlertRuleTemplate is the BasicAlertRuleTemplate implementation for ThreatIntelligenceAlertRuleTemplate. +func (tiart ThreatIntelligenceAlertRuleTemplate) AsMicrosoftSecurityIncidentCreationAlertRuleTemplate() (*MicrosoftSecurityIncidentCreationAlertRuleTemplate, bool) { + return nil, false +} + +// AsScheduledAlertRuleTemplate is the BasicAlertRuleTemplate implementation for ThreatIntelligenceAlertRuleTemplate. +func (tiart ThreatIntelligenceAlertRuleTemplate) AsScheduledAlertRuleTemplate() (*ScheduledAlertRuleTemplate, bool) { + return nil, false +} + +// AsNrtAlertRuleTemplate is the BasicAlertRuleTemplate implementation for ThreatIntelligenceAlertRuleTemplate. +func (tiart ThreatIntelligenceAlertRuleTemplate) AsNrtAlertRuleTemplate() (*NrtAlertRuleTemplate, bool) { + return nil, false +} + +// AsAlertRuleTemplate is the BasicAlertRuleTemplate implementation for ThreatIntelligenceAlertRuleTemplate. +func (tiart ThreatIntelligenceAlertRuleTemplate) AsAlertRuleTemplate() (*AlertRuleTemplate, bool) { + return nil, false +} + +// AsBasicAlertRuleTemplate is the BasicAlertRuleTemplate implementation for ThreatIntelligenceAlertRuleTemplate. +func (tiart ThreatIntelligenceAlertRuleTemplate) AsBasicAlertRuleTemplate() (BasicAlertRuleTemplate, bool) { + return &tiart, true +} + +// UnmarshalJSON is the custom unmarshaler for ThreatIntelligenceAlertRuleTemplate struct. +func (tiart *ThreatIntelligenceAlertRuleTemplate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var threatIntelligenceAlertRuleTemplateProperties ThreatIntelligenceAlertRuleTemplateProperties + err = json.Unmarshal(*v, &threatIntelligenceAlertRuleTemplateProperties) + if err != nil { + return err + } + tiart.ThreatIntelligenceAlertRuleTemplateProperties = &threatIntelligenceAlertRuleTemplateProperties + } + case "kind": + if v != nil { + var kind KindBasicAlertRuleTemplate + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + tiart.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + tiart.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + tiart.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + tiart.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + tiart.SystemData = &systemData + } + } + } + + return nil +} + +// ThreatIntelligenceAlertRuleTemplateProperties threat Intelligence alert rule template properties +type ThreatIntelligenceAlertRuleTemplateProperties struct { + // Severity - The severity for alerts created by this alert rule. Possible values include: 'AlertSeverityHigh', 'AlertSeverityMedium', 'AlertSeverityLow', 'AlertSeverityInformational' + Severity AlertSeverity `json:"severity,omitempty"` + // Tactics - The tactics of the alert rule + Tactics *[]AttackTactic `json:"tactics,omitempty"` + // Techniques - The techniques of the alert rule + Techniques *[]string `json:"techniques,omitempty"` + // AlertRulesCreatedByTemplateCount - the number of alert rules that were created by this template + AlertRulesCreatedByTemplateCount *int32 `json:"alertRulesCreatedByTemplateCount,omitempty"` + // LastUpdatedDateUTC - READ-ONLY; The last time that this alert rule template has been updated. + LastUpdatedDateUTC *date.Time `json:"lastUpdatedDateUTC,omitempty"` + // CreatedDateUTC - READ-ONLY; The time that this alert rule template has been added. + CreatedDateUTC *date.Time `json:"createdDateUTC,omitempty"` + // Description - The description of the alert rule template. + Description *string `json:"description,omitempty"` + // DisplayName - The display name for alert rule template. + DisplayName *string `json:"displayName,omitempty"` + // RequiredDataConnectors - The required data sources for this template + RequiredDataConnectors *[]AlertRuleTemplateDataSource `json:"requiredDataConnectors,omitempty"` + // Status - The alert rule template status. Possible values include: 'TemplateStatusInstalled', 'TemplateStatusAvailable', 'TemplateStatusNotAvailable' + Status TemplateStatus `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for ThreatIntelligenceAlertRuleTemplateProperties. +func (tiart ThreatIntelligenceAlertRuleTemplateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tiart.Severity != "" { + objectMap["severity"] = tiart.Severity + } + if tiart.Tactics != nil { + objectMap["tactics"] = tiart.Tactics + } + if tiart.Techniques != nil { + objectMap["techniques"] = tiart.Techniques + } + if tiart.AlertRulesCreatedByTemplateCount != nil { + objectMap["alertRulesCreatedByTemplateCount"] = tiart.AlertRulesCreatedByTemplateCount + } + if tiart.Description != nil { + objectMap["description"] = tiart.Description + } + if tiart.DisplayName != nil { + objectMap["displayName"] = tiart.DisplayName + } + if tiart.RequiredDataConnectors != nil { + objectMap["requiredDataConnectors"] = tiart.RequiredDataConnectors + } + if tiart.Status != "" { + objectMap["status"] = tiart.Status + } + return json.Marshal(objectMap) +} + +// ThreatIntelligenceAppendTags array of tags to be appended to the threat intelligence indicator. +type ThreatIntelligenceAppendTags struct { + // ThreatIntelligenceTags - List of tags to be appended. + ThreatIntelligenceTags *[]string `json:"threatIntelligenceTags,omitempty"` +} + +// ThreatIntelligenceExternalReference describes external reference +type ThreatIntelligenceExternalReference struct { + // Description - External reference description + Description *string `json:"description,omitempty"` + // ExternalID - External reference ID + ExternalID *string `json:"externalId,omitempty"` + // SourceName - External reference source name + SourceName *string `json:"sourceName,omitempty"` + // URL - External reference URL + URL *string `json:"url,omitempty"` + // Hashes - External reference hashes + Hashes map[string]*string `json:"hashes"` +} + +// MarshalJSON is the custom marshaler for ThreatIntelligenceExternalReference. +func (tier ThreatIntelligenceExternalReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tier.Description != nil { + objectMap["description"] = tier.Description + } + if tier.ExternalID != nil { + objectMap["externalId"] = tier.ExternalID + } + if tier.SourceName != nil { + objectMap["sourceName"] = tier.SourceName + } + if tier.URL != nil { + objectMap["url"] = tier.URL + } + if tier.Hashes != nil { + objectMap["hashes"] = tier.Hashes + } + return json.Marshal(objectMap) +} + +// ThreatIntelligenceFilteringCriteria filtering criteria for querying threat intelligence indicators. +type ThreatIntelligenceFilteringCriteria struct { + // PageSize - Page size + PageSize *int32 `json:"pageSize,omitempty"` + // MinConfidence - Minimum confidence. + MinConfidence *int32 `json:"minConfidence,omitempty"` + // MaxConfidence - Maximum confidence. + MaxConfidence *int32 `json:"maxConfidence,omitempty"` + // MinValidUntil - Start time for ValidUntil filter. + MinValidUntil *string `json:"minValidUntil,omitempty"` + // MaxValidUntil - End time for ValidUntil filter. + MaxValidUntil *string `json:"maxValidUntil,omitempty"` + // IncludeDisabled - Parameter to include/exclude disabled indicators. + IncludeDisabled *bool `json:"includeDisabled,omitempty"` + // SortBy - Columns to sort by and sorting order + SortBy *[]ThreatIntelligenceSortingCriteria `json:"sortBy,omitempty"` + // Sources - Sources of threat intelligence indicators + Sources *[]string `json:"sources,omitempty"` + // PatternTypes - Pattern types + PatternTypes *[]string `json:"patternTypes,omitempty"` + // ThreatTypes - Threat types of threat intelligence indicators + ThreatTypes *[]string `json:"threatTypes,omitempty"` + // Ids - Ids of threat intelligence indicators + Ids *[]string `json:"ids,omitempty"` + // Keywords - Keywords for searching threat intelligence indicators + Keywords *[]string `json:"keywords,omitempty"` + // SkipToken - Skip token. + SkipToken *string `json:"skipToken,omitempty"` +} + +// ThreatIntelligenceGranularMarkingModel describes threat granular marking model entity +type ThreatIntelligenceGranularMarkingModel struct { + // Language - Language granular marking model + Language *string `json:"language,omitempty"` + // MarkingRef - marking reference granular marking model + MarkingRef *int32 `json:"markingRef,omitempty"` + // Selectors - granular marking model selectors + Selectors *[]string `json:"selectors,omitempty"` +} + +// ThreatIntelligenceIndicatorModel threat intelligence indicator entity. +type ThreatIntelligenceIndicatorModel struct { + // ThreatIntelligenceIndicatorProperties - Threat Intelligence Entity properties + *ThreatIntelligenceIndicatorProperties `json:"properties,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` + // Kind - Possible values include: 'KindBasicThreatIntelligenceInformationKindThreatIntelligenceInformation', 'KindBasicThreatIntelligenceInformationKindIndicator' + Kind KindBasicThreatIntelligenceInformation `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for ThreatIntelligenceIndicatorModel. +func (tiim ThreatIntelligenceIndicatorModel) MarshalJSON() ([]byte, error) { + tiim.Kind = KindBasicThreatIntelligenceInformationKindIndicator + objectMap := make(map[string]interface{}) + if tiim.ThreatIntelligenceIndicatorProperties != nil { + objectMap["properties"] = tiim.ThreatIntelligenceIndicatorProperties + } + if tiim.Kind != "" { + objectMap["kind"] = tiim.Kind + } + if tiim.Etag != nil { + objectMap["etag"] = tiim.Etag + } + return json.Marshal(objectMap) +} + +// AsThreatIntelligenceIndicatorModel is the BasicThreatIntelligenceInformation implementation for ThreatIntelligenceIndicatorModel. +func (tiim ThreatIntelligenceIndicatorModel) AsThreatIntelligenceIndicatorModel() (*ThreatIntelligenceIndicatorModel, bool) { + return &tiim, true +} + +// AsThreatIntelligenceInformation is the BasicThreatIntelligenceInformation implementation for ThreatIntelligenceIndicatorModel. +func (tiim ThreatIntelligenceIndicatorModel) AsThreatIntelligenceInformation() (*ThreatIntelligenceInformation, bool) { + return nil, false +} + +// AsBasicThreatIntelligenceInformation is the BasicThreatIntelligenceInformation implementation for ThreatIntelligenceIndicatorModel. +func (tiim ThreatIntelligenceIndicatorModel) AsBasicThreatIntelligenceInformation() (BasicThreatIntelligenceInformation, bool) { + return &tiim, true +} + +// UnmarshalJSON is the custom unmarshaler for ThreatIntelligenceIndicatorModel struct. +func (tiim *ThreatIntelligenceIndicatorModel) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var threatIntelligenceIndicatorProperties ThreatIntelligenceIndicatorProperties + err = json.Unmarshal(*v, &threatIntelligenceIndicatorProperties) + if err != nil { + return err + } + tiim.ThreatIntelligenceIndicatorProperties = &threatIntelligenceIndicatorProperties + } + case "kind": + if v != nil { + var kind KindBasicThreatIntelligenceInformation + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + tiim.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + tiim.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + tiim.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + tiim.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + tiim.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + tiim.SystemData = &systemData + } + } + } + + return nil +} + +// ThreatIntelligenceIndicatorProperties describes threat intelligence entity properties +type ThreatIntelligenceIndicatorProperties struct { + // ThreatIntelligenceTags - List of tags + ThreatIntelligenceTags *[]string `json:"threatIntelligenceTags,omitempty"` + // LastUpdatedTimeUtc - Last updated time in UTC + LastUpdatedTimeUtc *string `json:"lastUpdatedTimeUtc,omitempty"` + // Source - Source of a threat intelligence entity + Source *string `json:"source,omitempty"` + // DisplayName - Display name of a threat intelligence entity + DisplayName *string `json:"displayName,omitempty"` + // Description - Description of a threat intelligence entity + Description *string `json:"description,omitempty"` + // IndicatorTypes - Indicator types of threat intelligence entities + IndicatorTypes *[]string `json:"indicatorTypes,omitempty"` + // Pattern - Pattern of a threat intelligence entity + Pattern *string `json:"pattern,omitempty"` + // PatternType - Pattern type of a threat intelligence entity + PatternType *string `json:"patternType,omitempty"` + // PatternVersion - Pattern version of a threat intelligence entity + PatternVersion *string `json:"patternVersion,omitempty"` + // KillChainPhases - Kill chain phases + KillChainPhases *[]ThreatIntelligenceKillChainPhase `json:"killChainPhases,omitempty"` + // ParsedPattern - Parsed patterns + ParsedPattern *[]ThreatIntelligenceParsedPattern `json:"parsedPattern,omitempty"` + // ExternalID - External ID of threat intelligence entity + ExternalID *string `json:"externalId,omitempty"` + // CreatedByRef - Created by reference of threat intelligence entity + CreatedByRef *string `json:"createdByRef,omitempty"` + // Defanged - Is threat intelligence entity defanged + Defanged *bool `json:"defanged,omitempty"` + // ExternalLastUpdatedTimeUtc - External last updated time in UTC + ExternalLastUpdatedTimeUtc *string `json:"externalLastUpdatedTimeUtc,omitempty"` + // ExternalReferences - External References + ExternalReferences *[]ThreatIntelligenceExternalReference `json:"externalReferences,omitempty"` + // GranularMarkings - Granular Markings + GranularMarkings *[]ThreatIntelligenceGranularMarkingModel `json:"granularMarkings,omitempty"` + // Labels - Labels of threat intelligence entity + Labels *[]string `json:"labels,omitempty"` + // Revoked - Is threat intelligence entity revoked + Revoked *bool `json:"revoked,omitempty"` + // Confidence - Confidence of threat intelligence entity + Confidence *int32 `json:"confidence,omitempty"` + // ObjectMarkingRefs - Threat intelligence entity object marking references + ObjectMarkingRefs *[]string `json:"objectMarkingRefs,omitempty"` + // Language - Language of threat intelligence entity + Language *string `json:"language,omitempty"` + // ThreatTypes - Threat types + ThreatTypes *[]string `json:"threatTypes,omitempty"` + // ValidFrom - Valid from + ValidFrom *string `json:"validFrom,omitempty"` + // ValidUntil - Valid until + ValidUntil *string `json:"validUntil,omitempty"` + // Created - Created by + Created *string `json:"created,omitempty"` + // Modified - Modified by + Modified *string `json:"modified,omitempty"` + // Extensions - Extensions map + Extensions map[string]interface{} `json:"extensions"` + // AdditionalData - READ-ONLY; A bag of custom fields that should be part of the entity and will be presented to the user. + AdditionalData map[string]interface{} `json:"additionalData"` + // FriendlyName - READ-ONLY; The graph item display name which is a short humanly readable description of the graph item instance. This property is optional and might be system generated. + FriendlyName *string `json:"friendlyName,omitempty"` +} + +// MarshalJSON is the custom marshaler for ThreatIntelligenceIndicatorProperties. +func (tiip ThreatIntelligenceIndicatorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tiip.ThreatIntelligenceTags != nil { + objectMap["threatIntelligenceTags"] = tiip.ThreatIntelligenceTags + } + if tiip.LastUpdatedTimeUtc != nil { + objectMap["lastUpdatedTimeUtc"] = tiip.LastUpdatedTimeUtc + } + if tiip.Source != nil { + objectMap["source"] = tiip.Source + } + if tiip.DisplayName != nil { + objectMap["displayName"] = tiip.DisplayName + } + if tiip.Description != nil { + objectMap["description"] = tiip.Description + } + if tiip.IndicatorTypes != nil { + objectMap["indicatorTypes"] = tiip.IndicatorTypes + } + if tiip.Pattern != nil { + objectMap["pattern"] = tiip.Pattern + } + if tiip.PatternType != nil { + objectMap["patternType"] = tiip.PatternType + } + if tiip.PatternVersion != nil { + objectMap["patternVersion"] = tiip.PatternVersion + } + if tiip.KillChainPhases != nil { + objectMap["killChainPhases"] = tiip.KillChainPhases + } + if tiip.ParsedPattern != nil { + objectMap["parsedPattern"] = tiip.ParsedPattern + } + if tiip.ExternalID != nil { + objectMap["externalId"] = tiip.ExternalID + } + if tiip.CreatedByRef != nil { + objectMap["createdByRef"] = tiip.CreatedByRef + } + if tiip.Defanged != nil { + objectMap["defanged"] = tiip.Defanged + } + if tiip.ExternalLastUpdatedTimeUtc != nil { + objectMap["externalLastUpdatedTimeUtc"] = tiip.ExternalLastUpdatedTimeUtc + } + if tiip.ExternalReferences != nil { + objectMap["externalReferences"] = tiip.ExternalReferences + } + if tiip.GranularMarkings != nil { + objectMap["granularMarkings"] = tiip.GranularMarkings + } + if tiip.Labels != nil { + objectMap["labels"] = tiip.Labels + } + if tiip.Revoked != nil { + objectMap["revoked"] = tiip.Revoked + } + if tiip.Confidence != nil { + objectMap["confidence"] = tiip.Confidence + } + if tiip.ObjectMarkingRefs != nil { + objectMap["objectMarkingRefs"] = tiip.ObjectMarkingRefs + } + if tiip.Language != nil { + objectMap["language"] = tiip.Language + } + if tiip.ThreatTypes != nil { + objectMap["threatTypes"] = tiip.ThreatTypes + } + if tiip.ValidFrom != nil { + objectMap["validFrom"] = tiip.ValidFrom + } + if tiip.ValidUntil != nil { + objectMap["validUntil"] = tiip.ValidUntil + } + if tiip.Created != nil { + objectMap["created"] = tiip.Created + } + if tiip.Modified != nil { + objectMap["modified"] = tiip.Modified + } + if tiip.Extensions != nil { + objectMap["extensions"] = tiip.Extensions + } + return json.Marshal(objectMap) +} + +// BasicThreatIntelligenceInformation threat intelligence information object. +type BasicThreatIntelligenceInformation interface { + AsThreatIntelligenceIndicatorModel() (*ThreatIntelligenceIndicatorModel, bool) + AsThreatIntelligenceInformation() (*ThreatIntelligenceInformation, bool) +} + +// ThreatIntelligenceInformation threat intelligence information object. +type ThreatIntelligenceInformation struct { + autorest.Response `json:"-"` + // Kind - Possible values include: 'KindBasicThreatIntelligenceInformationKindThreatIntelligenceInformation', 'KindBasicThreatIntelligenceInformationKindIndicator' + Kind KindBasicThreatIntelligenceInformation `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +func unmarshalBasicThreatIntelligenceInformation(body []byte) (BasicThreatIntelligenceInformation, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["kind"] { + case string(KindBasicThreatIntelligenceInformationKindIndicator): + var tiim ThreatIntelligenceIndicatorModel + err := json.Unmarshal(body, &tiim) + return tiim, err + default: + var tii ThreatIntelligenceInformation + err := json.Unmarshal(body, &tii) + return tii, err + } +} +func unmarshalBasicThreatIntelligenceInformationArray(body []byte) ([]BasicThreatIntelligenceInformation, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + tiiArray := make([]BasicThreatIntelligenceInformation, len(rawMessages)) + + for index, rawMessage := range rawMessages { + tii, err := unmarshalBasicThreatIntelligenceInformation(*rawMessage) + if err != nil { + return nil, err + } + tiiArray[index] = tii + } + return tiiArray, nil +} + +// MarshalJSON is the custom marshaler for ThreatIntelligenceInformation. +func (tii ThreatIntelligenceInformation) MarshalJSON() ([]byte, error) { + tii.Kind = KindBasicThreatIntelligenceInformationKindThreatIntelligenceInformation + objectMap := make(map[string]interface{}) + if tii.Kind != "" { + objectMap["kind"] = tii.Kind + } + if tii.Etag != nil { + objectMap["etag"] = tii.Etag + } + return json.Marshal(objectMap) +} + +// AsThreatIntelligenceIndicatorModel is the BasicThreatIntelligenceInformation implementation for ThreatIntelligenceInformation. +func (tii ThreatIntelligenceInformation) AsThreatIntelligenceIndicatorModel() (*ThreatIntelligenceIndicatorModel, bool) { + return nil, false +} + +// AsThreatIntelligenceInformation is the BasicThreatIntelligenceInformation implementation for ThreatIntelligenceInformation. +func (tii ThreatIntelligenceInformation) AsThreatIntelligenceInformation() (*ThreatIntelligenceInformation, bool) { + return &tii, true +} + +// AsBasicThreatIntelligenceInformation is the BasicThreatIntelligenceInformation implementation for ThreatIntelligenceInformation. +func (tii ThreatIntelligenceInformation) AsBasicThreatIntelligenceInformation() (BasicThreatIntelligenceInformation, bool) { + return &tii, true +} + +// ThreatIntelligenceInformationList list of all the threat intelligence information objects. +type ThreatIntelligenceInformationList struct { + autorest.Response `json:"-"` + // NextLink - READ-ONLY; URL to fetch the next set of information objects. + NextLink *string `json:"nextLink,omitempty"` + // Value - Array of threat intelligence information objects. + Value *[]BasicThreatIntelligenceInformation `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for ThreatIntelligenceInformationList. +func (tiil ThreatIntelligenceInformationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tiil.Value != nil { + objectMap["value"] = tiil.Value + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ThreatIntelligenceInformationList struct. +func (tiil *ThreatIntelligenceInformationList) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "nextLink": + if v != nil { + var nextLink string + err = json.Unmarshal(*v, &nextLink) + if err != nil { + return err + } + tiil.NextLink = &nextLink + } + case "value": + if v != nil { + value, err := unmarshalBasicThreatIntelligenceInformationArray(*v) + if err != nil { + return err + } + tiil.Value = &value + } + } + } + + return nil +} + +// ThreatIntelligenceInformationListIterator provides access to a complete listing of +// ThreatIntelligenceInformation values. +type ThreatIntelligenceInformationListIterator struct { + i int + page ThreatIntelligenceInformationListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ThreatIntelligenceInformationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ThreatIntelligenceInformationListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ThreatIntelligenceInformationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ThreatIntelligenceInformationListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ThreatIntelligenceInformationListIterator) Response() ThreatIntelligenceInformationList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ThreatIntelligenceInformationListIterator) Value() BasicThreatIntelligenceInformation { + if !iter.page.NotDone() { + return ThreatIntelligenceInformation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ThreatIntelligenceInformationListIterator type. +func NewThreatIntelligenceInformationListIterator(page ThreatIntelligenceInformationListPage) ThreatIntelligenceInformationListIterator { + return ThreatIntelligenceInformationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (tiil ThreatIntelligenceInformationList) IsEmpty() bool { + return tiil.Value == nil || len(*tiil.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (tiil ThreatIntelligenceInformationList) hasNextLink() bool { + return tiil.NextLink != nil && len(*tiil.NextLink) != 0 +} + +// threatIntelligenceInformationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (tiil ThreatIntelligenceInformationList) threatIntelligenceInformationListPreparer(ctx context.Context) (*http.Request, error) { + if !tiil.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(tiil.NextLink))) +} + +// ThreatIntelligenceInformationListPage contains a page of BasicThreatIntelligenceInformation values. +type ThreatIntelligenceInformationListPage struct { + fn func(context.Context, ThreatIntelligenceInformationList) (ThreatIntelligenceInformationList, error) + tiil ThreatIntelligenceInformationList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ThreatIntelligenceInformationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ThreatIntelligenceInformationListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.tiil) + if err != nil { + return err + } + page.tiil = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ThreatIntelligenceInformationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ThreatIntelligenceInformationListPage) NotDone() bool { + return !page.tiil.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ThreatIntelligenceInformationListPage) Response() ThreatIntelligenceInformationList { + return page.tiil +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ThreatIntelligenceInformationListPage) Values() []BasicThreatIntelligenceInformation { + if page.tiil.IsEmpty() { + return nil + } + return *page.tiil.Value +} + +// Creates a new instance of the ThreatIntelligenceInformationListPage type. +func NewThreatIntelligenceInformationListPage(cur ThreatIntelligenceInformationList, getNextPage func(context.Context, ThreatIntelligenceInformationList) (ThreatIntelligenceInformationList, error)) ThreatIntelligenceInformationListPage { + return ThreatIntelligenceInformationListPage{ + fn: getNextPage, + tiil: cur, + } +} + +// ThreatIntelligenceInformationModel ... +type ThreatIntelligenceInformationModel struct { + autorest.Response `json:"-"` + Value BasicThreatIntelligenceInformation `json:"value,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for ThreatIntelligenceInformationModel struct. +func (tiim *ThreatIntelligenceInformationModel) UnmarshalJSON(body []byte) error { + tii, err := unmarshalBasicThreatIntelligenceInformation(body) + if err != nil { + return err + } + tiim.Value = tii + + return nil +} + +// ThreatIntelligenceKillChainPhase describes threat kill chain phase entity +type ThreatIntelligenceKillChainPhase struct { + // KillChainName - Kill chainName name + KillChainName *string `json:"killChainName,omitempty"` + // PhaseName - Phase name + PhaseName *string `json:"phaseName,omitempty"` +} + +// ThreatIntelligenceMetric describes threat intelligence metric +type ThreatIntelligenceMetric struct { + // LastUpdatedTimeUtc - Last updated indicator metric + LastUpdatedTimeUtc *string `json:"lastUpdatedTimeUtc,omitempty"` + // ThreatTypeMetrics - Threat type metrics + ThreatTypeMetrics *[]ThreatIntelligenceMetricEntity `json:"threatTypeMetrics,omitempty"` + // PatternTypeMetrics - Pattern type metrics + PatternTypeMetrics *[]ThreatIntelligenceMetricEntity `json:"patternTypeMetrics,omitempty"` + // SourceMetrics - Source metrics + SourceMetrics *[]ThreatIntelligenceMetricEntity `json:"sourceMetrics,omitempty"` +} + +// ThreatIntelligenceMetricEntity describes threat intelligence metric entity +type ThreatIntelligenceMetricEntity struct { + // MetricName - Metric name + MetricName *string `json:"metricName,omitempty"` + // MetricValue - Metric value + MetricValue *int32 `json:"metricValue,omitempty"` +} + +// ThreatIntelligenceMetrics threat intelligence metrics. +type ThreatIntelligenceMetrics struct { + // Properties - Threat intelligence metrics. + Properties *ThreatIntelligenceMetric `json:"properties,omitempty"` +} + +// ThreatIntelligenceMetricsList list of all the threat intelligence metric fields (type/threat +// type/source). +type ThreatIntelligenceMetricsList struct { + autorest.Response `json:"-"` + // Value - Array of threat intelligence metric fields (type/threat type/source). + Value *[]ThreatIntelligenceMetrics `json:"value,omitempty"` +} + +// ThreatIntelligenceParsedPattern describes parsed pattern entity +type ThreatIntelligenceParsedPattern struct { + // PatternTypeKey - Pattern type key + PatternTypeKey *string `json:"patternTypeKey,omitempty"` + // PatternTypeValues - Pattern type keys + PatternTypeValues *[]ThreatIntelligenceParsedPatternTypeValue `json:"patternTypeValues,omitempty"` +} + +// ThreatIntelligenceParsedPatternTypeValue describes threat kill chain phase entity +type ThreatIntelligenceParsedPatternTypeValue struct { + // ValueType - Type of the value + ValueType *string `json:"valueType,omitempty"` + // Value - Value of parsed pattern + Value *string `json:"value,omitempty"` +} + +// ThreatIntelligenceSortingCriteria list of available columns for sorting +type ThreatIntelligenceSortingCriteria struct { + // ItemKey - Column name + ItemKey *string `json:"itemKey,omitempty"` + // SortOrder - Sorting order (ascending/descending/unsorted). Possible values include: 'ThreatIntelligenceSortingCriteriaEnumUnsorted', 'ThreatIntelligenceSortingCriteriaEnumAscending', 'ThreatIntelligenceSortingCriteriaEnumDescending' + SortOrder ThreatIntelligenceSortingCriteriaEnum `json:"sortOrder,omitempty"` +} + +// TICheckRequirements threat Intelligence Platforms data connector check requirements +type TICheckRequirements struct { + // TICheckRequirementsProperties - Threat Intelligence Platforms data connector check required properties + *TICheckRequirementsProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorsCheckRequirementsKindDataConnectorsCheckRequirements', 'KindBasicDataConnectorsCheckRequirementsKindAzureActiveDirectory', 'KindBasicDataConnectorsCheckRequirementsKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindAzureSecurityCenter', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesS3', 'KindBasicDataConnectorsCheckRequirementsKindDynamics365', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindOfficeATP', 'KindBasicDataConnectorsCheckRequirementsKindOfficeIRM', 'KindBasicDataConnectorsCheckRequirementsKindOffice365Project', 'KindBasicDataConnectorsCheckRequirementsKindOfficePowerBI', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligenceTaxii', 'KindBasicDataConnectorsCheckRequirementsKindIOT' + Kind KindBasicDataConnectorsCheckRequirements `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for TICheckRequirements. +func (tcr TICheckRequirements) MarshalJSON() ([]byte, error) { + tcr.Kind = KindBasicDataConnectorsCheckRequirementsKindThreatIntelligence + objectMap := make(map[string]interface{}) + if tcr.TICheckRequirementsProperties != nil { + objectMap["properties"] = tcr.TICheckRequirementsProperties + } + if tcr.Kind != "" { + objectMap["kind"] = tcr.Kind + } + return json.Marshal(objectMap) +} + +// AsAADCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TICheckRequirements. +func (tcr TICheckRequirements) AsAADCheckRequirements() (*AADCheckRequirements, bool) { + return nil, false +} + +// AsAATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TICheckRequirements. +func (tcr TICheckRequirements) AsAATPCheckRequirements() (*AATPCheckRequirements, bool) { + return nil, false +} + +// AsASCCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TICheckRequirements. +func (tcr TICheckRequirements) AsASCCheckRequirements() (*ASCCheckRequirements, bool) { + return nil, false +} + +// AsAwsCloudTrailCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TICheckRequirements. +func (tcr TICheckRequirements) AsAwsCloudTrailCheckRequirements() (*AwsCloudTrailCheckRequirements, bool) { + return nil, false +} + +// AsAwsS3CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TICheckRequirements. +func (tcr TICheckRequirements) AsAwsS3CheckRequirements() (*AwsS3CheckRequirements, bool) { + return nil, false +} + +// AsDynamics365CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TICheckRequirements. +func (tcr TICheckRequirements) AsDynamics365CheckRequirements() (*Dynamics365CheckRequirements, bool) { + return nil, false +} + +// AsMCASCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TICheckRequirements. +func (tcr TICheckRequirements) AsMCASCheckRequirements() (*MCASCheckRequirements, bool) { + return nil, false +} + +// AsMDATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TICheckRequirements. +func (tcr TICheckRequirements) AsMDATPCheckRequirements() (*MDATPCheckRequirements, bool) { + return nil, false +} + +// AsMSTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TICheckRequirements. +func (tcr TICheckRequirements) AsMSTICheckRequirements() (*MSTICheckRequirements, bool) { + return nil, false +} + +// AsMtpCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TICheckRequirements. +func (tcr TICheckRequirements) AsMtpCheckRequirements() (*MtpCheckRequirements, bool) { + return nil, false +} + +// AsOfficeATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TICheckRequirements. +func (tcr TICheckRequirements) AsOfficeATPCheckRequirements() (*OfficeATPCheckRequirements, bool) { + return nil, false +} + +// AsOfficeIRMCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TICheckRequirements. +func (tcr TICheckRequirements) AsOfficeIRMCheckRequirements() (*OfficeIRMCheckRequirements, bool) { + return nil, false +} + +// AsOffice365ProjectCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TICheckRequirements. +func (tcr TICheckRequirements) AsOffice365ProjectCheckRequirements() (*Office365ProjectCheckRequirements, bool) { + return nil, false +} + +// AsOfficePowerBICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TICheckRequirements. +func (tcr TICheckRequirements) AsOfficePowerBICheckRequirements() (*OfficePowerBICheckRequirements, bool) { + return nil, false +} + +// AsTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TICheckRequirements. +func (tcr TICheckRequirements) AsTICheckRequirements() (*TICheckRequirements, bool) { + return &tcr, true +} + +// AsTiTaxiiCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TICheckRequirements. +func (tcr TICheckRequirements) AsTiTaxiiCheckRequirements() (*TiTaxiiCheckRequirements, bool) { + return nil, false +} + +// AsIoTCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TICheckRequirements. +func (tcr TICheckRequirements) AsIoTCheckRequirements() (*IoTCheckRequirements, bool) { + return nil, false +} + +// AsDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TICheckRequirements. +func (tcr TICheckRequirements) AsDataConnectorsCheckRequirements() (*DataConnectorsCheckRequirements, bool) { + return nil, false +} + +// AsBasicDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TICheckRequirements. +func (tcr TICheckRequirements) AsBasicDataConnectorsCheckRequirements() (BasicDataConnectorsCheckRequirements, bool) { + return &tcr, true +} + +// UnmarshalJSON is the custom unmarshaler for TICheckRequirements struct. +func (tcr *TICheckRequirements) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var tICheckRequirementsProperties TICheckRequirementsProperties + err = json.Unmarshal(*v, &tICheckRequirementsProperties) + if err != nil { + return err + } + tcr.TICheckRequirementsProperties = &tICheckRequirementsProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnectorsCheckRequirements + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + tcr.Kind = kind + } + } + } + + return nil +} + +// TICheckRequirementsProperties threat Intelligence Platforms data connector required properties. +type TICheckRequirementsProperties struct { + // TenantID - The tenant id to connect to, and get the data from. + TenantID *string `json:"tenantId,omitempty"` +} + +// TIDataConnector represents threat intelligence data connector. +type TIDataConnector struct { + // TIDataConnectorProperties - TI (Threat Intelligence) data connector properties. + *TIDataConnectorProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorKindDataConnector', 'KindBasicDataConnectorKindAzureActiveDirectory', 'KindBasicDataConnectorKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorKindMicrosoftThreatProtection', 'KindBasicDataConnectorKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorKindAzureSecurityCenter', 'KindBasicDataConnectorKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorKindAmazonWebServicesS3', 'KindBasicDataConnectorKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorKindDynamics365', 'KindBasicDataConnectorKindOfficeATP', 'KindBasicDataConnectorKindOffice365Project', 'KindBasicDataConnectorKindOfficePowerBI', 'KindBasicDataConnectorKindOfficeIRM', 'KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorKindOffice365', 'KindBasicDataConnectorKindThreatIntelligence', 'KindBasicDataConnectorKindThreatIntelligenceTaxii', 'KindBasicDataConnectorKindIOT', 'KindBasicDataConnectorKindGenericUI', 'KindBasicDataConnectorKindAPIPolling' + Kind KindBasicDataConnector `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for TIDataConnector. +func (tdc TIDataConnector) MarshalJSON() ([]byte, error) { + tdc.Kind = KindBasicDataConnectorKindThreatIntelligence + objectMap := make(map[string]interface{}) + if tdc.TIDataConnectorProperties != nil { + objectMap["properties"] = tdc.TIDataConnectorProperties + } + if tdc.Kind != "" { + objectMap["kind"] = tdc.Kind + } + if tdc.Etag != nil { + objectMap["etag"] = tdc.Etag + } + return json.Marshal(objectMap) +} + +// AsAADDataConnector is the BasicDataConnector implementation for TIDataConnector. +func (tdc TIDataConnector) AsAADDataConnector() (*AADDataConnector, bool) { + return nil, false +} + +// AsMSTIDataConnector is the BasicDataConnector implementation for TIDataConnector. +func (tdc TIDataConnector) AsMSTIDataConnector() (*MSTIDataConnector, bool) { + return nil, false +} + +// AsMTPDataConnector is the BasicDataConnector implementation for TIDataConnector. +func (tdc TIDataConnector) AsMTPDataConnector() (*MTPDataConnector, bool) { + return nil, false +} + +// AsAATPDataConnector is the BasicDataConnector implementation for TIDataConnector. +func (tdc TIDataConnector) AsAATPDataConnector() (*AATPDataConnector, bool) { + return nil, false +} + +// AsASCDataConnector is the BasicDataConnector implementation for TIDataConnector. +func (tdc TIDataConnector) AsASCDataConnector() (*ASCDataConnector, bool) { + return nil, false +} + +// AsAwsCloudTrailDataConnector is the BasicDataConnector implementation for TIDataConnector. +func (tdc TIDataConnector) AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) { + return nil, false +} + +// AsAwsS3DataConnector is the BasicDataConnector implementation for TIDataConnector. +func (tdc TIDataConnector) AsAwsS3DataConnector() (*AwsS3DataConnector, bool) { + return nil, false +} + +// AsMCASDataConnector is the BasicDataConnector implementation for TIDataConnector. +func (tdc TIDataConnector) AsMCASDataConnector() (*MCASDataConnector, bool) { + return nil, false +} + +// AsDynamics365DataConnector is the BasicDataConnector implementation for TIDataConnector. +func (tdc TIDataConnector) AsDynamics365DataConnector() (*Dynamics365DataConnector, bool) { + return nil, false +} + +// AsOfficeATPDataConnector is the BasicDataConnector implementation for TIDataConnector. +func (tdc TIDataConnector) AsOfficeATPDataConnector() (*OfficeATPDataConnector, bool) { + return nil, false +} + +// AsOffice365ProjectDataConnector is the BasicDataConnector implementation for TIDataConnector. +func (tdc TIDataConnector) AsOffice365ProjectDataConnector() (*Office365ProjectDataConnector, bool) { + return nil, false +} + +// AsOfficePowerBIDataConnector is the BasicDataConnector implementation for TIDataConnector. +func (tdc TIDataConnector) AsOfficePowerBIDataConnector() (*OfficePowerBIDataConnector, bool) { + return nil, false +} + +// AsOfficeIRMDataConnector is the BasicDataConnector implementation for TIDataConnector. +func (tdc TIDataConnector) AsOfficeIRMDataConnector() (*OfficeIRMDataConnector, bool) { + return nil, false +} + +// AsMDATPDataConnector is the BasicDataConnector implementation for TIDataConnector. +func (tdc TIDataConnector) AsMDATPDataConnector() (*MDATPDataConnector, bool) { + return nil, false +} + +// AsOfficeDataConnector is the BasicDataConnector implementation for TIDataConnector. +func (tdc TIDataConnector) AsOfficeDataConnector() (*OfficeDataConnector, bool) { + return nil, false +} + +// AsTIDataConnector is the BasicDataConnector implementation for TIDataConnector. +func (tdc TIDataConnector) AsTIDataConnector() (*TIDataConnector, bool) { + return &tdc, true +} + +// AsTiTaxiiDataConnector is the BasicDataConnector implementation for TIDataConnector. +func (tdc TIDataConnector) AsTiTaxiiDataConnector() (*TiTaxiiDataConnector, bool) { + return nil, false +} + +// AsIoTDataConnector is the BasicDataConnector implementation for TIDataConnector. +func (tdc TIDataConnector) AsIoTDataConnector() (*IoTDataConnector, bool) { + return nil, false +} + +// AsCodelessUIDataConnector is the BasicDataConnector implementation for TIDataConnector. +func (tdc TIDataConnector) AsCodelessUIDataConnector() (*CodelessUIDataConnector, bool) { + return nil, false +} + +// AsCodelessAPIPollingDataConnector is the BasicDataConnector implementation for TIDataConnector. +func (tdc TIDataConnector) AsCodelessAPIPollingDataConnector() (*CodelessAPIPollingDataConnector, bool) { + return nil, false +} + +// AsDataConnector is the BasicDataConnector implementation for TIDataConnector. +func (tdc TIDataConnector) AsDataConnector() (*DataConnector, bool) { + return nil, false +} + +// AsBasicDataConnector is the BasicDataConnector implementation for TIDataConnector. +func (tdc TIDataConnector) AsBasicDataConnector() (BasicDataConnector, bool) { + return &tdc, true +} + +// UnmarshalJSON is the custom unmarshaler for TIDataConnector struct. +func (tdc *TIDataConnector) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var tIDataConnectorProperties TIDataConnectorProperties + err = json.Unmarshal(*v, &tIDataConnectorProperties) + if err != nil { + return err + } + tdc.TIDataConnectorProperties = &tIDataConnectorProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnector + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + tdc.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + tdc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + tdc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + tdc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + tdc.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + tdc.SystemData = &systemData + } + } + } + + return nil +} + +// TIDataConnectorDataTypes the available data types for TI (Threat Intelligence) data connector. +type TIDataConnectorDataTypes struct { + // Indicators - Data type for indicators connection. + Indicators *TIDataConnectorDataTypesIndicators `json:"indicators,omitempty"` +} + +// TIDataConnectorDataTypesIndicators data type for indicators connection. +type TIDataConnectorDataTypesIndicators struct { + // State - Describe whether this data type connection is enabled or not. Possible values include: 'DataTypeStateEnabled', 'DataTypeStateDisabled' + State DataTypeState `json:"state,omitempty"` +} + +// TIDataConnectorProperties TI (Threat Intelligence) data connector properties. +type TIDataConnectorProperties struct { + // TipLookbackPeriod - The lookback period for the feed to be imported. + TipLookbackPeriod *date.Time `json:"tipLookbackPeriod,omitempty"` + // DataTypes - The available data types for the connector. + DataTypes *TIDataConnectorDataTypes `json:"dataTypes,omitempty"` + // TenantID - The tenant id to connect to, and get the data from. + TenantID *string `json:"tenantId,omitempty"` +} + +// TimelineAggregation timeline aggregation information per kind +type TimelineAggregation struct { + // Count - the total items found for a kind + Count *int32 `json:"count,omitempty"` + // Kind - the query kind. Possible values include: 'EntityTimelineKindActivity', 'EntityTimelineKindBookmark', 'EntityTimelineKindSecurityAlert' + Kind EntityTimelineKind `json:"kind,omitempty"` +} + +// TimelineError timeline Query Errors. +type TimelineError struct { + // Kind - the query kind. Possible values include: 'EntityTimelineKindActivity', 'EntityTimelineKindBookmark', 'EntityTimelineKindSecurityAlert' + Kind EntityTimelineKind `json:"kind,omitempty"` + // QueryID - the query id + QueryID *string `json:"queryId,omitempty"` + // ErrorMessage - the error message + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +// TimelineResultsMetadata expansion result metadata. +type TimelineResultsMetadata struct { + // TotalCount - the total items found for the timeline request + TotalCount *int32 `json:"totalCount,omitempty"` + // Aggregations - timeline aggregation per kind + Aggregations *[]TimelineAggregation `json:"aggregations,omitempty"` + // Errors - information about the failure queries + Errors *[]TimelineError `json:"errors,omitempty"` +} + +// TiTaxiiCheckRequirements threat Intelligence TAXII data connector check requirements +type TiTaxiiCheckRequirements struct { + // TiTaxiiCheckRequirementsProperties - Threat Intelligence TAXII check required properties. + *TiTaxiiCheckRequirementsProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorsCheckRequirementsKindDataConnectorsCheckRequirements', 'KindBasicDataConnectorsCheckRequirementsKindAzureActiveDirectory', 'KindBasicDataConnectorsCheckRequirementsKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindAzureSecurityCenter', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorsCheckRequirementsKindAmazonWebServicesS3', 'KindBasicDataConnectorsCheckRequirementsKindDynamics365', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindMicrosoftThreatProtection', 'KindBasicDataConnectorsCheckRequirementsKindOfficeATP', 'KindBasicDataConnectorsCheckRequirementsKindOfficeIRM', 'KindBasicDataConnectorsCheckRequirementsKindOffice365Project', 'KindBasicDataConnectorsCheckRequirementsKindOfficePowerBI', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligence', 'KindBasicDataConnectorsCheckRequirementsKindThreatIntelligenceTaxii', 'KindBasicDataConnectorsCheckRequirementsKindIOT' + Kind KindBasicDataConnectorsCheckRequirements `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for TiTaxiiCheckRequirements. +func (ttcr TiTaxiiCheckRequirements) MarshalJSON() ([]byte, error) { + ttcr.Kind = KindBasicDataConnectorsCheckRequirementsKindThreatIntelligenceTaxii + objectMap := make(map[string]interface{}) + if ttcr.TiTaxiiCheckRequirementsProperties != nil { + objectMap["properties"] = ttcr.TiTaxiiCheckRequirementsProperties + } + if ttcr.Kind != "" { + objectMap["kind"] = ttcr.Kind + } + return json.Marshal(objectMap) +} + +// AsAADCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TiTaxiiCheckRequirements. +func (ttcr TiTaxiiCheckRequirements) AsAADCheckRequirements() (*AADCheckRequirements, bool) { + return nil, false +} + +// AsAATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TiTaxiiCheckRequirements. +func (ttcr TiTaxiiCheckRequirements) AsAATPCheckRequirements() (*AATPCheckRequirements, bool) { + return nil, false +} + +// AsASCCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TiTaxiiCheckRequirements. +func (ttcr TiTaxiiCheckRequirements) AsASCCheckRequirements() (*ASCCheckRequirements, bool) { + return nil, false +} + +// AsAwsCloudTrailCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TiTaxiiCheckRequirements. +func (ttcr TiTaxiiCheckRequirements) AsAwsCloudTrailCheckRequirements() (*AwsCloudTrailCheckRequirements, bool) { + return nil, false +} + +// AsAwsS3CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TiTaxiiCheckRequirements. +func (ttcr TiTaxiiCheckRequirements) AsAwsS3CheckRequirements() (*AwsS3CheckRequirements, bool) { + return nil, false +} + +// AsDynamics365CheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TiTaxiiCheckRequirements. +func (ttcr TiTaxiiCheckRequirements) AsDynamics365CheckRequirements() (*Dynamics365CheckRequirements, bool) { + return nil, false +} + +// AsMCASCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TiTaxiiCheckRequirements. +func (ttcr TiTaxiiCheckRequirements) AsMCASCheckRequirements() (*MCASCheckRequirements, bool) { + return nil, false +} + +// AsMDATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TiTaxiiCheckRequirements. +func (ttcr TiTaxiiCheckRequirements) AsMDATPCheckRequirements() (*MDATPCheckRequirements, bool) { + return nil, false +} + +// AsMSTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TiTaxiiCheckRequirements. +func (ttcr TiTaxiiCheckRequirements) AsMSTICheckRequirements() (*MSTICheckRequirements, bool) { + return nil, false +} + +// AsMtpCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TiTaxiiCheckRequirements. +func (ttcr TiTaxiiCheckRequirements) AsMtpCheckRequirements() (*MtpCheckRequirements, bool) { + return nil, false +} + +// AsOfficeATPCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TiTaxiiCheckRequirements. +func (ttcr TiTaxiiCheckRequirements) AsOfficeATPCheckRequirements() (*OfficeATPCheckRequirements, bool) { + return nil, false +} + +// AsOfficeIRMCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TiTaxiiCheckRequirements. +func (ttcr TiTaxiiCheckRequirements) AsOfficeIRMCheckRequirements() (*OfficeIRMCheckRequirements, bool) { + return nil, false +} + +// AsOffice365ProjectCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TiTaxiiCheckRequirements. +func (ttcr TiTaxiiCheckRequirements) AsOffice365ProjectCheckRequirements() (*Office365ProjectCheckRequirements, bool) { + return nil, false +} + +// AsOfficePowerBICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TiTaxiiCheckRequirements. +func (ttcr TiTaxiiCheckRequirements) AsOfficePowerBICheckRequirements() (*OfficePowerBICheckRequirements, bool) { + return nil, false +} + +// AsTICheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TiTaxiiCheckRequirements. +func (ttcr TiTaxiiCheckRequirements) AsTICheckRequirements() (*TICheckRequirements, bool) { + return nil, false +} + +// AsTiTaxiiCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TiTaxiiCheckRequirements. +func (ttcr TiTaxiiCheckRequirements) AsTiTaxiiCheckRequirements() (*TiTaxiiCheckRequirements, bool) { + return &ttcr, true +} + +// AsIoTCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TiTaxiiCheckRequirements. +func (ttcr TiTaxiiCheckRequirements) AsIoTCheckRequirements() (*IoTCheckRequirements, bool) { + return nil, false +} + +// AsDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TiTaxiiCheckRequirements. +func (ttcr TiTaxiiCheckRequirements) AsDataConnectorsCheckRequirements() (*DataConnectorsCheckRequirements, bool) { + return nil, false +} + +// AsBasicDataConnectorsCheckRequirements is the BasicDataConnectorsCheckRequirements implementation for TiTaxiiCheckRequirements. +func (ttcr TiTaxiiCheckRequirements) AsBasicDataConnectorsCheckRequirements() (BasicDataConnectorsCheckRequirements, bool) { + return &ttcr, true +} + +// UnmarshalJSON is the custom unmarshaler for TiTaxiiCheckRequirements struct. +func (ttcr *TiTaxiiCheckRequirements) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var tiTaxiiCheckRequirementsProperties TiTaxiiCheckRequirementsProperties + err = json.Unmarshal(*v, &tiTaxiiCheckRequirementsProperties) + if err != nil { + return err + } + ttcr.TiTaxiiCheckRequirementsProperties = &tiTaxiiCheckRequirementsProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnectorsCheckRequirements + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ttcr.Kind = kind + } + } + } + + return nil +} + +// TiTaxiiCheckRequirementsProperties threat Intelligence TAXII data connector required properties. +type TiTaxiiCheckRequirementsProperties struct { + // TenantID - The tenant id to connect to, and get the data from. + TenantID *string `json:"tenantId,omitempty"` +} + +// TiTaxiiDataConnector data connector to pull Threat intelligence data from TAXII 2.0/2.1 server +type TiTaxiiDataConnector struct { + // TiTaxiiDataConnectorProperties - Threat intelligence TAXII data connector properties. + *TiTaxiiDataConnectorProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectorKindDataConnector', 'KindBasicDataConnectorKindAzureActiveDirectory', 'KindBasicDataConnectorKindMicrosoftThreatIntelligence', 'KindBasicDataConnectorKindMicrosoftThreatProtection', 'KindBasicDataConnectorKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorKindAzureSecurityCenter', 'KindBasicDataConnectorKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorKindAmazonWebServicesS3', 'KindBasicDataConnectorKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorKindDynamics365', 'KindBasicDataConnectorKindOfficeATP', 'KindBasicDataConnectorKindOffice365Project', 'KindBasicDataConnectorKindOfficePowerBI', 'KindBasicDataConnectorKindOfficeIRM', 'KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorKindOffice365', 'KindBasicDataConnectorKindThreatIntelligence', 'KindBasicDataConnectorKindThreatIntelligenceTaxii', 'KindBasicDataConnectorKindIOT', 'KindBasicDataConnectorKindGenericUI', 'KindBasicDataConnectorKindAPIPolling' + Kind KindBasicDataConnector `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for TiTaxiiDataConnector. +func (ttdc TiTaxiiDataConnector) MarshalJSON() ([]byte, error) { + ttdc.Kind = KindBasicDataConnectorKindThreatIntelligenceTaxii + objectMap := make(map[string]interface{}) + if ttdc.TiTaxiiDataConnectorProperties != nil { + objectMap["properties"] = ttdc.TiTaxiiDataConnectorProperties + } + if ttdc.Kind != "" { + objectMap["kind"] = ttdc.Kind + } + if ttdc.Etag != nil { + objectMap["etag"] = ttdc.Etag + } + return json.Marshal(objectMap) +} + +// AsAADDataConnector is the BasicDataConnector implementation for TiTaxiiDataConnector. +func (ttdc TiTaxiiDataConnector) AsAADDataConnector() (*AADDataConnector, bool) { + return nil, false +} + +// AsMSTIDataConnector is the BasicDataConnector implementation for TiTaxiiDataConnector. +func (ttdc TiTaxiiDataConnector) AsMSTIDataConnector() (*MSTIDataConnector, bool) { + return nil, false +} + +// AsMTPDataConnector is the BasicDataConnector implementation for TiTaxiiDataConnector. +func (ttdc TiTaxiiDataConnector) AsMTPDataConnector() (*MTPDataConnector, bool) { + return nil, false +} + +// AsAATPDataConnector is the BasicDataConnector implementation for TiTaxiiDataConnector. +func (ttdc TiTaxiiDataConnector) AsAATPDataConnector() (*AATPDataConnector, bool) { + return nil, false +} + +// AsASCDataConnector is the BasicDataConnector implementation for TiTaxiiDataConnector. +func (ttdc TiTaxiiDataConnector) AsASCDataConnector() (*ASCDataConnector, bool) { + return nil, false +} + +// AsAwsCloudTrailDataConnector is the BasicDataConnector implementation for TiTaxiiDataConnector. +func (ttdc TiTaxiiDataConnector) AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) { + return nil, false +} + +// AsAwsS3DataConnector is the BasicDataConnector implementation for TiTaxiiDataConnector. +func (ttdc TiTaxiiDataConnector) AsAwsS3DataConnector() (*AwsS3DataConnector, bool) { + return nil, false +} + +// AsMCASDataConnector is the BasicDataConnector implementation for TiTaxiiDataConnector. +func (ttdc TiTaxiiDataConnector) AsMCASDataConnector() (*MCASDataConnector, bool) { + return nil, false +} + +// AsDynamics365DataConnector is the BasicDataConnector implementation for TiTaxiiDataConnector. +func (ttdc TiTaxiiDataConnector) AsDynamics365DataConnector() (*Dynamics365DataConnector, bool) { + return nil, false +} + +// AsOfficeATPDataConnector is the BasicDataConnector implementation for TiTaxiiDataConnector. +func (ttdc TiTaxiiDataConnector) AsOfficeATPDataConnector() (*OfficeATPDataConnector, bool) { + return nil, false +} + +// AsOffice365ProjectDataConnector is the BasicDataConnector implementation for TiTaxiiDataConnector. +func (ttdc TiTaxiiDataConnector) AsOffice365ProjectDataConnector() (*Office365ProjectDataConnector, bool) { + return nil, false +} + +// AsOfficePowerBIDataConnector is the BasicDataConnector implementation for TiTaxiiDataConnector. +func (ttdc TiTaxiiDataConnector) AsOfficePowerBIDataConnector() (*OfficePowerBIDataConnector, bool) { + return nil, false +} + +// AsOfficeIRMDataConnector is the BasicDataConnector implementation for TiTaxiiDataConnector. +func (ttdc TiTaxiiDataConnector) AsOfficeIRMDataConnector() (*OfficeIRMDataConnector, bool) { + return nil, false +} + +// AsMDATPDataConnector is the BasicDataConnector implementation for TiTaxiiDataConnector. +func (ttdc TiTaxiiDataConnector) AsMDATPDataConnector() (*MDATPDataConnector, bool) { + return nil, false +} + +// AsOfficeDataConnector is the BasicDataConnector implementation for TiTaxiiDataConnector. +func (ttdc TiTaxiiDataConnector) AsOfficeDataConnector() (*OfficeDataConnector, bool) { + return nil, false +} + +// AsTIDataConnector is the BasicDataConnector implementation for TiTaxiiDataConnector. +func (ttdc TiTaxiiDataConnector) AsTIDataConnector() (*TIDataConnector, bool) { + return nil, false +} + +// AsTiTaxiiDataConnector is the BasicDataConnector implementation for TiTaxiiDataConnector. +func (ttdc TiTaxiiDataConnector) AsTiTaxiiDataConnector() (*TiTaxiiDataConnector, bool) { + return &ttdc, true +} + +// AsIoTDataConnector is the BasicDataConnector implementation for TiTaxiiDataConnector. +func (ttdc TiTaxiiDataConnector) AsIoTDataConnector() (*IoTDataConnector, bool) { + return nil, false +} + +// AsCodelessUIDataConnector is the BasicDataConnector implementation for TiTaxiiDataConnector. +func (ttdc TiTaxiiDataConnector) AsCodelessUIDataConnector() (*CodelessUIDataConnector, bool) { + return nil, false +} + +// AsCodelessAPIPollingDataConnector is the BasicDataConnector implementation for TiTaxiiDataConnector. +func (ttdc TiTaxiiDataConnector) AsCodelessAPIPollingDataConnector() (*CodelessAPIPollingDataConnector, bool) { + return nil, false +} + +// AsDataConnector is the BasicDataConnector implementation for TiTaxiiDataConnector. +func (ttdc TiTaxiiDataConnector) AsDataConnector() (*DataConnector, bool) { + return nil, false +} + +// AsBasicDataConnector is the BasicDataConnector implementation for TiTaxiiDataConnector. +func (ttdc TiTaxiiDataConnector) AsBasicDataConnector() (BasicDataConnector, bool) { + return &ttdc, true +} + +// UnmarshalJSON is the custom unmarshaler for TiTaxiiDataConnector struct. +func (ttdc *TiTaxiiDataConnector) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var tiTaxiiDataConnectorProperties TiTaxiiDataConnectorProperties + err = json.Unmarshal(*v, &tiTaxiiDataConnectorProperties) + if err != nil { + return err + } + ttdc.TiTaxiiDataConnectorProperties = &tiTaxiiDataConnectorProperties + } + case "kind": + if v != nil { + var kind KindBasicDataConnector + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ttdc.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ttdc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ttdc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ttdc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ttdc.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + ttdc.SystemData = &systemData + } + } + } + + return nil +} + +// TiTaxiiDataConnectorDataTypes the available data types for Threat Intelligence TAXII data connector. +type TiTaxiiDataConnectorDataTypes struct { + // TaxiiClient - Data type for TAXII connector. + TaxiiClient *TiTaxiiDataConnectorDataTypesTaxiiClient `json:"taxiiClient,omitempty"` +} + +// TiTaxiiDataConnectorDataTypesTaxiiClient data type for TAXII connector. +type TiTaxiiDataConnectorDataTypesTaxiiClient struct { + // State - Describe whether this data type connection is enabled or not. Possible values include: 'DataTypeStateEnabled', 'DataTypeStateDisabled' + State DataTypeState `json:"state,omitempty"` +} + +// TiTaxiiDataConnectorProperties threat Intelligence TAXII data connector properties. +type TiTaxiiDataConnectorProperties struct { + // WorkspaceID - The workspace id. + WorkspaceID *string `json:"workspaceId,omitempty"` + // FriendlyName - The friendly name for the TAXII server. + FriendlyName *string `json:"friendlyName,omitempty"` + // TaxiiServer - The API root for the TAXII server. + TaxiiServer *string `json:"taxiiServer,omitempty"` + // CollectionID - The collection id of the TAXII server. + CollectionID *string `json:"collectionId,omitempty"` + // UserName - The userName for the TAXII server. + UserName *string `json:"userName,omitempty"` + // Password - The password for the TAXII server. + Password *string `json:"password,omitempty"` + // TaxiiLookbackPeriod - The lookback period for the TAXII server. + TaxiiLookbackPeriod *date.Time `json:"taxiiLookbackPeriod,omitempty"` + // PollingFrequency - The polling frequency for the TAXII server. Possible values include: 'PollingFrequencyOnceAMinute', 'PollingFrequencyOnceAnHour', 'PollingFrequencyOnceADay' + PollingFrequency PollingFrequency `json:"pollingFrequency,omitempty"` + // DataTypes - The available data types for Threat Intelligence TAXII data connector. + DataTypes *TiTaxiiDataConnectorDataTypes `json:"dataTypes,omitempty"` + // TenantID - The tenant id to connect to, and get the data from. + TenantID *string `json:"tenantId,omitempty"` +} + +// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource +// which has 'tags' and a 'location' +type TrackedResource struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} + +// Ueba settings with single toggle. +type Ueba struct { + // UebaProperties - Ueba properties + *UebaProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicSettingsKindSettings', 'KindBasicSettingsKindAnomalies', 'KindBasicSettingsKindEyesOn', 'KindBasicSettingsKindEntityAnalytics', 'KindBasicSettingsKindUeba' + Kind KindBasicSettings `json:"kind,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Ueba. +func (u Ueba) MarshalJSON() ([]byte, error) { + u.Kind = KindBasicSettingsKindUeba + objectMap := make(map[string]interface{}) + if u.UebaProperties != nil { + objectMap["properties"] = u.UebaProperties + } + if u.Kind != "" { + objectMap["kind"] = u.Kind + } + if u.Etag != nil { + objectMap["etag"] = u.Etag + } + return json.Marshal(objectMap) +} + +// AsAnomalies is the BasicSettings implementation for Ueba. +func (u Ueba) AsAnomalies() (*Anomalies, bool) { + return nil, false +} + +// AsEyesOn is the BasicSettings implementation for Ueba. +func (u Ueba) AsEyesOn() (*EyesOn, bool) { + return nil, false +} + +// AsEntityAnalytics is the BasicSettings implementation for Ueba. +func (u Ueba) AsEntityAnalytics() (*EntityAnalytics, bool) { + return nil, false +} + +// AsUeba is the BasicSettings implementation for Ueba. +func (u Ueba) AsUeba() (*Ueba, bool) { + return &u, true +} + +// AsSettings is the BasicSettings implementation for Ueba. +func (u Ueba) AsSettings() (*Settings, bool) { + return nil, false +} + +// AsBasicSettings is the BasicSettings implementation for Ueba. +func (u Ueba) AsBasicSettings() (BasicSettings, bool) { + return &u, true +} + +// UnmarshalJSON is the custom unmarshaler for Ueba struct. +func (u *Ueba) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var uebaProperties UebaProperties + err = json.Unmarshal(*v, &uebaProperties) + if err != nil { + return err + } + u.UebaProperties = &uebaProperties + } + case "kind": + if v != nil { + var kind KindBasicSettings + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + u.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + u.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + u.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + u.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + u.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + u.SystemData = &systemData + } + } + } + + return nil +} + +// UebaProperties ueba property bag. +type UebaProperties struct { + // DataSources - The relevant data sources that enriched by ueba + DataSources *[]UebaDataSources `json:"dataSources,omitempty"` +} + +// URLEntity represents a url entity. +type URLEntity struct { + // URLEntityProperties - Url entity properties + *URLEntityProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindBasicEntityKindEntity', 'KindBasicEntityKindURL', 'KindBasicEntityKindSubmissionMail', 'KindBasicEntityKindSecurityGroup', 'KindBasicEntityKindSecurityAlert', 'KindBasicEntityKindRegistryValue', 'KindBasicEntityKindRegistryKey', 'KindBasicEntityKindProcess', 'KindBasicEntityKindMalware', 'KindBasicEntityKindMailMessage', 'KindBasicEntityKindMailCluster', 'KindBasicEntityKindMailbox', 'KindBasicEntityKindIP', 'KindBasicEntityKindIoTDevice', 'KindBasicEntityKindBookmark', 'KindBasicEntityKindHost', 'KindBasicEntityKindFileHash', 'KindBasicEntityKindFile', 'KindBasicEntityKindDNSResolution', 'KindBasicEntityKindCloudApplication', 'KindBasicEntityKindAzureResource', 'KindBasicEntityKindAccount' + Kind KindBasicEntity `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for URLEntity. +func (ue URLEntity) MarshalJSON() ([]byte, error) { + ue.Kind = KindBasicEntityKindURL + objectMap := make(map[string]interface{}) + if ue.URLEntityProperties != nil { + objectMap["properties"] = ue.URLEntityProperties + } + if ue.Kind != "" { + objectMap["kind"] = ue.Kind + } + return json.Marshal(objectMap) +} + +// AsURLEntity is the BasicEntity implementation for URLEntity. +func (ue URLEntity) AsURLEntity() (*URLEntity, bool) { + return &ue, true +} + +// AsSubmissionMailEntity is the BasicEntity implementation for URLEntity. +func (ue URLEntity) AsSubmissionMailEntity() (*SubmissionMailEntity, bool) { + return nil, false +} + +// AsSecurityGroupEntity is the BasicEntity implementation for URLEntity. +func (ue URLEntity) AsSecurityGroupEntity() (*SecurityGroupEntity, bool) { + return nil, false +} + +// AsSecurityAlert is the BasicEntity implementation for URLEntity. +func (ue URLEntity) AsSecurityAlert() (*SecurityAlert, bool) { + return nil, false +} + +// AsRegistryValueEntity is the BasicEntity implementation for URLEntity. +func (ue URLEntity) AsRegistryValueEntity() (*RegistryValueEntity, bool) { + return nil, false +} + +// AsRegistryKeyEntity is the BasicEntity implementation for URLEntity. +func (ue URLEntity) AsRegistryKeyEntity() (*RegistryKeyEntity, bool) { + return nil, false +} + +// AsProcessEntity is the BasicEntity implementation for URLEntity. +func (ue URLEntity) AsProcessEntity() (*ProcessEntity, bool) { + return nil, false +} + +// AsMalwareEntity is the BasicEntity implementation for URLEntity. +func (ue URLEntity) AsMalwareEntity() (*MalwareEntity, bool) { + return nil, false +} + +// AsMailMessageEntity is the BasicEntity implementation for URLEntity. +func (ue URLEntity) AsMailMessageEntity() (*MailMessageEntity, bool) { + return nil, false +} + +// AsMailClusterEntity is the BasicEntity implementation for URLEntity. +func (ue URLEntity) AsMailClusterEntity() (*MailClusterEntity, bool) { + return nil, false +} + +// AsMailboxEntity is the BasicEntity implementation for URLEntity. +func (ue URLEntity) AsMailboxEntity() (*MailboxEntity, bool) { + return nil, false +} + +// AsIPEntity is the BasicEntity implementation for URLEntity. +func (ue URLEntity) AsIPEntity() (*IPEntity, bool) { + return nil, false +} + +// AsIoTDeviceEntity is the BasicEntity implementation for URLEntity. +func (ue URLEntity) AsIoTDeviceEntity() (*IoTDeviceEntity, bool) { + return nil, false +} + +// AsHuntingBookmark is the BasicEntity implementation for URLEntity. +func (ue URLEntity) AsHuntingBookmark() (*HuntingBookmark, bool) { + return nil, false +} + +// AsHostEntity is the BasicEntity implementation for URLEntity. +func (ue URLEntity) AsHostEntity() (*HostEntity, bool) { + return nil, false +} + +// AsFileHashEntity is the BasicEntity implementation for URLEntity. +func (ue URLEntity) AsFileHashEntity() (*FileHashEntity, bool) { + return nil, false +} + +// AsFileEntity is the BasicEntity implementation for URLEntity. +func (ue URLEntity) AsFileEntity() (*FileEntity, bool) { + return nil, false +} + +// AsDNSEntity is the BasicEntity implementation for URLEntity. +func (ue URLEntity) AsDNSEntity() (*DNSEntity, bool) { + return nil, false +} + +// AsCloudApplicationEntity is the BasicEntity implementation for URLEntity. +func (ue URLEntity) AsCloudApplicationEntity() (*CloudApplicationEntity, bool) { + return nil, false +} + +// AsAzureResourceEntity is the BasicEntity implementation for URLEntity. +func (ue URLEntity) AsAzureResourceEntity() (*AzureResourceEntity, bool) { + return nil, false +} + +// AsAccountEntity is the BasicEntity implementation for URLEntity. +func (ue URLEntity) AsAccountEntity() (*AccountEntity, bool) { + return nil, false +} + +// AsEntity is the BasicEntity implementation for URLEntity. +func (ue URLEntity) AsEntity() (*Entity, bool) { + return nil, false +} + +// AsBasicEntity is the BasicEntity implementation for URLEntity. +func (ue URLEntity) AsBasicEntity() (BasicEntity, bool) { + return &ue, true +} + +// UnmarshalJSON is the custom unmarshaler for URLEntity struct. +func (ue *URLEntity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var URLEntityProperties URLEntityProperties + err = json.Unmarshal(*v, &URLEntityProperties) + if err != nil { + return err + } + ue.URLEntityProperties = &URLEntityProperties + } + case "kind": + if v != nil { + var kind KindBasicEntity + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ue.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ue.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ue.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ue.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + ue.SystemData = &systemData + } + } + } + + return nil +} + +// URLEntityProperties url entity property bag. +type URLEntityProperties struct { + // URL - READ-ONLY; A full URL the entity points to + URL *string `json:"url,omitempty"` + // AdditionalData - READ-ONLY; A bag of custom fields that should be part of the entity and will be presented to the user. + AdditionalData map[string]interface{} `json:"additionalData"` + // FriendlyName - READ-ONLY; The graph item display name which is a short humanly readable description of the graph item instance. This property is optional and might be system generated. + FriendlyName *string `json:"friendlyName,omitempty"` +} + +// MarshalJSON is the custom marshaler for URLEntityProperties. +func (uep URLEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// UserInfo user information that made some action +type UserInfo struct { + // Email - READ-ONLY; The email of the user. + Email *string `json:"email,omitempty"` + // Name - READ-ONLY; The name of the user. + Name *string `json:"name,omitempty"` + // ObjectID - The object id of the user. + ObjectID *uuid.UUID `json:"objectId,omitempty"` +} + +// MarshalJSON is the custom marshaler for UserInfo. +func (UI UserInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if UI.ObjectID != nil { + objectMap["objectId"] = UI.ObjectID + } + return json.Marshal(objectMap) +} + +// Watchlist represents a Watchlist in Azure Security Insights. +type Watchlist struct { + autorest.Response `json:"-"` + // WatchlistProperties - Watchlist properties + *WatchlistProperties `json:"properties,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Watchlist. +func (w Watchlist) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if w.WatchlistProperties != nil { + objectMap["properties"] = w.WatchlistProperties + } + if w.Etag != nil { + objectMap["etag"] = w.Etag + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Watchlist struct. +func (w *Watchlist) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var watchlistProperties WatchlistProperties + err = json.Unmarshal(*v, &watchlistProperties) + if err != nil { + return err + } + w.WatchlistProperties = &watchlistProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + w.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + w.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + w.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + w.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + w.SystemData = &systemData + } + } + } + + return nil +} + +// WatchlistItem represents a Watchlist item in Azure Security Insights. +type WatchlistItem struct { + autorest.Response `json:"-"` + // WatchlistItemProperties - Watchlist Item properties + *WatchlistItemProperties `json:"properties,omitempty"` + // Etag - Etag of the azure resource + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for WatchlistItem. +func (wi WatchlistItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wi.WatchlistItemProperties != nil { + objectMap["properties"] = wi.WatchlistItemProperties + } + if wi.Etag != nil { + objectMap["etag"] = wi.Etag + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for WatchlistItem struct. +func (wi *WatchlistItem) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var watchlistItemProperties WatchlistItemProperties + err = json.Unmarshal(*v, &watchlistItemProperties) + if err != nil { + return err + } + wi.WatchlistItemProperties = &watchlistItemProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + wi.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + wi.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + wi.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + wi.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + wi.SystemData = &systemData + } + } + } + + return nil +} + +// WatchlistItemList list all the watchlist items. +type WatchlistItemList struct { + autorest.Response `json:"-"` + // NextLink - READ-ONLY; URL to fetch the next set of watchlist item. + NextLink *string `json:"nextLink,omitempty"` + // Value - Array of watchlist items. + Value *[]WatchlistItem `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for WatchlistItemList. +func (wil WatchlistItemList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wil.Value != nil { + objectMap["value"] = wil.Value + } + return json.Marshal(objectMap) +} + +// WatchlistItemListIterator provides access to a complete listing of WatchlistItem values. +type WatchlistItemListIterator struct { + i int + page WatchlistItemListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *WatchlistItemListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchlistItemListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *WatchlistItemListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter WatchlistItemListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter WatchlistItemListIterator) Response() WatchlistItemList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter WatchlistItemListIterator) Value() WatchlistItem { + if !iter.page.NotDone() { + return WatchlistItem{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the WatchlistItemListIterator type. +func NewWatchlistItemListIterator(page WatchlistItemListPage) WatchlistItemListIterator { + return WatchlistItemListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (wil WatchlistItemList) IsEmpty() bool { + return wil.Value == nil || len(*wil.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (wil WatchlistItemList) hasNextLink() bool { + return wil.NextLink != nil && len(*wil.NextLink) != 0 +} + +// watchlistItemListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (wil WatchlistItemList) watchlistItemListPreparer(ctx context.Context) (*http.Request, error) { + if !wil.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(wil.NextLink))) +} + +// WatchlistItemListPage contains a page of WatchlistItem values. +type WatchlistItemListPage struct { + fn func(context.Context, WatchlistItemList) (WatchlistItemList, error) + wil WatchlistItemList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *WatchlistItemListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchlistItemListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.wil) + if err != nil { + return err + } + page.wil = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *WatchlistItemListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page WatchlistItemListPage) NotDone() bool { + return !page.wil.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page WatchlistItemListPage) Response() WatchlistItemList { + return page.wil +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page WatchlistItemListPage) Values() []WatchlistItem { + if page.wil.IsEmpty() { + return nil + } + return *page.wil.Value +} + +// Creates a new instance of the WatchlistItemListPage type. +func NewWatchlistItemListPage(cur WatchlistItemList, getNextPage func(context.Context, WatchlistItemList) (WatchlistItemList, error)) WatchlistItemListPage { + return WatchlistItemListPage{ + fn: getNextPage, + wil: cur, + } +} + +// WatchlistItemProperties describes watchlist item properties +type WatchlistItemProperties struct { + // WatchlistItemType - The type of the watchlist item + WatchlistItemType *string `json:"watchlistItemType,omitempty"` + // WatchlistItemID - The id (a Guid) of the watchlist item + WatchlistItemID *string `json:"watchlistItemId,omitempty"` + // TenantID - The tenantId to which the watchlist item belongs to + TenantID *string `json:"tenantId,omitempty"` + // IsDeleted - A flag that indicates if the watchlist item is deleted or not + IsDeleted *bool `json:"isDeleted,omitempty"` + // Created - The time the watchlist item was created + Created *date.Time `json:"created,omitempty"` + // Updated - The last time the watchlist item was updated + Updated *date.Time `json:"updated,omitempty"` + // CreatedBy - Describes a user that created the watchlist item + CreatedBy *UserInfo `json:"createdBy,omitempty"` + // UpdatedBy - Describes a user that updated the watchlist item + UpdatedBy *UserInfo `json:"updatedBy,omitempty"` + // ItemsKeyValue - key-value pairs for a watchlist item + ItemsKeyValue interface{} `json:"itemsKeyValue,omitempty"` + // EntityMapping - key-value pairs for a watchlist item entity mapping + EntityMapping interface{} `json:"entityMapping,omitempty"` +} + +// WatchlistList list all the watchlists. +type WatchlistList struct { + autorest.Response `json:"-"` + // NextLink - READ-ONLY; URL to fetch the next set of watchlists. + NextLink *string `json:"nextLink,omitempty"` + // Value - Array of watchlist. + Value *[]Watchlist `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for WatchlistList. +func (wl WatchlistList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wl.Value != nil { + objectMap["value"] = wl.Value + } + return json.Marshal(objectMap) +} + +// WatchlistListIterator provides access to a complete listing of Watchlist values. +type WatchlistListIterator struct { + i int + page WatchlistListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *WatchlistListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchlistListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *WatchlistListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter WatchlistListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter WatchlistListIterator) Response() WatchlistList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter WatchlistListIterator) Value() Watchlist { + if !iter.page.NotDone() { + return Watchlist{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the WatchlistListIterator type. +func NewWatchlistListIterator(page WatchlistListPage) WatchlistListIterator { + return WatchlistListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (wl WatchlistList) IsEmpty() bool { + return wl.Value == nil || len(*wl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (wl WatchlistList) hasNextLink() bool { + return wl.NextLink != nil && len(*wl.NextLink) != 0 +} + +// watchlistListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (wl WatchlistList) watchlistListPreparer(ctx context.Context) (*http.Request, error) { + if !wl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(wl.NextLink))) +} + +// WatchlistListPage contains a page of Watchlist values. +type WatchlistListPage struct { + fn func(context.Context, WatchlistList) (WatchlistList, error) + wl WatchlistList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *WatchlistListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchlistListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.wl) + if err != nil { + return err + } + page.wl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *WatchlistListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page WatchlistListPage) NotDone() bool { + return !page.wl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page WatchlistListPage) Response() WatchlistList { + return page.wl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page WatchlistListPage) Values() []Watchlist { + if page.wl.IsEmpty() { + return nil + } + return *page.wl.Value +} + +// Creates a new instance of the WatchlistListPage type. +func NewWatchlistListPage(cur WatchlistList, getNextPage func(context.Context, WatchlistList) (WatchlistList, error)) WatchlistListPage { + return WatchlistListPage{ + fn: getNextPage, + wl: cur, + } +} + +// WatchlistProperties describes watchlist properties +type WatchlistProperties struct { + // WatchlistID - The id (a Guid) of the watchlist + WatchlistID *string `json:"watchlistId,omitempty"` + // DisplayName - The display name of the watchlist + DisplayName *string `json:"displayName,omitempty"` + // Provider - The provider of the watchlist + Provider *string `json:"provider,omitempty"` + // Source - The filename of the watchlist, called 'source' + Source *string `json:"source,omitempty"` + // SourceType - The sourceType of the watchlist. Possible values include: 'SourceTypeLocalfile', 'SourceTypeRemotestorage' + SourceType SourceType `json:"sourceType,omitempty"` + // Created - The time the watchlist was created + Created *date.Time `json:"created,omitempty"` + // Updated - The last time the watchlist was updated + Updated *date.Time `json:"updated,omitempty"` + // CreatedBy - Describes a user that created the watchlist + CreatedBy *UserInfo `json:"createdBy,omitempty"` + // UpdatedBy - Describes a user that updated the watchlist + UpdatedBy *UserInfo `json:"updatedBy,omitempty"` + // Description - A description of the watchlist + Description *string `json:"description,omitempty"` + // WatchlistType - The type of the watchlist + WatchlistType *string `json:"watchlistType,omitempty"` + // WatchlistAlias - The alias of the watchlist + WatchlistAlias *string `json:"watchlistAlias,omitempty"` + // IsDeleted - A flag that indicates if the watchlist is deleted or not + IsDeleted *bool `json:"isDeleted,omitempty"` + // Labels - List of labels relevant to this watchlist + Labels *[]string `json:"labels,omitempty"` + // DefaultDuration - The default duration of a watchlist (in ISO 8601 duration format) + DefaultDuration *string `json:"defaultDuration,omitempty"` + // TenantID - The tenantId where the watchlist belongs to + TenantID *string `json:"tenantId,omitempty"` + // NumberOfLinesToSkip - The number of lines in a csv/tsv content to skip before the header + NumberOfLinesToSkip *int32 `json:"numberOfLinesToSkip,omitempty"` + // RawContent - The raw content that represents to watchlist items to create. In case of csv/tsv content type, it's the content of the file that will parsed by the endpoint + RawContent *string `json:"rawContent,omitempty"` + // ItemsSearchKey - The search key is used to optimize query performance when using watchlists for joins with other data. For example, enable a column with IP addresses to be the designated SearchKey field, then use this field as the key field when joining to other event data by IP address. + ItemsSearchKey *string `json:"itemsSearchKey,omitempty"` + // ContentType - The content type of the raw content. Example : text/csv or text/tsv + ContentType *string `json:"contentType,omitempty"` + // UploadStatus - The status of the Watchlist upload : New, InProgress or Complete. Pls note : When a Watchlist upload status is equal to InProgress, the Watchlist cannot be deleted + UploadStatus *string `json:"uploadStatus,omitempty"` +} + +// Webhook detail about the webhook object. +type Webhook struct { + // WebhookID - Unique identifier for the webhook. + WebhookID *string `json:"webhookId,omitempty"` + // WebhookURL - URL that gets invoked by the webhook. + WebhookURL *string `json:"webhookUrl,omitempty"` + // WebhookSecretUpdateTime - Time when the webhook secret was updated. + WebhookSecretUpdateTime *string `json:"webhookSecretUpdateTime,omitempty"` + // RotateWebhookSecret - A flag to instruct the backend service to rotate webhook secret. + RotateWebhookSecret *bool `json:"rotateWebhookSecret,omitempty"` +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/officeconsents.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/officeconsents.go new file mode 100644 index 000000000000..486193663454 --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/officeconsents.go @@ -0,0 +1,341 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OfficeConsentsClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider +type OfficeConsentsClient struct { + BaseClient +} + +// NewOfficeConsentsClient creates an instance of the OfficeConsentsClient client. +func NewOfficeConsentsClient(subscriptionID string) OfficeConsentsClient { + return NewOfficeConsentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOfficeConsentsClientWithBaseURI creates an instance of the OfficeConsentsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOfficeConsentsClientWithBaseURI(baseURI string, subscriptionID string) OfficeConsentsClient { + return OfficeConsentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Delete delete the office365 consent. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// consentID - consent ID +func (client OfficeConsentsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, consentID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OfficeConsentsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.OfficeConsentsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, consentID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.OfficeConsentsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "securityinsight.OfficeConsentsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.OfficeConsentsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client OfficeConsentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, consentID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "consentId": autorest.Encode("path", consentID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/officeConsents/{consentId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client OfficeConsentsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client OfficeConsentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an office365 consent. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// consentID - consent ID +func (client OfficeConsentsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, consentID string) (result OfficeConsent, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OfficeConsentsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.OfficeConsentsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, consentID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.OfficeConsentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.OfficeConsentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.OfficeConsentsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client OfficeConsentsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, consentID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "consentId": autorest.Encode("path", consentID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/officeConsents/{consentId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client OfficeConsentsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client OfficeConsentsClient) GetResponder(resp *http.Response) (result OfficeConsent, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all office365 consents. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +func (client OfficeConsentsClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result OfficeConsentListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OfficeConsentsClient.List") + defer func() { + sc := -1 + if result.ocl.Response.Response != nil { + sc = result.ocl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.OfficeConsentsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.OfficeConsentsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ocl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.OfficeConsentsClient", "List", resp, "Failure sending request") + return + } + + result.ocl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.OfficeConsentsClient", "List", resp, "Failure responding to request") + return + } + if result.ocl.hasNextLink() && result.ocl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OfficeConsentsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/officeConsents", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OfficeConsentsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OfficeConsentsClient) ListResponder(resp *http.Response) (result OfficeConsentList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OfficeConsentsClient) listNextResults(ctx context.Context, lastResults OfficeConsentList) (result OfficeConsentList, err error) { + req, err := lastResults.officeConsentListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "securityinsight.OfficeConsentsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "securityinsight.OfficeConsentsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.OfficeConsentsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OfficeConsentsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result OfficeConsentListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OfficeConsentsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName) + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/operations.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/operations.go new file mode 100644 index 000000000000..492fc04b6f1e --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/operations.go @@ -0,0 +1,140 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all operations available Azure Security Insights Resource Provider. +func (client OperationsClient) List(ctx context.Context) (result OperationsListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.ol.Response.Response != nil { + sc = result.ol.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ol.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.ol, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.ol.hasNextLink() && result.ol.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.SecurityInsights/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationsList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationsList) (result OperationsList, err error) { + req, err := lastResults.operationsListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "securityinsight.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "securityinsight.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result OperationsListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/productsettings.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/productsettings.go new file mode 100644 index 000000000000..2251f0e23fb2 --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/productsettings.go @@ -0,0 +1,392 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ProductSettingsClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider +type ProductSettingsClient struct { + BaseClient +} + +// NewProductSettingsClient creates an instance of the ProductSettingsClient client. +func NewProductSettingsClient(subscriptionID string) ProductSettingsClient { + return NewProductSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProductSettingsClientWithBaseURI creates an instance of the ProductSettingsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewProductSettingsClientWithBaseURI(baseURI string, subscriptionID string) ProductSettingsClient { + return ProductSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Delete delete setting of the product. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// settingsName - the setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba +func (client ProductSettingsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, settingsName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProductSettingsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.ProductSettingsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, settingsName) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ProductSettingsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "securityinsight.ProductSettingsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ProductSettingsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ProductSettingsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, settingsName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "settingsName": autorest.Encode("path", settingsName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings/{settingsName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ProductSettingsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ProductSettingsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a setting. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// settingsName - the setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba +func (client ProductSettingsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, settingsName string) (result SettingsModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProductSettingsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.ProductSettingsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, settingsName) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ProductSettingsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.ProductSettingsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ProductSettingsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ProductSettingsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, settingsName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "settingsName": autorest.Encode("path", settingsName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings/{settingsName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ProductSettingsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ProductSettingsClient) GetResponder(resp *http.Response) (result SettingsModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list of all the settings +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +func (client ProductSettingsClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result SettingList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProductSettingsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.ProductSettingsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ProductSettingsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.ProductSettingsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ProductSettingsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ProductSettingsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ProductSettingsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ProductSettingsClient) ListResponder(resp *http.Response) (result SettingList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates setting. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// settingsName - the setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba +// settings - the setting +func (client ProductSettingsClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, settingsName string, settings BasicSettings) (result SettingsModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProductSettingsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.ProductSettingsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, workspaceName, settingsName, settings) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ProductSettingsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.ProductSettingsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ProductSettingsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ProductSettingsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, settingsName string, settings BasicSettings) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "settingsName": autorest.Encode("path", settingsName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings/{settingsName}", pathParameters), + autorest.WithJSON(settings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ProductSettingsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ProductSettingsClient) UpdateResponder(resp *http.Response) (result SettingsModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/securityinsightapi/interfaces.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/securityinsightapi/interfaces.go new file mode 100644 index 000000000000..18ac41ccf09c --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/securityinsightapi/interfaces.go @@ -0,0 +1,330 @@ +package securityinsightapi + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight" + "github.com/Azure/go-autorest/autorest" +) + +// AlertRulesClientAPI contains the set of methods on the AlertRulesClient type. +type AlertRulesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, ruleID string, alertRule securityinsight.BasicAlertRule) (result securityinsight.AlertRuleModel, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, ruleID string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, ruleID string) (result securityinsight.AlertRuleModel, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string) (result securityinsight.AlertRulesListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result securityinsight.AlertRulesListIterator, err error) +} + +var _ AlertRulesClientAPI = (*securityinsight.AlertRulesClient)(nil) + +// ActionsClientAPI contains the set of methods on the ActionsClient type. +type ActionsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, ruleID string, actionID string, action securityinsight.ActionRequest) (result securityinsight.ActionResponse, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, ruleID string, actionID string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, ruleID string, actionID string) (result securityinsight.ActionResponse, err error) + ListByAlertRule(ctx context.Context, resourceGroupName string, workspaceName string, ruleID string) (result securityinsight.ActionsListPage, err error) + ListByAlertRuleComplete(ctx context.Context, resourceGroupName string, workspaceName string, ruleID string) (result securityinsight.ActionsListIterator, err error) +} + +var _ ActionsClientAPI = (*securityinsight.ActionsClient)(nil) + +// AlertRuleTemplatesClientAPI contains the set of methods on the AlertRuleTemplatesClient type. +type AlertRuleTemplatesClientAPI interface { + Get(ctx context.Context, resourceGroupName string, workspaceName string, alertRuleTemplateID string) (result securityinsight.AlertRuleTemplateModel, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string) (result securityinsight.AlertRuleTemplatesListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result securityinsight.AlertRuleTemplatesListIterator, err error) +} + +var _ AlertRuleTemplatesClientAPI = (*securityinsight.AlertRuleTemplatesClient)(nil) + +// AutomationRulesClientAPI contains the set of methods on the AutomationRulesClient type. +type AutomationRulesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, automationRuleID string, automationRuleToUpsert *securityinsight.AutomationRule) (result securityinsight.AutomationRule, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, automationRuleID string) (result securityinsight.SetObject, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, automationRuleID string) (result securityinsight.AutomationRule, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string) (result securityinsight.AutomationRulesListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result securityinsight.AutomationRulesListIterator, err error) +} + +var _ AutomationRulesClientAPI = (*securityinsight.AutomationRulesClient)(nil) + +// IncidentsClientAPI contains the set of methods on the IncidentsClient type. +type IncidentsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, incident securityinsight.Incident) (result securityinsight.Incident, err error) + CreateTeam(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, teamProperties securityinsight.TeamProperties) (result securityinsight.TeamInformation, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string) (result securityinsight.Incident, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, filter string, orderby string, top *int32, skipToken string) (result securityinsight.IncidentListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, filter string, orderby string, top *int32, skipToken string) (result securityinsight.IncidentListIterator, err error) + ListAlerts(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string) (result securityinsight.IncidentAlertList, err error) + ListBookmarks(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string) (result securityinsight.IncidentBookmarkList, err error) + ListEntities(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string) (result securityinsight.IncidentEntitiesResponse, err error) + RunPlaybook(ctx context.Context, resourceGroupName string, workspaceName string, incidentIdentifier string, requestBody *securityinsight.ManualTriggerRequestBody) (result securityinsight.SetObject, err error) +} + +var _ IncidentsClientAPI = (*securityinsight.IncidentsClient)(nil) + +// BookmarksClientAPI contains the set of methods on the BookmarksClient type. +type BookmarksClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, bookmarkID string, bookmark securityinsight.Bookmark) (result securityinsight.Bookmark, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, bookmarkID string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, bookmarkID string) (result securityinsight.Bookmark, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string) (result securityinsight.BookmarkListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result securityinsight.BookmarkListIterator, err error) +} + +var _ BookmarksClientAPI = (*securityinsight.BookmarksClient)(nil) + +// BookmarkRelationsClientAPI contains the set of methods on the BookmarkRelationsClient type. +type BookmarkRelationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, bookmarkID string, relationName string, relation securityinsight.Relation) (result securityinsight.Relation, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, bookmarkID string, relationName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, bookmarkID string, relationName string) (result securityinsight.Relation, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, bookmarkID string, filter string, orderby string, top *int32, skipToken string) (result securityinsight.RelationListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, bookmarkID string, filter string, orderby string, top *int32, skipToken string) (result securityinsight.RelationListIterator, err error) +} + +var _ BookmarkRelationsClientAPI = (*securityinsight.BookmarkRelationsClient)(nil) + +// BookmarkClientAPI contains the set of methods on the BookmarkClient type. +type BookmarkClientAPI interface { + Expand(ctx context.Context, resourceGroupName string, workspaceName string, bookmarkID string, parameters securityinsight.BookmarkExpandParameters) (result securityinsight.BookmarkExpandResponse, err error) +} + +var _ BookmarkClientAPI = (*securityinsight.BookmarkClient)(nil) + +// IPGeodataClientAPI contains the set of methods on the IPGeodataClient type. +type IPGeodataClientAPI interface { + Get(ctx context.Context, resourceGroupName string, IPAddress string) (result securityinsight.EnrichmentIPGeodata, err error) +} + +var _ IPGeodataClientAPI = (*securityinsight.IPGeodataClient)(nil) + +// DomainWhoisClientAPI contains the set of methods on the DomainWhoisClient type. +type DomainWhoisClientAPI interface { + Get(ctx context.Context, resourceGroupName string, domain string) (result securityinsight.EnrichmentDomainWhois, err error) +} + +var _ DomainWhoisClientAPI = (*securityinsight.DomainWhoisClient)(nil) + +// EntitiesClientAPI contains the set of methods on the EntitiesClient type. +type EntitiesClientAPI interface { + Expand(ctx context.Context, resourceGroupName string, workspaceName string, entityID string, parameters securityinsight.EntityExpandParameters) (result securityinsight.EntityExpandResponse, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, entityID string) (result securityinsight.EntityModel, err error) + GetInsights(ctx context.Context, resourceGroupName string, workspaceName string, entityID string, parameters securityinsight.EntityGetInsightsParameters) (result securityinsight.EntityGetInsightsResponse, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string) (result securityinsight.EntityListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result securityinsight.EntityListIterator, err error) + Queries(ctx context.Context, resourceGroupName string, workspaceName string, entityID string) (result securityinsight.GetQueriesResponse, err error) +} + +var _ EntitiesClientAPI = (*securityinsight.EntitiesClient)(nil) + +// EntitiesGetTimelineClientAPI contains the set of methods on the EntitiesGetTimelineClient type. +type EntitiesGetTimelineClientAPI interface { + List(ctx context.Context, resourceGroupName string, workspaceName string, entityID string, parameters securityinsight.EntityTimelineParameters) (result securityinsight.EntityTimelineResponse, err error) +} + +var _ EntitiesGetTimelineClientAPI = (*securityinsight.EntitiesGetTimelineClient)(nil) + +// EntitiesRelationsClientAPI contains the set of methods on the EntitiesRelationsClient type. +type EntitiesRelationsClientAPI interface { + List(ctx context.Context, resourceGroupName string, workspaceName string, entityID string, filter string, orderby string, top *int32, skipToken string) (result securityinsight.RelationListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, entityID string, filter string, orderby string, top *int32, skipToken string) (result securityinsight.RelationListIterator, err error) +} + +var _ EntitiesRelationsClientAPI = (*securityinsight.EntitiesRelationsClient)(nil) + +// EntityRelationsClientAPI contains the set of methods on the EntityRelationsClient type. +type EntityRelationsClientAPI interface { + GetRelation(ctx context.Context, resourceGroupName string, workspaceName string, entityID string, relationName string) (result securityinsight.Relation, err error) +} + +var _ EntityRelationsClientAPI = (*securityinsight.EntityRelationsClient)(nil) + +// EntityQueriesClientAPI contains the set of methods on the EntityQueriesClient type. +type EntityQueriesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, entityQueryID string, entityQuery securityinsight.BasicCustomEntityQuery) (result securityinsight.EntityQueryModel, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, entityQueryID string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, entityQueryID string) (result securityinsight.EntityQueryModel, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, kind string) (result securityinsight.EntityQueryListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, kind string) (result securityinsight.EntityQueryListIterator, err error) +} + +var _ EntityQueriesClientAPI = (*securityinsight.EntityQueriesClient)(nil) + +// EntityQueryTemplatesClientAPI contains the set of methods on the EntityQueryTemplatesClient type. +type EntityQueryTemplatesClientAPI interface { + Get(ctx context.Context, resourceGroupName string, workspaceName string, entityQueryTemplateID string) (result securityinsight.EntityQueryTemplateModel, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, kind string) (result securityinsight.EntityQueryTemplateListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, kind string) (result securityinsight.EntityQueryTemplateListIterator, err error) +} + +var _ EntityQueryTemplatesClientAPI = (*securityinsight.EntityQueryTemplatesClient)(nil) + +// IncidentCommentsClientAPI contains the set of methods on the IncidentCommentsClient type. +type IncidentCommentsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, incidentCommentID string, incidentComment securityinsight.IncidentComment) (result securityinsight.IncidentComment, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, incidentCommentID string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, incidentCommentID string) (result securityinsight.IncidentComment, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, filter string, orderby string, top *int32, skipToken string) (result securityinsight.IncidentCommentListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, filter string, orderby string, top *int32, skipToken string) (result securityinsight.IncidentCommentListIterator, err error) +} + +var _ IncidentCommentsClientAPI = (*securityinsight.IncidentCommentsClient)(nil) + +// IncidentRelationsClientAPI contains the set of methods on the IncidentRelationsClient type. +type IncidentRelationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, relationName string, relation securityinsight.Relation) (result securityinsight.Relation, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, relationName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, relationName string) (result securityinsight.Relation, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, filter string, orderby string, top *int32, skipToken string) (result securityinsight.RelationListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, filter string, orderby string, top *int32, skipToken string) (result securityinsight.RelationListIterator, err error) +} + +var _ IncidentRelationsClientAPI = (*securityinsight.IncidentRelationsClient)(nil) + +// MetadataClientAPI contains the set of methods on the MetadataClient type. +type MetadataClientAPI interface { + Create(ctx context.Context, resourceGroupName string, workspaceName string, metadataName string, metadata securityinsight.MetadataModel) (result securityinsight.MetadataModel, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, metadataName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, metadataName string) (result securityinsight.MetadataModel, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, filter string, orderby string, top *int32, skip *int32) (result securityinsight.MetadataListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, filter string, orderby string, top *int32, skip *int32) (result securityinsight.MetadataListIterator, err error) + Update(ctx context.Context, resourceGroupName string, workspaceName string, metadataName string, metadataPatch securityinsight.MetadataPatch) (result securityinsight.MetadataModel, err error) +} + +var _ MetadataClientAPI = (*securityinsight.MetadataClient)(nil) + +// OfficeConsentsClientAPI contains the set of methods on the OfficeConsentsClient type. +type OfficeConsentsClientAPI interface { + Delete(ctx context.Context, resourceGroupName string, workspaceName string, consentID string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, consentID string) (result securityinsight.OfficeConsent, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string) (result securityinsight.OfficeConsentListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result securityinsight.OfficeConsentListIterator, err error) +} + +var _ OfficeConsentsClientAPI = (*securityinsight.OfficeConsentsClient)(nil) + +// SentinelOnboardingStatesClientAPI contains the set of methods on the SentinelOnboardingStatesClient type. +type SentinelOnboardingStatesClientAPI interface { + Create(ctx context.Context, resourceGroupName string, workspaceName string, sentinelOnboardingStateName string, sentinelOnboardingStateParameter *securityinsight.SentinelOnboardingState) (result securityinsight.SentinelOnboardingState, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, sentinelOnboardingStateName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, sentinelOnboardingStateName string) (result securityinsight.SentinelOnboardingState, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string) (result securityinsight.SentinelOnboardingStatesList, err error) +} + +var _ SentinelOnboardingStatesClientAPI = (*securityinsight.SentinelOnboardingStatesClient)(nil) + +// ProductSettingsClientAPI contains the set of methods on the ProductSettingsClient type. +type ProductSettingsClientAPI interface { + Delete(ctx context.Context, resourceGroupName string, workspaceName string, settingsName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, settingsName string) (result securityinsight.SettingsModel, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string) (result securityinsight.SettingList, err error) + Update(ctx context.Context, resourceGroupName string, workspaceName string, settingsName string, settings securityinsight.BasicSettings) (result securityinsight.SettingsModel, err error) +} + +var _ ProductSettingsClientAPI = (*securityinsight.ProductSettingsClient)(nil) + +// SourceControlClientAPI contains the set of methods on the SourceControlClient type. +type SourceControlClientAPI interface { + ListRepositories(ctx context.Context, resourceGroupName string, workspaceName string, repoType securityinsight.RepoType) (result securityinsight.RepoListPage, err error) + ListRepositoriesComplete(ctx context.Context, resourceGroupName string, workspaceName string, repoType securityinsight.RepoType) (result securityinsight.RepoListIterator, err error) +} + +var _ SourceControlClientAPI = (*securityinsight.SourceControlClient)(nil) + +// SourceControlsClientAPI contains the set of methods on the SourceControlsClient type. +type SourceControlsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, workspaceName string, sourceControlID string, sourceControl securityinsight.SourceControl) (result securityinsight.SourceControl, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, sourceControlID string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, sourceControlID string) (result securityinsight.SourceControl, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string) (result securityinsight.SourceControlListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result securityinsight.SourceControlListIterator, err error) +} + +var _ SourceControlsClientAPI = (*securityinsight.SourceControlsClient)(nil) + +// ThreatIntelligenceIndicatorClientAPI contains the set of methods on the ThreatIntelligenceIndicatorClient type. +type ThreatIntelligenceIndicatorClientAPI interface { + AppendTags(ctx context.Context, resourceGroupName string, workspaceName string, name string, threatIntelligenceAppendTags securityinsight.ThreatIntelligenceAppendTags) (result autorest.Response, err error) + Create(ctx context.Context, resourceGroupName string, workspaceName string, name string, threatIntelligenceProperties securityinsight.ThreatIntelligenceIndicatorModel) (result securityinsight.ThreatIntelligenceInformationModel, err error) + CreateIndicator(ctx context.Context, resourceGroupName string, workspaceName string, threatIntelligenceProperties securityinsight.ThreatIntelligenceIndicatorModel) (result securityinsight.ThreatIntelligenceInformationModel, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result securityinsight.ThreatIntelligenceInformationModel, err error) + QueryIndicators(ctx context.Context, resourceGroupName string, workspaceName string, threatIntelligenceFilteringCriteria securityinsight.ThreatIntelligenceFilteringCriteria) (result securityinsight.ThreatIntelligenceInformationListPage, err error) + QueryIndicatorsComplete(ctx context.Context, resourceGroupName string, workspaceName string, threatIntelligenceFilteringCriteria securityinsight.ThreatIntelligenceFilteringCriteria) (result securityinsight.ThreatIntelligenceInformationListIterator, err error) + ReplaceTags(ctx context.Context, resourceGroupName string, workspaceName string, name string, threatIntelligenceReplaceTags securityinsight.ThreatIntelligenceIndicatorModel) (result securityinsight.ThreatIntelligenceInformationModel, err error) +} + +var _ ThreatIntelligenceIndicatorClientAPI = (*securityinsight.ThreatIntelligenceIndicatorClient)(nil) + +// ThreatIntelligenceIndicatorsClientAPI contains the set of methods on the ThreatIntelligenceIndicatorsClient type. +type ThreatIntelligenceIndicatorsClientAPI interface { + List(ctx context.Context, resourceGroupName string, workspaceName string, filter string, orderby string, top *int32, skipToken string) (result securityinsight.ThreatIntelligenceInformationListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, filter string, orderby string, top *int32, skipToken string) (result securityinsight.ThreatIntelligenceInformationListIterator, err error) +} + +var _ ThreatIntelligenceIndicatorsClientAPI = (*securityinsight.ThreatIntelligenceIndicatorsClient)(nil) + +// ThreatIntelligenceIndicatorMetricsClientAPI contains the set of methods on the ThreatIntelligenceIndicatorMetricsClient type. +type ThreatIntelligenceIndicatorMetricsClientAPI interface { + List(ctx context.Context, resourceGroupName string, workspaceName string) (result securityinsight.ThreatIntelligenceMetricsList, err error) +} + +var _ ThreatIntelligenceIndicatorMetricsClientAPI = (*securityinsight.ThreatIntelligenceIndicatorMetricsClient)(nil) + +// WatchlistsClientAPI contains the set of methods on the WatchlistsClient type. +type WatchlistsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, watchlistAlias string, watchlist securityinsight.Watchlist) (result securityinsight.Watchlist, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, watchlistAlias string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, watchlistAlias string) (result securityinsight.Watchlist, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, skipToken string) (result securityinsight.WatchlistListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, skipToken string) (result securityinsight.WatchlistListIterator, err error) +} + +var _ WatchlistsClientAPI = (*securityinsight.WatchlistsClient)(nil) + +// WatchlistItemsClientAPI contains the set of methods on the WatchlistItemsClient type. +type WatchlistItemsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, watchlistAlias string, watchlistItemID string, watchlistItem securityinsight.WatchlistItem) (result securityinsight.WatchlistItem, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, watchlistAlias string, watchlistItemID string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, watchlistAlias string, watchlistItemID string) (result securityinsight.WatchlistItem, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, watchlistAlias string, skipToken string) (result securityinsight.WatchlistItemListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, watchlistAlias string, skipToken string) (result securityinsight.WatchlistItemListIterator, err error) +} + +var _ WatchlistItemsClientAPI = (*securityinsight.WatchlistItemsClient)(nil) + +// DataConnectorsClientAPI contains the set of methods on the DataConnectorsClient type. +type DataConnectorsClientAPI interface { + Connect(ctx context.Context, resourceGroupName string, workspaceName string, dataConnectorID string, connectBody securityinsight.DataConnectorConnectBody) (result autorest.Response, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, dataConnectorID string, dataConnector securityinsight.BasicDataConnector) (result securityinsight.DataConnectorModel, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, dataConnectorID string) (result autorest.Response, err error) + Disconnect(ctx context.Context, resourceGroupName string, workspaceName string, dataConnectorID string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, dataConnectorID string) (result securityinsight.DataConnectorModel, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string) (result securityinsight.DataConnectorListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result securityinsight.DataConnectorListIterator, err error) +} + +var _ DataConnectorsClientAPI = (*securityinsight.DataConnectorsClient)(nil) + +// DataConnectorsCheckRequirementsClientAPI contains the set of methods on the DataConnectorsCheckRequirementsClient type. +type DataConnectorsCheckRequirementsClientAPI interface { + Post(ctx context.Context, resourceGroupName string, workspaceName string, dataConnectorsCheckRequirements securityinsight.BasicDataConnectorsCheckRequirements) (result securityinsight.DataConnectorRequirementsState, err error) +} + +var _ DataConnectorsCheckRequirementsClientAPI = (*securityinsight.DataConnectorsCheckRequirementsClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result securityinsight.OperationsListPage, err error) + ListComplete(ctx context.Context) (result securityinsight.OperationsListIterator, err error) +} + +var _ OperationsClientAPI = (*securityinsight.OperationsClient)(nil) diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/sentinelonboardingstates.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/sentinelonboardingstates.go new file mode 100644 index 000000000000..db2d16f8a7cd --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/sentinelonboardingstates.go @@ -0,0 +1,397 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SentinelOnboardingStatesClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) resource +// provider +type SentinelOnboardingStatesClient struct { + BaseClient +} + +// NewSentinelOnboardingStatesClient creates an instance of the SentinelOnboardingStatesClient client. +func NewSentinelOnboardingStatesClient(subscriptionID string) SentinelOnboardingStatesClient { + return NewSentinelOnboardingStatesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSentinelOnboardingStatesClientWithBaseURI creates an instance of the SentinelOnboardingStatesClient client using +// a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewSentinelOnboardingStatesClientWithBaseURI(baseURI string, subscriptionID string) SentinelOnboardingStatesClient { + return SentinelOnboardingStatesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create Sentinel onboarding state +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// sentinelOnboardingStateName - the Sentinel onboarding state name. Supports - default +// sentinelOnboardingStateParameter - the Sentinel onboarding state parameter +func (client SentinelOnboardingStatesClient) Create(ctx context.Context, resourceGroupName string, workspaceName string, sentinelOnboardingStateName string, sentinelOnboardingStateParameter *SentinelOnboardingState) (result SentinelOnboardingState, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SentinelOnboardingStatesClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.SentinelOnboardingStatesClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, workspaceName, sentinelOnboardingStateName, sentinelOnboardingStateParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.SentinelOnboardingStatesClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.SentinelOnboardingStatesClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.SentinelOnboardingStatesClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client SentinelOnboardingStatesClient) CreatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, sentinelOnboardingStateName string, sentinelOnboardingStateParameter *SentinelOnboardingState) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sentinelOnboardingStateName": autorest.Encode("path", sentinelOnboardingStateName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates/{sentinelOnboardingStateName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if sentinelOnboardingStateParameter != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(sentinelOnboardingStateParameter)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client SentinelOnboardingStatesClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client SentinelOnboardingStatesClient) CreateResponder(resp *http.Response) (result SentinelOnboardingState, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete Sentinel onboarding state +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// sentinelOnboardingStateName - the Sentinel onboarding state name. Supports - default +func (client SentinelOnboardingStatesClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, sentinelOnboardingStateName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SentinelOnboardingStatesClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.SentinelOnboardingStatesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, sentinelOnboardingStateName) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.SentinelOnboardingStatesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "securityinsight.SentinelOnboardingStatesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.SentinelOnboardingStatesClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SentinelOnboardingStatesClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, sentinelOnboardingStateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sentinelOnboardingStateName": autorest.Encode("path", sentinelOnboardingStateName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates/{sentinelOnboardingStateName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SentinelOnboardingStatesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SentinelOnboardingStatesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get Sentinel onboarding state +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// sentinelOnboardingStateName - the Sentinel onboarding state name. Supports - default +func (client SentinelOnboardingStatesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, sentinelOnboardingStateName string) (result SentinelOnboardingState, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SentinelOnboardingStatesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.SentinelOnboardingStatesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, sentinelOnboardingStateName) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.SentinelOnboardingStatesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.SentinelOnboardingStatesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.SentinelOnboardingStatesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SentinelOnboardingStatesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, sentinelOnboardingStateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sentinelOnboardingStateName": autorest.Encode("path", sentinelOnboardingStateName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates/{sentinelOnboardingStateName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SentinelOnboardingStatesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SentinelOnboardingStatesClient) GetResponder(resp *http.Response) (result SentinelOnboardingState, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all Sentinel onboarding states +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +func (client SentinelOnboardingStatesClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result SentinelOnboardingStatesList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SentinelOnboardingStatesClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.SentinelOnboardingStatesClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.SentinelOnboardingStatesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.SentinelOnboardingStatesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.SentinelOnboardingStatesClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SentinelOnboardingStatesClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SentinelOnboardingStatesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SentinelOnboardingStatesClient) ListResponder(resp *http.Response) (result SentinelOnboardingStatesList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/sourcecontrol.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/sourcecontrol.go new file mode 100644 index 000000000000..bc663d4a6947 --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/sourcecontrol.go @@ -0,0 +1,165 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SourceControlClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider +type SourceControlClient struct { + BaseClient +} + +// NewSourceControlClient creates an instance of the SourceControlClient client. +func NewSourceControlClient(subscriptionID string) SourceControlClient { + return NewSourceControlClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSourceControlClientWithBaseURI creates an instance of the SourceControlClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewSourceControlClientWithBaseURI(baseURI string, subscriptionID string) SourceControlClient { + return SourceControlClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListRepositories gets a list of repositories metadata. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// repoType - the repo type. +func (client SourceControlClient) ListRepositories(ctx context.Context, resourceGroupName string, workspaceName string, repoType RepoType) (result RepoListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlClient.ListRepositories") + defer func() { + sc := -1 + if result.rl.Response.Response != nil { + sc = result.rl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.SourceControlClient", "ListRepositories", err.Error()) + } + + result.fn = client.listRepositoriesNextResults + req, err := client.ListRepositoriesPreparer(ctx, resourceGroupName, workspaceName, repoType) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.SourceControlClient", "ListRepositories", nil, "Failure preparing request") + return + } + + resp, err := client.ListRepositoriesSender(req) + if err != nil { + result.rl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.SourceControlClient", "ListRepositories", resp, "Failure sending request") + return + } + + result.rl, err = client.ListRepositoriesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.SourceControlClient", "ListRepositories", resp, "Failure responding to request") + return + } + if result.rl.hasNextLink() && result.rl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListRepositoriesPreparer prepares the ListRepositories request. +func (client SourceControlClient) ListRepositoriesPreparer(ctx context.Context, resourceGroupName string, workspaceName string, repoType RepoType) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/listRepositories", pathParameters), + autorest.WithJSON(repoType), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListRepositoriesSender sends the ListRepositories request. The method will close the +// http.Response Body if it receives an error. +func (client SourceControlClient) ListRepositoriesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListRepositoriesResponder handles the response to the ListRepositories request. The method always +// closes the http.Response Body. +func (client SourceControlClient) ListRepositoriesResponder(resp *http.Response) (result RepoList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listRepositoriesNextResults retrieves the next set of results, if any. +func (client SourceControlClient) listRepositoriesNextResults(ctx context.Context, lastResults RepoList) (result RepoList, err error) { + req, err := lastResults.repoListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "securityinsight.SourceControlClient", "listRepositoriesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListRepositoriesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "securityinsight.SourceControlClient", "listRepositoriesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListRepositoriesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.SourceControlClient", "listRepositoriesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListRepositoriesComplete enumerates all values, automatically crossing page boundaries as required. +func (client SourceControlClient) ListRepositoriesComplete(ctx context.Context, resourceGroupName string, workspaceName string, repoType RepoType) (result RepoListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlClient.ListRepositories") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListRepositories(ctx, resourceGroupName, workspaceName, repoType) + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/sourcecontrols.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/sourcecontrols.go new file mode 100644 index 000000000000..81e0343cb2d3 --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/sourcecontrols.go @@ -0,0 +1,440 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SourceControlsClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider +type SourceControlsClient struct { + BaseClient +} + +// NewSourceControlsClient creates an instance of the SourceControlsClient client. +func NewSourceControlsClient(subscriptionID string) SourceControlsClient { + return NewSourceControlsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSourceControlsClientWithBaseURI creates an instance of the SourceControlsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewSourceControlsClientWithBaseURI(baseURI string, subscriptionID string) SourceControlsClient { + return SourceControlsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a source control. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// sourceControlID - source control Id +// sourceControl - the SourceControl +func (client SourceControlsClient) Create(ctx context.Context, resourceGroupName string, workspaceName string, sourceControlID string, sourceControl SourceControl) (result SourceControl, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlsClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: sourceControl, + Constraints: []validation.Constraint{{Target: "sourceControl.SourceControlProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "sourceControl.SourceControlProperties.DisplayName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "sourceControl.SourceControlProperties.ContentTypes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "sourceControl.SourceControlProperties.Repository", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("securityinsight.SourceControlsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, workspaceName, sourceControlID, sourceControl) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.SourceControlsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.SourceControlsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.SourceControlsClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client SourceControlsClient) CreatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, sourceControlID string, sourceControl SourceControl) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlId": autorest.Encode("path", sourceControlID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}", pathParameters), + autorest.WithJSON(sourceControl), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client SourceControlsClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client SourceControlsClient) CreateResponder(resp *http.Response) (result SourceControl, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a source control. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// sourceControlID - source control Id +func (client SourceControlsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, sourceControlID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.SourceControlsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, sourceControlID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.SourceControlsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "securityinsight.SourceControlsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.SourceControlsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SourceControlsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, sourceControlID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlId": autorest.Encode("path", sourceControlID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SourceControlsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SourceControlsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a source control byt its identifier. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// sourceControlID - source control Id +func (client SourceControlsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, sourceControlID string) (result SourceControl, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.SourceControlsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, sourceControlID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.SourceControlsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.SourceControlsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.SourceControlsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SourceControlsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, sourceControlID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlId": autorest.Encode("path", sourceControlID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SourceControlsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SourceControlsClient) GetResponder(resp *http.Response) (result SourceControl, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all source controls, without source control items. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +func (client SourceControlsClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result SourceControlListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlsClient.List") + defer func() { + sc := -1 + if result.scl.Response.Response != nil { + sc = result.scl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.SourceControlsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.SourceControlsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.scl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.SourceControlsClient", "List", resp, "Failure sending request") + return + } + + result.scl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.SourceControlsClient", "List", resp, "Failure responding to request") + return + } + if result.scl.hasNextLink() && result.scl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SourceControlsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SourceControlsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SourceControlsClient) ListResponder(resp *http.Response) (result SourceControlList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SourceControlsClient) listNextResults(ctx context.Context, lastResults SourceControlList) (result SourceControlList, err error) { + req, err := lastResults.sourceControlListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "securityinsight.SourceControlsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "securityinsight.SourceControlsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.SourceControlsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SourceControlsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result SourceControlListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName) + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/threatintelligenceindicator.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/threatintelligenceindicator.go new file mode 100644 index 000000000000..c79627c189f7 --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/threatintelligenceindicator.go @@ -0,0 +1,715 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ThreatIntelligenceIndicatorClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) resource +// provider +type ThreatIntelligenceIndicatorClient struct { + BaseClient +} + +// NewThreatIntelligenceIndicatorClient creates an instance of the ThreatIntelligenceIndicatorClient client. +func NewThreatIntelligenceIndicatorClient(subscriptionID string) ThreatIntelligenceIndicatorClient { + return NewThreatIntelligenceIndicatorClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewThreatIntelligenceIndicatorClientWithBaseURI creates an instance of the ThreatIntelligenceIndicatorClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewThreatIntelligenceIndicatorClientWithBaseURI(baseURI string, subscriptionID string) ThreatIntelligenceIndicatorClient { + return ThreatIntelligenceIndicatorClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// AppendTags append tags to a threat intelligence indicator. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// name - threat intelligence indicator name field. +// threatIntelligenceAppendTags - the threat intelligence append tags request body +func (client ThreatIntelligenceIndicatorClient) AppendTags(ctx context.Context, resourceGroupName string, workspaceName string, name string, threatIntelligenceAppendTags ThreatIntelligenceAppendTags) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ThreatIntelligenceIndicatorClient.AppendTags") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.ThreatIntelligenceIndicatorClient", "AppendTags", err.Error()) + } + + req, err := client.AppendTagsPreparer(ctx, resourceGroupName, workspaceName, name, threatIntelligenceAppendTags) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorClient", "AppendTags", nil, "Failure preparing request") + return + } + + resp, err := client.AppendTagsSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorClient", "AppendTags", resp, "Failure sending request") + return + } + + result, err = client.AppendTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorClient", "AppendTags", resp, "Failure responding to request") + return + } + + return +} + +// AppendTagsPreparer prepares the AppendTags request. +func (client ThreatIntelligenceIndicatorClient) AppendTagsPreparer(ctx context.Context, resourceGroupName string, workspaceName string, name string, threatIntelligenceAppendTags ThreatIntelligenceAppendTags) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}/appendTags", pathParameters), + autorest.WithJSON(threatIntelligenceAppendTags), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AppendTagsSender sends the AppendTags request. The method will close the +// http.Response Body if it receives an error. +func (client ThreatIntelligenceIndicatorClient) AppendTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// AppendTagsResponder handles the response to the AppendTags request. The method always +// closes the http.Response Body. +func (client ThreatIntelligenceIndicatorClient) AppendTagsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Create update a threat Intelligence indicator. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// name - threat intelligence indicator name field. +// threatIntelligenceProperties - properties of threat intelligence indicators to create and update. +func (client ThreatIntelligenceIndicatorClient) Create(ctx context.Context, resourceGroupName string, workspaceName string, name string, threatIntelligenceProperties ThreatIntelligenceIndicatorModel) (result ThreatIntelligenceInformationModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ThreatIntelligenceIndicatorClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.ThreatIntelligenceIndicatorClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, workspaceName, name, threatIntelligenceProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ThreatIntelligenceIndicatorClient) CreatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, name string, threatIntelligenceProperties ThreatIntelligenceIndicatorModel) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}", pathParameters), + autorest.WithJSON(threatIntelligenceProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ThreatIntelligenceIndicatorClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ThreatIntelligenceIndicatorClient) CreateResponder(resp *http.Response) (result ThreatIntelligenceInformationModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateIndicator create a new threat intelligence indicator. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// threatIntelligenceProperties - properties of threat intelligence indicators to create and update. +func (client ThreatIntelligenceIndicatorClient) CreateIndicator(ctx context.Context, resourceGroupName string, workspaceName string, threatIntelligenceProperties ThreatIntelligenceIndicatorModel) (result ThreatIntelligenceInformationModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ThreatIntelligenceIndicatorClient.CreateIndicator") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.ThreatIntelligenceIndicatorClient", "CreateIndicator", err.Error()) + } + + req, err := client.CreateIndicatorPreparer(ctx, resourceGroupName, workspaceName, threatIntelligenceProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorClient", "CreateIndicator", nil, "Failure preparing request") + return + } + + resp, err := client.CreateIndicatorSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorClient", "CreateIndicator", resp, "Failure sending request") + return + } + + result, err = client.CreateIndicatorResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorClient", "CreateIndicator", resp, "Failure responding to request") + return + } + + return +} + +// CreateIndicatorPreparer prepares the CreateIndicator request. +func (client ThreatIntelligenceIndicatorClient) CreateIndicatorPreparer(ctx context.Context, resourceGroupName string, workspaceName string, threatIntelligenceProperties ThreatIntelligenceIndicatorModel) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/createIndicator", pathParameters), + autorest.WithJSON(threatIntelligenceProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateIndicatorSender sends the CreateIndicator request. The method will close the +// http.Response Body if it receives an error. +func (client ThreatIntelligenceIndicatorClient) CreateIndicatorSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateIndicatorResponder handles the response to the CreateIndicator request. The method always +// closes the http.Response Body. +func (client ThreatIntelligenceIndicatorClient) CreateIndicatorResponder(resp *http.Response) (result ThreatIntelligenceInformationModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a threat intelligence indicator. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// name - threat intelligence indicator name field. +func (client ThreatIntelligenceIndicatorClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ThreatIntelligenceIndicatorClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.ThreatIntelligenceIndicatorClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ThreatIntelligenceIndicatorClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ThreatIntelligenceIndicatorClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ThreatIntelligenceIndicatorClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get view a threat intelligence indicator by name. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// name - threat intelligence indicator name field. +func (client ThreatIntelligenceIndicatorClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result ThreatIntelligenceInformationModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ThreatIntelligenceIndicatorClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.ThreatIntelligenceIndicatorClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ThreatIntelligenceIndicatorClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ThreatIntelligenceIndicatorClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ThreatIntelligenceIndicatorClient) GetResponder(resp *http.Response) (result ThreatIntelligenceInformationModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// QueryIndicators query threat intelligence indicators as per filtering criteria. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// threatIntelligenceFilteringCriteria - filtering criteria for querying threat intelligence indicators. +func (client ThreatIntelligenceIndicatorClient) QueryIndicators(ctx context.Context, resourceGroupName string, workspaceName string, threatIntelligenceFilteringCriteria ThreatIntelligenceFilteringCriteria) (result ThreatIntelligenceInformationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ThreatIntelligenceIndicatorClient.QueryIndicators") + defer func() { + sc := -1 + if result.tiil.Response.Response != nil { + sc = result.tiil.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.ThreatIntelligenceIndicatorClient", "QueryIndicators", err.Error()) + } + + result.fn = client.queryIndicatorsNextResults + req, err := client.QueryIndicatorsPreparer(ctx, resourceGroupName, workspaceName, threatIntelligenceFilteringCriteria) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorClient", "QueryIndicators", nil, "Failure preparing request") + return + } + + resp, err := client.QueryIndicatorsSender(req) + if err != nil { + result.tiil.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorClient", "QueryIndicators", resp, "Failure sending request") + return + } + + result.tiil, err = client.QueryIndicatorsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorClient", "QueryIndicators", resp, "Failure responding to request") + return + } + if result.tiil.hasNextLink() && result.tiil.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// QueryIndicatorsPreparer prepares the QueryIndicators request. +func (client ThreatIntelligenceIndicatorClient) QueryIndicatorsPreparer(ctx context.Context, resourceGroupName string, workspaceName string, threatIntelligenceFilteringCriteria ThreatIntelligenceFilteringCriteria) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/queryIndicators", pathParameters), + autorest.WithJSON(threatIntelligenceFilteringCriteria), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// QueryIndicatorsSender sends the QueryIndicators request. The method will close the +// http.Response Body if it receives an error. +func (client ThreatIntelligenceIndicatorClient) QueryIndicatorsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// QueryIndicatorsResponder handles the response to the QueryIndicators request. The method always +// closes the http.Response Body. +func (client ThreatIntelligenceIndicatorClient) QueryIndicatorsResponder(resp *http.Response) (result ThreatIntelligenceInformationList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// queryIndicatorsNextResults retrieves the next set of results, if any. +func (client ThreatIntelligenceIndicatorClient) queryIndicatorsNextResults(ctx context.Context, lastResults ThreatIntelligenceInformationList) (result ThreatIntelligenceInformationList, err error) { + req, err := lastResults.threatIntelligenceInformationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorClient", "queryIndicatorsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.QueryIndicatorsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorClient", "queryIndicatorsNextResults", resp, "Failure sending next results request") + } + result, err = client.QueryIndicatorsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorClient", "queryIndicatorsNextResults", resp, "Failure responding to next results request") + } + return +} + +// QueryIndicatorsComplete enumerates all values, automatically crossing page boundaries as required. +func (client ThreatIntelligenceIndicatorClient) QueryIndicatorsComplete(ctx context.Context, resourceGroupName string, workspaceName string, threatIntelligenceFilteringCriteria ThreatIntelligenceFilteringCriteria) (result ThreatIntelligenceInformationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ThreatIntelligenceIndicatorClient.QueryIndicators") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.QueryIndicators(ctx, resourceGroupName, workspaceName, threatIntelligenceFilteringCriteria) + return +} + +// ReplaceTags replace tags added to a threat intelligence indicator. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// name - threat intelligence indicator name field. +// threatIntelligenceReplaceTags - tags in the threat intelligence indicator to be replaced. +func (client ThreatIntelligenceIndicatorClient) ReplaceTags(ctx context.Context, resourceGroupName string, workspaceName string, name string, threatIntelligenceReplaceTags ThreatIntelligenceIndicatorModel) (result ThreatIntelligenceInformationModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ThreatIntelligenceIndicatorClient.ReplaceTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.ThreatIntelligenceIndicatorClient", "ReplaceTags", err.Error()) + } + + req, err := client.ReplaceTagsPreparer(ctx, resourceGroupName, workspaceName, name, threatIntelligenceReplaceTags) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorClient", "ReplaceTags", nil, "Failure preparing request") + return + } + + resp, err := client.ReplaceTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorClient", "ReplaceTags", resp, "Failure sending request") + return + } + + result, err = client.ReplaceTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorClient", "ReplaceTags", resp, "Failure responding to request") + return + } + + return +} + +// ReplaceTagsPreparer prepares the ReplaceTags request. +func (client ThreatIntelligenceIndicatorClient) ReplaceTagsPreparer(ctx context.Context, resourceGroupName string, workspaceName string, name string, threatIntelligenceReplaceTags ThreatIntelligenceIndicatorModel) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}/replaceTags", pathParameters), + autorest.WithJSON(threatIntelligenceReplaceTags), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ReplaceTagsSender sends the ReplaceTags request. The method will close the +// http.Response Body if it receives an error. +func (client ThreatIntelligenceIndicatorClient) ReplaceTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ReplaceTagsResponder handles the response to the ReplaceTags request. The method always +// closes the http.Response Body. +func (client ThreatIntelligenceIndicatorClient) ReplaceTagsResponder(resp *http.Response) (result ThreatIntelligenceInformationModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/threatintelligenceindicatormetrics.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/threatintelligenceindicatormetrics.go new file mode 100644 index 000000000000..a8ffc4382839 --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/threatintelligenceindicatormetrics.go @@ -0,0 +1,123 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ThreatIntelligenceIndicatorMetricsClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) +// resource provider +type ThreatIntelligenceIndicatorMetricsClient struct { + BaseClient +} + +// NewThreatIntelligenceIndicatorMetricsClient creates an instance of the ThreatIntelligenceIndicatorMetricsClient +// client. +func NewThreatIntelligenceIndicatorMetricsClient(subscriptionID string) ThreatIntelligenceIndicatorMetricsClient { + return NewThreatIntelligenceIndicatorMetricsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewThreatIntelligenceIndicatorMetricsClientWithBaseURI creates an instance of the +// ThreatIntelligenceIndicatorMetricsClient client using a custom endpoint. Use this when interacting with an Azure +// cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewThreatIntelligenceIndicatorMetricsClientWithBaseURI(baseURI string, subscriptionID string) ThreatIntelligenceIndicatorMetricsClient { + return ThreatIntelligenceIndicatorMetricsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List get threat intelligence indicators metrics (Indicators counts by Type, Threat Type, Source). +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +func (client ThreatIntelligenceIndicatorMetricsClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result ThreatIntelligenceMetricsList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ThreatIntelligenceIndicatorMetricsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.ThreatIntelligenceIndicatorMetricsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorMetricsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorMetricsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorMetricsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ThreatIntelligenceIndicatorMetricsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/metrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ThreatIntelligenceIndicatorMetricsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ThreatIntelligenceIndicatorMetricsClient) ListResponder(resp *http.Response) (result ThreatIntelligenceMetricsList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/threatintelligenceindicators.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/threatintelligenceindicators.go new file mode 100644 index 000000000000..df1bf6401f05 --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/threatintelligenceindicators.go @@ -0,0 +1,182 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ThreatIntelligenceIndicatorsClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) resource +// provider +type ThreatIntelligenceIndicatorsClient struct { + BaseClient +} + +// NewThreatIntelligenceIndicatorsClient creates an instance of the ThreatIntelligenceIndicatorsClient client. +func NewThreatIntelligenceIndicatorsClient(subscriptionID string) ThreatIntelligenceIndicatorsClient { + return NewThreatIntelligenceIndicatorsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewThreatIntelligenceIndicatorsClientWithBaseURI creates an instance of the ThreatIntelligenceIndicatorsClient +// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI +// (sovereign clouds, Azure stack). +func NewThreatIntelligenceIndicatorsClientWithBaseURI(baseURI string, subscriptionID string) ThreatIntelligenceIndicatorsClient { + return ThreatIntelligenceIndicatorsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List get all threat intelligence indicators. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// filter - filters the results, based on a Boolean condition. Optional. +// orderby - sorts the results. Optional. +// top - returns only the first n results. Optional. +// skipToken - skiptoken is only used if a previous operation returned a partial result. If a previous response +// contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that +// specifies a starting point to use for subsequent calls. Optional. +func (client ThreatIntelligenceIndicatorsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, filter string, orderby string, top *int32, skipToken string) (result ThreatIntelligenceInformationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ThreatIntelligenceIndicatorsClient.List") + defer func() { + sc := -1 + if result.tiil.Response.Response != nil { + sc = result.tiil.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.ThreatIntelligenceIndicatorsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, filter, orderby, top, skipToken) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.tiil.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorsClient", "List", resp, "Failure sending request") + return + } + + result.tiil, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorsClient", "List", resp, "Failure responding to request") + return + } + if result.tiil.hasNextLink() && result.tiil.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ThreatIntelligenceIndicatorsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, filter string, orderby string, top *int32, skipToken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(skipToken) > 0 { + queryParameters["$skipToken"] = autorest.Encode("query", skipToken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ThreatIntelligenceIndicatorsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ThreatIntelligenceIndicatorsClient) ListResponder(resp *http.Response) (result ThreatIntelligenceInformationList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ThreatIntelligenceIndicatorsClient) listNextResults(ctx context.Context, lastResults ThreatIntelligenceInformationList) (result ThreatIntelligenceInformationList, err error) { + req, err := lastResults.threatIntelligenceInformationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.ThreatIntelligenceIndicatorsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ThreatIntelligenceIndicatorsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, filter string, orderby string, top *int32, skipToken string) (result ThreatIntelligenceInformationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ThreatIntelligenceIndicatorsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName, filter, orderby, top, skipToken) + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/version.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/version.go new file mode 100644 index 000000000000..9646c6860570 --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/version.go @@ -0,0 +1,19 @@ +package securityinsight + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights 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. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " securityinsight/2022-01-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/watchlistitems.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/watchlistitems.go new file mode 100644 index 000000000000..6c49affe27b9 --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/watchlistitems.go @@ -0,0 +1,451 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// WatchlistItemsClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider +type WatchlistItemsClient struct { + BaseClient +} + +// NewWatchlistItemsClient creates an instance of the WatchlistItemsClient client. +func NewWatchlistItemsClient(subscriptionID string) WatchlistItemsClient { + return NewWatchlistItemsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWatchlistItemsClientWithBaseURI creates an instance of the WatchlistItemsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWatchlistItemsClientWithBaseURI(baseURI string, subscriptionID string) WatchlistItemsClient { + return WatchlistItemsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a watchlist item. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// watchlistAlias - watchlist Alias +// watchlistItemID - watchlist Item Id (GUID) +// watchlistItem - the watchlist item +func (client WatchlistItemsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, watchlistAlias string, watchlistItemID string, watchlistItem WatchlistItem) (result WatchlistItem, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchlistItemsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: watchlistItem, + Constraints: []validation.Constraint{{Target: "watchlistItem.WatchlistItemProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "watchlistItem.WatchlistItemProperties.ItemsKeyValue", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("securityinsight.WatchlistItemsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, watchlistAlias, watchlistItemID, watchlistItem) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.WatchlistItemsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.WatchlistItemsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.WatchlistItemsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client WatchlistItemsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, watchlistAlias string, watchlistItemID string, watchlistItem WatchlistItem) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "watchlistAlias": autorest.Encode("path", watchlistAlias), + "watchlistItemId": autorest.Encode("path", watchlistItemID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems/{watchlistItemId}", pathParameters), + autorest.WithJSON(watchlistItem), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client WatchlistItemsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client WatchlistItemsClient) CreateOrUpdateResponder(resp *http.Response) (result WatchlistItem, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a watchlist item. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// watchlistAlias - watchlist Alias +// watchlistItemID - watchlist Item Id (GUID) +func (client WatchlistItemsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, watchlistAlias string, watchlistItemID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchlistItemsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.WatchlistItemsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, watchlistAlias, watchlistItemID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.WatchlistItemsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "securityinsight.WatchlistItemsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.WatchlistItemsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client WatchlistItemsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, watchlistAlias string, watchlistItemID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "watchlistAlias": autorest.Encode("path", watchlistAlias), + "watchlistItemId": autorest.Encode("path", watchlistItemID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems/{watchlistItemId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client WatchlistItemsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client WatchlistItemsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a watchlist, without its watchlist items. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// watchlistAlias - watchlist Alias +// watchlistItemID - watchlist Item Id (GUID) +func (client WatchlistItemsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, watchlistAlias string, watchlistItemID string) (result WatchlistItem, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchlistItemsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.WatchlistItemsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, watchlistAlias, watchlistItemID) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.WatchlistItemsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.WatchlistItemsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.WatchlistItemsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client WatchlistItemsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, watchlistAlias string, watchlistItemID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "watchlistAlias": autorest.Encode("path", watchlistAlias), + "watchlistItemId": autorest.Encode("path", watchlistItemID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems/{watchlistItemId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client WatchlistItemsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client WatchlistItemsClient) GetResponder(resp *http.Response) (result WatchlistItem, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all watchlist Items. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// watchlistAlias - watchlist Alias +// skipToken - skiptoken is only used if a previous operation returned a partial result. If a previous response +// contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that +// specifies a starting point to use for subsequent calls. Optional. +func (client WatchlistItemsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, watchlistAlias string, skipToken string) (result WatchlistItemListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchlistItemsClient.List") + defer func() { + sc := -1 + if result.wil.Response.Response != nil { + sc = result.wil.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.WatchlistItemsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, watchlistAlias, skipToken) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.WatchlistItemsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.wil.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.WatchlistItemsClient", "List", resp, "Failure sending request") + return + } + + result.wil, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.WatchlistItemsClient", "List", resp, "Failure responding to request") + return + } + if result.wil.hasNextLink() && result.wil.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client WatchlistItemsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, watchlistAlias string, skipToken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "watchlistAlias": autorest.Encode("path", watchlistAlias), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(skipToken) > 0 { + queryParameters["$skipToken"] = autorest.Encode("query", skipToken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client WatchlistItemsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client WatchlistItemsClient) ListResponder(resp *http.Response) (result WatchlistItemList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client WatchlistItemsClient) listNextResults(ctx context.Context, lastResults WatchlistItemList) (result WatchlistItemList, err error) { + req, err := lastResults.watchlistItemListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "securityinsight.WatchlistItemsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "securityinsight.WatchlistItemsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.WatchlistItemsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client WatchlistItemsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, watchlistAlias string, skipToken string) (result WatchlistItemListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchlistItemsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName, watchlistAlias, skipToken) + return +} diff --git a/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/watchlists.go b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/watchlists.go new file mode 100644 index 000000000000..9fa8393ed047 --- /dev/null +++ b/services/preview/securityinsight/mgmt/2022-01-01-preview/securityinsight/watchlists.go @@ -0,0 +1,450 @@ +package securityinsight + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// WatchlistsClient is the API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider +type WatchlistsClient struct { + BaseClient +} + +// NewWatchlistsClient creates an instance of the WatchlistsClient client. +func NewWatchlistsClient(subscriptionID string) WatchlistsClient { + return NewWatchlistsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWatchlistsClientWithBaseURI creates an instance of the WatchlistsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWatchlistsClientWithBaseURI(baseURI string, subscriptionID string) WatchlistsClient { + return WatchlistsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a Watchlist and its Watchlist Items (bulk creation, e.g. through text/csv content +// type). To create a Watchlist and its Items, we should call this endpoint with either rawContent or a valid SAR URI +// and contentType properties. The rawContent is mainly used for small watchlist (content size below 3.8 MB). The SAS +// URI enables the creation of large watchlist, where the content size can go up to 500 MB. The status of processing +// such large file can be polled through the URL returned in Azure-AsyncOperation header. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// watchlistAlias - watchlist Alias +// watchlist - the watchlist +func (client WatchlistsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, watchlistAlias string, watchlist Watchlist) (result Watchlist, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchlistsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: watchlist, + Constraints: []validation.Constraint{{Target: "watchlist.WatchlistProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "watchlist.WatchlistProperties.DisplayName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "watchlist.WatchlistProperties.Provider", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "watchlist.WatchlistProperties.ItemsSearchKey", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("securityinsight.WatchlistsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, watchlistAlias, watchlist) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.WatchlistsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.WatchlistsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.WatchlistsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client WatchlistsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, watchlistAlias string, watchlist Watchlist) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "watchlistAlias": autorest.Encode("path", watchlistAlias), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}", pathParameters), + autorest.WithJSON(watchlist), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client WatchlistsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client WatchlistsClient) CreateOrUpdateResponder(resp *http.Response) (result Watchlist, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a watchlist. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// watchlistAlias - watchlist Alias +func (client WatchlistsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, watchlistAlias string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchlistsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.WatchlistsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, watchlistAlias) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.WatchlistsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "securityinsight.WatchlistsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.WatchlistsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client WatchlistsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, watchlistAlias string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "watchlistAlias": autorest.Encode("path", watchlistAlias), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client WatchlistsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client WatchlistsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a watchlist, without its watchlist items. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// watchlistAlias - watchlist Alias +func (client WatchlistsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, watchlistAlias string) (result Watchlist, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchlistsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.WatchlistsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, watchlistAlias) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.WatchlistsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.WatchlistsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.WatchlistsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client WatchlistsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, watchlistAlias string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "watchlistAlias": autorest.Encode("path", watchlistAlias), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client WatchlistsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client WatchlistsClient) GetResponder(resp *http.Response) (result Watchlist, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all watchlists, without watchlist items. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// skipToken - skiptoken is only used if a previous operation returned a partial result. If a previous response +// contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that +// specifies a starting point to use for subsequent calls. Optional. +func (client WatchlistsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, skipToken string) (result WatchlistListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchlistsClient.List") + defer func() { + sc := -1 + if result.wl.Response.Response != nil { + sc = result.wl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("securityinsight.WatchlistsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, skipToken) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.WatchlistsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.wl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "securityinsight.WatchlistsClient", "List", resp, "Failure sending request") + return + } + + result.wl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.WatchlistsClient", "List", resp, "Failure responding to request") + return + } + if result.wl.hasNextLink() && result.wl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client WatchlistsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, skipToken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(skipToken) > 0 { + queryParameters["$skipToken"] = autorest.Encode("query", skipToken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client WatchlistsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client WatchlistsClient) ListResponder(resp *http.Response) (result WatchlistList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client WatchlistsClient) listNextResults(ctx context.Context, lastResults WatchlistList) (result WatchlistList, err error) { + req, err := lastResults.watchlistListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "securityinsight.WatchlistsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "securityinsight.WatchlistsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "securityinsight.WatchlistsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client WatchlistsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, skipToken string) (result WatchlistListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchlistsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName, skipToken) + return +} diff --git a/services/storagecache/mgmt/2022-01-01/storagecache/CHANGELOG.md b/services/storagecache/mgmt/2022-01-01/storagecache/CHANGELOG.md new file mode 100644 index 000000000000..52911e4cc5e4 --- /dev/null +++ b/services/storagecache/mgmt/2022-01-01/storagecache/CHANGELOG.md @@ -0,0 +1,2 @@ +# Change History + diff --git a/services/storagecache/mgmt/2022-01-01/storagecache/_meta.json b/services/storagecache/mgmt/2022-01-01/storagecache/_meta.json new file mode 100644 index 000000000000..bfc592c130c3 --- /dev/null +++ b/services/storagecache/mgmt/2022-01-01/storagecache/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "162460648e39b3cd20ef3d302008add138e90223", + "readme": "/_/azure-rest-api-specs/specification/storagecache/resource-manager/readme.md", + "tag": "package-2022-01", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2022-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/storagecache/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" + } +} \ No newline at end of file diff --git a/services/storagecache/mgmt/2022-01-01/storagecache/ascoperations.go b/services/storagecache/mgmt/2022-01-01/storagecache/ascoperations.go new file mode 100644 index 000000000000..e53cdc385afd --- /dev/null +++ b/services/storagecache/mgmt/2022-01-01/storagecache/ascoperations.go @@ -0,0 +1,109 @@ +package storagecache + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AscOperationsClient is the a Storage Cache provides scalable caching service for NAS clients, serving data from +// either NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). These operations allow you to manage +// Caches. +type AscOperationsClient struct { + BaseClient +} + +// NewAscOperationsClient creates an instance of the AscOperationsClient client. +func NewAscOperationsClient(subscriptionID string) AscOperationsClient { + return NewAscOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAscOperationsClientWithBaseURI creates an instance of the AscOperationsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAscOperationsClientWithBaseURI(baseURI string, subscriptionID string) AscOperationsClient { + return AscOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets the status of an asynchronous operation for the Azure HPC Cache +// Parameters: +// location - the name of the region used to look up the operation. +// operationID - the operation id which uniquely identifies the asynchronous operation. +func (client AscOperationsClient) Get(ctx context.Context, location string, operationID string) (result AscOperation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AscOperationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, location, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.AscOperationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storagecache.AscOperationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.AscOperationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AscOperationsClient) GetPreparer(ctx context.Context, location string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "operationId": autorest.Encode("path", operationID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/locations/{location}/ascOperations/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AscOperationsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AscOperationsClient) GetResponder(resp *http.Response) (result AscOperation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/storagecache/mgmt/2022-01-01/storagecache/ascusages.go b/services/storagecache/mgmt/2022-01-01/storagecache/ascusages.go new file mode 100644 index 000000000000..4d87cd0de79d --- /dev/null +++ b/services/storagecache/mgmt/2022-01-01/storagecache/ascusages.go @@ -0,0 +1,148 @@ +package storagecache + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AscUsagesClient is the a Storage Cache provides scalable caching service for NAS clients, serving data from either +// NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). These operations allow you to manage Caches. +type AscUsagesClient struct { + BaseClient +} + +// NewAscUsagesClient creates an instance of the AscUsagesClient client. +func NewAscUsagesClient(subscriptionID string) AscUsagesClient { + return NewAscUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAscUsagesClientWithBaseURI creates an instance of the AscUsagesClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAscUsagesClientWithBaseURI(baseURI string, subscriptionID string) AscUsagesClient { + return AscUsagesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets the quantity used and quota limit for resources +// Parameters: +// location - the name of the region to query for usage information. +func (client AscUsagesClient) List(ctx context.Context, location string) (result ResourceUsagesListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AscUsagesClient.List") + defer func() { + sc := -1 + if result.rulr.Response.Response != nil { + sc = result.rulr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.AscUsagesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rulr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storagecache.AscUsagesClient", "List", resp, "Failure sending request") + return + } + + result.rulr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.AscUsagesClient", "List", resp, "Failure responding to request") + return + } + if result.rulr.hasNextLink() && result.rulr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AscUsagesClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/locations/{location}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AscUsagesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AscUsagesClient) ListResponder(resp *http.Response) (result ResourceUsagesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AscUsagesClient) listNextResults(ctx context.Context, lastResults ResourceUsagesListResult) (result ResourceUsagesListResult, err error) { + req, err := lastResults.resourceUsagesListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "storagecache.AscUsagesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "storagecache.AscUsagesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.AscUsagesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AscUsagesClient) ListComplete(ctx context.Context, location string) (result ResourceUsagesListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AscUsagesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, location) + return +} diff --git a/services/storagecache/mgmt/2022-01-01/storagecache/caches.go b/services/storagecache/mgmt/2022-01-01/storagecache/caches.go new file mode 100644 index 000000000000..db1d2c4e90b1 --- /dev/null +++ b/services/storagecache/mgmt/2022-01-01/storagecache/caches.go @@ -0,0 +1,1077 @@ +package storagecache + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// CachesClient is the a Storage Cache provides scalable caching service for NAS clients, serving data from either +// NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). These operations allow you to manage Caches. +type CachesClient struct { + BaseClient +} + +// NewCachesClient creates an instance of the CachesClient client. +func NewCachesClient(subscriptionID string) CachesClient { + return NewCachesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCachesClientWithBaseURI creates an instance of the CachesClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewCachesClientWithBaseURI(baseURI string, subscriptionID string) CachesClient { + return CachesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a Cache. +// Parameters: +// resourceGroupName - target resource group. +// cacheName - name of Cache. Length of name must not be greater than 80 and chars must be from the +// [-0-9a-zA-Z_] char class. +// cache - object containing the user-selectable properties of the new Cache. If read-only properties are +// included, they must match the existing values of those properties. +func (client CachesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, cacheName string, cache *Cache) (result CachesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: cacheName, + Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}, + {TargetValue: cache, + Constraints: []validation.Constraint{{Target: "cache", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cache.CacheProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cache.CacheProperties.NetworkSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cache.CacheProperties.NetworkSettings.Mtu", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cache.CacheProperties.NetworkSettings.Mtu", Name: validation.InclusiveMaximum, Rule: int64(1500), Chain: nil}, + {Target: "cache.CacheProperties.NetworkSettings.Mtu", Name: validation.InclusiveMinimum, Rule: int64(576), Chain: nil}, + }}, + }}, + {Target: "cache.CacheProperties.EncryptionSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cache.CacheProperties.EncryptionSettings.KeyEncryptionKey", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cache.CacheProperties.EncryptionSettings.KeyEncryptionKey.KeyURL", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "cache.CacheProperties.EncryptionSettings.KeyEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + {Target: "cache.CacheProperties.DirectoryServicesSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cache.CacheProperties.DirectoryServicesSettings.ActiveDirectory", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cache.CacheProperties.DirectoryServicesSettings.ActiveDirectory.PrimaryDNSIPAddress", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "cache.CacheProperties.DirectoryServicesSettings.ActiveDirectory.DomainName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "cache.CacheProperties.DirectoryServicesSettings.ActiveDirectory.DomainNetBiosName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "cache.CacheProperties.DirectoryServicesSettings.ActiveDirectory.CacheNetBiosName", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "cache.CacheProperties.DirectoryServicesSettings.ActiveDirectory.CacheNetBiosName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z]{1,15}$`, Chain: nil}}}, + {Target: "cache.CacheProperties.DirectoryServicesSettings.ActiveDirectory.Credentials", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cache.CacheProperties.DirectoryServicesSettings.ActiveDirectory.Credentials.Username", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "cache.CacheProperties.DirectoryServicesSettings.ActiveDirectory.Credentials.Password", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("storagecache.CachesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, cacheName, cache) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client CachesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, cacheName string, cache *Cache) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cacheName": autorest.Encode("path", cacheName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + cache.ID = nil + cache.Name = nil + cache.Type = nil + cache.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if cache != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(cache)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client CachesClient) CreateOrUpdateSender(req *http.Request) (future CachesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client CachesClient) CreateOrUpdateResponder(resp *http.Response) (result Cache, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DebugInfo tells a Cache to write generate debug info for support to process. +// Parameters: +// resourceGroupName - target resource group. +// cacheName - name of Cache. Length of name must not be greater than 80 and chars must be from the +// [-0-9a-zA-Z_] char class. +func (client CachesClient) DebugInfo(ctx context.Context, resourceGroupName string, cacheName string) (result CachesDebugInfoFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.DebugInfo") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: cacheName, + Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("storagecache.CachesClient", "DebugInfo", err.Error()) + } + + req, err := client.DebugInfoPreparer(ctx, resourceGroupName, cacheName) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "DebugInfo", nil, "Failure preparing request") + return + } + + result, err = client.DebugInfoSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "DebugInfo", result.Response(), "Failure sending request") + return + } + + return +} + +// DebugInfoPreparer prepares the DebugInfo request. +func (client CachesClient) DebugInfoPreparer(ctx context.Context, resourceGroupName string, cacheName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cacheName": autorest.Encode("path", cacheName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/debugInfo", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DebugInfoSender sends the DebugInfo request. The method will close the +// http.Response Body if it receives an error. +func (client CachesClient) DebugInfoSender(req *http.Request) (future CachesDebugInfoFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DebugInfoResponder handles the response to the DebugInfo request. The method always +// closes the http.Response Body. +func (client CachesClient) DebugInfoResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete schedules a Cache for deletion. +// Parameters: +// resourceGroupName - target resource group. +// cacheName - name of Cache. Length of name must not be greater than 80 and chars must be from the +// [-0-9a-zA-Z_] char class. +func (client CachesClient) Delete(ctx context.Context, resourceGroupName string, cacheName string) (result CachesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: cacheName, + Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("storagecache.CachesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, cacheName) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client CachesClient) DeletePreparer(ctx context.Context, resourceGroupName string, cacheName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cacheName": autorest.Encode("path", cacheName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client CachesClient) DeleteSender(req *http.Request) (future CachesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client CachesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Flush tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors +// returned until the flush is complete. +// Parameters: +// resourceGroupName - target resource group. +// cacheName - name of Cache. Length of name must not be greater than 80 and chars must be from the +// [-0-9a-zA-Z_] char class. +func (client CachesClient) Flush(ctx context.Context, resourceGroupName string, cacheName string) (result CachesFlushFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.Flush") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: cacheName, + Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("storagecache.CachesClient", "Flush", err.Error()) + } + + req, err := client.FlushPreparer(ctx, resourceGroupName, cacheName) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "Flush", nil, "Failure preparing request") + return + } + + result, err = client.FlushSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "Flush", result.Response(), "Failure sending request") + return + } + + return +} + +// FlushPreparer prepares the Flush request. +func (client CachesClient) FlushPreparer(ctx context.Context, resourceGroupName string, cacheName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cacheName": autorest.Encode("path", cacheName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/flush", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// FlushSender sends the Flush request. The method will close the +// http.Response Body if it receives an error. +func (client CachesClient) FlushSender(req *http.Request) (future CachesFlushFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// FlushResponder handles the response to the Flush request. The method always +// closes the http.Response Body. +func (client CachesClient) FlushResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get returns a Cache. +// Parameters: +// resourceGroupName - target resource group. +// cacheName - name of Cache. Length of name must not be greater than 80 and chars must be from the +// [-0-9a-zA-Z_] char class. +func (client CachesClient) Get(ctx context.Context, resourceGroupName string, cacheName string) (result Cache, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: cacheName, + Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("storagecache.CachesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, cacheName) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client CachesClient) GetPreparer(ctx context.Context, resourceGroupName string, cacheName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cacheName": autorest.Encode("path", cacheName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client CachesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client CachesClient) GetResponder(resp *http.Response) (result Cache, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List returns all Caches the user has access to under a subscription. +func (client CachesClient) List(ctx context.Context) (result CachesListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.List") + defer func() { + sc := -1 + if result.clr.Response.Response != nil { + sc = result.clr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.clr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "List", resp, "Failure sending request") + return + } + + result.clr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "List", resp, "Failure responding to request") + return + } + if result.clr.hasNextLink() && result.clr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client CachesClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/caches", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client CachesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client CachesClient) ListResponder(resp *http.Response) (result CachesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client CachesClient) listNextResults(ctx context.Context, lastResults CachesListResult) (result CachesListResult, err error) { + req, err := lastResults.cachesListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "storagecache.CachesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "storagecache.CachesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client CachesClient) ListComplete(ctx context.Context) (result CachesListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup returns all Caches the user has access to under a resource group. +// Parameters: +// resourceGroupName - target resource group. +func (client CachesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result CachesListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.clr.Response.Response != nil { + sc = result.clr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.clr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.clr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.clr.hasNextLink() && result.clr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client CachesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client CachesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client CachesClient) ListByResourceGroupResponder(resp *http.Response) (result CachesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client CachesClient) listByResourceGroupNextResults(ctx context.Context, lastResults CachesListResult) (result CachesListResult, err error) { + req, err := lastResults.cachesListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "storagecache.CachesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "storagecache.CachesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client CachesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result CachesListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// Start tells a Stopped state Cache to transition to Active state. +// Parameters: +// resourceGroupName - target resource group. +// cacheName - name of Cache. Length of name must not be greater than 80 and chars must be from the +// [-0-9a-zA-Z_] char class. +func (client CachesClient) Start(ctx context.Context, resourceGroupName string, cacheName string) (result CachesStartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.Start") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: cacheName, + Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("storagecache.CachesClient", "Start", err.Error()) + } + + req, err := client.StartPreparer(ctx, resourceGroupName, cacheName) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "Start", nil, "Failure preparing request") + return + } + + result, err = client.StartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "Start", result.Response(), "Failure sending request") + return + } + + return +} + +// StartPreparer prepares the Start request. +func (client CachesClient) StartPreparer(ctx context.Context, resourceGroupName string, cacheName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cacheName": autorest.Encode("path", cacheName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client CachesClient) StartSender(req *http.Request) (future CachesStartFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client CachesClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Stop tells an Active Cache to transition to Stopped state. +// Parameters: +// resourceGroupName - target resource group. +// cacheName - name of Cache. Length of name must not be greater than 80 and chars must be from the +// [-0-9a-zA-Z_] char class. +func (client CachesClient) Stop(ctx context.Context, resourceGroupName string, cacheName string) (result CachesStopFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.Stop") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: cacheName, + Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("storagecache.CachesClient", "Stop", err.Error()) + } + + req, err := client.StopPreparer(ctx, resourceGroupName, cacheName) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "Stop", nil, "Failure preparing request") + return + } + + result, err = client.StopSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "Stop", result.Response(), "Failure sending request") + return + } + + return +} + +// StopPreparer prepares the Stop request. +func (client CachesClient) StopPreparer(ctx context.Context, resourceGroupName string, cacheName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cacheName": autorest.Encode("path", cacheName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client CachesClient) StopSender(req *http.Request) (future CachesStopFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client CachesClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update update a Cache instance. +// Parameters: +// resourceGroupName - target resource group. +// cacheName - name of Cache. Length of name must not be greater than 80 and chars must be from the +// [-0-9a-zA-Z_] char class. +// cache - object containing the user-selectable properties of the Cache. If read-only properties are included, +// they must match the existing values of those properties. +func (client CachesClient) Update(ctx context.Context, resourceGroupName string, cacheName string, cache *Cache) (result Cache, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: cacheName, + Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("storagecache.CachesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, cacheName, cache) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client CachesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, cacheName string, cache *Cache) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cacheName": autorest.Encode("path", cacheName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + cache.ID = nil + cache.Name = nil + cache.Type = nil + cache.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if cache != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(cache)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client CachesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client CachesClient) UpdateResponder(resp *http.Response) (result Cache, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpgradeFirmware upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. +// Parameters: +// resourceGroupName - target resource group. +// cacheName - name of Cache. Length of name must not be greater than 80 and chars must be from the +// [-0-9a-zA-Z_] char class. +func (client CachesClient) UpgradeFirmware(ctx context.Context, resourceGroupName string, cacheName string) (result CachesUpgradeFirmwareFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.UpgradeFirmware") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: cacheName, + Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("storagecache.CachesClient", "UpgradeFirmware", err.Error()) + } + + req, err := client.UpgradeFirmwarePreparer(ctx, resourceGroupName, cacheName) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "UpgradeFirmware", nil, "Failure preparing request") + return + } + + result, err = client.UpgradeFirmwareSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "UpgradeFirmware", result.Response(), "Failure sending request") + return + } + + return +} + +// UpgradeFirmwarePreparer prepares the UpgradeFirmware request. +func (client CachesClient) UpgradeFirmwarePreparer(ctx context.Context, resourceGroupName string, cacheName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cacheName": autorest.Encode("path", cacheName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/upgrade", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpgradeFirmwareSender sends the UpgradeFirmware request. The method will close the +// http.Response Body if it receives an error. +func (client CachesClient) UpgradeFirmwareSender(req *http.Request) (future CachesUpgradeFirmwareFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpgradeFirmwareResponder handles the response to the UpgradeFirmware request. The method always +// closes the http.Response Body. +func (client CachesClient) UpgradeFirmwareResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/storagecache/mgmt/2022-01-01/storagecache/client.go b/services/storagecache/mgmt/2022-01-01/storagecache/client.go new file mode 100644 index 000000000000..0062e4da6699 --- /dev/null +++ b/services/storagecache/mgmt/2022-01-01/storagecache/client.go @@ -0,0 +1,42 @@ +// Package storagecache implements the Azure ARM Storagecache service API version 2022-01-01. +// +// A Storage Cache provides scalable caching service for NAS clients, serving data from either NFSv3 or Blob at-rest +// storage (referred to as "Storage Targets"). These operations allow you to manage Caches. +package storagecache + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Storagecache + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Storagecache. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/storagecache/mgmt/2022-01-01/storagecache/enums.go b/services/storagecache/mgmt/2022-01-01/storagecache/enums.go new file mode 100644 index 000000000000..857d8526515d --- /dev/null +++ b/services/storagecache/mgmt/2022-01-01/storagecache/enums.go @@ -0,0 +1,277 @@ +package storagecache + +// Copyright (c) Microsoft Corporation. All rights 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. + +// CacheIdentityType enumerates the values for cache identity type. +type CacheIdentityType string + +const ( + // CacheIdentityTypeNone ... + CacheIdentityTypeNone CacheIdentityType = "None" + // CacheIdentityTypeSystemAssigned ... + CacheIdentityTypeSystemAssigned CacheIdentityType = "SystemAssigned" + // CacheIdentityTypeSystemAssignedUserAssigned ... + CacheIdentityTypeSystemAssignedUserAssigned CacheIdentityType = "SystemAssigned, UserAssigned" + // CacheIdentityTypeUserAssigned ... + CacheIdentityTypeUserAssigned CacheIdentityType = "UserAssigned" +) + +// PossibleCacheIdentityTypeValues returns an array of possible values for the CacheIdentityType const type. +func PossibleCacheIdentityTypeValues() []CacheIdentityType { + return []CacheIdentityType{CacheIdentityTypeNone, CacheIdentityTypeSystemAssigned, CacheIdentityTypeSystemAssignedUserAssigned, CacheIdentityTypeUserAssigned} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // CreatedByTypeApplication ... + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey ... + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity ... + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + // CreatedByTypeUser ... + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} +} + +// DomainJoinedType enumerates the values for domain joined type. +type DomainJoinedType string + +const ( + // DomainJoinedTypeError ... + DomainJoinedTypeError DomainJoinedType = "Error" + // DomainJoinedTypeNo ... + DomainJoinedTypeNo DomainJoinedType = "No" + // DomainJoinedTypeYes ... + DomainJoinedTypeYes DomainJoinedType = "Yes" +) + +// PossibleDomainJoinedTypeValues returns an array of possible values for the DomainJoinedType const type. +func PossibleDomainJoinedTypeValues() []DomainJoinedType { + return []DomainJoinedType{DomainJoinedTypeError, DomainJoinedTypeNo, DomainJoinedTypeYes} +} + +// FirmwareStatusType enumerates the values for firmware status type. +type FirmwareStatusType string + +const ( + // FirmwareStatusTypeAvailable ... + FirmwareStatusTypeAvailable FirmwareStatusType = "available" + // FirmwareStatusTypeUnavailable ... + FirmwareStatusTypeUnavailable FirmwareStatusType = "unavailable" +) + +// PossibleFirmwareStatusTypeValues returns an array of possible values for the FirmwareStatusType const type. +func PossibleFirmwareStatusTypeValues() []FirmwareStatusType { + return []FirmwareStatusType{FirmwareStatusTypeAvailable, FirmwareStatusTypeUnavailable} +} + +// HealthStateType enumerates the values for health state type. +type HealthStateType string + +const ( + // HealthStateTypeDegraded ... + HealthStateTypeDegraded HealthStateType = "Degraded" + // HealthStateTypeDown ... + HealthStateTypeDown HealthStateType = "Down" + // HealthStateTypeFlushing ... + HealthStateTypeFlushing HealthStateType = "Flushing" + // HealthStateTypeHealthy ... + HealthStateTypeHealthy HealthStateType = "Healthy" + // HealthStateTypeStopped ... + HealthStateTypeStopped HealthStateType = "Stopped" + // HealthStateTypeStopping ... + HealthStateTypeStopping HealthStateType = "Stopping" + // HealthStateTypeTransitioning ... + HealthStateTypeTransitioning HealthStateType = "Transitioning" + // HealthStateTypeUnknown ... + HealthStateTypeUnknown HealthStateType = "Unknown" + // HealthStateTypeUpgrading ... + HealthStateTypeUpgrading HealthStateType = "Upgrading" +) + +// PossibleHealthStateTypeValues returns an array of possible values for the HealthStateType const type. +func PossibleHealthStateTypeValues() []HealthStateType { + return []HealthStateType{HealthStateTypeDegraded, HealthStateTypeDown, HealthStateTypeFlushing, HealthStateTypeHealthy, HealthStateTypeStopped, HealthStateTypeStopping, HealthStateTypeTransitioning, HealthStateTypeUnknown, HealthStateTypeUpgrading} +} + +// MetricAggregationType enumerates the values for metric aggregation type. +type MetricAggregationType string + +const ( + // MetricAggregationTypeAverage ... + MetricAggregationTypeAverage MetricAggregationType = "Average" + // MetricAggregationTypeCount ... + MetricAggregationTypeCount MetricAggregationType = "Count" + // MetricAggregationTypeMaximum ... + MetricAggregationTypeMaximum MetricAggregationType = "Maximum" + // MetricAggregationTypeMinimum ... + MetricAggregationTypeMinimum MetricAggregationType = "Minimum" + // MetricAggregationTypeNone ... + MetricAggregationTypeNone MetricAggregationType = "None" + // MetricAggregationTypeNotSpecified ... + MetricAggregationTypeNotSpecified MetricAggregationType = "NotSpecified" + // MetricAggregationTypeTotal ... + MetricAggregationTypeTotal MetricAggregationType = "Total" +) + +// PossibleMetricAggregationTypeValues returns an array of possible values for the MetricAggregationType const type. +func PossibleMetricAggregationTypeValues() []MetricAggregationType { + return []MetricAggregationType{MetricAggregationTypeAverage, MetricAggregationTypeCount, MetricAggregationTypeMaximum, MetricAggregationTypeMinimum, MetricAggregationTypeNone, MetricAggregationTypeNotSpecified, MetricAggregationTypeTotal} +} + +// NfsAccessRuleAccess enumerates the values for nfs access rule access. +type NfsAccessRuleAccess string + +const ( + // NfsAccessRuleAccessNo ... + NfsAccessRuleAccessNo NfsAccessRuleAccess = "no" + // NfsAccessRuleAccessRo ... + NfsAccessRuleAccessRo NfsAccessRuleAccess = "ro" + // NfsAccessRuleAccessRw ... + NfsAccessRuleAccessRw NfsAccessRuleAccess = "rw" +) + +// PossibleNfsAccessRuleAccessValues returns an array of possible values for the NfsAccessRuleAccess const type. +func PossibleNfsAccessRuleAccessValues() []NfsAccessRuleAccess { + return []NfsAccessRuleAccess{NfsAccessRuleAccessNo, NfsAccessRuleAccessRo, NfsAccessRuleAccessRw} +} + +// NfsAccessRuleScope enumerates the values for nfs access rule scope. +type NfsAccessRuleScope string + +const ( + // NfsAccessRuleScopeDefault ... + NfsAccessRuleScopeDefault NfsAccessRuleScope = "default" + // NfsAccessRuleScopeHost ... + NfsAccessRuleScopeHost NfsAccessRuleScope = "host" + // NfsAccessRuleScopeNetwork ... + NfsAccessRuleScopeNetwork NfsAccessRuleScope = "network" +) + +// PossibleNfsAccessRuleScopeValues returns an array of possible values for the NfsAccessRuleScope const type. +func PossibleNfsAccessRuleScopeValues() []NfsAccessRuleScope { + return []NfsAccessRuleScope{NfsAccessRuleScopeDefault, NfsAccessRuleScopeHost, NfsAccessRuleScopeNetwork} +} + +// OperationalStateType enumerates the values for operational state type. +type OperationalStateType string + +const ( + // OperationalStateTypeBusy ... + OperationalStateTypeBusy OperationalStateType = "Busy" + // OperationalStateTypeFlushing ... + OperationalStateTypeFlushing OperationalStateType = "Flushing" + // OperationalStateTypeReady ... + OperationalStateTypeReady OperationalStateType = "Ready" + // OperationalStateTypeSuspended ... + OperationalStateTypeSuspended OperationalStateType = "Suspended" +) + +// PossibleOperationalStateTypeValues returns an array of possible values for the OperationalStateType const type. +func PossibleOperationalStateTypeValues() []OperationalStateType { + return []OperationalStateType{OperationalStateTypeBusy, OperationalStateTypeFlushing, OperationalStateTypeReady, OperationalStateTypeSuspended} +} + +// ProvisioningStateType enumerates the values for provisioning state type. +type ProvisioningStateType string + +const ( + // ProvisioningStateTypeCancelled ... + ProvisioningStateTypeCancelled ProvisioningStateType = "Cancelled" + // ProvisioningStateTypeCreating ... + ProvisioningStateTypeCreating ProvisioningStateType = "Creating" + // ProvisioningStateTypeDeleting ... + ProvisioningStateTypeDeleting ProvisioningStateType = "Deleting" + // ProvisioningStateTypeFailed ... + ProvisioningStateTypeFailed ProvisioningStateType = "Failed" + // ProvisioningStateTypeSucceeded ... + ProvisioningStateTypeSucceeded ProvisioningStateType = "Succeeded" + // ProvisioningStateTypeUpdating ... + ProvisioningStateTypeUpdating ProvisioningStateType = "Updating" +) + +// PossibleProvisioningStateTypeValues returns an array of possible values for the ProvisioningStateType const type. +func PossibleProvisioningStateTypeValues() []ProvisioningStateType { + return []ProvisioningStateType{ProvisioningStateTypeCancelled, ProvisioningStateTypeCreating, ProvisioningStateTypeDeleting, ProvisioningStateTypeFailed, ProvisioningStateTypeSucceeded, ProvisioningStateTypeUpdating} +} + +// ReasonCode enumerates the values for reason code. +type ReasonCode string + +const ( + // ReasonCodeNotAvailableForSubscription ... + ReasonCodeNotAvailableForSubscription ReasonCode = "NotAvailableForSubscription" + // ReasonCodeQuotaID ... + ReasonCodeQuotaID ReasonCode = "QuotaId" +) + +// PossibleReasonCodeValues returns an array of possible values for the ReasonCode const type. +func PossibleReasonCodeValues() []ReasonCode { + return []ReasonCode{ReasonCodeNotAvailableForSubscription, ReasonCodeQuotaID} +} + +// StorageTargetType enumerates the values for storage target type. +type StorageTargetType string + +const ( + // StorageTargetTypeBlobNfs ... + StorageTargetTypeBlobNfs StorageTargetType = "blobNfs" + // StorageTargetTypeClfs ... + StorageTargetTypeClfs StorageTargetType = "clfs" + // StorageTargetTypeNfs3 ... + StorageTargetTypeNfs3 StorageTargetType = "nfs3" + // StorageTargetTypeUnknown ... + StorageTargetTypeUnknown StorageTargetType = "unknown" +) + +// PossibleStorageTargetTypeValues returns an array of possible values for the StorageTargetType const type. +func PossibleStorageTargetTypeValues() []StorageTargetType { + return []StorageTargetType{StorageTargetTypeBlobNfs, StorageTargetTypeClfs, StorageTargetTypeNfs3, StorageTargetTypeUnknown} +} + +// UsernameDownloadedType enumerates the values for username downloaded type. +type UsernameDownloadedType string + +const ( + // UsernameDownloadedTypeError ... + UsernameDownloadedTypeError UsernameDownloadedType = "Error" + // UsernameDownloadedTypeNo ... + UsernameDownloadedTypeNo UsernameDownloadedType = "No" + // UsernameDownloadedTypeYes ... + UsernameDownloadedTypeYes UsernameDownloadedType = "Yes" +) + +// PossibleUsernameDownloadedTypeValues returns an array of possible values for the UsernameDownloadedType const type. +func PossibleUsernameDownloadedTypeValues() []UsernameDownloadedType { + return []UsernameDownloadedType{UsernameDownloadedTypeError, UsernameDownloadedTypeNo, UsernameDownloadedTypeYes} +} + +// UsernameSource enumerates the values for username source. +type UsernameSource string + +const ( + // UsernameSourceAD ... + UsernameSourceAD UsernameSource = "AD" + // UsernameSourceFile ... + UsernameSourceFile UsernameSource = "File" + // UsernameSourceLDAP ... + UsernameSourceLDAP UsernameSource = "LDAP" + // UsernameSourceNone ... + UsernameSourceNone UsernameSource = "None" +) + +// PossibleUsernameSourceValues returns an array of possible values for the UsernameSource const type. +func PossibleUsernameSourceValues() []UsernameSource { + return []UsernameSource{UsernameSourceAD, UsernameSourceFile, UsernameSourceLDAP, UsernameSourceNone} +} diff --git a/services/storagecache/mgmt/2022-01-01/storagecache/models.go b/services/storagecache/mgmt/2022-01-01/storagecache/models.go new file mode 100644 index 000000000000..fd91969ae21d --- /dev/null +++ b/services/storagecache/mgmt/2022-01-01/storagecache/models.go @@ -0,0 +1,2693 @@ +package storagecache + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2022-01-01/storagecache" + +// APIOperation REST API operation description: see +// https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/openapi-authoring-automated-guidelines.md#r3023-operationsapiimplementation +type APIOperation struct { + // Display - The object that represents the operation. + Display *APIOperationDisplay `json:"display,omitempty"` + // Origin - Origin of the operation. + Origin *string `json:"origin,omitempty"` + // IsDataAction - The flag that indicates whether the operation applies to data plane. + IsDataAction *bool `json:"isDataAction,omitempty"` + // Name - Operation name: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // APIOperationProperties - Additional details about an operation. + *APIOperationProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for APIOperation. +func (ao APIOperation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ao.Display != nil { + objectMap["display"] = ao.Display + } + if ao.Origin != nil { + objectMap["origin"] = ao.Origin + } + if ao.IsDataAction != nil { + objectMap["isDataAction"] = ao.IsDataAction + } + if ao.Name != nil { + objectMap["name"] = ao.Name + } + if ao.APIOperationProperties != nil { + objectMap["properties"] = ao.APIOperationProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for APIOperation struct. +func (ao *APIOperation) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "display": + if v != nil { + var display APIOperationDisplay + err = json.Unmarshal(*v, &display) + if err != nil { + return err + } + ao.Display = &display + } + case "origin": + if v != nil { + var origin string + err = json.Unmarshal(*v, &origin) + if err != nil { + return err + } + ao.Origin = &origin + } + case "isDataAction": + if v != nil { + var isDataAction bool + err = json.Unmarshal(*v, &isDataAction) + if err != nil { + return err + } + ao.IsDataAction = &isDataAction + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ao.Name = &name + } + case "properties": + if v != nil { + var APIOperationProperties APIOperationProperties + err = json.Unmarshal(*v, &APIOperationProperties) + if err != nil { + return err + } + ao.APIOperationProperties = &APIOperationProperties + } + } + } + + return nil +} + +// APIOperationDisplay the object that represents the operation. +type APIOperationDisplay struct { + // Operation - Operation type: Read, write, delete, etc. + Operation *string `json:"operation,omitempty"` + // Provider - Service provider: Microsoft.StorageCache + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed: Cache, etc. + Resource *string `json:"resource,omitempty"` + // Description - The description of the operation + Description *string `json:"description,omitempty"` +} + +// APIOperationListResult result of the request to list Resource Provider operations. It contains a list of +// operations and a URL link to get the next set of results. +type APIOperationListResult struct { + autorest.Response `json:"-"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` + // Value - List of Resource Provider operations supported by the Microsoft.StorageCache resource provider. + Value *[]APIOperation `json:"value,omitempty"` +} + +// APIOperationListResultIterator provides access to a complete listing of APIOperation values. +type APIOperationListResultIterator struct { + i int + page APIOperationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *APIOperationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *APIOperationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter APIOperationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter APIOperationListResultIterator) Response() APIOperationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter APIOperationListResultIterator) Value() APIOperation { + if !iter.page.NotDone() { + return APIOperation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the APIOperationListResultIterator type. +func NewAPIOperationListResultIterator(page APIOperationListResultPage) APIOperationListResultIterator { + return APIOperationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (aolr APIOperationListResult) IsEmpty() bool { + return aolr.Value == nil || len(*aolr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (aolr APIOperationListResult) hasNextLink() bool { + return aolr.NextLink != nil && len(*aolr.NextLink) != 0 +} + +// aPIOperationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (aolr APIOperationListResult) aPIOperationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !aolr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(aolr.NextLink))) +} + +// APIOperationListResultPage contains a page of APIOperation values. +type APIOperationListResultPage struct { + fn func(context.Context, APIOperationListResult) (APIOperationListResult, error) + aolr APIOperationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *APIOperationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.aolr) + if err != nil { + return err + } + page.aolr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *APIOperationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page APIOperationListResultPage) NotDone() bool { + return !page.aolr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page APIOperationListResultPage) Response() APIOperationListResult { + return page.aolr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page APIOperationListResultPage) Values() []APIOperation { + if page.aolr.IsEmpty() { + return nil + } + return *page.aolr.Value +} + +// Creates a new instance of the APIOperationListResultPage type. +func NewAPIOperationListResultPage(cur APIOperationListResult, getNextPage func(context.Context, APIOperationListResult) (APIOperationListResult, error)) APIOperationListResultPage { + return APIOperationListResultPage{ + fn: getNextPage, + aolr: cur, + } +} + +// APIOperationProperties additional details about an operation. +type APIOperationProperties struct { + // ServiceSpecification - Specification of the all the metrics provided for a resource type. + ServiceSpecification *APIOperationPropertiesServiceSpecification `json:"serviceSpecification,omitempty"` +} + +// APIOperationPropertiesServiceSpecification specification of the all the metrics provided for a resource +// type. +type APIOperationPropertiesServiceSpecification struct { + // MetricSpecifications - Details about operations related to metrics. + MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"` +} + +// AscOperation the status of operation. +type AscOperation struct { + autorest.Response `json:"-"` + // ID - The operation Id. + ID *string `json:"id,omitempty"` + // Name - The operation name. + Name *string `json:"name,omitempty"` + // StartTime - The start time of the operation. + StartTime *string `json:"startTime,omitempty"` + // EndTime - The end time of the operation. + EndTime *string `json:"endTime,omitempty"` + // Status - The status of the operation. + Status *string `json:"status,omitempty"` + // Error - The error detail of the operation if any. + Error *ErrorResponse `json:"error,omitempty"` + // AscOperationProperties - Additional operation-specific properties + *AscOperationProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AscOperation. +func (ao AscOperation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ao.ID != nil { + objectMap["id"] = ao.ID + } + if ao.Name != nil { + objectMap["name"] = ao.Name + } + if ao.StartTime != nil { + objectMap["startTime"] = ao.StartTime + } + if ao.EndTime != nil { + objectMap["endTime"] = ao.EndTime + } + if ao.Status != nil { + objectMap["status"] = ao.Status + } + if ao.Error != nil { + objectMap["error"] = ao.Error + } + if ao.AscOperationProperties != nil { + objectMap["properties"] = ao.AscOperationProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AscOperation struct. +func (ao *AscOperation) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ao.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ao.Name = &name + } + case "startTime": + if v != nil { + var startTime string + err = json.Unmarshal(*v, &startTime) + if err != nil { + return err + } + ao.StartTime = &startTime + } + case "endTime": + if v != nil { + var endTime string + err = json.Unmarshal(*v, &endTime) + if err != nil { + return err + } + ao.EndTime = &endTime + } + case "status": + if v != nil { + var status string + err = json.Unmarshal(*v, &status) + if err != nil { + return err + } + ao.Status = &status + } + case "error": + if v != nil { + var errorVar ErrorResponse + err = json.Unmarshal(*v, &errorVar) + if err != nil { + return err + } + ao.Error = &errorVar + } + case "properties": + if v != nil { + var ascOperationProperties AscOperationProperties + err = json.Unmarshal(*v, &ascOperationProperties) + if err != nil { + return err + } + ao.AscOperationProperties = &ascOperationProperties + } + } + } + + return nil +} + +// AscOperationProperties additional operation-specific output. +type AscOperationProperties struct { + // Output - Additional operation-specific output. + Output map[string]interface{} `json:"output"` +} + +// MarshalJSON is the custom marshaler for AscOperationProperties. +func (aop AscOperationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aop.Output != nil { + objectMap["output"] = aop.Output + } + return json.Marshal(objectMap) +} + +// BlobNfsTarget properties pertaining to the BlobNfsTarget. +type BlobNfsTarget struct { + // Target - Resource ID of the storage container. + Target *string `json:"target,omitempty"` + // UsageModel - Identifies the StorageCache usage model to be used for this storage target. + UsageModel *string `json:"usageModel,omitempty"` +} + +// Cache a Cache instance. Follows Azure Resource Manager standards: +// https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md +type Cache struct { + autorest.Response `json:"-"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Resource ID of the Cache. + ID *string `json:"id,omitempty"` + // Location - Region name string. + Location *string `json:"location,omitempty"` + // Name - READ-ONLY; Name of Cache. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Type of the Cache; Microsoft.StorageCache/Cache + Type *string `json:"type,omitempty"` + // Identity - The identity of the cache, if configured. + Identity *CacheIdentity `json:"identity,omitempty"` + // SystemData - READ-ONLY; The system meta data relating to this resource. + SystemData *SystemData `json:"systemData,omitempty"` + // CacheProperties - Properties of the Cache. + *CacheProperties `json:"properties,omitempty"` + // Sku - SKU for the Cache. + Sku *CacheSku `json:"sku,omitempty"` +} + +// MarshalJSON is the custom marshaler for Cache. +func (c Cache) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if c.Tags != nil { + objectMap["tags"] = c.Tags + } + if c.Location != nil { + objectMap["location"] = c.Location + } + if c.Identity != nil { + objectMap["identity"] = c.Identity + } + if c.CacheProperties != nil { + objectMap["properties"] = c.CacheProperties + } + if c.Sku != nil { + objectMap["sku"] = c.Sku + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Cache struct. +func (c *Cache) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + c.Tags = tags + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + c.ID = &ID + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + c.Location = &location + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + c.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + c.Type = &typeVar + } + case "identity": + if v != nil { + var identity CacheIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + c.Identity = &identity + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + c.SystemData = &systemData + } + case "properties": + if v != nil { + var cacheProperties CacheProperties + err = json.Unmarshal(*v, &cacheProperties) + if err != nil { + return err + } + c.CacheProperties = &cacheProperties + } + case "sku": + if v != nil { + var sku CacheSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + c.Sku = &sku + } + } + } + + return nil +} + +// CacheActiveDirectorySettings active Directory settings used to join a cache to a domain. +type CacheActiveDirectorySettings struct { + // PrimaryDNSIPAddress - Primary DNS IP address used to resolve the Active Directory domain controller's fully qualified domain name. + PrimaryDNSIPAddress *string `json:"primaryDnsIpAddress,omitempty"` + // SecondaryDNSIPAddress - Secondary DNS IP address used to resolve the Active Directory domain controller's fully qualified domain name. + SecondaryDNSIPAddress *string `json:"secondaryDnsIpAddress,omitempty"` + // DomainName - The fully qualified domain name of the Active Directory domain controller. + DomainName *string `json:"domainName,omitempty"` + // DomainNetBiosName - The Active Directory domain's NetBIOS name. + DomainNetBiosName *string `json:"domainNetBiosName,omitempty"` + // CacheNetBiosName - The NetBIOS name to assign to the HPC Cache when it joins the Active Directory domain as a server. Length must 1-15 characters from the class [-0-9a-zA-Z]. + CacheNetBiosName *string `json:"cacheNetBiosName,omitempty"` + // DomainJoined - READ-ONLY; True if the HPC Cache is joined to the Active Directory domain. Possible values include: 'DomainJoinedTypeYes', 'DomainJoinedTypeNo', 'DomainJoinedTypeError' + DomainJoined DomainJoinedType `json:"domainJoined,omitempty"` + // Credentials - Active Directory admin credentials used to join the HPC Cache to a domain. + Credentials *CacheActiveDirectorySettingsCredentials `json:"credentials,omitempty"` +} + +// MarshalJSON is the custom marshaler for CacheActiveDirectorySettings. +func (cads CacheActiveDirectorySettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cads.PrimaryDNSIPAddress != nil { + objectMap["primaryDnsIpAddress"] = cads.PrimaryDNSIPAddress + } + if cads.SecondaryDNSIPAddress != nil { + objectMap["secondaryDnsIpAddress"] = cads.SecondaryDNSIPAddress + } + if cads.DomainName != nil { + objectMap["domainName"] = cads.DomainName + } + if cads.DomainNetBiosName != nil { + objectMap["domainNetBiosName"] = cads.DomainNetBiosName + } + if cads.CacheNetBiosName != nil { + objectMap["cacheNetBiosName"] = cads.CacheNetBiosName + } + if cads.Credentials != nil { + objectMap["credentials"] = cads.Credentials + } + return json.Marshal(objectMap) +} + +// CacheActiveDirectorySettingsCredentials active Directory admin credentials used to join the HPC Cache to +// a domain. +type CacheActiveDirectorySettingsCredentials struct { + // Username - Username of the Active Directory domain administrator. This value is stored encrypted and not returned on response. + Username *string `json:"username,omitempty"` + // Password - Plain text password of the Active Directory domain administrator. This value is stored encrypted and not returned on response. + Password *string `json:"password,omitempty"` +} + +// CacheDirectorySettings cache Directory Services settings. +type CacheDirectorySettings struct { + // ActiveDirectory - Specifies settings for joining the HPC Cache to an Active Directory domain. + ActiveDirectory *CacheActiveDirectorySettings `json:"activeDirectory,omitempty"` + // UsernameDownload - Specifies settings for Extended Groups. Extended Groups allows users to be members of more than 16 groups. + UsernameDownload *CacheUsernameDownloadSettings `json:"usernameDownload,omitempty"` +} + +// CacheEncryptionSettings cache encryption settings. +type CacheEncryptionSettings struct { + // KeyEncryptionKey - Specifies the location of the key encryption key in Key Vault. + KeyEncryptionKey *KeyVaultKeyReference `json:"keyEncryptionKey,omitempty"` + // RotationToLatestKeyVersionEnabled - Specifies whether the service will automatically rotate to the newest version of the key in the Key Vault. + RotationToLatestKeyVersionEnabled *bool `json:"rotationToLatestKeyVersionEnabled,omitempty"` +} + +// CacheHealth an indication of Cache health. Gives more information about health than just that related to +// provisioning. +type CacheHealth struct { + // State - List of Cache health states. Possible values include: 'HealthStateTypeUnknown', 'HealthStateTypeHealthy', 'HealthStateTypeDegraded', 'HealthStateTypeDown', 'HealthStateTypeTransitioning', 'HealthStateTypeStopping', 'HealthStateTypeStopped', 'HealthStateTypeUpgrading', 'HealthStateTypeFlushing' + State HealthStateType `json:"state,omitempty"` + // StatusDescription - Describes explanation of state. + StatusDescription *string `json:"statusDescription,omitempty"` + // Conditions - READ-ONLY; Outstanding conditions that need to be investigated and resolved. + Conditions *[]Condition `json:"conditions,omitempty"` +} + +// MarshalJSON is the custom marshaler for CacheHealth. +func (ch CacheHealth) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ch.State != "" { + objectMap["state"] = ch.State + } + if ch.StatusDescription != nil { + objectMap["statusDescription"] = ch.StatusDescription + } + return json.Marshal(objectMap) +} + +// CacheIdentity cache identity properties. +type CacheIdentity struct { + // PrincipalID - READ-ONLY; The principal ID for the system-assigned identity of the cache. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID associated with the cache. + TenantID *string `json:"tenantId,omitempty"` + // Type - The type of identity used for the cache. Possible values include: 'CacheIdentityTypeSystemAssigned', 'CacheIdentityTypeUserAssigned', 'CacheIdentityTypeSystemAssignedUserAssigned', 'CacheIdentityTypeNone' + Type CacheIdentityType `json:"type,omitempty"` + // UserAssignedIdentities - A dictionary where each key is a user assigned identity resource ID, and each key's value is an empty dictionary. + UserAssignedIdentities map[string]*CacheIdentityUserAssignedIdentitiesValue `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for CacheIdentity. +func (ci CacheIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ci.Type != "" { + objectMap["type"] = ci.Type + } + if ci.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = ci.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// CacheIdentityUserAssignedIdentitiesValue ... +type CacheIdentityUserAssignedIdentitiesValue struct { + // PrincipalID - READ-ONLY; The principal ID of the user-assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // ClientID - READ-ONLY; The client ID of the user-assigned identity. + ClientID *string `json:"clientId,omitempty"` +} + +// MarshalJSON is the custom marshaler for CacheIdentityUserAssignedIdentitiesValue. +func (ciAiv CacheIdentityUserAssignedIdentitiesValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CacheNetworkSettings cache network settings. +type CacheNetworkSettings struct { + // Mtu - The IPv4 maximum transmission unit configured for the subnet. + Mtu *int32 `json:"mtu,omitempty"` + // UtilityAddresses - READ-ONLY; Array of additional IP addresses used by this Cache. + UtilityAddresses *[]string `json:"utilityAddresses,omitempty"` + // DNSServers - DNS servers for the cache to use. It will be set from the network configuration if no value is provided. + DNSServers *[]string `json:"dnsServers,omitempty"` + // DNSSearchDomain - DNS search domain + DNSSearchDomain *string `json:"dnsSearchDomain,omitempty"` + // NtpServer - NTP server IP Address or FQDN for the cache to use. The default is time.windows.com. + NtpServer *string `json:"ntpServer,omitempty"` +} + +// MarshalJSON is the custom marshaler for CacheNetworkSettings. +func (cns CacheNetworkSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cns.Mtu != nil { + objectMap["mtu"] = cns.Mtu + } + if cns.DNSServers != nil { + objectMap["dnsServers"] = cns.DNSServers + } + if cns.DNSSearchDomain != nil { + objectMap["dnsSearchDomain"] = cns.DNSSearchDomain + } + if cns.NtpServer != nil { + objectMap["ntpServer"] = cns.NtpServer + } + return json.Marshal(objectMap) +} + +// CacheProperties properties of the Cache. +type CacheProperties struct { + // CacheSizeGB - The size of this Cache, in GB. + CacheSizeGB *int32 `json:"cacheSizeGB,omitempty"` + // Health - READ-ONLY; Health of the Cache. + Health *CacheHealth `json:"health,omitempty"` + // MountAddresses - READ-ONLY; Array of IP addresses that can be used by clients mounting this Cache. + MountAddresses *[]string `json:"mountAddresses,omitempty"` + // ProvisioningState - READ-ONLY; ARM provisioning state, see https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. Possible values include: 'ProvisioningStateTypeSucceeded', 'ProvisioningStateTypeFailed', 'ProvisioningStateTypeCancelled', 'ProvisioningStateTypeCreating', 'ProvisioningStateTypeDeleting', 'ProvisioningStateTypeUpdating' + ProvisioningState ProvisioningStateType `json:"provisioningState,omitempty"` + // Subnet - Subnet used for the Cache. + Subnet *string `json:"subnet,omitempty"` + // UpgradeStatus - READ-ONLY; Upgrade status of the Cache. + UpgradeStatus *CacheUpgradeStatus `json:"upgradeStatus,omitempty"` + // NetworkSettings - Specifies network settings of the cache. + NetworkSettings *CacheNetworkSettings `json:"networkSettings,omitempty"` + // EncryptionSettings - Specifies encryption settings of the cache. + EncryptionSettings *CacheEncryptionSettings `json:"encryptionSettings,omitempty"` + // SecuritySettings - Specifies security settings of the cache. + SecuritySettings *CacheSecuritySettings `json:"securitySettings,omitempty"` + // DirectoryServicesSettings - Specifies Directory Services settings of the cache. + DirectoryServicesSettings *CacheDirectorySettings `json:"directoryServicesSettings,omitempty"` + // Zones - Availability zones for resources. This field should only contain a single element in the array. + Zones *[]string `json:"zones,omitempty"` +} + +// MarshalJSON is the custom marshaler for CacheProperties. +func (c CacheProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if c.CacheSizeGB != nil { + objectMap["cacheSizeGB"] = c.CacheSizeGB + } + if c.Subnet != nil { + objectMap["subnet"] = c.Subnet + } + if c.NetworkSettings != nil { + objectMap["networkSettings"] = c.NetworkSettings + } + if c.EncryptionSettings != nil { + objectMap["encryptionSettings"] = c.EncryptionSettings + } + if c.SecuritySettings != nil { + objectMap["securitySettings"] = c.SecuritySettings + } + if c.DirectoryServicesSettings != nil { + objectMap["directoryServicesSettings"] = c.DirectoryServicesSettings + } + if c.Zones != nil { + objectMap["zones"] = c.Zones + } + return json.Marshal(objectMap) +} + +// CachesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type CachesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CachesClient) (Cache, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CachesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for CachesCreateOrUpdateFuture.Result. +func (future *CachesCreateOrUpdateFuture) result(client CachesClient) (c Cache, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + c.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("storagecache.CachesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { + c, err = client.CreateOrUpdateResponder(c.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesCreateOrUpdateFuture", "Result", c.Response.Response, "Failure responding to request") + } + } + return +} + +// CachesDebugInfoFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type CachesDebugInfoFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CachesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CachesDebugInfoFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for CachesDebugInfoFuture.Result. +func (future *CachesDebugInfoFuture) result(client CachesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesDebugInfoFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("storagecache.CachesDebugInfoFuture") + return + } + ar.Response = future.Response() + return +} + +// CachesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type CachesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CachesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CachesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for CachesDeleteFuture.Result. +func (future *CachesDeleteFuture) result(client CachesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("storagecache.CachesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// CacheSecuritySettings cache security settings. +type CacheSecuritySettings struct { + // AccessPolicies - NFS access policies defined for this cache. + AccessPolicies *[]NfsAccessPolicy `json:"accessPolicies,omitempty"` +} + +// CachesFlushFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type CachesFlushFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CachesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CachesFlushFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for CachesFlushFuture.Result. +func (future *CachesFlushFuture) result(client CachesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesFlushFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("storagecache.CachesFlushFuture") + return + } + ar.Response = future.Response() + return +} + +// CacheSku SKU for the Cache. +type CacheSku struct { + // Name - SKU name for this Cache. + Name *string `json:"name,omitempty"` +} + +// CachesListResult result of the request to list Caches. It contains a list of Caches and a URL link to +// get the next set of results. +type CachesListResult struct { + autorest.Response `json:"-"` + // NextLink - URL to get the next set of Cache list results, if there are any. + NextLink *string `json:"nextLink,omitempty"` + // Value - List of Caches. + Value *[]Cache `json:"value,omitempty"` +} + +// CachesListResultIterator provides access to a complete listing of Cache values. +type CachesListResultIterator struct { + i int + page CachesListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *CachesListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CachesListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *CachesListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CachesListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter CachesListResultIterator) Response() CachesListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter CachesListResultIterator) Value() Cache { + if !iter.page.NotDone() { + return Cache{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CachesListResultIterator type. +func NewCachesListResultIterator(page CachesListResultPage) CachesListResultIterator { + return CachesListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (clr CachesListResult) IsEmpty() bool { + return clr.Value == nil || len(*clr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (clr CachesListResult) hasNextLink() bool { + return clr.NextLink != nil && len(*clr.NextLink) != 0 +} + +// cachesListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (clr CachesListResult) cachesListResultPreparer(ctx context.Context) (*http.Request, error) { + if !clr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(clr.NextLink))) +} + +// CachesListResultPage contains a page of Cache values. +type CachesListResultPage struct { + fn func(context.Context, CachesListResult) (CachesListResult, error) + clr CachesListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *CachesListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CachesListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.clr) + if err != nil { + return err + } + page.clr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *CachesListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CachesListResultPage) NotDone() bool { + return !page.clr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CachesListResultPage) Response() CachesListResult { + return page.clr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CachesListResultPage) Values() []Cache { + if page.clr.IsEmpty() { + return nil + } + return *page.clr.Value +} + +// Creates a new instance of the CachesListResultPage type. +func NewCachesListResultPage(cur CachesListResult, getNextPage func(context.Context, CachesListResult) (CachesListResult, error)) CachesListResultPage { + return CachesListResultPage{ + fn: getNextPage, + clr: cur, + } +} + +// CachesStartFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type CachesStartFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CachesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CachesStartFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for CachesStartFuture.Result. +func (future *CachesStartFuture) result(client CachesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("storagecache.CachesStartFuture") + return + } + ar.Response = future.Response() + return +} + +// CachesStopFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type CachesStopFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CachesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CachesStopFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for CachesStopFuture.Result. +func (future *CachesStopFuture) result(client CachesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesStopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("storagecache.CachesStopFuture") + return + } + ar.Response = future.Response() + return +} + +// CachesUpgradeFirmwareFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type CachesUpgradeFirmwareFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CachesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CachesUpgradeFirmwareFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for CachesUpgradeFirmwareFuture.Result. +func (future *CachesUpgradeFirmwareFuture) result(client CachesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.CachesUpgradeFirmwareFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("storagecache.CachesUpgradeFirmwareFuture") + return + } + ar.Response = future.Response() + return +} + +// CacheUpgradeStatus properties describing the software upgrade state of the Cache. +type CacheUpgradeStatus struct { + // CurrentFirmwareVersion - READ-ONLY; Version string of the firmware currently installed on this Cache. + CurrentFirmwareVersion *string `json:"currentFirmwareVersion,omitempty"` + // FirmwareUpdateStatus - READ-ONLY; True if there is a firmware update ready to install on this Cache. The firmware will automatically be installed after firmwareUpdateDeadline if not triggered earlier via the upgrade operation. Possible values include: 'FirmwareStatusTypeAvailable', 'FirmwareStatusTypeUnavailable' + FirmwareUpdateStatus FirmwareStatusType `json:"firmwareUpdateStatus,omitempty"` + // FirmwareUpdateDeadline - READ-ONLY; Time at which the pending firmware update will automatically be installed on the Cache. + FirmwareUpdateDeadline *date.Time `json:"firmwareUpdateDeadline,omitempty"` + // LastFirmwareUpdate - READ-ONLY; Time of the last successful firmware update. + LastFirmwareUpdate *date.Time `json:"lastFirmwareUpdate,omitempty"` + // PendingFirmwareVersion - READ-ONLY; When firmwareUpdateAvailable is true, this field holds the version string for the update. + PendingFirmwareVersion *string `json:"pendingFirmwareVersion,omitempty"` +} + +// MarshalJSON is the custom marshaler for CacheUpgradeStatus. +func (cus CacheUpgradeStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CacheUsernameDownloadSettings settings for Extended Groups username and group download. +type CacheUsernameDownloadSettings struct { + // ExtendedGroups - Whether or not Extended Groups is enabled. + ExtendedGroups *bool `json:"extendedGroups,omitempty"` + // UsernameSource - This setting determines how the cache gets username and group names for clients. Possible values include: 'UsernameSourceAD', 'UsernameSourceLDAP', 'UsernameSourceFile', 'UsernameSourceNone' + UsernameSource UsernameSource `json:"usernameSource,omitempty"` + // GroupFileURI - The URI of the file containing group information (in /etc/group file format). This field must be populated when 'usernameSource' is set to 'File'. + GroupFileURI *string `json:"groupFileURI,omitempty"` + // UserFileURI - The URI of the file containing user information (in /etc/passwd file format). This field must be populated when 'usernameSource' is set to 'File'. + UserFileURI *string `json:"userFileURI,omitempty"` + // LdapServer - The fully qualified domain name or IP address of the LDAP server to use. + LdapServer *string `json:"ldapServer,omitempty"` + // LdapBaseDN - The base distinguished name for the LDAP domain. + LdapBaseDN *string `json:"ldapBaseDN,omitempty"` + // EncryptLdapConnection - Whether or not the LDAP connection should be encrypted. + EncryptLdapConnection *bool `json:"encryptLdapConnection,omitempty"` + // RequireValidCertificate - Determines if the certificates must be validated by a certificate authority. When true, caCertificateURI must be provided. + RequireValidCertificate *bool `json:"requireValidCertificate,omitempty"` + // AutoDownloadCertificate - Determines if the certificate should be automatically downloaded. This applies to 'caCertificateURI' only if 'requireValidCertificate' is true. + AutoDownloadCertificate *bool `json:"autoDownloadCertificate,omitempty"` + // CaCertificateURI - The URI of the CA certificate to validate the LDAP secure connection. This field must be populated when 'requireValidCertificate' is set to true. + CaCertificateURI *string `json:"caCertificateURI,omitempty"` + // UsernameDownloaded - READ-ONLY; Indicates whether or not the HPC Cache has performed the username download successfully. Possible values include: 'UsernameDownloadedTypeYes', 'UsernameDownloadedTypeNo', 'UsernameDownloadedTypeError' + UsernameDownloaded UsernameDownloadedType `json:"usernameDownloaded,omitempty"` + // Credentials - When present, these are the credentials for the secure LDAP connection. + Credentials *CacheUsernameDownloadSettingsCredentials `json:"credentials,omitempty"` +} + +// MarshalJSON is the custom marshaler for CacheUsernameDownloadSettings. +func (cuds CacheUsernameDownloadSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cuds.ExtendedGroups != nil { + objectMap["extendedGroups"] = cuds.ExtendedGroups + } + if cuds.UsernameSource != "" { + objectMap["usernameSource"] = cuds.UsernameSource + } + if cuds.GroupFileURI != nil { + objectMap["groupFileURI"] = cuds.GroupFileURI + } + if cuds.UserFileURI != nil { + objectMap["userFileURI"] = cuds.UserFileURI + } + if cuds.LdapServer != nil { + objectMap["ldapServer"] = cuds.LdapServer + } + if cuds.LdapBaseDN != nil { + objectMap["ldapBaseDN"] = cuds.LdapBaseDN + } + if cuds.EncryptLdapConnection != nil { + objectMap["encryptLdapConnection"] = cuds.EncryptLdapConnection + } + if cuds.RequireValidCertificate != nil { + objectMap["requireValidCertificate"] = cuds.RequireValidCertificate + } + if cuds.AutoDownloadCertificate != nil { + objectMap["autoDownloadCertificate"] = cuds.AutoDownloadCertificate + } + if cuds.CaCertificateURI != nil { + objectMap["caCertificateURI"] = cuds.CaCertificateURI + } + if cuds.Credentials != nil { + objectMap["credentials"] = cuds.Credentials + } + return json.Marshal(objectMap) +} + +// CacheUsernameDownloadSettingsCredentials when present, these are the credentials for the secure LDAP +// connection. +type CacheUsernameDownloadSettingsCredentials struct { + // BindDn - The Bind Distinguished Name identity to be used in the secure LDAP connection. This value is stored encrypted and not returned on response. + BindDn *string `json:"bindDn,omitempty"` + // BindPassword - The Bind password to be used in the secure LDAP connection. This value is stored encrypted and not returned on response. + BindPassword *string `json:"bindPassword,omitempty"` +} + +// ClfsTarget properties pertaining to the ClfsTarget +type ClfsTarget struct { + // Target - Resource ID of storage container. + Target *string `json:"target,omitempty"` +} + +// CloudError an error response. +type CloudError struct { + // Error - The body of the error. + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody an error response. +type CloudErrorBody struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Details - A list of additional details about the error. + Details *[]CloudErrorBody `json:"details,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + // Target - The target of the particular error. For example, the name of the property in error. + Target *string `json:"target,omitempty"` +} + +// Condition outstanding conditions that will need to be resolved. +type Condition struct { + // Timestamp - READ-ONLY; The time when the condition was raised. + Timestamp *date.Time `json:"timestamp,omitempty"` + // Message - READ-ONLY; The issue requiring attention. + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for Condition. +func (c Condition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponse describes the format of Error response. +type ErrorResponse struct { + // Code - Error code + Code *string `json:"code,omitempty"` + // Message - Error message indicating why the operation failed. + Message *string `json:"message,omitempty"` +} + +// KeyVaultKeyReference describes a reference to Key Vault Key. +type KeyVaultKeyReference struct { + // KeyURL - The URL referencing a key encryption key in Key Vault. + KeyURL *string `json:"keyUrl,omitempty"` + // SourceVault - Describes a resource Id to source Key Vault. + SourceVault *KeyVaultKeyReferenceSourceVault `json:"sourceVault,omitempty"` +} + +// KeyVaultKeyReferenceSourceVault describes a resource Id to source Key Vault. +type KeyVaultKeyReferenceSourceVault struct { + // ID - Resource Id. + ID *string `json:"id,omitempty"` +} + +// MetricDimension specifications of the Dimension of metrics. +type MetricDimension struct { + // Name - Name of the dimension + Name *string `json:"name,omitempty"` + // DisplayName - Localized friendly display name of the dimension + DisplayName *string `json:"displayName,omitempty"` + // InternalName - Internal name of the dimension. + InternalName *string `json:"internalName,omitempty"` + // ToBeExportedForShoebox - To be exported to shoe box. + ToBeExportedForShoebox *bool `json:"toBeExportedForShoebox,omitempty"` +} + +// MetricSpecification details about operation related to metrics. +type MetricSpecification struct { + // Name - The name of the metric. + Name *string `json:"name,omitempty"` + // DisplayName - Localized display name of the metric. + DisplayName *string `json:"displayName,omitempty"` + // DisplayDescription - The description of the metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + // Unit - The unit that the metric is measured in. + Unit *string `json:"unit,omitempty"` + // AggregationType - The type of metric aggregation. + AggregationType *string `json:"aggregationType,omitempty"` + // SupportedAggregationTypes - Support metric aggregation type. + SupportedAggregationTypes *[]MetricAggregationType `json:"supportedAggregationTypes,omitempty"` + // MetricClass - Type of metrics. + MetricClass *string `json:"metricClass,omitempty"` + // Dimensions - Dimensions of the metric + Dimensions *[]MetricDimension `json:"dimensions,omitempty"` +} + +// NamespaceJunction a namespace junction. +type NamespaceJunction struct { + // NamespacePath - Namespace path on a Cache for a Storage Target. + NamespacePath *string `json:"namespacePath,omitempty"` + // TargetPath - Path in Storage Target to which namespacePath points. + TargetPath *string `json:"targetPath,omitempty"` + // NfsExport - NFS export where targetPath exists. + NfsExport *string `json:"nfsExport,omitempty"` + // NfsAccessPolicy - Name of the access policy applied to this junction. + NfsAccessPolicy *string `json:"nfsAccessPolicy,omitempty"` +} + +// Nfs3Target properties pertaining to the Nfs3Target +type Nfs3Target struct { + // Target - IP address or host name of an NFSv3 host (e.g., 10.0.44.44). + Target *string `json:"target,omitempty"` + // UsageModel - Identifies the StorageCache usage model to be used for this storage target. + UsageModel *string `json:"usageModel,omitempty"` +} + +// NfsAccessPolicy a set of rules describing access policies applied to NFSv3 clients of the cache. +type NfsAccessPolicy struct { + // Name - Name identifying this policy. Access Policy names are not case sensitive. + Name *string `json:"name,omitempty"` + // AccessRules - The set of rules describing client accesses allowed under this policy. + AccessRules *[]NfsAccessRule `json:"accessRules,omitempty"` +} + +// NfsAccessRule rule to place restrictions on portions of the cache namespace being presented to clients. +type NfsAccessRule struct { + // Scope - Scope for this rule. The scope and filter determine which clients match the rule. Possible values include: 'NfsAccessRuleScopeDefault', 'NfsAccessRuleScopeNetwork', 'NfsAccessRuleScopeHost' + Scope NfsAccessRuleScope `json:"scope,omitempty"` + // Filter - Filter applied to the scope for this rule. The filter's format depends on its scope. 'default' scope matches all clients and has no filter value. 'network' scope takes a filter in CIDR format (for example, 10.99.1.0/24). 'host' takes an IP address or fully qualified domain name as filter. If a client does not match any filter rule and there is no default rule, access is denied. + Filter *string `json:"filter,omitempty"` + // Access - Access allowed by this rule. Possible values include: 'NfsAccessRuleAccessNo', 'NfsAccessRuleAccessRo', 'NfsAccessRuleAccessRw' + Access NfsAccessRuleAccess `json:"access,omitempty"` + // Suid - Allow SUID semantics. + Suid *bool `json:"suid,omitempty"` + // SubmountAccess - For the default policy, allow access to subdirectories under the root export. If this is set to no, clients can only mount the path '/'. If set to yes, clients can mount a deeper path, like '/a/b'. + SubmountAccess *bool `json:"submountAccess,omitempty"` + // RootSquash - Map root accesses to anonymousUID and anonymousGID. + RootSquash *bool `json:"rootSquash,omitempty"` + // AnonymousUID - UID value that replaces 0 when rootSquash is true. 65534 will be used if not provided. + AnonymousUID *string `json:"anonymousUID,omitempty"` + // AnonymousGID - GID value that replaces 0 when rootSquash is true. This will use the value of anonymousUID if not provided. + AnonymousGID *string `json:"anonymousGID,omitempty"` +} + +// ResourceSku a resource SKU. +type ResourceSku struct { + // ResourceType - READ-ONLY; The type of resource the SKU applies to. + ResourceType *string `json:"resourceType,omitempty"` + // Capabilities - A list of capabilities of this SKU, such as throughput or ops/sec. + Capabilities *[]ResourceSkuCapabilities `json:"capabilities,omitempty"` + // Locations - READ-ONLY; The set of locations where the SKU is available. This is the supported and registered Azure Geo Regions (e.g., West US, East US, Southeast Asia, etc.). + Locations *[]string `json:"locations,omitempty"` + // LocationInfo - The set of locations where the SKU is available. + LocationInfo *[]ResourceSkuLocationInfo `json:"locationInfo,omitempty"` + // Name - The name of this SKU. + Name *string `json:"name,omitempty"` + // Restrictions - The restrictions preventing this SKU from being used. This is empty if there are no restrictions. + Restrictions *[]Restriction `json:"restrictions,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceSku. +func (rs ResourceSku) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rs.Capabilities != nil { + objectMap["capabilities"] = rs.Capabilities + } + if rs.LocationInfo != nil { + objectMap["locationInfo"] = rs.LocationInfo + } + if rs.Name != nil { + objectMap["name"] = rs.Name + } + if rs.Restrictions != nil { + objectMap["restrictions"] = rs.Restrictions + } + return json.Marshal(objectMap) +} + +// ResourceSkuCapabilities a resource SKU capability. +type ResourceSkuCapabilities struct { + // Name - Name of a capability, such as ops/sec. + Name *string `json:"name,omitempty"` + // Value - Quantity, if the capability is measured by quantity. + Value *string `json:"value,omitempty"` +} + +// ResourceSkuLocationInfo resource SKU location information. +type ResourceSkuLocationInfo struct { + // Location - Location where this SKU is available. + Location *string `json:"location,omitempty"` + // Zones - Zones if any. + Zones *[]string `json:"zones,omitempty"` +} + +// ResourceSkusResult the response from the List Cache SKUs operation. +type ResourceSkusResult struct { + autorest.Response `json:"-"` + // NextLink - The URI to fetch the next page of Cache SKUs. + NextLink *string `json:"nextLink,omitempty"` + // Value - READ-ONLY; The list of SKUs available for the subscription. + Value *[]ResourceSku `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceSkusResult. +func (rsr ResourceSkusResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rsr.NextLink != nil { + objectMap["nextLink"] = rsr.NextLink + } + return json.Marshal(objectMap) +} + +// ResourceSkusResultIterator provides access to a complete listing of ResourceSku values. +type ResourceSkusResultIterator struct { + i int + page ResourceSkusResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ResourceSkusResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkusResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ResourceSkusResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourceSkusResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResourceSkusResultIterator) Response() ResourceSkusResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResourceSkusResultIterator) Value() ResourceSku { + if !iter.page.NotDone() { + return ResourceSku{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResourceSkusResultIterator type. +func NewResourceSkusResultIterator(page ResourceSkusResultPage) ResourceSkusResultIterator { + return ResourceSkusResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rsr ResourceSkusResult) IsEmpty() bool { + return rsr.Value == nil || len(*rsr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rsr ResourceSkusResult) hasNextLink() bool { + return rsr.NextLink != nil && len(*rsr.NextLink) != 0 +} + +// resourceSkusResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rsr ResourceSkusResult) resourceSkusResultPreparer(ctx context.Context) (*http.Request, error) { + if !rsr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rsr.NextLink))) +} + +// ResourceSkusResultPage contains a page of ResourceSku values. +type ResourceSkusResultPage struct { + fn func(context.Context, ResourceSkusResult) (ResourceSkusResult, error) + rsr ResourceSkusResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResourceSkusResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkusResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rsr) + if err != nil { + return err + } + page.rsr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ResourceSkusResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourceSkusResultPage) NotDone() bool { + return !page.rsr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourceSkusResultPage) Response() ResourceSkusResult { + return page.rsr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourceSkusResultPage) Values() []ResourceSku { + if page.rsr.IsEmpty() { + return nil + } + return *page.rsr.Value +} + +// Creates a new instance of the ResourceSkusResultPage type. +func NewResourceSkusResultPage(cur ResourceSkusResult, getNextPage func(context.Context, ResourceSkusResult) (ResourceSkusResult, error)) ResourceSkusResultPage { + return ResourceSkusResultPage{ + fn: getNextPage, + rsr: cur, + } +} + +// ResourceUsage the usage and limit (quota) for a resource. +type ResourceUsage struct { + // Limit - READ-ONLY; The limit (quota) for this resource. + Limit *int32 `json:"limit,omitempty"` + // Unit - READ-ONLY; Unit that the limit and usages are expressed in, such as 'Count'. + Unit *string `json:"unit,omitempty"` + // CurrentValue - READ-ONLY; The current usage of this resource. + CurrentValue *int32 `json:"currentValue,omitempty"` + // Name - READ-ONLY; Naming information for this resource type. + Name *ResourceUsageName `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceUsage. +func (ru ResourceUsage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceUsageName naming information for this resource type. +type ResourceUsageName struct { + // Value - Canonical name for this resource type. + Value *string `json:"value,omitempty"` + // LocalizedValue - Localized name for this resource type. + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// ResourceUsagesListResult result of the request to list resource usages. It contains a list of resource +// usages & limits and a URL link to get the next set of results. +type ResourceUsagesListResult struct { + autorest.Response `json:"-"` + // NextLink - READ-ONLY; URL to get the next set of resource usage list results if there are any. + NextLink *string `json:"nextLink,omitempty"` + // Value - READ-ONLY; List of usages and limits for resources controlled by the Microsoft.StorageCache resource provider. + Value *[]ResourceUsage `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceUsagesListResult. +func (rulr ResourceUsagesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceUsagesListResultIterator provides access to a complete listing of ResourceUsage values. +type ResourceUsagesListResultIterator struct { + i int + page ResourceUsagesListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ResourceUsagesListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceUsagesListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ResourceUsagesListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourceUsagesListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResourceUsagesListResultIterator) Response() ResourceUsagesListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResourceUsagesListResultIterator) Value() ResourceUsage { + if !iter.page.NotDone() { + return ResourceUsage{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResourceUsagesListResultIterator type. +func NewResourceUsagesListResultIterator(page ResourceUsagesListResultPage) ResourceUsagesListResultIterator { + return ResourceUsagesListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rulr ResourceUsagesListResult) IsEmpty() bool { + return rulr.Value == nil || len(*rulr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rulr ResourceUsagesListResult) hasNextLink() bool { + return rulr.NextLink != nil && len(*rulr.NextLink) != 0 +} + +// resourceUsagesListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rulr ResourceUsagesListResult) resourceUsagesListResultPreparer(ctx context.Context) (*http.Request, error) { + if !rulr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rulr.NextLink))) +} + +// ResourceUsagesListResultPage contains a page of ResourceUsage values. +type ResourceUsagesListResultPage struct { + fn func(context.Context, ResourceUsagesListResult) (ResourceUsagesListResult, error) + rulr ResourceUsagesListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResourceUsagesListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceUsagesListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rulr) + if err != nil { + return err + } + page.rulr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ResourceUsagesListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourceUsagesListResultPage) NotDone() bool { + return !page.rulr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourceUsagesListResultPage) Response() ResourceUsagesListResult { + return page.rulr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourceUsagesListResultPage) Values() []ResourceUsage { + if page.rulr.IsEmpty() { + return nil + } + return *page.rulr.Value +} + +// Creates a new instance of the ResourceUsagesListResultPage type. +func NewResourceUsagesListResultPage(cur ResourceUsagesListResult, getNextPage func(context.Context, ResourceUsagesListResult) (ResourceUsagesListResult, error)) ResourceUsagesListResultPage { + return ResourceUsagesListResultPage{ + fn: getNextPage, + rulr: cur, + } +} + +// Restriction the restrictions preventing this SKU from being used. +type Restriction struct { + // Type - READ-ONLY; The type of restrictions. In this version, the only possible value for this is location. + Type *string `json:"type,omitempty"` + // Values - READ-ONLY; The value of restrictions. If the restriction type is set to location, then this would be the different locations where the SKU is restricted. + Values *[]string `json:"values,omitempty"` + // ReasonCode - The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". "QuotaId" is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. "NotAvailableForSubscription" is related to capacity at the datacenter. Possible values include: 'ReasonCodeQuotaID', 'ReasonCodeNotAvailableForSubscription' + ReasonCode ReasonCode `json:"reasonCode,omitempty"` +} + +// MarshalJSON is the custom marshaler for Restriction. +func (r Restriction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.ReasonCode != "" { + objectMap["reasonCode"] = r.ReasonCode + } + return json.Marshal(objectMap) +} + +// StorageTarget type of the Storage Target. +type StorageTarget struct { + autorest.Response `json:"-"` + // StorageTargetProperties - StorageTarget properties + *StorageTargetProperties `json:"properties,omitempty"` + // Name - READ-ONLY; Name of the Storage Target. + Name *string `json:"name,omitempty"` + // ID - READ-ONLY; Resource ID of the Storage Target. + ID *string `json:"id,omitempty"` + // Type - READ-ONLY; Type of the Storage Target; Microsoft.StorageCache/Cache/StorageTarget + Type *string `json:"type,omitempty"` + // Location - READ-ONLY; Region name string. + Location *string `json:"location,omitempty"` + // SystemData - READ-ONLY; The system meta data relating to this resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for StorageTarget. +func (st StorageTarget) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if st.StorageTargetProperties != nil { + objectMap["properties"] = st.StorageTargetProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for StorageTarget struct. +func (st *StorageTarget) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var storageTargetProperties StorageTargetProperties + err = json.Unmarshal(*v, &storageTargetProperties) + if err != nil { + return err + } + st.StorageTargetProperties = &storageTargetProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + st.Name = &name + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + st.ID = &ID + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + st.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + st.Location = &location + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + st.SystemData = &systemData + } + } + } + + return nil +} + +// StorageTargetFlushFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type StorageTargetFlushFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StorageTargetClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *StorageTargetFlushFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for StorageTargetFlushFuture.Result. +func (future *StorageTargetFlushFuture) result(client StorageTargetClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.StorageTargetFlushFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("storagecache.StorageTargetFlushFuture") + return + } + ar.Response = future.Response() + return +} + +// StorageTargetInvalidateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type StorageTargetInvalidateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StorageTargetClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *StorageTargetInvalidateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for StorageTargetInvalidateFuture.Result. +func (future *StorageTargetInvalidateFuture) result(client StorageTargetClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.StorageTargetInvalidateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("storagecache.StorageTargetInvalidateFuture") + return + } + ar.Response = future.Response() + return +} + +// StorageTargetProperties properties of the Storage Target. +type StorageTargetProperties struct { + // Junctions - List of Cache namespace junctions to target for namespace associations. + Junctions *[]NamespaceJunction `json:"junctions,omitempty"` + // TargetType - Type of the Storage Target. Possible values include: 'StorageTargetTypeNfs3', 'StorageTargetTypeClfs', 'StorageTargetTypeUnknown', 'StorageTargetTypeBlobNfs' + TargetType StorageTargetType `json:"targetType,omitempty"` + // ProvisioningState - READ-ONLY; ARM provisioning state, see https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. Possible values include: 'ProvisioningStateTypeSucceeded', 'ProvisioningStateTypeFailed', 'ProvisioningStateTypeCancelled', 'ProvisioningStateTypeCreating', 'ProvisioningStateTypeDeleting', 'ProvisioningStateTypeUpdating' + ProvisioningState ProvisioningStateType `json:"provisioningState,omitempty"` + // State - Storage target operational state. Possible values include: 'OperationalStateTypeReady', 'OperationalStateTypeBusy', 'OperationalStateTypeSuspended', 'OperationalStateTypeFlushing' + State OperationalStateType `json:"state,omitempty"` + // Nfs3 - Properties when targetType is nfs3. + Nfs3 *Nfs3Target `json:"nfs3,omitempty"` + // Clfs - Properties when targetType is clfs. + Clfs *ClfsTarget `json:"clfs,omitempty"` + // Unknown - Properties when targetType is unknown. + Unknown *UnknownTarget `json:"unknown,omitempty"` + // BlobNfs - Properties when targetType is blobNfs. + BlobNfs *BlobNfsTarget `json:"blobNfs,omitempty"` +} + +// MarshalJSON is the custom marshaler for StorageTargetProperties. +func (stp StorageTargetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if stp.Junctions != nil { + objectMap["junctions"] = stp.Junctions + } + if stp.TargetType != "" { + objectMap["targetType"] = stp.TargetType + } + if stp.State != "" { + objectMap["state"] = stp.State + } + if stp.Nfs3 != nil { + objectMap["nfs3"] = stp.Nfs3 + } + if stp.Clfs != nil { + objectMap["clfs"] = stp.Clfs + } + if stp.Unknown != nil { + objectMap["unknown"] = stp.Unknown + } + if stp.BlobNfs != nil { + objectMap["blobNfs"] = stp.BlobNfs + } + return json.Marshal(objectMap) +} + +// StorageTargetResource resource used by a Cache. +type StorageTargetResource struct { + // Name - READ-ONLY; Name of the Storage Target. + Name *string `json:"name,omitempty"` + // ID - READ-ONLY; Resource ID of the Storage Target. + ID *string `json:"id,omitempty"` + // Type - READ-ONLY; Type of the Storage Target; Microsoft.StorageCache/Cache/StorageTarget + Type *string `json:"type,omitempty"` + // Location - READ-ONLY; Region name string. + Location *string `json:"location,omitempty"` + // SystemData - READ-ONLY; The system meta data relating to this resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for StorageTargetResource. +func (str StorageTargetResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// StorageTargetResumeFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type StorageTargetResumeFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StorageTargetClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *StorageTargetResumeFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for StorageTargetResumeFuture.Result. +func (future *StorageTargetResumeFuture) result(client StorageTargetClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.StorageTargetResumeFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("storagecache.StorageTargetResumeFuture") + return + } + ar.Response = future.Response() + return +} + +// StorageTargetsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type StorageTargetsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StorageTargetsClient) (StorageTarget, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *StorageTargetsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for StorageTargetsCreateOrUpdateFuture.Result. +func (future *StorageTargetsCreateOrUpdateFuture) result(client StorageTargetsClient) (st StorageTarget, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.StorageTargetsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + st.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("storagecache.StorageTargetsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if st.Response.Response, err = future.GetResult(sender); err == nil && st.Response.Response.StatusCode != http.StatusNoContent { + st, err = client.CreateOrUpdateResponder(st.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.StorageTargetsCreateOrUpdateFuture", "Result", st.Response.Response, "Failure responding to request") + } + } + return +} + +// StorageTargetsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type StorageTargetsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StorageTargetsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *StorageTargetsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for StorageTargetsDeleteFuture.Result. +func (future *StorageTargetsDeleteFuture) result(client StorageTargetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.StorageTargetsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("storagecache.StorageTargetsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// StorageTargetsDNSRefreshFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type StorageTargetsDNSRefreshFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StorageTargetsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *StorageTargetsDNSRefreshFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for StorageTargetsDNSRefreshFuture.Result. +func (future *StorageTargetsDNSRefreshFuture) result(client StorageTargetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.StorageTargetsDNSRefreshFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("storagecache.StorageTargetsDNSRefreshFuture") + return + } + ar.Response = future.Response() + return +} + +// StorageTargetsResult a list of Storage Targets. +type StorageTargetsResult struct { + autorest.Response `json:"-"` + // NextLink - The URI to fetch the next page of Storage Targets. + NextLink *string `json:"nextLink,omitempty"` + // Value - The list of Storage Targets defined for the Cache. + Value *[]StorageTarget `json:"value,omitempty"` +} + +// StorageTargetsResultIterator provides access to a complete listing of StorageTarget values. +type StorageTargetsResultIterator struct { + i int + page StorageTargetsResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *StorageTargetsResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StorageTargetsResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *StorageTargetsResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter StorageTargetsResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter StorageTargetsResultIterator) Response() StorageTargetsResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter StorageTargetsResultIterator) Value() StorageTarget { + if !iter.page.NotDone() { + return StorageTarget{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the StorageTargetsResultIterator type. +func NewStorageTargetsResultIterator(page StorageTargetsResultPage) StorageTargetsResultIterator { + return StorageTargetsResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (str StorageTargetsResult) IsEmpty() bool { + return str.Value == nil || len(*str.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (str StorageTargetsResult) hasNextLink() bool { + return str.NextLink != nil && len(*str.NextLink) != 0 +} + +// storageTargetsResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (str StorageTargetsResult) storageTargetsResultPreparer(ctx context.Context) (*http.Request, error) { + if !str.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(str.NextLink))) +} + +// StorageTargetsResultPage contains a page of StorageTarget values. +type StorageTargetsResultPage struct { + fn func(context.Context, StorageTargetsResult) (StorageTargetsResult, error) + str StorageTargetsResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *StorageTargetsResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StorageTargetsResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.str) + if err != nil { + return err + } + page.str = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *StorageTargetsResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page StorageTargetsResultPage) NotDone() bool { + return !page.str.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page StorageTargetsResultPage) Response() StorageTargetsResult { + return page.str +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page StorageTargetsResultPage) Values() []StorageTarget { + if page.str.IsEmpty() { + return nil + } + return *page.str.Value +} + +// Creates a new instance of the StorageTargetsResultPage type. +func NewStorageTargetsResultPage(cur StorageTargetsResult, getNextPage func(context.Context, StorageTargetsResult) (StorageTargetsResult, error)) StorageTargetsResultPage { + return StorageTargetsResultPage{ + fn: getNextPage, + str: cur, + } +} + +// StorageTargetSuspendFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type StorageTargetSuspendFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StorageTargetClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *StorageTargetSuspendFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for StorageTargetSuspendFuture.Result. +func (future *StorageTargetSuspendFuture) result(client StorageTargetClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.StorageTargetSuspendFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("storagecache.StorageTargetSuspendFuture") + return + } + ar.Response = future.Response() + return +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// UnknownTarget properties pertaining to the UnknownTarget +type UnknownTarget struct { + // Attributes - Dictionary of string->string pairs containing information about the Storage Target. + Attributes map[string]*string `json:"attributes"` +} + +// MarshalJSON is the custom marshaler for UnknownTarget. +func (ut UnknownTarget) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ut.Attributes != nil { + objectMap["attributes"] = ut.Attributes + } + return json.Marshal(objectMap) +} + +// UsageModel a usage model. +type UsageModel struct { + // Display - Localized information describing this usage model. + Display *UsageModelDisplay `json:"display,omitempty"` + // ModelName - Non-localized keyword name for this usage model. + ModelName *string `json:"modelName,omitempty"` + // TargetType - The type of Storage Target to which this model is applicable (only nfs3 as of this version). + TargetType *string `json:"targetType,omitempty"` +} + +// UsageModelDisplay localized information describing this usage model. +type UsageModelDisplay struct { + // Description - String to display for this usage model. + Description *string `json:"description,omitempty"` +} + +// UsageModelsResult a list of Cache usage models. +type UsageModelsResult struct { + autorest.Response `json:"-"` + // NextLink - The URI to fetch the next page of Cache usage models. + NextLink *string `json:"nextLink,omitempty"` + // Value - The list of usage models available for the subscription. + Value *[]UsageModel `json:"value,omitempty"` +} + +// UsageModelsResultIterator provides access to a complete listing of UsageModel values. +type UsageModelsResultIterator struct { + i int + page UsageModelsResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *UsageModelsResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsageModelsResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *UsageModelsResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter UsageModelsResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter UsageModelsResultIterator) Response() UsageModelsResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter UsageModelsResultIterator) Value() UsageModel { + if !iter.page.NotDone() { + return UsageModel{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the UsageModelsResultIterator type. +func NewUsageModelsResultIterator(page UsageModelsResultPage) UsageModelsResultIterator { + return UsageModelsResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (umr UsageModelsResult) IsEmpty() bool { + return umr.Value == nil || len(*umr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (umr UsageModelsResult) hasNextLink() bool { + return umr.NextLink != nil && len(*umr.NextLink) != 0 +} + +// usageModelsResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (umr UsageModelsResult) usageModelsResultPreparer(ctx context.Context) (*http.Request, error) { + if !umr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(umr.NextLink))) +} + +// UsageModelsResultPage contains a page of UsageModel values. +type UsageModelsResultPage struct { + fn func(context.Context, UsageModelsResult) (UsageModelsResult, error) + umr UsageModelsResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *UsageModelsResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsageModelsResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.umr) + if err != nil { + return err + } + page.umr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *UsageModelsResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page UsageModelsResultPage) NotDone() bool { + return !page.umr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page UsageModelsResultPage) Response() UsageModelsResult { + return page.umr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page UsageModelsResultPage) Values() []UsageModel { + if page.umr.IsEmpty() { + return nil + } + return *page.umr.Value +} + +// Creates a new instance of the UsageModelsResultPage type. +func NewUsageModelsResultPage(cur UsageModelsResult, getNextPage func(context.Context, UsageModelsResult) (UsageModelsResult, error)) UsageModelsResultPage { + return UsageModelsResultPage{ + fn: getNextPage, + umr: cur, + } +} diff --git a/services/storagecache/mgmt/2022-01-01/storagecache/operations.go b/services/storagecache/mgmt/2022-01-01/storagecache/operations.go new file mode 100644 index 000000000000..d599ae442fa3 --- /dev/null +++ b/services/storagecache/mgmt/2022-01-01/storagecache/operations.go @@ -0,0 +1,141 @@ +package storagecache + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the a Storage Cache provides scalable caching service for NAS clients, serving data from either +// NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). These operations allow you to manage Caches. +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available Resource Provider operations. +func (client OperationsClient) List(ctx context.Context) (result APIOperationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.aolr.Response.Response != nil { + sc = result.aolr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.aolr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storagecache.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.aolr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.aolr.hasNextLink() && result.aolr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.StorageCache/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result APIOperationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults APIOperationListResult) (result APIOperationListResult, err error) { + req, err := lastResults.aPIOperationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "storagecache.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "storagecache.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result APIOperationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/storagecache/mgmt/2022-01-01/storagecache/skus.go b/services/storagecache/mgmt/2022-01-01/storagecache/skus.go new file mode 100644 index 000000000000..9360ca7c0da2 --- /dev/null +++ b/services/storagecache/mgmt/2022-01-01/storagecache/skus.go @@ -0,0 +1,145 @@ +package storagecache + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SkusClient is the a Storage Cache provides scalable caching service for NAS clients, serving data from either NFSv3 +// or Blob at-rest storage (referred to as "Storage Targets"). These operations allow you to manage Caches. +type SkusClient struct { + BaseClient +} + +// NewSkusClient creates an instance of the SkusClient client. +func NewSkusClient(subscriptionID string) SkusClient { + return NewSkusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSkusClientWithBaseURI creates an instance of the SkusClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewSkusClientWithBaseURI(baseURI string, subscriptionID string) SkusClient { + return SkusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List get the list of StorageCache.Cache SKUs available to this subscription. +func (client SkusClient) List(ctx context.Context) (result ResourceSkusResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SkusClient.List") + defer func() { + sc := -1 + if result.rsr.Response.Response != nil { + sc = result.rsr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.SkusClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rsr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storagecache.SkusClient", "List", resp, "Failure sending request") + return + } + + result.rsr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.SkusClient", "List", resp, "Failure responding to request") + return + } + if result.rsr.hasNextLink() && result.rsr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SkusClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/skus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SkusClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SkusClient) ListResponder(resp *http.Response) (result ResourceSkusResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SkusClient) listNextResults(ctx context.Context, lastResults ResourceSkusResult) (result ResourceSkusResult, err error) { + req, err := lastResults.resourceSkusResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "storagecache.SkusClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "storagecache.SkusClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.SkusClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SkusClient) ListComplete(ctx context.Context) (result ResourceSkusResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SkusClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/storagecache/mgmt/2022-01-01/storagecache/storagecacheapi/interfaces.go b/services/storagecache/mgmt/2022-01-01/storagecache/storagecacheapi/interfaces.go new file mode 100644 index 000000000000..b79f6aa6ed58 --- /dev/null +++ b/services/storagecache/mgmt/2022-01-01/storagecache/storagecacheapi/interfaces.go @@ -0,0 +1,92 @@ +package storagecacheapi + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2022-01-01/storagecache" +) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result storagecache.APIOperationListResultPage, err error) + ListComplete(ctx context.Context) (result storagecache.APIOperationListResultIterator, err error) +} + +var _ OperationsClientAPI = (*storagecache.OperationsClient)(nil) + +// SkusClientAPI contains the set of methods on the SkusClient type. +type SkusClientAPI interface { + List(ctx context.Context) (result storagecache.ResourceSkusResultPage, err error) + ListComplete(ctx context.Context) (result storagecache.ResourceSkusResultIterator, err error) +} + +var _ SkusClientAPI = (*storagecache.SkusClient)(nil) + +// UsageModelsClientAPI contains the set of methods on the UsageModelsClient type. +type UsageModelsClientAPI interface { + List(ctx context.Context) (result storagecache.UsageModelsResultPage, err error) + ListComplete(ctx context.Context) (result storagecache.UsageModelsResultIterator, err error) +} + +var _ UsageModelsClientAPI = (*storagecache.UsageModelsClient)(nil) + +// AscOperationsClientAPI contains the set of methods on the AscOperationsClient type. +type AscOperationsClientAPI interface { + Get(ctx context.Context, location string, operationID string) (result storagecache.AscOperation, err error) +} + +var _ AscOperationsClientAPI = (*storagecache.AscOperationsClient)(nil) + +// AscUsagesClientAPI contains the set of methods on the AscUsagesClient type. +type AscUsagesClientAPI interface { + List(ctx context.Context, location string) (result storagecache.ResourceUsagesListResultPage, err error) + ListComplete(ctx context.Context, location string) (result storagecache.ResourceUsagesListResultIterator, err error) +} + +var _ AscUsagesClientAPI = (*storagecache.AscUsagesClient)(nil) + +// CachesClientAPI contains the set of methods on the CachesClient type. +type CachesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, cacheName string, cache *storagecache.Cache) (result storagecache.CachesCreateOrUpdateFuture, err error) + DebugInfo(ctx context.Context, resourceGroupName string, cacheName string) (result storagecache.CachesDebugInfoFuture, err error) + Delete(ctx context.Context, resourceGroupName string, cacheName string) (result storagecache.CachesDeleteFuture, err error) + Flush(ctx context.Context, resourceGroupName string, cacheName string) (result storagecache.CachesFlushFuture, err error) + Get(ctx context.Context, resourceGroupName string, cacheName string) (result storagecache.Cache, err error) + List(ctx context.Context) (result storagecache.CachesListResultPage, err error) + ListComplete(ctx context.Context) (result storagecache.CachesListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result storagecache.CachesListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result storagecache.CachesListResultIterator, err error) + Start(ctx context.Context, resourceGroupName string, cacheName string) (result storagecache.CachesStartFuture, err error) + Stop(ctx context.Context, resourceGroupName string, cacheName string) (result storagecache.CachesStopFuture, err error) + Update(ctx context.Context, resourceGroupName string, cacheName string, cache *storagecache.Cache) (result storagecache.Cache, err error) + UpgradeFirmware(ctx context.Context, resourceGroupName string, cacheName string) (result storagecache.CachesUpgradeFirmwareFuture, err error) +} + +var _ CachesClientAPI = (*storagecache.CachesClient)(nil) + +// StorageTargetsClientAPI contains the set of methods on the StorageTargetsClient type. +type StorageTargetsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string, storagetarget *storagecache.StorageTarget) (result storagecache.StorageTargetsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string, force string) (result storagecache.StorageTargetsDeleteFuture, err error) + DNSRefresh(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string) (result storagecache.StorageTargetsDNSRefreshFuture, err error) + Get(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string) (result storagecache.StorageTarget, err error) + ListByCache(ctx context.Context, resourceGroupName string, cacheName string) (result storagecache.StorageTargetsResultPage, err error) + ListByCacheComplete(ctx context.Context, resourceGroupName string, cacheName string) (result storagecache.StorageTargetsResultIterator, err error) +} + +var _ StorageTargetsClientAPI = (*storagecache.StorageTargetsClient)(nil) + +// StorageTargetClientAPI contains the set of methods on the StorageTargetClient type. +type StorageTargetClientAPI interface { + Flush(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string) (result storagecache.StorageTargetFlushFuture, err error) + Invalidate(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string) (result storagecache.StorageTargetInvalidateFuture, err error) + Resume(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string) (result storagecache.StorageTargetResumeFuture, err error) + Suspend(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string) (result storagecache.StorageTargetSuspendFuture, err error) +} + +var _ StorageTargetClientAPI = (*storagecache.StorageTargetClient)(nil) diff --git a/services/storagecache/mgmt/2022-01-01/storagecache/storagetarget.go b/services/storagecache/mgmt/2022-01-01/storagecache/storagetarget.go new file mode 100644 index 000000000000..40bfb53daed2 --- /dev/null +++ b/services/storagecache/mgmt/2022-01-01/storagecache/storagetarget.go @@ -0,0 +1,392 @@ +package storagecache + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// StorageTargetClient is the a Storage Cache provides scalable caching service for NAS clients, serving data from +// either NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). These operations allow you to manage +// Caches. +type StorageTargetClient struct { + BaseClient +} + +// NewStorageTargetClient creates an instance of the StorageTargetClient client. +func NewStorageTargetClient(subscriptionID string) StorageTargetClient { + return NewStorageTargetClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewStorageTargetClientWithBaseURI creates an instance of the StorageTargetClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewStorageTargetClientWithBaseURI(baseURI string, subscriptionID string) StorageTargetClient { + return StorageTargetClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Flush tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to this +// storage target's namespace will return errors until the flush operation completes. +// Parameters: +// resourceGroupName - target resource group. +// cacheName - name of Cache. Length of name must not be greater than 80 and chars must be from the +// [-0-9a-zA-Z_] char class. +// storageTargetName - name of Storage Target. +func (client StorageTargetClient) Flush(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string) (result StorageTargetFlushFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StorageTargetClient.Flush") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: cacheName, + Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}, + {TargetValue: storageTargetName, + Constraints: []validation.Constraint{{Target: "storageTargetName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("storagecache.StorageTargetClient", "Flush", err.Error()) + } + + req, err := client.FlushPreparer(ctx, resourceGroupName, cacheName, storageTargetName) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.StorageTargetClient", "Flush", nil, "Failure preparing request") + return + } + + result, err = client.FlushSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.StorageTargetClient", "Flush", result.Response(), "Failure sending request") + return + } + + return +} + +// FlushPreparer prepares the Flush request. +func (client StorageTargetClient) FlushPreparer(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cacheName": autorest.Encode("path", cacheName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "storageTargetName": autorest.Encode("path", storageTargetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/flush", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// FlushSender sends the Flush request. The method will close the +// http.Response Body if it receives an error. +func (client StorageTargetClient) FlushSender(req *http.Request) (future StorageTargetFlushFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// FlushResponder handles the response to the Flush request. The method always +// closes the http.Response Body. +func (client StorageTargetClient) FlushResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Invalidate invalidate all cached data for a storage target. Cached files are discarded and fetched from the back end +// on the next request. +// Parameters: +// resourceGroupName - target resource group. +// cacheName - name of Cache. Length of name must not be greater than 80 and chars must be from the +// [-0-9a-zA-Z_] char class. +// storageTargetName - name of Storage Target. +func (client StorageTargetClient) Invalidate(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string) (result StorageTargetInvalidateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StorageTargetClient.Invalidate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: cacheName, + Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}, + {TargetValue: storageTargetName, + Constraints: []validation.Constraint{{Target: "storageTargetName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("storagecache.StorageTargetClient", "Invalidate", err.Error()) + } + + req, err := client.InvalidatePreparer(ctx, resourceGroupName, cacheName, storageTargetName) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.StorageTargetClient", "Invalidate", nil, "Failure preparing request") + return + } + + result, err = client.InvalidateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.StorageTargetClient", "Invalidate", result.Response(), "Failure sending request") + return + } + + return +} + +// InvalidatePreparer prepares the Invalidate request. +func (client StorageTargetClient) InvalidatePreparer(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cacheName": autorest.Encode("path", cacheName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "storageTargetName": autorest.Encode("path", storageTargetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/invalidate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// InvalidateSender sends the Invalidate request. The method will close the +// http.Response Body if it receives an error. +func (client StorageTargetClient) InvalidateSender(req *http.Request) (future StorageTargetInvalidateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// InvalidateResponder handles the response to the Invalidate request. The method always +// closes the http.Response Body. +func (client StorageTargetClient) InvalidateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Resume resumes client access to a previously suspended storage target. +// Parameters: +// resourceGroupName - target resource group. +// cacheName - name of Cache. Length of name must not be greater than 80 and chars must be from the +// [-0-9a-zA-Z_] char class. +// storageTargetName - name of Storage Target. +func (client StorageTargetClient) Resume(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string) (result StorageTargetResumeFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StorageTargetClient.Resume") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: cacheName, + Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}, + {TargetValue: storageTargetName, + Constraints: []validation.Constraint{{Target: "storageTargetName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("storagecache.StorageTargetClient", "Resume", err.Error()) + } + + req, err := client.ResumePreparer(ctx, resourceGroupName, cacheName, storageTargetName) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.StorageTargetClient", "Resume", nil, "Failure preparing request") + return + } + + result, err = client.ResumeSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.StorageTargetClient", "Resume", result.Response(), "Failure sending request") + return + } + + return +} + +// ResumePreparer prepares the Resume request. +func (client StorageTargetClient) ResumePreparer(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cacheName": autorest.Encode("path", cacheName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "storageTargetName": autorest.Encode("path", storageTargetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/resume", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResumeSender sends the Resume request. The method will close the +// http.Response Body if it receives an error. +func (client StorageTargetClient) ResumeSender(req *http.Request) (future StorageTargetResumeFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ResumeResponder handles the response to the Resume request. The method always +// closes the http.Response Body. +func (client StorageTargetClient) ResumeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Suspend suspends client access to a storage target. +// Parameters: +// resourceGroupName - target resource group. +// cacheName - name of Cache. Length of name must not be greater than 80 and chars must be from the +// [-0-9a-zA-Z_] char class. +// storageTargetName - name of Storage Target. +func (client StorageTargetClient) Suspend(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string) (result StorageTargetSuspendFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StorageTargetClient.Suspend") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: cacheName, + Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}, + {TargetValue: storageTargetName, + Constraints: []validation.Constraint{{Target: "storageTargetName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("storagecache.StorageTargetClient", "Suspend", err.Error()) + } + + req, err := client.SuspendPreparer(ctx, resourceGroupName, cacheName, storageTargetName) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.StorageTargetClient", "Suspend", nil, "Failure preparing request") + return + } + + result, err = client.SuspendSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.StorageTargetClient", "Suspend", result.Response(), "Failure sending request") + return + } + + return +} + +// SuspendPreparer prepares the Suspend request. +func (client StorageTargetClient) SuspendPreparer(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cacheName": autorest.Encode("path", cacheName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "storageTargetName": autorest.Encode("path", storageTargetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/suspend", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SuspendSender sends the Suspend request. The method will close the +// http.Response Body if it receives an error. +func (client StorageTargetClient) SuspendSender(req *http.Request) (future StorageTargetSuspendFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// SuspendResponder handles the response to the Suspend request. The method always +// closes the http.Response Body. +func (client StorageTargetClient) SuspendResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/storagecache/mgmt/2022-01-01/storagecache/storagetargets.go b/services/storagecache/mgmt/2022-01-01/storagecache/storagetargets.go new file mode 100644 index 000000000000..bf499339621b --- /dev/null +++ b/services/storagecache/mgmt/2022-01-01/storagecache/storagetargets.go @@ -0,0 +1,538 @@ +package storagecache + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// StorageTargetsClient is the a Storage Cache provides scalable caching service for NAS clients, serving data from +// either NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). These operations allow you to manage +// Caches. +type StorageTargetsClient struct { + BaseClient +} + +// NewStorageTargetsClient creates an instance of the StorageTargetsClient client. +func NewStorageTargetsClient(subscriptionID string) StorageTargetsClient { + return NewStorageTargetsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewStorageTargetsClientWithBaseURI creates an instance of the StorageTargetsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewStorageTargetsClientWithBaseURI(baseURI string, subscriptionID string) StorageTargetsClient { + return StorageTargetsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or +// unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. +// Parameters: +// resourceGroupName - target resource group. +// cacheName - name of Cache. Length of name must not be greater than 80 and chars must be from the +// [-0-9a-zA-Z_] char class. +// storageTargetName - name of Storage Target. +// storagetarget - object containing the definition of a Storage Target. +func (client StorageTargetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string, storagetarget *StorageTarget) (result StorageTargetsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StorageTargetsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: cacheName, + Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}, + {TargetValue: storageTargetName, + Constraints: []validation.Constraint{{Target: "storageTargetName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}, + {TargetValue: storagetarget, + Constraints: []validation.Constraint{{Target: "storagetarget", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "storagetarget.StorageTargetProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "storagetarget.StorageTargetProperties.Nfs3", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "storagetarget.StorageTargetProperties.Nfs3.Target", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "storagetarget.StorageTargetProperties.Nfs3.Target", Name: validation.Pattern, Rule: `^[-.,0-9a-zA-Z]+$`, Chain: nil}}}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("storagecache.StorageTargetsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, cacheName, storageTargetName, storagetarget) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.StorageTargetsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.StorageTargetsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client StorageTargetsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string, storagetarget *StorageTarget) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cacheName": autorest.Encode("path", cacheName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "storageTargetName": autorest.Encode("path", storageTargetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if storagetarget != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(storagetarget)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client StorageTargetsClient) CreateOrUpdateSender(req *http.Request) (future StorageTargetsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client StorageTargetsClient) CreateOrUpdateResponder(resp *http.Response) (result StorageTarget, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or +// unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if +// the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be +// deleted. +// Parameters: +// resourceGroupName - target resource group. +// cacheName - name of Cache. Length of name must not be greater than 80 and chars must be from the +// [-0-9a-zA-Z_] char class. +// storageTargetName - name of Storage Target. +// force - boolean value requesting the force delete operation for a storage target. Force delete discards +// unwritten-data in the cache instead of flushing it to back-end storage. +func (client StorageTargetsClient) Delete(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string, force string) (result StorageTargetsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StorageTargetsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: cacheName, + Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}, + {TargetValue: storageTargetName, + Constraints: []validation.Constraint{{Target: "storageTargetName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("storagecache.StorageTargetsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, cacheName, storageTargetName, force) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.StorageTargetsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.StorageTargetsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client StorageTargetsClient) DeletePreparer(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string, force string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cacheName": autorest.Encode("path", cacheName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "storageTargetName": autorest.Encode("path", storageTargetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(force) > 0 { + queryParameters["force"] = autorest.Encode("query", force) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client StorageTargetsClient) DeleteSender(req *http.Request) (future StorageTargetsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client StorageTargetsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DNSRefresh tells a storage target to refresh its DNS information. +// Parameters: +// resourceGroupName - target resource group. +// cacheName - name of Cache. Length of name must not be greater than 80 and chars must be from the +// [-0-9a-zA-Z_] char class. +// storageTargetName - name of Storage Target. +func (client StorageTargetsClient) DNSRefresh(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string) (result StorageTargetsDNSRefreshFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StorageTargetsClient.DNSRefresh") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: cacheName, + Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}, + {TargetValue: storageTargetName, + Constraints: []validation.Constraint{{Target: "storageTargetName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("storagecache.StorageTargetsClient", "DNSRefresh", err.Error()) + } + + req, err := client.DNSRefreshPreparer(ctx, resourceGroupName, cacheName, storageTargetName) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.StorageTargetsClient", "DNSRefresh", nil, "Failure preparing request") + return + } + + result, err = client.DNSRefreshSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.StorageTargetsClient", "DNSRefresh", result.Response(), "Failure sending request") + return + } + + return +} + +// DNSRefreshPreparer prepares the DNSRefresh request. +func (client StorageTargetsClient) DNSRefreshPreparer(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cacheName": autorest.Encode("path", cacheName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "storageTargetName": autorest.Encode("path", storageTargetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/dnsRefresh", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DNSRefreshSender sends the DNSRefresh request. The method will close the +// http.Response Body if it receives an error. +func (client StorageTargetsClient) DNSRefreshSender(req *http.Request) (future StorageTargetsDNSRefreshFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DNSRefreshResponder handles the response to the DNSRefresh request. The method always +// closes the http.Response Body. +func (client StorageTargetsClient) DNSRefreshResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get returns a Storage Target from a Cache. +// Parameters: +// resourceGroupName - target resource group. +// cacheName - name of Cache. Length of name must not be greater than 80 and chars must be from the +// [-0-9a-zA-Z_] char class. +// storageTargetName - name of Storage Target. +func (client StorageTargetsClient) Get(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string) (result StorageTarget, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StorageTargetsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: cacheName, + Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}, + {TargetValue: storageTargetName, + Constraints: []validation.Constraint{{Target: "storageTargetName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("storagecache.StorageTargetsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, cacheName, storageTargetName) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.StorageTargetsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storagecache.StorageTargetsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.StorageTargetsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client StorageTargetsClient) GetPreparer(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cacheName": autorest.Encode("path", cacheName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "storageTargetName": autorest.Encode("path", storageTargetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client StorageTargetsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client StorageTargetsClient) GetResponder(resp *http.Response) (result StorageTarget, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByCache returns a list of Storage Targets for the specified Cache. +// Parameters: +// resourceGroupName - target resource group. +// cacheName - name of Cache. Length of name must not be greater than 80 and chars must be from the +// [-0-9a-zA-Z_] char class. +func (client StorageTargetsClient) ListByCache(ctx context.Context, resourceGroupName string, cacheName string) (result StorageTargetsResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StorageTargetsClient.ListByCache") + defer func() { + sc := -1 + if result.str.Response.Response != nil { + sc = result.str.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: cacheName, + Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("storagecache.StorageTargetsClient", "ListByCache", err.Error()) + } + + result.fn = client.listByCacheNextResults + req, err := client.ListByCachePreparer(ctx, resourceGroupName, cacheName) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.StorageTargetsClient", "ListByCache", nil, "Failure preparing request") + return + } + + resp, err := client.ListByCacheSender(req) + if err != nil { + result.str.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storagecache.StorageTargetsClient", "ListByCache", resp, "Failure sending request") + return + } + + result.str, err = client.ListByCacheResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.StorageTargetsClient", "ListByCache", resp, "Failure responding to request") + return + } + if result.str.hasNextLink() && result.str.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByCachePreparer prepares the ListByCache request. +func (client StorageTargetsClient) ListByCachePreparer(ctx context.Context, resourceGroupName string, cacheName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cacheName": autorest.Encode("path", cacheName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByCacheSender sends the ListByCache request. The method will close the +// http.Response Body if it receives an error. +func (client StorageTargetsClient) ListByCacheSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByCacheResponder handles the response to the ListByCache request. The method always +// closes the http.Response Body. +func (client StorageTargetsClient) ListByCacheResponder(resp *http.Response) (result StorageTargetsResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByCacheNextResults retrieves the next set of results, if any. +func (client StorageTargetsClient) listByCacheNextResults(ctx context.Context, lastResults StorageTargetsResult) (result StorageTargetsResult, err error) { + req, err := lastResults.storageTargetsResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "storagecache.StorageTargetsClient", "listByCacheNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByCacheSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "storagecache.StorageTargetsClient", "listByCacheNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByCacheResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.StorageTargetsClient", "listByCacheNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByCacheComplete enumerates all values, automatically crossing page boundaries as required. +func (client StorageTargetsClient) ListByCacheComplete(ctx context.Context, resourceGroupName string, cacheName string) (result StorageTargetsResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StorageTargetsClient.ListByCache") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByCache(ctx, resourceGroupName, cacheName) + return +} diff --git a/services/storagecache/mgmt/2022-01-01/storagecache/usagemodels.go b/services/storagecache/mgmt/2022-01-01/storagecache/usagemodels.go new file mode 100644 index 000000000000..bf24348069b7 --- /dev/null +++ b/services/storagecache/mgmt/2022-01-01/storagecache/usagemodels.go @@ -0,0 +1,145 @@ +package storagecache + +// Copyright (c) Microsoft Corporation. All rights 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// UsageModelsClient is the a Storage Cache provides scalable caching service for NAS clients, serving data from either +// NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). These operations allow you to manage Caches. +type UsageModelsClient struct { + BaseClient +} + +// NewUsageModelsClient creates an instance of the UsageModelsClient client. +func NewUsageModelsClient(subscriptionID string) UsageModelsClient { + return NewUsageModelsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewUsageModelsClientWithBaseURI creates an instance of the UsageModelsClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewUsageModelsClientWithBaseURI(baseURI string, subscriptionID string) UsageModelsClient { + return UsageModelsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List get the list of Cache Usage Models available to this subscription. +func (client UsageModelsClient) List(ctx context.Context) (result UsageModelsResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsageModelsClient.List") + defer func() { + sc := -1 + if result.umr.Response.Response != nil { + sc = result.umr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.UsageModelsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.umr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storagecache.UsageModelsClient", "List", resp, "Failure sending request") + return + } + + result.umr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.UsageModelsClient", "List", resp, "Failure responding to request") + return + } + if result.umr.hasNextLink() && result.umr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client UsageModelsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/usageModels", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client UsageModelsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client UsageModelsClient) ListResponder(resp *http.Response) (result UsageModelsResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client UsageModelsClient) listNextResults(ctx context.Context, lastResults UsageModelsResult) (result UsageModelsResult, err error) { + req, err := lastResults.usageModelsResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "storagecache.UsageModelsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "storagecache.UsageModelsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.UsageModelsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client UsageModelsClient) ListComplete(ctx context.Context) (result UsageModelsResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsageModelsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/storagecache/mgmt/2022-01-01/storagecache/version.go b/services/storagecache/mgmt/2022-01-01/storagecache/version.go new file mode 100644 index 000000000000..33c0e78617ef --- /dev/null +++ b/services/storagecache/mgmt/2022-01-01/storagecache/version.go @@ -0,0 +1,19 @@ +package storagecache + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights 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. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " storagecache/2022-01-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/streamanalytics/mgmt/2020-03-01/streamanalytics/CHANGELOG.md b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/CHANGELOG.md index 52911e4cc5e4..4957b7129df9 100644 --- a/services/streamanalytics/mgmt/2020-03-01/streamanalytics/CHANGELOG.md +++ b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/CHANGELOG.md @@ -1,2 +1,51 @@ # Change History +## Additive Changes + +### New Constants + +1. TypeBasicOutputDataSource.TypeBasicOutputDataSourceTypeMicrosoftAzureFunction + +### New Funcs + +1. *AzureFunctionOutputDataSource.UnmarshalJSON([]byte) error +1. AzureDataLakeStoreOutputDataSource.AsAzureFunctionOutputDataSource() (*AzureFunctionOutputDataSource, bool) +1. AzureFunctionOutputDataSource.AsAzureDataLakeStoreOutputDataSource() (*AzureDataLakeStoreOutputDataSource, bool) +1. AzureFunctionOutputDataSource.AsAzureFunctionOutputDataSource() (*AzureFunctionOutputDataSource, bool) +1. AzureFunctionOutputDataSource.AsAzureSQLDatabaseOutputDataSource() (*AzureSQLDatabaseOutputDataSource, bool) +1. AzureFunctionOutputDataSource.AsAzureSynapseOutputDataSource() (*AzureSynapseOutputDataSource, bool) +1. AzureFunctionOutputDataSource.AsAzureTableOutputDataSource() (*AzureTableOutputDataSource, bool) +1. AzureFunctionOutputDataSource.AsBasicOutputDataSource() (BasicOutputDataSource, bool) +1. AzureFunctionOutputDataSource.AsBlobOutputDataSource() (*BlobOutputDataSource, bool) +1. AzureFunctionOutputDataSource.AsDocumentDbOutputDataSource() (*DocumentDbOutputDataSource, bool) +1. AzureFunctionOutputDataSource.AsEventHubOutputDataSource() (*EventHubOutputDataSource, bool) +1. AzureFunctionOutputDataSource.AsEventHubV2OutputDataSource() (*EventHubV2OutputDataSource, bool) +1. AzureFunctionOutputDataSource.AsOutputDataSource() (*OutputDataSource, bool) +1. AzureFunctionOutputDataSource.AsPowerBIOutputDataSource() (*PowerBIOutputDataSource, bool) +1. AzureFunctionOutputDataSource.AsServiceBusQueueOutputDataSource() (*ServiceBusQueueOutputDataSource, bool) +1. AzureFunctionOutputDataSource.AsServiceBusTopicOutputDataSource() (*ServiceBusTopicOutputDataSource, bool) +1. AzureFunctionOutputDataSource.MarshalJSON() ([]byte, error) +1. AzureSQLDatabaseOutputDataSource.AsAzureFunctionOutputDataSource() (*AzureFunctionOutputDataSource, bool) +1. AzureSynapseOutputDataSource.AsAzureFunctionOutputDataSource() (*AzureFunctionOutputDataSource, bool) +1. AzureTableOutputDataSource.AsAzureFunctionOutputDataSource() (*AzureFunctionOutputDataSource, bool) +1. BlobOutputDataSource.AsAzureFunctionOutputDataSource() (*AzureFunctionOutputDataSource, bool) +1. DocumentDbOutputDataSource.AsAzureFunctionOutputDataSource() (*AzureFunctionOutputDataSource, bool) +1. EventHubOutputDataSource.AsAzureFunctionOutputDataSource() (*AzureFunctionOutputDataSource, bool) +1. EventHubV2OutputDataSource.AsAzureFunctionOutputDataSource() (*AzureFunctionOutputDataSource, bool) +1. OutputDataSource.AsAzureFunctionOutputDataSource() (*AzureFunctionOutputDataSource, bool) +1. PowerBIOutputDataSource.AsAzureFunctionOutputDataSource() (*AzureFunctionOutputDataSource, bool) +1. ServiceBusQueueOutputDataSource.AsAzureFunctionOutputDataSource() (*AzureFunctionOutputDataSource, bool) +1. ServiceBusTopicOutputDataSource.AsAzureFunctionOutputDataSource() (*AzureFunctionOutputDataSource, bool) + +### Struct Changes + +#### New Structs + +1. AzureFunctionOutputDataSource +1. AzureFunctionOutputDataSourceProperties + +#### New Struct Fields + +1. BlobDataSourceProperties.AuthenticationMode +1. BlobReferenceInputDataSourceProperties.AuthenticationMode +1. BlobStreamInputDataSourceProperties.AuthenticationMode diff --git a/services/streamanalytics/mgmt/2020-03-01/streamanalytics/_meta.json b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/_meta.json index ed46495ddb8d..e783cfa86ff7 100644 --- a/services/streamanalytics/mgmt/2020-03-01/streamanalytics/_meta.json +++ b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/_meta.json @@ -1,5 +1,5 @@ { - "commit": "81ab10cd9d46a85258b710c6150ec48021c6d202", + "commit": "162460648e39b3cd20ef3d302008add138e90223", "readme": "/_/azure-rest-api-specs/specification/streamanalytics/resource-manager/readme.md", "tag": "package-pure-2020-03", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/streamanalytics/mgmt/2020-03-01/streamanalytics/enums.go b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/enums.go index ed5cd317d0de..d0928f60a9d2 100644 --- a/services/streamanalytics/mgmt/2020-03-01/streamanalytics/enums.go +++ b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/enums.go @@ -363,6 +363,8 @@ func PossibleTypeBasicInputPropertiesValues() []TypeBasicInputProperties { type TypeBasicOutputDataSource string const ( + // TypeBasicOutputDataSourceTypeMicrosoftAzureFunction ... + TypeBasicOutputDataSourceTypeMicrosoftAzureFunction TypeBasicOutputDataSource = "Microsoft.AzureFunction" // TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts ... TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts TypeBasicOutputDataSource = "Microsoft.DataLake/Accounts" // TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub ... @@ -391,7 +393,7 @@ const ( // PossibleTypeBasicOutputDataSourceValues returns an array of possible values for the TypeBasicOutputDataSource const type. func PossibleTypeBasicOutputDataSourceValues() []TypeBasicOutputDataSource { - return []TypeBasicOutputDataSource{TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts, TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub, TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub, TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue, TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic, TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase, TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse, TypeBasicOutputDataSourceTypeMicrosoftStorageBlob, TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB, TypeBasicOutputDataSourceTypeMicrosoftStorageTable, TypeBasicOutputDataSourceTypeOutputDataSource, TypeBasicOutputDataSourceTypePowerBI} + return []TypeBasicOutputDataSource{TypeBasicOutputDataSourceTypeMicrosoftAzureFunction, TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts, TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub, TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub, TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue, TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic, TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase, TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse, TypeBasicOutputDataSourceTypeMicrosoftStorageBlob, TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB, TypeBasicOutputDataSourceTypeMicrosoftStorageTable, TypeBasicOutputDataSourceTypeOutputDataSource, TypeBasicOutputDataSourceTypePowerBI} } // TypeBasicReferenceInputDataSource enumerates the values for type basic reference input data source. diff --git a/services/streamanalytics/mgmt/2020-03-01/streamanalytics/models.go b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/models.go index b83507cf399d..d98046ed9050 100644 --- a/services/streamanalytics/mgmt/2020-03-01/streamanalytics/models.go +++ b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/models.go @@ -76,7 +76,7 @@ func (as AvroSerialization) AsBasicSerialization() (BasicSerialization, bool) { type AzureDataLakeStoreOutputDataSource struct { // AzureDataLakeStoreOutputDataSourceProperties - The properties that are associated with an Azure Data Lake Store output. Required on PUT (CreateOrReplace) requests. *AzureDataLakeStoreOutputDataSourceProperties `json:"properties,omitempty"` - // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' + // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftAzureFunction', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' Type TypeBasicOutputDataSource `json:"type,omitempty"` } @@ -113,6 +113,11 @@ func (adlsods AzureDataLakeStoreOutputDataSource) AsServiceBusQueueOutputDataSou return nil, false } +// AsAzureFunctionOutputDataSource is the BasicOutputDataSource implementation for AzureDataLakeStoreOutputDataSource. +func (adlsods AzureDataLakeStoreOutputDataSource) AsAzureFunctionOutputDataSource() (*AzureFunctionOutputDataSource, bool) { + return nil, false +} + // AsDocumentDbOutputDataSource is the BasicOutputDataSource implementation for AzureDataLakeStoreOutputDataSource. func (adlsods AzureDataLakeStoreOutputDataSource) AsDocumentDbOutputDataSource() (*DocumentDbOutputDataSource, bool) { return nil, false @@ -214,6 +219,145 @@ type AzureDataLakeStoreOutputDataSourceProperties struct { TokenUserDisplayName *string `json:"tokenUserDisplayName,omitempty"` } +// AzureFunctionOutputDataSource defines the metadata of AzureFunctionOutputDataSource +type AzureFunctionOutputDataSource struct { + // AzureFunctionOutputDataSourceProperties - The properties that are associated with a Azure Function output. Required on PUT (CreateOrReplace) requests. + *AzureFunctionOutputDataSourceProperties `json:"properties,omitempty"` + // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftAzureFunction', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' + Type TypeBasicOutputDataSource `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureFunctionOutputDataSource. +func (afods AzureFunctionOutputDataSource) MarshalJSON() ([]byte, error) { + afods.Type = TypeBasicOutputDataSourceTypeMicrosoftAzureFunction + objectMap := make(map[string]interface{}) + if afods.AzureFunctionOutputDataSourceProperties != nil { + objectMap["properties"] = afods.AzureFunctionOutputDataSourceProperties + } + if afods.Type != "" { + objectMap["type"] = afods.Type + } + return json.Marshal(objectMap) +} + +// AsAzureDataLakeStoreOutputDataSource is the BasicOutputDataSource implementation for AzureFunctionOutputDataSource. +func (afods AzureFunctionOutputDataSource) AsAzureDataLakeStoreOutputDataSource() (*AzureDataLakeStoreOutputDataSource, bool) { + return nil, false +} + +// AsPowerBIOutputDataSource is the BasicOutputDataSource implementation for AzureFunctionOutputDataSource. +func (afods AzureFunctionOutputDataSource) AsPowerBIOutputDataSource() (*PowerBIOutputDataSource, bool) { + return nil, false +} + +// AsServiceBusTopicOutputDataSource is the BasicOutputDataSource implementation for AzureFunctionOutputDataSource. +func (afods AzureFunctionOutputDataSource) AsServiceBusTopicOutputDataSource() (*ServiceBusTopicOutputDataSource, bool) { + return nil, false +} + +// AsServiceBusQueueOutputDataSource is the BasicOutputDataSource implementation for AzureFunctionOutputDataSource. +func (afods AzureFunctionOutputDataSource) AsServiceBusQueueOutputDataSource() (*ServiceBusQueueOutputDataSource, bool) { + return nil, false +} + +// AsAzureFunctionOutputDataSource is the BasicOutputDataSource implementation for AzureFunctionOutputDataSource. +func (afods AzureFunctionOutputDataSource) AsAzureFunctionOutputDataSource() (*AzureFunctionOutputDataSource, bool) { + return &afods, true +} + +// AsDocumentDbOutputDataSource is the BasicOutputDataSource implementation for AzureFunctionOutputDataSource. +func (afods AzureFunctionOutputDataSource) AsDocumentDbOutputDataSource() (*DocumentDbOutputDataSource, bool) { + return nil, false +} + +// AsAzureSynapseOutputDataSource is the BasicOutputDataSource implementation for AzureFunctionOutputDataSource. +func (afods AzureFunctionOutputDataSource) AsAzureSynapseOutputDataSource() (*AzureSynapseOutputDataSource, bool) { + return nil, false +} + +// AsAzureSQLDatabaseOutputDataSource is the BasicOutputDataSource implementation for AzureFunctionOutputDataSource. +func (afods AzureFunctionOutputDataSource) AsAzureSQLDatabaseOutputDataSource() (*AzureSQLDatabaseOutputDataSource, bool) { + return nil, false +} + +// AsEventHubV2OutputDataSource is the BasicOutputDataSource implementation for AzureFunctionOutputDataSource. +func (afods AzureFunctionOutputDataSource) AsEventHubV2OutputDataSource() (*EventHubV2OutputDataSource, bool) { + return nil, false +} + +// AsEventHubOutputDataSource is the BasicOutputDataSource implementation for AzureFunctionOutputDataSource. +func (afods AzureFunctionOutputDataSource) AsEventHubOutputDataSource() (*EventHubOutputDataSource, bool) { + return nil, false +} + +// AsAzureTableOutputDataSource is the BasicOutputDataSource implementation for AzureFunctionOutputDataSource. +func (afods AzureFunctionOutputDataSource) AsAzureTableOutputDataSource() (*AzureTableOutputDataSource, bool) { + return nil, false +} + +// AsBlobOutputDataSource is the BasicOutputDataSource implementation for AzureFunctionOutputDataSource. +func (afods AzureFunctionOutputDataSource) AsBlobOutputDataSource() (*BlobOutputDataSource, bool) { + return nil, false +} + +// AsOutputDataSource is the BasicOutputDataSource implementation for AzureFunctionOutputDataSource. +func (afods AzureFunctionOutputDataSource) AsOutputDataSource() (*OutputDataSource, bool) { + return nil, false +} + +// AsBasicOutputDataSource is the BasicOutputDataSource implementation for AzureFunctionOutputDataSource. +func (afods AzureFunctionOutputDataSource) AsBasicOutputDataSource() (BasicOutputDataSource, bool) { + return &afods, true +} + +// UnmarshalJSON is the custom unmarshaler for AzureFunctionOutputDataSource struct. +func (afods *AzureFunctionOutputDataSource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var azureFunctionOutputDataSourceProperties AzureFunctionOutputDataSourceProperties + err = json.Unmarshal(*v, &azureFunctionOutputDataSourceProperties) + if err != nil { + return err + } + afods.AzureFunctionOutputDataSourceProperties = &azureFunctionOutputDataSourceProperties + } + case "type": + if v != nil { + var typeVar TypeBasicOutputDataSource + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + afods.Type = typeVar + } + } + } + + return nil +} + +// AzureFunctionOutputDataSourceProperties the properties that are associated with an Azure Function +// output. +type AzureFunctionOutputDataSourceProperties struct { + // FunctionAppName - The name of your Azure Functions app. + FunctionAppName *string `json:"functionAppName,omitempty"` + // FunctionName - The name of the function in your Azure Functions app. + FunctionName *string `json:"functionName,omitempty"` + // APIKey - If you want to use an Azure Function from another subscription, you can do so by providing the key to access your function. + APIKey *string `json:"apiKey,omitempty"` + // MaxBatchSize - A property that lets you set the maximum size for each output batch that's sent to your Azure function. The input unit is in bytes. By default, this value is 262,144 bytes (256 KB). + MaxBatchSize *float64 `json:"maxBatchSize,omitempty"` + // MaxBatchCount - A property that lets you specify the maximum number of events in each batch that's sent to Azure Functions. The default value is 100. + MaxBatchCount *float64 `json:"maxBatchCount,omitempty"` +} + // AzureMachineLearningWebServiceFunctionBinding the binding to an Azure Machine Learning web service. type AzureMachineLearningWebServiceFunctionBinding struct { // AzureMachineLearningWebServiceFunctionBindingProperties - The binding properties associated with an Azure Machine learning web service. @@ -440,7 +584,7 @@ type AzureSQLDatabaseDataSourceProperties struct { type AzureSQLDatabaseOutputDataSource struct { // AzureSQLDatabaseOutputDataSourceProperties - The properties that are associated with an Azure SQL database output. Required on PUT (CreateOrReplace) requests. *AzureSQLDatabaseOutputDataSourceProperties `json:"properties,omitempty"` - // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' + // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftAzureFunction', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' Type TypeBasicOutputDataSource `json:"type,omitempty"` } @@ -477,6 +621,11 @@ func (asdods AzureSQLDatabaseOutputDataSource) AsServiceBusQueueOutputDataSource return nil, false } +// AsAzureFunctionOutputDataSource is the BasicOutputDataSource implementation for AzureSQLDatabaseOutputDataSource. +func (asdods AzureSQLDatabaseOutputDataSource) AsAzureFunctionOutputDataSource() (*AzureFunctionOutputDataSource, bool) { + return nil, false +} + // AsDocumentDbOutputDataSource is the BasicOutputDataSource implementation for AzureSQLDatabaseOutputDataSource. func (asdods AzureSQLDatabaseOutputDataSource) AsDocumentDbOutputDataSource() (*DocumentDbOutputDataSource, bool) { return nil, false @@ -692,7 +841,7 @@ type AzureSynapseDataSourceProperties struct { type AzureSynapseOutputDataSource struct { // AzureSynapseOutputDataSourceProperties - The properties that are associated with an Azure Synapse output. Required on PUT (CreateOrReplace) requests. *AzureSynapseOutputDataSourceProperties `json:"properties,omitempty"` - // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' + // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftAzureFunction', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' Type TypeBasicOutputDataSource `json:"type,omitempty"` } @@ -729,6 +878,11 @@ func (asods AzureSynapseOutputDataSource) AsServiceBusQueueOutputDataSource() (* return nil, false } +// AsAzureFunctionOutputDataSource is the BasicOutputDataSource implementation for AzureSynapseOutputDataSource. +func (asods AzureSynapseOutputDataSource) AsAzureFunctionOutputDataSource() (*AzureFunctionOutputDataSource, bool) { + return nil, false +} + // AsDocumentDbOutputDataSource is the BasicOutputDataSource implementation for AzureSynapseOutputDataSource. func (asods AzureSynapseOutputDataSource) AsDocumentDbOutputDataSource() (*DocumentDbOutputDataSource, bool) { return nil, false @@ -825,7 +979,7 @@ type AzureSynapseOutputDataSourceProperties struct { type AzureTableOutputDataSource struct { // AzureTableOutputDataSourceProperties - The properties that are associated with an Azure Table output. Required on PUT (CreateOrReplace) requests. *AzureTableOutputDataSourceProperties `json:"properties,omitempty"` - // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' + // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftAzureFunction', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' Type TypeBasicOutputDataSource `json:"type,omitempty"` } @@ -862,6 +1016,11 @@ func (atods AzureTableOutputDataSource) AsServiceBusQueueOutputDataSource() (*Se return nil, false } +// AsAzureFunctionOutputDataSource is the BasicOutputDataSource implementation for AzureTableOutputDataSource. +func (atods AzureTableOutputDataSource) AsAzureFunctionOutputDataSource() (*AzureFunctionOutputDataSource, bool) { + return nil, false +} + // AsDocumentDbOutputDataSource is the BasicOutputDataSource implementation for AzureTableOutputDataSource. func (atods AzureTableOutputDataSource) AsDocumentDbOutputDataSource() (*DocumentDbOutputDataSource, bool) { return nil, false @@ -970,13 +1129,15 @@ type BlobDataSourceProperties struct { DateFormat *string `json:"dateFormat,omitempty"` // TimeFormat - The time format. Wherever {time} appears in pathPattern, the value of this property is used as the time format instead. TimeFormat *string `json:"timeFormat,omitempty"` + // AuthenticationMode - Authentication Mode. Possible values include: 'AuthenticationModeMsi', 'AuthenticationModeUserToken', 'AuthenticationModeConnectionString' + AuthenticationMode AuthenticationMode `json:"authenticationMode,omitempty"` } // BlobOutputDataSource describes a blob output data source. type BlobOutputDataSource struct { // BlobOutputDataSourceProperties - The properties that are associated with a blob output. Required on PUT (CreateOrReplace) requests. *BlobOutputDataSourceProperties `json:"properties,omitempty"` - // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' + // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftAzureFunction', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' Type TypeBasicOutputDataSource `json:"type,omitempty"` } @@ -1013,6 +1174,11 @@ func (bods BlobOutputDataSource) AsServiceBusQueueOutputDataSource() (*ServiceBu return nil, false } +// AsAzureFunctionOutputDataSource is the BasicOutputDataSource implementation for BlobOutputDataSource. +func (bods BlobOutputDataSource) AsAzureFunctionOutputDataSource() (*AzureFunctionOutputDataSource, bool) { + return nil, false +} + // AsDocumentDbOutputDataSource is the BasicOutputDataSource implementation for BlobOutputDataSource. func (bods BlobOutputDataSource) AsDocumentDbOutputDataSource() (*DocumentDbOutputDataSource, bool) { return nil, false @@ -1093,8 +1259,6 @@ func (bods *BlobOutputDataSource) UnmarshalJSON(body []byte) error { // BlobOutputDataSourceProperties the properties that are associated with a blob output. type BlobOutputDataSourceProperties struct { - // AuthenticationMode - Authentication Mode. Possible values include: 'AuthenticationModeMsi', 'AuthenticationModeUserToken', 'AuthenticationModeConnectionString' - AuthenticationMode AuthenticationMode `json:"authenticationMode,omitempty"` // StorageAccounts - A list of one or more Azure Storage accounts. Required on PUT (CreateOrReplace) requests. StorageAccounts *[]StorageAccount `json:"storageAccounts,omitempty"` // Container - The name of a container within the associated Storage account. This container contains either the blob(s) to be read from or written to. Required on PUT (CreateOrReplace) requests. @@ -1105,6 +1269,8 @@ type BlobOutputDataSourceProperties struct { DateFormat *string `json:"dateFormat,omitempty"` // TimeFormat - The time format. Wherever {time} appears in pathPattern, the value of this property is used as the time format instead. TimeFormat *string `json:"timeFormat,omitempty"` + // AuthenticationMode - Authentication Mode. Possible values include: 'AuthenticationModeMsi', 'AuthenticationModeUserToken', 'AuthenticationModeConnectionString' + AuthenticationMode AuthenticationMode `json:"authenticationMode,omitempty"` } // BlobReferenceInputDataSource describes a blob input data source that contains reference data. @@ -1194,6 +1360,8 @@ type BlobReferenceInputDataSourceProperties struct { DateFormat *string `json:"dateFormat,omitempty"` // TimeFormat - The time format. Wherever {time} appears in pathPattern, the value of this property is used as the time format instead. TimeFormat *string `json:"timeFormat,omitempty"` + // AuthenticationMode - Authentication Mode. Possible values include: 'AuthenticationModeMsi', 'AuthenticationModeUserToken', 'AuthenticationModeConnectionString' + AuthenticationMode AuthenticationMode `json:"authenticationMode,omitempty"` } // BlobStreamInputDataSource describes a blob input data source that contains stream data. @@ -1283,7 +1451,7 @@ func (bsids *BlobStreamInputDataSource) UnmarshalJSON(body []byte) error { // BlobStreamInputDataSourceProperties the properties that are associated with a blob input containing // stream data. type BlobStreamInputDataSourceProperties struct { - // SourcePartitionCount - The partition count of the blob input data source. Range 1 - 256. + // SourcePartitionCount - The partition count of the blob input data source. Range 1 - 1024. SourcePartitionCount *int32 `json:"sourcePartitionCount,omitempty"` // StorageAccounts - A list of one or more Azure Storage accounts. Required on PUT (CreateOrReplace) requests. StorageAccounts *[]StorageAccount `json:"storageAccounts,omitempty"` @@ -1295,6 +1463,8 @@ type BlobStreamInputDataSourceProperties struct { DateFormat *string `json:"dateFormat,omitempty"` // TimeFormat - The time format. Wherever {time} appears in pathPattern, the value of this property is used as the time format instead. TimeFormat *string `json:"timeFormat,omitempty"` + // AuthenticationMode - Authentication Mode. Possible values include: 'AuthenticationModeMsi', 'AuthenticationModeUserToken', 'AuthenticationModeConnectionString' + AuthenticationMode AuthenticationMode `json:"authenticationMode,omitempty"` } // Cluster a Stream Analytics Cluster object @@ -2065,7 +2235,7 @@ func (d Diagnostics) MarshalJSON() ([]byte, error) { type DocumentDbOutputDataSource struct { // DocumentDbOutputDataSourceProperties - The properties that are associated with a DocumentDB output. Required on PUT (CreateOrReplace) requests. *DocumentDbOutputDataSourceProperties `json:"properties,omitempty"` - // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' + // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftAzureFunction', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' Type TypeBasicOutputDataSource `json:"type,omitempty"` } @@ -2102,6 +2272,11 @@ func (ddods DocumentDbOutputDataSource) AsServiceBusQueueOutputDataSource() (*Se return nil, false } +// AsAzureFunctionOutputDataSource is the BasicOutputDataSource implementation for DocumentDbOutputDataSource. +func (ddods DocumentDbOutputDataSource) AsAzureFunctionOutputDataSource() (*AzureFunctionOutputDataSource, bool) { + return nil, false +} + // AsDocumentDbOutputDataSource is the BasicOutputDataSource implementation for DocumentDbOutputDataSource. func (ddods DocumentDbOutputDataSource) AsDocumentDbOutputDataSource() (*DocumentDbOutputDataSource, bool) { return &ddods, true @@ -2256,7 +2431,7 @@ type EventHubDataSourceProperties struct { type EventHubOutputDataSource struct { // EventHubOutputDataSourceProperties - The properties that are associated with an Event Hub output. Required on PUT (CreateOrReplace) requests. *EventHubOutputDataSourceProperties `json:"properties,omitempty"` - // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' + // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftAzureFunction', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' Type TypeBasicOutputDataSource `json:"type,omitempty"` } @@ -2293,6 +2468,11 @@ func (ehods EventHubOutputDataSource) AsServiceBusQueueOutputDataSource() (*Serv return nil, false } +// AsAzureFunctionOutputDataSource is the BasicOutputDataSource implementation for EventHubOutputDataSource. +func (ehods EventHubOutputDataSource) AsAzureFunctionOutputDataSource() (*AzureFunctionOutputDataSource, bool) { + return nil, false +} + // AsDocumentDbOutputDataSource is the BasicOutputDataSource implementation for EventHubOutputDataSource. func (ehods EventHubOutputDataSource) AsDocumentDbOutputDataSource() (*DocumentDbOutputDataSource, bool) { return nil, false @@ -2494,7 +2674,7 @@ type EventHubStreamInputDataSourceProperties struct { type EventHubV2OutputDataSource struct { // EventHubOutputDataSourceProperties - The properties that are associated with an Event Hub output. Required on PUT (CreateOrReplace) requests. *EventHubOutputDataSourceProperties `json:"properties,omitempty"` - // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' + // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftAzureFunction', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' Type TypeBasicOutputDataSource `json:"type,omitempty"` } @@ -2531,6 +2711,11 @@ func (ehvods EventHubV2OutputDataSource) AsServiceBusQueueOutputDataSource() (*S return nil, false } +// AsAzureFunctionOutputDataSource is the BasicOutputDataSource implementation for EventHubV2OutputDataSource. +func (ehvods EventHubV2OutputDataSource) AsAzureFunctionOutputDataSource() (*AzureFunctionOutputDataSource, bool) { + return nil, false +} + // AsDocumentDbOutputDataSource is the BasicOutputDataSource implementation for EventHubV2OutputDataSource. func (ehvods EventHubV2OutputDataSource) AsDocumentDbOutputDataSource() (*DocumentDbOutputDataSource, bool) { return nil, false @@ -4360,6 +4545,7 @@ type BasicOutputDataSource interface { AsPowerBIOutputDataSource() (*PowerBIOutputDataSource, bool) AsServiceBusTopicOutputDataSource() (*ServiceBusTopicOutputDataSource, bool) AsServiceBusQueueOutputDataSource() (*ServiceBusQueueOutputDataSource, bool) + AsAzureFunctionOutputDataSource() (*AzureFunctionOutputDataSource, bool) AsDocumentDbOutputDataSource() (*DocumentDbOutputDataSource, bool) AsAzureSynapseOutputDataSource() (*AzureSynapseOutputDataSource, bool) AsAzureSQLDatabaseOutputDataSource() (*AzureSQLDatabaseOutputDataSource, bool) @@ -4372,7 +4558,7 @@ type BasicOutputDataSource interface { // OutputDataSource describes the data source that output will be written to. type OutputDataSource struct { - // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' + // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftAzureFunction', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' Type TypeBasicOutputDataSource `json:"type,omitempty"` } @@ -4400,6 +4586,10 @@ func unmarshalBasicOutputDataSource(body []byte) (BasicOutputDataSource, error) var sbqods ServiceBusQueueOutputDataSource err := json.Unmarshal(body, &sbqods) return sbqods, err + case string(TypeBasicOutputDataSourceTypeMicrosoftAzureFunction): + var afods AzureFunctionOutputDataSource + err := json.Unmarshal(body, &afods) + return afods, err case string(TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB): var ddods DocumentDbOutputDataSource err := json.Unmarshal(body, &ddods) @@ -4483,6 +4673,11 @@ func (ods OutputDataSource) AsServiceBusQueueOutputDataSource() (*ServiceBusQueu return nil, false } +// AsAzureFunctionOutputDataSource is the BasicOutputDataSource implementation for OutputDataSource. +func (ods OutputDataSource) AsAzureFunctionOutputDataSource() (*AzureFunctionOutputDataSource, bool) { + return nil, false +} + // AsDocumentDbOutputDataSource is the BasicOutputDataSource implementation for OutputDataSource. func (ods OutputDataSource) AsDocumentDbOutputDataSource() (*DocumentDbOutputDataSource, bool) { return nil, false @@ -4888,7 +5083,7 @@ func (ps ParquetSerialization) AsBasicSerialization() (BasicSerialization, bool) type PowerBIOutputDataSource struct { // PowerBIOutputDataSourceProperties - The properties that are associated with a Power BI output. Required on PUT (CreateOrReplace) requests. *PowerBIOutputDataSourceProperties `json:"properties,omitempty"` - // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' + // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftAzureFunction', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' Type TypeBasicOutputDataSource `json:"type,omitempty"` } @@ -4925,6 +5120,11 @@ func (pbods PowerBIOutputDataSource) AsServiceBusQueueOutputDataSource() (*Servi return nil, false } +// AsAzureFunctionOutputDataSource is the BasicOutputDataSource implementation for PowerBIOutputDataSource. +func (pbods PowerBIOutputDataSource) AsAzureFunctionOutputDataSource() (*AzureFunctionOutputDataSource, bool) { + return nil, false +} + // AsDocumentDbOutputDataSource is the BasicOutputDataSource implementation for PowerBIOutputDataSource. func (pbods PowerBIOutputDataSource) AsDocumentDbOutputDataSource() (*DocumentDbOutputDataSource, bool) { return nil, false @@ -5934,7 +6134,7 @@ type ServiceBusDataSourceProperties struct { type ServiceBusQueueOutputDataSource struct { // ServiceBusQueueOutputDataSourceProperties - The properties that are associated with a Service Bus Queue output. Required on PUT (CreateOrReplace) requests. *ServiceBusQueueOutputDataSourceProperties `json:"properties,omitempty"` - // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' + // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftAzureFunction', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' Type TypeBasicOutputDataSource `json:"type,omitempty"` } @@ -5971,6 +6171,11 @@ func (sbqods ServiceBusQueueOutputDataSource) AsServiceBusQueueOutputDataSource( return &sbqods, true } +// AsAzureFunctionOutputDataSource is the BasicOutputDataSource implementation for ServiceBusQueueOutputDataSource. +func (sbqods ServiceBusQueueOutputDataSource) AsAzureFunctionOutputDataSource() (*AzureFunctionOutputDataSource, bool) { + return nil, false +} + // AsDocumentDbOutputDataSource is the BasicOutputDataSource implementation for ServiceBusQueueOutputDataSource. func (sbqods ServiceBusQueueOutputDataSource) AsDocumentDbOutputDataSource() (*DocumentDbOutputDataSource, bool) { return nil, false @@ -6072,7 +6277,7 @@ type ServiceBusQueueOutputDataSourceProperties struct { type ServiceBusTopicOutputDataSource struct { // ServiceBusTopicOutputDataSourceProperties - The properties that are associated with a Service Bus Topic output. Required on PUT (CreateOrReplace) requests. *ServiceBusTopicOutputDataSourceProperties `json:"properties,omitempty"` - // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' + // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftAzureFunction', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' Type TypeBasicOutputDataSource `json:"type,omitempty"` } @@ -6109,6 +6314,11 @@ func (sbtods ServiceBusTopicOutputDataSource) AsServiceBusQueueOutputDataSource( return nil, false } +// AsAzureFunctionOutputDataSource is the BasicOutputDataSource implementation for ServiceBusTopicOutputDataSource. +func (sbtods ServiceBusTopicOutputDataSource) AsAzureFunctionOutputDataSource() (*AzureFunctionOutputDataSource, bool) { + return nil, false +} + // AsDocumentDbOutputDataSource is the BasicOutputDataSource implementation for ServiceBusTopicOutputDataSource. func (sbtods ServiceBusTopicOutputDataSource) AsDocumentDbOutputDataSource() (*DocumentDbOutputDataSource, bool) { return nil, false diff --git a/version/version.go b/version/version.go index a68c28e753a9..acfdf20b0f16 100644 --- a/version/version.go +++ b/version/version.go @@ -4,4 +4,4 @@ package version // Licensed under the MIT License. See License.txt in the project root for license information. // Number contains the semantic version of this SDK. -const Number = "v62.2.0" +const Number = "v62.3.0"